Skip to content

Commit 0911e42

Browse files
authored
Merge pull request #1005 from Codeinwp/bugfix/pro/755
Fixed cache data issue elementor widgets
2 parents db828a9 + aaba5c6 commit 0911e42

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

includes/abstract/feedzy-rss-feeds-admin-abstract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ public function feedzy_rss( $atts, $content = '' ) {
485485
}
486486
$attributes .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $val ) . '"';
487487
}
488-
$lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ) ) );
488+
$lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s-%d-%d', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ), ( ! empty( $sc['max'] ) ? $sc['max'] : 1 ), ( ! empty( $sc['offset'] ) ? $sc['offset'] : 0 ) ) );
489489
$content = get_transient( $lazyload_cache_key );
490490

491491
// the first time the shortcode is being called it will not have any content.
@@ -577,7 +577,7 @@ public function feedzy_lazy_load( $data ) {
577577
$content = $this->render_content( $sc, $feed, $feed_url, '' );
578578

579579
// save the content as a transient so that whenever the feed is refreshed next, this stale content is displayed first.
580-
$lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ) ) );
580+
$lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s-%d-%d', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ), ( ! empty( $sc['max'] ) ? $sc['max'] : 1 ), ( ! empty( $sc['offset'] ) ? $sc['offset'] : 0 ) ) );
581581
set_transient( $lazyload_cache_key, $content, apply_filters( 'feedzy_lazyload_cache_time', DAY_IN_SECONDS, $feed_url ) );
582582

583583
wp_send_json_success( array( 'content' => $content ) );

includes/admin/feedzy-wp-widget.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,6 @@ public static function get_instance() {
5757
return self::$instance;
5858
}
5959

60-
/**
61-
* The register method for registering this widget class
62-
*
63-
* @since 3.0.0
64-
* @access public
65-
*/
66-
public function registerWidget() {
67-
register_widget( 'feedzy_wp_widget' );
68-
}
69-
7060
/**
7161
* The widget form creation
7262
*

includes/feedzy-rss-feeds.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,13 @@ private function define_admin_hooks() {
229229

230230
add_shortcode( 'feedzy-rss', array( self::$instance->admin, 'feedzy_rss' ) );
231231

232-
$plugin_widget = new feedzy_wp_widget();
233-
self::$instance->loader->add_action( 'widgets_init', $plugin_widget, 'registerWidget', 10 );
232+
add_action(
233+
'widgets_init',
234+
function () {
235+
register_widget( 'feedzy_wp_widget' );
236+
}
237+
);
238+
234239
self::$instance->loader->add_action( 'rest_api_init', self::$instance->admin, 'rest_route', 10 );
235240

236241
// Wizard screen setup.

0 commit comments

Comments
 (0)