Пример #1
0
	static function ob_cacher($stop=NULL){
	// implement HTML file caching here
	// move the other query checks here for couch etc. ?
		if(PROGRESSIVE_LOAD){		
			if(CACHE_QUERY && $stop){
				$put_file = CACHE_STORE . self::cache_token();
				$cache = ob_get_flush();
				if(!file_exists($put_file)){
				// compressing output doesn't seem to make the files drastically smaller
					if(COMPRESS_OUTPUT) $cache =  preg_replace("/\r?\n/m", "",$cache);
						file_put_contents("$put_file", $cache);
					}
				}
			elseif(CACHE_QUERY != true){
				ob_end_flush();
				if($stop!= NULL ) ob_start();	
			}elseif($_POST && CACHE_QUERY == TRUE){
				$cache_token = CACHE_STORE.self::cache_token();
				if(file_exists($cache_token)){
					$this->cache = 1;
					echo file_get_contents($cache_token);
					// tell the rest of the object to not render!
					return true;
					}
			}
		}
	}
    public function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_willow_ad_300x250', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        $title = apply_filters('widget_title', $instance['title']);
        $code = $instance['code'];
        if (empty($code)) {
            return;
        }
        ob_start();
        echo $args['before_widget'];
        echo !empty($title) ? $args['before_title'] . $title . $args['after_title'] : '';
        ?>
		<div class="ad ad-300x250">
			<?php 
        echo $code;
        ?>
		</div>
		<?php 
        echo $args['after_widget'];
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_willow_ad_300x250', $cache, 'widget');
    }
Пример #3
0
function discuss_cache($callback_with_parameters, $unique_name, $flags)
{
    global $discuss_cache;
    $discuss_cache[$unique_name] = array($unique_name);
    $return_value_file = rhizome_config('discuss_cache_dir') . '/' . $unique_name . '.serialized.txt';
    $output_file = rhizome_config('discuss_cache_dir') . '/' . $unique_name . '.output.txt';
    if (file_exists($output_file) && file_exists($return_value_file) && !isset($_REQUEST['force']) && isset($discuss_cache[$unique_name])) {
        readfile($output_file);
        return unserialize(file_get_contents($return_value_file));
    } else {
        foreach ($flags as $flag) {
            if (!isset($discuss_cache[$flag])) {
                $discuss_cache[$flag] = array();
            }
            if (!in_array($unique_name, $discuss_cache[$flag])) {
                $discuss_cache[$flag][] = $unique_name;
            }
        }
        $callback = array_shift($callback_with_parameters);
        ob_start();
        $result = call_user_func_array($callback, $callback_with_parameters);
        $serialized_result = serialize($result);
        $output = ob_get_flush();
        $fh = fopen($output_file, 'w');
        fwrite($fh, $output);
        fclose($fh);
        chmod($output_file, 0664);
        $fh = fopen($return_value_file, 'w');
        fwrite($fh, $serialized_result);
        fclose($fh);
        chmod($return_value_file, 0664);
        discuss_cache_save_index();
        return $result;
    }
}
Пример #4
0
 public function run()
 {
     ob_start();
     // output buffering
     require_once Url::getPage();
     ob_get_flush();
 }
Пример #5
0
 function widget($args, $instance)
 {
     $cache = wp_cache_get($this->className, 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = null;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args, EXTR_SKIP);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     echo $before_widget;
     if ($title) {
         echo $before_title, $title, $after_title;
     }
     if (isset($instance['list'])) {
         echo ciGetPracticeAreasTitlesList($instance['maxPracticeAreas']);
     } else {
         echo ciGetPracticeAreasHTML($instance['maxPracticeAreas'], 0, $instance['maxCharLength']);
     }
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set($this->className, $cache, 'widget');
 }
Пример #6
0
 public function widget($args, $instance)
 {
     $cache = array();
     if (!$this->is_preview()) {
         $cache = wp_cache_get($this->cache_key, 'widget');
     }
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo balanceTags($cache[$args['widget_id']]);
         return;
     }
     ob_start();
     $default = array('title' => 'Filter By:', 'show_attribute' => '', 'st_search_fields' => '', 'style' => 'dark');
     $instance = wp_parse_args($instance, $default);
     echo st()->load_template('rental/filter', null, array('instance' => $instance));
     if (!$this->is_preview()) {
         $cache[$args['widget_id']] = ob_get_flush();
         wp_cache_set($this->cache_key, $cache, 'widget');
     } else {
         ob_end_flush();
     }
 }
Пример #7
0
 /**
  * Widget
  * Display the widget in the sidebar
  *
  * @param  array  sidebar arguments
  * @param  array  instance
  */
 public function widget($args, $instance)
 {
     // Get the widget cache from the transient
     $cache = get_transient('fflcommerce_widget_cache');
     // If this tag cloud widget instance is cached, get from the cache
     if (isset($cache[$this->id])) {
         echo $cache[$this->id];
         return false;
     }
     // Otherwise Start buffering and output the Widget
     ob_start();
     // Extract the widget arguments
     extract($args);
     // Set the widget title
     $title = !empty($instance['title']) ? $instance['title'] : __('Product Tags', 'fflcommerce');
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     // Print the widget wrapper & title
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // Print tag cloud with wrapper
     echo '<div class="tagcloud">';
     wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => 'product_tag')));
     echo "</div>\n";
     // Print closing widget wrapper
     echo $after_widget;
     // Flush output buffer and save to transient cache
     $result = ob_get_flush();
     $cache[$this->id] = $result;
     set_transient('fflcommerce_widget_cache', $cache, 3600 * 3);
     // 3 hours ahead
 }
Пример #8
0
 /**
  * Stops and saves the cache.
  * @return void
  */
 public function save()
 {
     if ($this->key !== NULL) {
         $this->getCache()->save($this->key, ob_get_flush(), $this->frame);
     }
     $this->key = $this->frame = NULL;
 }
    function widget($args, $instance)
    {
        global $post;
        $cache = wp_cache_get('widget_progressive_menu', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        $nav_menu = !empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false;
        if (!$nav_menu) {
            return;
        }
        ob_start();
        extract($args);
        echo $before_widget;
        if (!empty($instance['title'])) {
            $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
            echo $before_title . esc_html($title) . $after_title;
        }
        echo '<nav>';
        wp_nav_menu(array('fallback_cb' => '', 'container' => false, 'menu' => $nav_menu, 'menu_class' => 'theme-menu', 'depth' => 2, 'walker' => new progressive_menu_widget_walker_nav_menu()));
        echo '</nav>';
        ?>

		<?php 
        echo $after_widget;
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_progressive_menu', $cache, 'widget');
    }
 public static function add_css()
 {
     global $aecomments;
     if (is_single() || is_page() || is_admin()) {
         if (is_page() && $aecomments->get_admin_option('show_pages') != 'true') {
             return;
         }
         //Output CSS or enqueue depending on if a file exists or not
         AECCSS::get_main_css(true);
         //echo out
         //Output clearfix - Saves a page request so it echoes out the entire CSS in the source
         ob_start();
         /* From http://blue-anvil.com/archives/experiments-with-floats-whats-the-best-method-of-clearance */
         if ($aecomments->get_admin_option('clear_after') == "true") {
             echo "<!--[if IE]>\n";
             echo "<style type='text/css'>";
             include $aecomments->get_plugin_dir('/css/clearfix.css');
             echo "</style>";
             echo "\n<![endif]-->\n";
         }
         /* clear after */
         ob_get_flush();
         AECDependencies::queue_colorbox_style();
     }
 }
Пример #11
0
    function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_custom_teaser', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $teaser_text = $instance['text'];
        $desc = $instance['desc'];
        echo $before_widget;
        ?>
			
		<div class="teaser">
		<?php 
        echo $teaser_text;
        ?>
		</div>
		
		<?php 
        echo $after_widget;
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_custom_teaser', $cache, 'widget');
    }
 function widget($args, $instance)
 {
     ob_start();
     extract($args);
     extract($instance);
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $stats_periods = array_keys($this->toplytics->ranges);
     if (!in_array($period, $stats_periods)) {
         $period = $stats_periods[0];
     }
     $toplytics_results = $this->toplytics->get_result($period);
     $toplytics_results = array_slice($toplytics_results, 0, $numberposts, true);
     // variables for backward compatibilty
     $widget_period = $period;
     $widget_numberposts = $numberposts;
     $widget_showviews = $showviews;
     echo $before_widget;
     $template_filename = $this->toplytics->get_template_filename();
     if ('' != $template_filename) {
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         $toplytics_args = array('widget_id' => $widget_id, 'period' => $period, 'numberposts' => $numberposts, 'showviews' => $showviews, 'before_title' => $before_title, 'title' => $title, 'after_title' => $after_title);
         $this->realtime_js_script($toplytics_args);
         echo "<div id='{$widget_id}'></div>";
         include $template_filename;
         echo $after_widget;
     }
     ob_get_flush();
 }
    function _lb79db717cbb__itemsContainer($_b, $_args)
    {
        foreach ($_args as $__k => $__v) {
            ${$__k} = $__v;
        }
        $_control->redrawControl('itemsContainer', FALSE);
        $iterations = 0;
        foreach ($list as $key => $item) {
            ?>
    <li<?php 
            echo ' id="' . ($_l->dynSnippetId = $_control->getSnippetId("item-{$key}")) . '"';
            ?>
><?php 
            ob_start();
            echo Latte\Runtime\Filters::escapeHtml($item, ENT_NOQUOTES);
            ?>
 <a class="ajax" href="<?php 
            echo Latte\Runtime\Filters::escapeHtml($_control->link("update!", array($key)), ENT_COMPAT);
            ?>
">update</a><?php 
            $_l->dynSnippets[$_l->dynSnippetId] = ob_get_flush();
            ?>
</li>
<?php 
            $iterations++;
        }
        if (isset($_l->dynSnippets)) {
            return $_l->dynSnippets;
        }
    }
Пример #14
0
/**
 * @name encCache
 * @author SkyWorld
 * @date 2011-1-18
 * @description this function will be registered in function cachePage
 * 				this function to call will get page contents and flush page
 * @parameters  $file: path and filename of cached page
 * @return void
 **/
function endCache($file)
{
    //get page data and preventing illegal access to cache files.
    $output = ob_get_flush();
    flush();
    file_put_contents($file, $output, LOCK_EX);
}
Пример #15
0
 public static function html($key, $params = array(), $cacheID = null, $cachetime = -1)
 {
     if ($cacheID != null) {
         if ($cacheID == -1) {
             $cacheID = md5($key . serialize($params));
         }
         $a = fcache::read($cacheID, $cachetime);
         if ($a != null) {
             echo $a;
             return;
         }
         ob_start();
     }
     $file = self::html_find($key);
     if ($file != null) {
         if (defined("debug")) {
             self::$_debuglog["html"][] = array("page" => $key, "file" => $file, "timestamp" => microtime(true));
         }
         include $file;
         if ($cacheID != null) {
             fcache::write($cacheID, ob_get_flush());
         }
         return;
     }
     if (defined("debug")) {
         trigger_error("Seite " . $key . " kann nicht gefunden werden.", E_USER_WARNING);
     }
 }
 function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_nice_opening_hours', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     $settings = array_fill_keys($this->settings, '');
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args($instance, $settings);
     extract($instance, EXTR_SKIP);
     echo $before_widget;
     if ($title != '') {
         echo $before_title . apply_filters('widget_title', $title, $instance, $this->id_base) . $after_title;
     }
     // get times and do the magic!
     echo nice_opening_hours();
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set('widget_nice_opening_hours', $cache, 'widget');
 }
Пример #17
0
 public function process()
 {
     // Retrieve the XML sent in the HTTP POST request to the ResponseHandler
     $xmlResponse = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");
     if (get_magic_quotes_gpc()) {
         $xmlResponse = stripslashes($xmlResponse);
     }
     #$this->log($xmlResponse);
     $debug = Mage::getModel('googlecheckout/api_debug')->setDir('in')->setUrl('process')->setRequestBody($xmlResponse)->save();
     list($root, $data) = $this->getGResponse()->GetParsedXML($xmlResponse);
     $debug->setUrl($root)->save();
     $this->getGResponse()->SetMerchantAuthentication($this->getMerchantId(), $this->getMerchantKey());
     $status = $this->getGResponse()->HttpAuthentication();
     if (!$status || empty($data[$root])) {
         exit;
     }
     $this->setRootName($root)->setRoot($data[$root]);
     $this->getGResponse()->setSerialNumber($this->getData('root/serial-number'));
     $method = '_response' . uc_words($root, '', '-');
     if (method_exists($this, $method)) {
         ob_start();
         try {
             $this->{$method}();
         } catch (Exception $e) {
             $this->getGResponse()->log->logError($e->getMessage());
         }
         $response = ob_get_flush();
         #$this->log($response);
         $debug->setResponseBody($response)->save();
     } else {
         $this->getGResponse()->SendBadRequestStatus("Invalid or not supported Message");
     }
     return $this;
 }
 public function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_willow_recent_posts', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     $title = apply_filters('widget_title', $instance['title']);
     if (empty($instance['number']) || !($number = absint($instance['number']))) {
         $number = 5;
     }
     $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
     global $wp_query;
     $temp = $wp_query;
     $wp_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1));
     ob_start();
     echo $args['before_widget'];
     echo !empty($title) ? $args['before_title'] . $title . $args['after_title'] : '';
     include locate_template('loop-widget-posts.php');
     echo $args['after_widget'];
     $cache[$args['widget_id']] = ob_get_flush();
     $wp_query = $temp;
     wp_reset_postdata();
     wp_cache_set('widget_willow_recent_posts', $cache, 'widget');
 }
Пример #19
0
 function widget($args, $instance)
 {
     $cache = wp_cache_get('related_widget', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Related Posts', 'related') : $instance['title'], $instance, $this->id_base);
     if (is_singular()) {
         global $related;
         $related_str = $related->show(get_the_ID());
         if (!empty($related_str)) {
             echo $before_widget;
             if ($title) {
                 echo $before_title . $title . $after_title;
             }
             echo $related_str;
             echo $after_widget;
         }
     }
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set('related_widget', $cache, 'widget');
 }
Пример #20
0
 /**
  * Displays the widget in the sidebar.
  *
  * @param array $args     Sidebar arguments.
  * @param array $instance The instance.
  *
  * @return bool|void
  */
 public function widget($args, $instance)
 {
     // Get the best selling products from the transient
     $cache = get_transient(Core::WIDGET_CACHE);
     // If cached get from the cache
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     // Start buffering
     ob_start();
     // Set the widget title
     $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Best Sellers', 'jigoshop'), $instance, $this->id_base);
     // Set number of products to fetch
     if (!($number = absint($instance['number']))) {
         $number = 5;
     }
     // Set up query
     $query_args = array('posts_per_page' => $number, 'post_type' => Types::PRODUCT, 'post_status' => 'publish', 'meta_key' => 'stock_sold', 'orderby' => 'meta_value_num+0', 'order' => 'desc', 'nopaging' => false, 'meta_query' => array(array('key' => 'visibility', 'value' => array(Product::VISIBILITY_CATALOG, Product::VISIBILITY_PUBLIC), 'compare' => 'IN')));
     // Run the query
     $q = new \WP_Query($query_args);
     $products = self::$productService->findByQuery($q);
     if (!empty($products)) {
         Render::output('widget/best_sellers/widget', array_merge($args, array('title' => $title, 'products' => $products)));
     }
     // Flush output buffer and save to transient cache
     $cache[$args['widget_id']] = ob_get_flush();
     set_transient(Core::WIDGET_CACHE, $cache, 3600 * 3);
     // 3 hours ahead
 }
Пример #21
0
 /**
  * Outputs the HTML for this widget.
  *
  * @param array An array of standard parameters for widgets in this theme
  * @param array An array of settings for this widget instance
  * @return void Echoes it's output
  **/
 function widget($args, $instance)
 {
     $cache = wp_cache_get('djd_site_post_widget', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = null;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args, EXTR_SKIP);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('DJD Site Post', 'djd-site-post') : $instance['title'], $instance, $this->id_base);
     echo $before_widget;
     echo $before_title;
     echo $title;
     // Can set this with a widget option, or omit altogether
     echo $after_title;
     echo do_shortcode('[djd-site-post called_from_widget = "1"]');
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set('djd_site_post_widget', $cache, 'widget');
 }
Пример #22
0
 /**
  * Process notification from google
  * @return Mage_GoogleCheckout_Model_Api_Xml_Callback
  */
 public function process()
 {
     // Retrieve the XML sent in the HTTP POST request to the ResponseHandler
     $xmlResponse = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");
     if (get_magic_quotes_gpc()) {
         $xmlResponse = stripslashes($xmlResponse);
     }
     $debugData = array('request' => $xmlResponse, 'dir' => 'in');
     if (empty($xmlResponse)) {
         $this->getApi()->debugData($debugData);
         return false;
     }
     list($root, $data) = $this->getGResponse()->GetParsedXML($xmlResponse);
     $this->getGResponse()->SetMerchantAuthentication($this->getMerchantId(), $this->getMerchantKey());
     $status = $this->getGResponse()->HttpAuthentication();
     if (!$status || empty($data[$root])) {
         exit;
     }
     $this->setRootName($root)->setRoot($data[$root]);
     $this->getGResponse()->setSerialNumber($this->getData('root/serial-number'));
     $method = '_response' . uc_words($root, '', '-');
     if (method_exists($this, $method)) {
         ob_start();
         try {
             $this->{$method}();
         } catch (Exception $e) {
             $this->getGResponse()->log->logError($e->__toString());
         }
         $debugData['result'] = ob_get_flush();
         $this->getApi()->debugData($debugData);
     } else {
         $this->getGResponse()->SendBadRequestStatus("Invalid or not supported Message");
     }
     return $this;
 }
Пример #23
0
 public function widget($args, $instance)
 {
     $cache = wp_cache_get('theme_wpv_posts', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     if (!($number = (int) $instance['number'])) {
         $number = 10;
     } elseif ($number < 1) {
         $number = 1;
     } elseif ($number > 15) {
         $number = 15;
     }
     if (!($desc_length = (int) $instance['desc_length'])) {
         $desc_length = 0;
     } elseif ($desc_length < 1) {
         $desc_length = 1;
     }
     $disable_thumbnail = $instance['disable_thumbnail'];
     $tag_taxonomy = $instance['tag_taxonomy'];
     $orderby = is_string($instance['orderby']) ? array($instance['orderby']) : (is_array($instance['orderby']) ? $instance['orderby'] : array());
     // just in case if orderby is not an array - pass an empty array
     $img_size = apply_filters('wpv_posts_widget_img_size', 300, $args);
     $thumbnail_name = apply_filters('wpv_posts_widget_thumbnail_name', 'thumbnail', $args);
     ob_start();
     include locate_template('templates/widgets/front/posts.php');
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set('theme_wpv_posts', $cache, 'widget');
 }
Пример #24
0
    function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_dt_slider', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('', 'engine') : $instance['title'], $instance, $this->id_base);
        $category = empty($instance['category']) ? '' : $instance['category'];
        $qty = empty($instance['qty']) ? '3' : $instance['qty'];
        $excerpt_length = empty($instance['excerpt_length']) ? '0' : $instance['excerpt_length'];
        $r = new WP_Query(array('posts_per_page' => $qty, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'category__in' => explode(',', $category)));
        if ($r->have_posts()) {
            ?>
		<?php 
            echo $before_widget;
            echo do_shortcode('[engine_slider title="' . $title . '" category="' . $category . '" qty="' . $qty . '" autoplay="0" random="0" thumb_size="small" excerpt_length="' . $excerpt_length . '"]');
            echo $after_widget;
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_dt_slider', $cache, 'widget');
    }
 function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_single_image', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args);
     $cb_title = empty($instance['title']) ? '' : $instance['title'];
     $cb_image = empty($instance['imgurl']) ? '' : $instance['imgurl'];
     $cb_retina_image = empty($instance['retimgurl']) ? '' : $instance['retimgurl'];
     echo $before_widget;
     if ($cb_title) {
         echo $before_title . esc_html($cb_title) . $after_title;
     }
     if ($cb_image != NULL) {
         echo '<img src="' . $cb_image . '" alt=" " ';
         if ($cb_retina_image != NULL) {
             echo ' data-at2x="' . $cb_retina_image . '"';
         }
         echo ' />';
     }
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set('widget_single_image', $cache, 'widget');
 }
 function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_page_content', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     global $post;
     $content = apply_filters('the_content', $post->post_content);
     $content = str_replace(']]>', ']]&gt;', $content);
     echo $content;
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_add('widget_recent_posts', $cache, 'widget');
 }
Пример #27
0
function _cache_hook($element)
{
    $fingerprint = md5(json_encode($element));
    $cache_path = YG_CACHE_PATH . '/hooks/' . $fingerprint;
    if (is_file($cache_path)) {
        $cache_buffer = file_get_contents($cache_path);
        $cache_date = filemtime($cache_path);
        if (YG_CACHE_HOOKS_TIMEOUT > time() - $cache_date) {
            $response = unserialize($cache_buffer);
            echo $response[0];
            return $response[1];
        } else {
            /* Expired cache! */
            ob_start();
            $refresh_hook = _do_fire_hook($element);
            $return_contents = ob_get_flush();
            if (file_put_contents($cache_path, serialize(array($return_contents, $refresh_hook)))) {
                return $refresh_hook;
            } else {
                return false;
            }
        }
    } else {
        ob_start();
        $refresh_hook = _do_fire_hook($element);
        $return_contents = ob_get_flush();
        if (file_put_contents($cache_path, serialize(array($return_contents, $refresh_hook)))) {
            return $refresh_hook;
        } else {
            return false;
        }
    }
}
    function widget($args, $instance)
    {
        $cache = wp_cache_get('widget_Pending_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            return $cache[$args['widget_id']];
        }
        ob_start();
        extract($args);
        $title = empty($instance['title']) ? __('Pending Posts', 'Pending_posts_widget') : apply_filters('widget_title', $instance['title']);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        $queryArgs = array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'pending', 'caller_get_posts' => 1, 'order' => 'ASC');
        $r = new WP_Query($queryArgs);
        if ($r->have_posts()) {
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            echo $before_title . $title . $after_title;
            ?>
		<ul>
		<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
		<li><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                edit_post_link('e', ' (', ')');
                ?>
</li>
		<?php 
            }
            ?>
		</ul>
		<?php 
            echo $after_widget;
            wp_reset_query();
            // Restore global post data stomped by the_post().
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_add('widget_Pending_posts', $cache, 'widget');
    }
Пример #29
0
	/**
	 * Stops and saves the cache.
	 * @param  array  dependencies
	 * @return void
	 */
	public function end(array $dp = NULL)
	{
		if ($this->cache === NULL) {
			throw new InvalidStateException('Output cache has already been saved.');
		}
		$this->cache->save($this->key, ob_get_flush(), (array) $dp + (array) $this->dependencies);
		$this->cache = NULL;
	}
Пример #30
0
 /**
  *  执行Action
  */
 public static function run($class)
 {
     $instance = new $class();
     $instance->run();
     Log::Write('System Run Class<run>:' . $class, Log::DEBUG);
     ob_get_flush();
     return $instance;
 }