diff --git a/includes/abstract/feedzy-rss-feeds-admin-abstract.php b/includes/abstract/feedzy-rss-feeds-admin-abstract.php index bbba08f9..552117ce 100644 --- a/includes/abstract/feedzy-rss-feeds-admin-abstract.php +++ b/includes/abstract/feedzy-rss-feeds-admin-abstract.php @@ -485,7 +485,7 @@ public function feedzy_rss( $atts, $content = '' ) { } $attributes .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $val ) . '"'; } - $lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ) ) ); + $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 ) ) ); $content = get_transient( $lazyload_cache_key ); // the first time the shortcode is being called it will not have any content. @@ -577,7 +577,7 @@ public function feedzy_lazy_load( $data ) { $content = $this->render_content( $sc, $feed, $feed_url, '' ); // save the content as a transient so that whenever the feed is refreshed next, this stale content is displayed first. - $lazyload_cache_key = md5( sprintf( 'feedzy-lazy-%s', ( is_array( $feed_url ) ? implode( ',', $feed_url ) : $feed_url ) ) ); + $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 ) ) ); set_transient( $lazyload_cache_key, $content, apply_filters( 'feedzy_lazyload_cache_time', DAY_IN_SECONDS, $feed_url ) ); wp_send_json_success( array( 'content' => $content ) ); diff --git a/includes/admin/feedzy-wp-widget.php b/includes/admin/feedzy-wp-widget.php index 8e2a411d..9598a9d9 100644 --- a/includes/admin/feedzy-wp-widget.php +++ b/includes/admin/feedzy-wp-widget.php @@ -57,16 +57,6 @@ public static function get_instance() { return self::$instance; } - /** - * The register method for registering this widget class - * - * @since 3.0.0 - * @access public - */ - public function registerWidget() { - register_widget( 'feedzy_wp_widget' ); - } - /** * The widget form creation * diff --git a/includes/feedzy-rss-feeds.php b/includes/feedzy-rss-feeds.php index d8f176c3..d3b48e50 100644 --- a/includes/feedzy-rss-feeds.php +++ b/includes/feedzy-rss-feeds.php @@ -229,8 +229,13 @@ private function define_admin_hooks() { add_shortcode( 'feedzy-rss', array( self::$instance->admin, 'feedzy_rss' ) ); - $plugin_widget = new feedzy_wp_widget(); - self::$instance->loader->add_action( 'widgets_init', $plugin_widget, 'registerWidget', 10 ); + add_action( + 'widgets_init', + function () { + register_widget( 'feedzy_wp_widget' ); + } + ); + self::$instance->loader->add_action( 'rest_api_init', self::$instance->admin, 'rest_route', 10 ); // Wizard screen setup.