PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.6
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.6
4.5.6 4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 All 148 releases
← All changes | admin/admin-feeds.php +9 -52 4.2.0 → 4.5.6 View file →
@@ -56,62 +56,12 @@
56 56 /**
57 57 * Display RSS Feeds Content
58 58 */
59 59 public function display_rss_feeds_content() {
60 - $feeds = $this->get_remote_feeds_data();
61 - if ( is_array( $feeds ) ) {
62 - foreach ( $feeds as $feed ) {
63 - ?>
64 - <div class="activity-block">
65 - <a href="<?php echo esc_url( $feed->demo_link ); ?>" target="_blank" style="margin-bottom:10px; display: inline-block;">
66 - <img src="<?php echo esc_url( $feed->image ); ?>" style="width:100%;min-height:240px;">
67 - </a>
68 - <p>
69 - <?php echo wp_kses_post( wp_trim_words( wp_strip_all_tags( $feed->content ), 50 ) ); ?>
70 - <a href="<?php echo esc_url( $feed->demo_link ); ?>" target="_blank">
71 - <?php esc_html_e( 'Learn more...', 'ultimate-post-kit' ); ?>
72 - </a>
73 - </p>
74 - </div>
75 - <?php
76 - }
77 - }
78 60 echo wp_kses_post( $this->get_rss_posts_data() );
79 61 }
80 62
81 63 /**
82 - * Get Remote Feeds Data
83 - *
84 - * @return array|mixed
85 - */
86 - private function get_remote_feeds_data() {
87 - $transient_key = $this->settings['transient_key'];
88 - $cached_data = get_transient( $transient_key );
89 -
90 - if ( ! empty( $cached_data ) ) {
91 - return json_decode( $cached_data );
92 - }
93 -
94 - $response = wp_remote_get( $this->settings['remote_feed_link'],
95 - array(
96 - 'timeout' => 30,
97 - 'headers' => array(
98 - 'Accept' => 'application/json',
99 - ),
100 - )
101 - );
102 -
103 - if ( is_wp_error( $response ) ) {
104 - return [];
105 - }
106 -
107 - $response_body = wp_remote_retrieve_body( $response );
108 - set_transient( $transient_key, $response_body, 6 * HOUR_IN_SECONDS );
109 -
110 - return json_decode( $response_body );
111 - }
112 -
113 - /**
114 64 * Get RSS Posts Data
115 65 *
116 66 * @return string
117 67 */
@@ -213,13 +163,13 @@
213 163 return $timestamp >= $cutoff;
214 164 }
215 165 }
216 166
167 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- local settings array for this admin feed file.
217 168 $settings = array(
218 169 'feed_title' => 'BdThemes News & Updates',
219 170 'transient_key' => 'bdthemes_product_feeds',
220 171 'feed_link' => 'https://bdthemes.com/feed',
221 - 'remote_feed_link' => 'https://dashboard.bdthemes.io/wp-json/bdthemes/v1/product-feed/?product_category=element-pack',
222 172 'text_domain' => 'bdthemes',
223 173 'footer_links' => [
224 174 [
225 175 'url' => 'https://bdthemes.com/blog/',
@@ -239,6 +189,13 @@
239 189 ],
240 190 ],
241 191 );
242 192
243 -new Admin_Feeds( $settings );
193 +/**
194 + * The dashboard news widget contacts an external BdThemes server, so it is strictly
195 + * opt-in: it stays disabled until the site administrator enables "BdThemes News &
196 + * Updates" under Ultimate Post Kit > Other Settings. No request is made otherwise.
197 + */
198 +if ( 'on' === \ultimate_post_kit_option( 'news_feed', 'ultimate_post_kit_other_settings', 'off' ) ) {
199 + new Admin_Feeds( $settings );
200 +}
244 201