set_cache_duration example

        $this->sanitize = new SimplePie_Sanitize();
        $this->registry = new SimplePie_Registry();

        if (func_num_args() > 0)
        {
            $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
            trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', $level);

            $args = func_get_args();
            switch (count($args)) {
                case 3:
                    $this->set_cache_duration($args[2]);
                case 2:
                    $this->set_cache_location($args[1]);
                case 1:
                    $this->set_feed_url($args[0]);
                    $this->init();
            }
        }
    }

    /** * Used for converting object to a string */
$feed->set_cache_location( 'wp_transient' );
    } else {
        // Back-compat for SimplePie 1.2.x.         require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
        $feed->set_cache_class( 'WP_Feed_Cache' );
    }

    $feed->set_file_class( 'WP_SimplePie_File' );

    $feed->set_feed_url( $url );
    /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
    $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );

    /** * Fires just before processing the SimplePie feed object. * * @since 3.0.0 * * @param SimplePie $feed SimplePie feed object (passed by reference). * @param string|string[] $url URL of feed or array of URLs of feeds to retrieve. */
    do_action_ref_array( 'wp_feed_options', array( &$feed$url ) );

    
Home | Imprint | This part of the site doesn't use cookies.