Skip to content

Fix classic widget form show/save #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/esi.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@ class ESI extends Root {
* @since 1.2.0
* @since 4.0 Change to be after Vary init in hook 'after_setup_theme'
*/
public function init() {
public function init()
{
$esi_enabled = $this->cls('Router')->esi_enabled();

if ($esi_enabled) {
// Show add/save widget form data
add_action('in_widget_form', array($this->cls('Admin_Display'), 'show_widget_edit'), 100, 3);
add_filter('widget_update_callback', __NAMESPACE__ . '\Admin_Settings::validate_widget_save', 10, 4);
}

/**
* Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue
*
* @since 2.9.7.2
*/
if (Router::is_ajax() || !$this->cls('Router')->esi_enabled()) {
if (Router::is_ajax() || !$esi_enabled) {
return;
}

Expand Down
5 changes: 3 additions & 2 deletions tpl/esi_widget_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
<?php esc_html_e( 'seconds', 'litespeed-cache' ); ?>

<p class="install-help">
<?php esc_html_e( 'Recommended value: 28800 seconds (8 hours).', 'litespeed-cache' ); ?>
<?php esc_html_e( 'A TTL of 0 indicates do not cache.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'Recommended value: 28800 seconds (8 hours).', 'litespeed-cache' ) ; ?>
<?php esc_html_e( 'A TTL of 0 indicates do not cache.', 'litespeed-cache' ) ; ?>
<?php esc_html_e('Otherwise, minimum value is 30.', 'litespeed-cache'); ?>
</p>
</div>

Expand Down