PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.2
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php +35 -73 3.10.103.4.2 View file →
@@ -80,10 +80,8 @@
80 80 $this->feeds = apply_filters(
81 81 'themeisle_sdk_dashboard_widget_feeds',
82 82 [
83 83 'https://themeisle.com/blog/feed',
84 - 'https://www.codeinwp.com/blog/feed',
85 - 'https://wpshout.com/feed',
86 84 ]
87 85 );
88 86 add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
89 87 add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
@@ -97,9 +95,9 @@
97 95 * Add widget to the dashboard
98 96 *
99 97 * @return string|void
100 98 */
101 - public function add_widget() {
99 + function add_widget() {
102 100 global $wp_meta_boxes;
103 101 if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) {
104 102 return;
105 103 }
@@ -115,9 +113,9 @@
115 113
116 114 /**
117 115 * Render widget content
118 116 */
119 - public function render_dashboard_widget() {
117 + function render_dashboard_widget() {
120 118 $this->setup_feeds();
121 119 if ( empty( $this->items ) || ! is_array( $this->items ) ) {
122 120 return;
123 121 }
@@ -132,11 +130,10 @@
132 130
133 131 #themeisle h2.hndle {
134 132 background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABbCAMAAADncTNAAAAAtFBMVEVHcEyAgIB/f3+xsbGgoaGBgYGCgoKKioqAgIC1tbW5ubnFx8iAgIDU1taBgYGCgoKAgIC0tLXW19jW2NiAgIC3uLiBgYHLzMy4uLhycnLW19d/f3/T1NW0tL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Cg3CGodnuJ4JVkfRFJYGVDBZrqKnn9RLf+CzDTS5PaN5J38+auzX4ykU4Qoj0rdKfcYs5ijfo9OL/uRUgZyQr7NCWtWwiUSLc4arfJa7lpszTA1OJZAQ8w8dXFrR5YHzCWSnS3pZ18tOi4Ps4vl/c7i/6qomjRecN+UubrPyPGn/VEMU3T0UFHkaPzpgjxmJsnjmrtionlMDZiog0TsY/DPtn8SXtlBvbtxKtwopy7lqW3smQO+yoGE1Uu55GJ3pmI8ygoejZNnqj0vnIRCyTKfLstRdtStGQi09myUsvwvlkuzSUXbV+Xz5ryBebV33fln/A/moud69FZiEYAAAAASUVORK5CYII=');
135 133 background-repeat: no-repeat;
136 - background-position: 2% 50%;
134 + background-position: 92% 50%;
137 135 background-size: 25px;
138 - padding-left: 39px;
139 136 }
140 137
141 138 #themeisle .inside {
142 139 padding: 0;
@@ -222,23 +219,21 @@
222 219 ?>
223 220 <li class="ti-dw-feed-item">
224 221 <a href="
225 222 <?php
226 - echo esc_url(
227 - add_query_arg(
228 - array(
229 - 'utm_source' => 'wpadmin',
230 - 'utm_campaign' => 'feed',
231 - 'utm_medium' => 'dashboard_widget',
232 - ),
233 - $item['link']
234 - )
223 + echo add_query_arg(
224 + array(
225 + 'utm_source' => 'wpadmin',
226 + 'utm_campaign' => 'feed',
227 + 'utm_medium' => 'dashboard_widget',
228 + ),
229 + $item['link']
235 230 );
236 231 ?>
237 232 " target="_blank">
238 233 <span class="ti-dw-date-container"><span
239 - class="ti-dw-day-container"><?php echo esc_attr( gmdate( 'd', $item['date'] ) ); ?></span> <span
240 - class="ti-dw-month-container"><?php echo esc_attr( substr( gmdate( 'M', $item['date'] ), 0, 3 ) ); ?></span></span><?php echo esc_attr( $item['title'] ); ?>
234 + class="ti-dw-day-container"><?php echo date( 'd', $item['date'] ); ?></span> <span
235 + class="ti-dw-month-container"><?php echo substr( date( 'M', $item['date'] ), 0, 3 ); ?></span></span><?php echo $item['title']; ?>
241 236 </a>
242 237 </li>
243 238 <?php
244 239 }
@@ -279,30 +274,28 @@
279 274 }
280 275 ?>
281 276 <div class="ti-dw-footer">
282 277 <span class="ti-dw-recommend-item ">
283 - <span class="ti-dw-recommend"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ) ); ?>
278 + <span class="ti-dw-recommend"><?php echo apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ); ?>
284 279 : </span>
285 280 <?php
286 - echo esc_attr(
287 - trim(
288 - str_replace(
289 - array(
290 - 'lite',
291 - 'Lite',
292 - '(Lite)',
293 - '(lite)',
294 - ),
295 - '',
296 - $recommend['name']
297 - )
281 + echo trim(
282 + str_replace(
283 + array(
284 + 'lite',
285 + 'Lite',
286 + '(Lite)',
287 + '(lite)',
288 + ),
289 + '',
290 + $recommend['name']
298 291 )
299 292 );
300 293 ?>
301 294 (<a class="thickbox open-plugin-details-modal"
302 - href="<?php echo esc_url( $url . '&TB_iframe=true&width=600&height=500' ); ?>"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_install_label', 'Install' ) ); ?></a>)
295 + href="<?php echo $url . '&TB_iframe=true&width=600&height=500'; ?>"><?php echo apply_filters( 'themeisle_sdk_dashboard_install_label', 'Install' ); ?></a>)
303 296 </span>
304 - <span class="ti-dw-powered-by"><span><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_widget_powered_by', sprintf( 'Powered by %s', $this->product->get_friendly_name() ) ) ); ?></span></span>
297 + <span class="ti-dw-powered-by"><span><?php echo apply_filters( 'themeisle_sdk_dashboard_widget_powered_by', esc_attr( sprintf( 'Powered by %s', $this->product->get_friendly_name() ) ) ); ?></span></span>
305 298 </div>
306 299
307 300 <?php
308 301
@@ -311,38 +304,11 @@
311 304 /**
312 305 * Setup feed items.
313 306 */
314 307 private function setup_feeds() {
315 - if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
316 - // Do not force the feed for the items in the sdk feeds list.
317 - // this prevents showing notices if another plugin will force all SimplePie feeds to load, instead it will
318 - // use the regular SimplePie validation and abort early if the feed is not valid.
319 - $sdk_feeds = $this->feeds;
320 - add_action(
321 - 'wp_feed_options',
322 - function ( $feed, $url ) use ( $sdk_feeds ) {
323 - if ( defined( 'TI_SDK_PHPUNIT' ) && true === TI_SDK_PHPUNIT ) {
324 - return;
325 - }
326 -
327 - if ( ! is_string( $url ) && in_array( $url, $sdk_feeds, true ) ) {
328 - $feed->force_feed( false );
329 - return;
330 - }
331 - if ( is_array( $url ) ) {
332 - foreach ( $url as $feed_url ) {
333 - if ( in_array( $feed_url, $sdk_feeds, true ) ) {
334 - $feed->force_feed( false );
335 - return;
336 - }
337 - }
338 - }
339 - },
340 - PHP_INT_MAX,
341 - 2
342 - );
308 + if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) {
343 309 // Load SimplePie Instance.
344 - $feed = fetch_feed( $sdk_feeds );
310 + $feed = fetch_feed( $this->feeds );
345 311 // TODO report error when is an error loading the feed.
346 312 if ( is_wp_error( $feed ) ) {
347 313 return;
348 314 }
@@ -347,13 +313,9 @@
347 313 return;
348 314 }
349 315
350 316 $items = $feed->get_items( 0, 5 );
351 - $items = is_array( $items ) ? $items : [];
352 -
353 - $items_normalized = [];
354 -
355 - foreach ( $items as $item ) {
317 + foreach ( (array) $items as $item ) {
356 318 $items_normalized[] = array(
357 319 'title' => $item->get_title(),
358 320 'date' => $item->get_date( 'U' ),
359 321 'link' => $item->get_permalink(),
@@ -390,9 +352,9 @@
390 352
391 353 /**
392 354 * Contact the API and fetch the recommended plugins/themes
393 355 */
394 - public function recommend_plugin_or_theme() {
356 + function recommend_plugin_or_theme() {
395 357 $products = $this->get_product_from_api();
396 358 if ( ! is_array( $products ) ) {
397 359 $products = array();
398 360 }
@@ -411,10 +373,10 @@
411 373 * Fetch products from the recomended section.
412 374 *
413 375 * @return array|mixed The list of products to use in recomended section.
414 376 */
415 - public function get_product_from_api() {
416 - if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
377 + function get_product_from_api() {
378 + if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) {
417 379 $products = array();
418 380 $all_themes = $this->get_themes_from_wporg( 'themeisle' );
419 381 $all_plugins = $this->get_plugins_from_wporg( 'themeisle' );
420 382 static $allowed_products = [
@@ -466,10 +428,10 @@
466 428 * @param string $author The author name.
467 429 *
468 430 * @return array The list of themes.
469 431 */
470 - public function get_themes_from_wporg( $author ) {
471 - $products = $this->safe_get(
432 + function get_themes_from_wporg( $author ) {
433 + $products = wp_remote_get(
472 434 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[author]=' . $author . '&request[per_page]=30&request[fields][active_installs]=true'
473 435 );
474 436 $products = json_decode( wp_remote_retrieve_body( $products ) );
475 437 if ( is_object( $products ) ) {
@@ -487,10 +449,10 @@
487 449 * @param string $author The author slug.
488 450 *
489 451 * @return array The list of plugins for the selected author.
490 452 */
491 - public function get_plugins_from_wporg( $author ) {
492 - $products = $this->safe_get(
453 + function get_plugins_from_wporg( $author ) {
454 + $products = wp_remote_get(
493 455 'https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[author]=' . $author . '&request[per_page]=40&request[fields][active_installs]=true'
494 456 );
495 457 $products = json_decode( wp_remote_retrieve_body( $products ) );
496 458 if ( is_object( $products ) ) {