PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.3.8
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.3.8
2.9.1 2.9.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.0.0 2.1.0 2.2.0 2.3.2 2.3.3 2.3.5 2.3.6 2.3.8 2.3.9 2.4.3 All 37 releases
← All changes | includes/youtube-api.php +14 -26 2.4.32.3.8 View file →
@@ -496,9 +496,9 @@
496 496 ),
497 497 $params
498 498 );
499 499
500 - $api_response = $this->request_api( $api_url, $api_params, 'live' );
500 + $api_response = $this->request_api( $api_url, $api_params );
501 501 if ( isset( $api_response->error ) ) {
502 502 return $api_response;
503 503 }
504 504
@@ -703,38 +703,26 @@
703 703 return $this->get_error( $message );
704 704 }
705 705
706 706 // Store in cache (transients)
707 - $can_store_in_transients = false;
707 + if ( ! $this->is_development_mode && 'videos' == $context && $cache_duration > 0 ) {
708 + if ( isset( $data->items ) && is_array( $data->items ) && count( $data->items ) > 0 ) {
709 + set_transient( $cache_key, $data, $cache_duration );
708 710
709 - if ( ! $this->is_development_mode && $cache_duration > 0 ) {
710 - if ( 'videos' == $context ) {
711 - if ( isset( $data->items ) && is_array( $data->items ) && count( $data->items ) > 0 ) {
712 - $can_store_in_transients = true;
711 + // Get the current list of transients
712 + $cache_keys = get_option( 'ayg_transient_keys', array() );
713 + if ( ! is_array( $cache_keys ) ) {
714 + $cache_keys = (array) $cache_keys;
713 715 }
714 - }
715 716
716 - if ( 'live' == $context ) {
717 - $can_store_in_transients = true;
718 - }
719 - }
717 + // Append our new one
718 + if ( ! in_array( $cache_key, $cache_keys ) ) {
719 + $cache_keys[] = $cache_key;
720 + }
720 721
721 - if ( $can_store_in_transients ) {
722 - set_transient( $cache_key, $data, $cache_duration );
723 -
724 - // Get the current list of transients
725 - $cache_keys = get_option( 'ayg_transient_keys', array() );
726 - if ( ! is_array( $cache_keys ) ) {
727 - $cache_keys = (array) $cache_keys;
722 + // Save it to the DB
723 + update_option( 'ayg_transient_keys', $cache_keys );
728 724 }
729 -
730 - // Append our new one
731 - if ( ! in_array( $cache_key, $cache_keys ) ) {
732 - $cache_keys[] = $cache_key;
733 - }
734 -
735 - // Save it to the DB
736 - update_option( 'ayg_transient_keys', $cache_keys );
737 725 }
738 726
739 727 // Store videos in our custom database table "{$wpdb->prefix}ayg_videos"
740 728 ayg_db_store_videos( $data );