本文整理汇总了PHP中ob_get_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_get_flush函数的具体用法?PHP ob_get_flush怎么用?PHP ob_get_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_get_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ob_cacher
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;
}
}
}
}
示例2: widget
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: discuss_cache
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: run
public function run()
{
ob_start();
// output buffering
require_once Url::getPage();
ob_get_flush();
}
示例5: widget
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: widget
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: widget
/**
* 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: save
/**
* 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;
}
示例9: widget
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');
}
示例10: add_css
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: widget
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');
}
示例12: 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();
}
示例13: _lb79db717cbb__itemsContainer
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;
}
}
开发者ID:jakuborava,项目名称:walletapp,代码行数:30,代码来源:htdocs-MyWallet-app-templates-Budget-detail-latte-f7093e0ad97a33d170dc57a106f8efce.php
示例14: endCache
/**
* @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: html
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);
}
}