Skip to content
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

Fix classic widget form show/save #775

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
5 changes: 0 additions & 5 deletions src/admin.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ public function admin_init()
$this->cls('Media')->after_admin_init();

do_action('litspeed_after_admin_init');

if ($this->cls('Router')->esi_enabled()) {
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);
}
}

/**
Expand Down
10 changes: 9 additions & 1 deletion src/esi.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ class ESI extends Root
*/
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
1 change: 1 addition & 0 deletions tpl/esi_widget_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<p class="install-help">
<?php echo __( 'Recommended value: 28800 seconds (8 hours).', 'litespeed-cache' ) ; ?>
<?php echo __( 'A TTL of 0 indicates do not cache.', 'litespeed-cache' ) ; ?>
<?php echo __('Otherwise, minimum value is 30.', 'litespeed-cache'); ?>
</p>
</div>

Expand Down
Loading