← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php
+6
-42
3.10.13
→
3.9.2
View file →
| @@ -11,9 +11,8 @@ | ||
| 11 | 11 | |
| 12 | 12 | namespace ThemeisleSDK\Modules; |
| 13 | 13 | |
| 14 | 14 | use ThemeisleSDK\Common\Abstract_Module; |
| 15 | -use ThemeisleSDK\Loader; | |
| 16 | 15 | use ThemeisleSDK\Product; |
| 17 | 16 | |
| 18 | 17 | // Exit if accessed directly. |
| 19 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -76,15 +75,13 @@ | ||
| 76 | 75 | if ( apply_filters( 'themeisle_sdk_hide_dashboard_widget', false ) ) { |
| 77 | 76 | return; |
| 78 | 77 | } |
| 79 | 78 | $this->product = $product; |
| 80 | - $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', Loader::$labels['dashboard_widget']['title'] ); | |
| 79 | + $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' ); | |
| 81 | 80 | $this->feeds = apply_filters( |
| 82 | 81 | 'themeisle_sdk_dashboard_widget_feeds', |
| 83 | 82 | [ |
| 84 | 83 | 'https://themeisle.com/blog/feed', |
| 85 | - 'https://www.codeinwp.com/blog/feed', | |
| 86 | - 'https://wpshout.com/feed', | |
| 87 | 84 | ] |
| 88 | 85 | ); |
| 89 | 86 | add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) ); |
| 90 | 87 | add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) ); |
| @@ -280,9 +277,9 @@ | ||
| 280 | 277 | } |
| 281 | 278 | ?> |
| 282 | 279 | <div class="ti-dw-footer"> |
| 283 | 280 | <span class="ti-dw-recommend-item "> |
| 284 | - <span class="ti-dw-recommend"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( Loader::$labels['dashboard_widget']['popular'], ucwords( $type ) ) ) ); ?> | |
| 281 | + <span class="ti-dw-recommend"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ) ); ?> | |
| 285 | 282 | : </span> |
| 286 | 283 | <?php |
| 287 | 284 | echo esc_attr( |
| 288 | 285 | trim( |
| @@ -299,11 +296,11 @@ | ||
| 299 | 296 | ) |
| 300 | 297 | ); |
| 301 | 298 | ?> |
| 302 | 299 | (<a class="thickbox open-plugin-details-modal" |
| 303 | - href="<?php echo esc_url( $url . '&TB_iframe=true&width=600&height=500' ); ?>"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_install_label', Loader::$labels['dashboard_widget']['install'] ) ); ?></a>) | |
| 300 | + 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>) | |
| 304 | 301 | </span> |
| 305 | - <span class="ti-dw-powered-by"><span><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_widget_powered_by', sprintf( Loader::$labels['dashboard_widget']['powered'], $this->product->get_friendly_name() ) ) ); ?></span></span> | |
| 302 | + <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> | |
| 306 | 303 | </div> |
| 307 | 304 | |
| 308 | 305 | <?php |
| 309 | 306 | |
| @@ -313,39 +310,10 @@ | ||
| 313 | 310 | * Setup feed items. |
| 314 | 311 | */ |
| 315 | 312 | private function setup_feeds() { |
| 316 | 313 | if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure |
| 317 | - // Do not force the feed for the items in the sdk feeds list. | |
| 318 | - // this prevents showing notices if another plugin will force all SimplePie feeds to load, instead it will | |
| 319 | - // use the regular SimplePie validation and abort early if the feed is not valid. | |
| 320 | - $sdk_feeds = $this->feeds; | |
| 321 | - add_action( | |
| 322 | - 'wp_feed_options', | |
| 323 | - function ( $feed, $url ) use ( $sdk_feeds ) { | |
| 324 | - if ( defined( 'TI_SDK_PHPUNIT' ) && true === TI_SDK_PHPUNIT ) { | |
| 325 | - return; | |
| 326 | - } | |
| 327 | - | |
| 328 | - if ( ! is_string( $url ) && in_array( $url, $sdk_feeds, true ) ) { | |
| 329 | - $feed->force_feed( false ); | |
| 330 | - | |
| 331 | - return; | |
| 332 | - } | |
| 333 | - if ( is_array( $url ) ) { | |
| 334 | - foreach ( $url as $feed_url ) { | |
| 335 | - if ( in_array( $feed_url, $sdk_feeds, true ) ) { | |
| 336 | - $feed->force_feed( false ); | |
| 337 | - | |
| 338 | - return; | |
| 339 | - } | |
| 340 | - } | |
| 341 | - } | |
| 342 | - }, | |
| 343 | - PHP_INT_MAX, | |
| 344 | - 2 | |
| 345 | - ); | |
| 346 | 314 | // Load SimplePie Instance. |
| 347 | - $feed = fetch_feed( $sdk_feeds ); | |
| 315 | + $feed = fetch_feed( $this->feeds ); | |
| 348 | 316 | // TODO report error when is an error loading the feed. |
| 349 | 317 | if ( is_wp_error( $feed ) ) { |
| 350 | 318 | return; |
| 351 | 319 | } |
| @@ -350,13 +318,9 @@ | ||
| 350 | 318 | return; |
| 351 | 319 | } |
| 352 | 320 | |
| 353 | 321 | $items = $feed->get_items( 0, 5 ); |
| 354 | - $items = is_array( $items ) ? $items : []; | |
| 355 | - | |
| 356 | - $items_normalized = []; | |
| 357 | - | |
| 358 | - foreach ( $items as $item ) { | |
| 322 | + foreach ( (array) $items as $item ) { | |
| 359 | 323 | $items_normalized[] = array( |
| 360 | 324 | 'title' => $item->get_title(), |
| 361 | 325 | 'date' => $item->get_date( 'U' ), |
| 362 | 326 | 'link' => $item->get_permalink(), |