本文整理汇总了PHP中ob_end_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_end_clean函数的具体用法?PHP ob_end_clean怎么用?PHP ob_end_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_end_clean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: command_dd
function command_dd()
{
$args = func_get_args();
$options = $this->get_options();
$dd = kernel::single('dev_docbuilder_dd');
if (empty($args)) {
$dd->export();
} else {
foreach ($args as $app_id) {
$dd->export_tables($app_id);
}
}
if ($filename = $options['result-file']) {
ob_start();
$dd->output();
$out = ob_get_contents();
ob_end_clean();
if (!is_dir(dirname($filename))) {
throw new Exception('cannot find the ' . dirname($filename) . 'directory');
} elseif (is_dir($filename)) {
throw new Exception('the result-file path is a directory.');
}
file_put_contents($options['result-file'], $out);
echo 'data dictionary doc export success.';
} else {
$dd->output();
}
}
示例2: popular
function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3)
{
global $config, $g5;
if (!$skin_dir) {
$skin_dir = 'basic';
}
$date_gap = date("Y-m-d", G5_SERVER_TIME - $date_cnt * 86400);
$sql = " select pp_word, count(*) as cnt from {$g5['popular_table']} where pp_date between '{$date_gap}' and '" . G5_TIME_YMD . "' group by pp_word order by cnt desc, pp_word limit 0, {$pop_cnt} ";
$result = sql_query($sql);
for ($i = 0; $row = sql_fetch_array($result); $i++) {
$list[$i] = $row;
// 스크립트등의 실행금지
$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
}
ob_start();
if (G5_IS_MOBILE) {
$popular_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
$popular_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
} else {
$popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir;
$popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir;
}
include_once $popular_skin_path . '/popular.skin.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例3: render
public function render($template = null, array $arguments = null)
{
if (null === $template) {
return false;
}
$parentTemplate = $this->currentTemplate;
$this->currentTemplate = $this->totalTemplates = $this->totalTemplates + 1;
$path = $this->finder->getPath($template);
if (!is_file($path)) {
throw new \RuntimeException('The requested view file doesn\'t exist in: <strong>' . $path . '</strong>', 404);
}
ob_start();
try {
$this->requireInContext($path, $arguments);
} catch (\Exception $e) {
ob_end_clean();
throw $e;
}
if (isset($this->parent[$this->currentTemplate])) {
$this->data['content'] = ob_get_contents();
ob_end_clean();
$this->render($this->parent[$this->currentTemplate], $arguments);
} else {
ob_end_flush();
}
if ($parentTemplate == 0) {
$this->clean();
} else {
$this->currentTemplate = $parentTemplate;
}
}
示例4: smarty_core_display_debug_console
/**
* Smarty debug_console function plugin
*
* Type: core<br>
* Name: display_debug_console<br>
* Purpose: display the javascript debug console window
* @param array Format: null
* @param Smarty
*/
function smarty_core_display_debug_console($params, &$smarty)
{
// we must force compile the debug template in case the environment
// changed between separate applications.
if (empty($smarty->debug_tpl)) {
// set path to debug template from SMARTY_DIR
$smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
if ($smarty->security && is_file($smarty->debug_tpl)) {
$smarty->secure_dir[] = realpath($smarty->debug_tpl);
}
$smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
}
$_ldelim_orig = $smarty->left_delimiter;
$_rdelim_orig = $smarty->right_delimiter;
$smarty->left_delimiter = '{';
$smarty->right_delimiter = '}';
$_compile_id_orig = $smarty->_compile_id;
$smarty->_compile_id = null;
$_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
ob_start();
$smarty->_include($_compile_path);
$_results = ob_get_contents();
ob_end_clean();
} else {
$_results = '';
}
$smarty->_compile_id = $_compile_id_orig;
$smarty->left_delimiter = $_ldelim_orig;
$smarty->right_delimiter = $_rdelim_orig;
return $_results;
}
示例5: disable_ob
function disable_ob()
{
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);
// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
// Clear, and turn off output buffering
while (ob_get_level() > 0) {
// Get the curent level
$level = ob_get_level();
// End the buffering
ob_end_clean();
// If the current level has not changed, abort
if (ob_get_level() == $level) {
break;
}
}
// Disable apache output buffering/compression
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', '1');
apache_setenv('dont-vary', '1');
}
}
示例6: b_wp_archives_monthly_show
function b_wp_archives_monthly_show($options, $wp_num = "")
{
$block_style = $options[0] ? $options[0] : 0;
$with_count = $options[1] == 0 ? false : true;
global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache;
$id = 1;
$use_cache = 1;
if ($wp_num == "") {
$wp_id = $wp_num;
$wp_inblock = 1;
require dirname(__FILE__) . '/../wp-config.php';
$wp_inblock = 0;
}
ob_start();
if ($block_style == 0) {
// Simple Listing
get_archives('monthly', '', 'html', '', '', $with_count);
} else {
// Dropdown Listing
echo '<form name="archiveform' . $wp_num . '" action="">';
echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
echo '<option value="">' . _WP_BY_MONTHLY . '</option>';
get_archives('monthly', '', 'option', '', '', $with_count);
echo '</select>';
echo '</form>';
}
$block['content'] = ob_get_contents();
ob_end_clean();
return $block;
}
示例7: doexport
public function doexport()
{
$data = $this->getThisModel()->exportData();
if ($data) {
$json = json_encode($data);
// Clear cache
while (@ob_end_clean()) {
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public", false);
// Send MIME headers
header("Content-Description: File Transfer");
header('Content-Type: json');
header("Accept-Ranges: bytes");
header('Content-Disposition: attachment; filename="admintools_settings.json"');
header('Content-Transfer-Encoding: text');
header('Connection: close');
header('Content-Length: ' . strlen($json));
echo $json;
JFactory::getApplication()->close();
} else {
$this->setRedirect('index.php?option=com_admintools&view=importexport&task=export', JText::_('COM_ADMINTOOLS_IMPORTEXPORT_SELECT_DATA_WARN'), 'warning');
}
}
示例8: DoIt
public static function DoIt()
{
self::prepareHttpString();
ob_start();
try {
$url = new BuUrl2(self::$httpString);
bu::setBuUrlInstance($url);
self::runController($url);
} catch (Exception $e) {
ob_end_clean();
$msg = 'Ошибка на сайте';
if (bu::config('rc/debug')) {
$msg = get_class($e) . ': ' . $e->getMessage();
}
$content = $msg;
if (bu::config('rc/debug')) {
$content .= sprintf('<br><b>%s</b><br>', get_class($e));
$content .= "<pre>";
foreach (array_reverse($e->getTrace()) as $v) {
if (isset($v['line'])) {
$content .= $v['line'] . ' ' . $v['file'] . "\n";
}
}
$content .= "</pre>";
}
echo bu::view('layout/panic', array('content' => $content));
}
}
示例9: background
function background()
{
$this->im = imagecreatetruecolor($this->width, $this->height);
$backgrounds = $c = array();
if (!$this->background || !$backgrounds) {
for ($i = 0; $i < 3; $i++) {
$start[$i] = mt_rand(200, 255);
$end[$i] = mt_rand(100, 150);
$step[$i] = ($end[$i] - $start[$i]) / $this->width;
$c[$i] = $start[$i];
}
for ($i = 0; $i < $this->width; $i++) {
$color = imagecolorallocate($this->im, $c[0], $c[1], $c[2]);
imageline($this->im, $i, 0, $i, $this->height, $color);
$c[0] += $step[0];
$c[1] += $step[1];
$c[2] += $step[2];
}
$c[0] -= 20;
$c[1] -= 20;
$c[2] -= 20;
}
ob_start();
if (function_exists('imagepng')) {
imagepng($this->im);
} else {
imagejpeg($this->im, '', 100);
}
imagedestroy($this->im);
$bgcontent = ob_get_contents();
ob_end_clean();
$this->fontcolor = $c;
return $bgcontent;
}
示例10: printResult
/**
* @param \PHPUnit_Framework_TestResult $result
*/
public function printResult(\PHPUnit_Framework_TestResult $result)
{
if ($this->runner->shouldNotify()) {
ob_start();
}
$testDox = trim(TestDox::get(spl_object_hash($result)));
if (strlen($testDox)) {
$this->write(PHP_EOL . PHP_EOL . $testDox);
}
parent::printResult($result);
if ($this->runner->shouldNotify()) {
$output = ob_get_contents();
ob_end_clean();
echo $output;
if ($result->failureCount() + $result->errorCount() + $result->skippedCount() + $result->notImplementedCount() == 0) {
$notificationResult = Notification::RESULT_PASSED;
} else {
$notificationResult = Notification::RESULT_FAILED;
}
$output = $this->removeAnsiEscapeCodesForColors($output);
if (preg_match('/(OK \\(\\d+ tests?, \\d+ assertions?\\))/', $output, $matches)) {
$notificationMessage = $matches[1];
} elseif (preg_match('/(FAILURES!)\\s+(.*)/', $output, $matches)) {
$notificationMessage = $matches[1] . PHP_EOL . $matches[2];
} elseif (preg_match('/(OK, but incomplete,.*!)\\s+(.*)/', $output, $matches)) {
$notificationMessage = $matches[1] . PHP_EOL . $matches[2];
} elseif (preg_match('/(No tests executed!)/', $output, $matches)) {
$notificationMessage = $matches[1];
} else {
$notificationMessage = '';
}
$this->notification = new Notification($notificationResult, $notificationMessage);
}
}
示例11: outputContent
/**
* Output the content of the resource
*
* @param array $options An array of options for the output
*/
public function outputContent(array $options = array())
{
if (empty($options['rpc_type'])) {
$options['rpc_type'] = 'XML';
}
$resourceClass = 'mod' . $options['rpc_type'] . 'RPCResource';
if (!$this->modx->resource instanceof $resourceClass) {
$this->modx->log(modX::LOG_LEVEL_FATAL, 'Could not load ' . $options['rpc_type'] . '-RPC Server class.');
}
$this->modx->resource->process();
$this->modx->resource->_output = $this->modx->resource->_content;
/* collect any uncached element tags in the content and process them */
$this->modx->getParser();
$maxIterations = intval($this->modx->getOption('parser_max_iterations', null, 10));
$this->modx->parser->processElementTags('', $this->modx->resource->_output, true, false, '[[', ']]', array(), $maxIterations);
$this->modx->parser->processElementTags('', $this->modx->resource->_output, true, true, '[[', ']]', array(), $maxIterations);
if (!$this->getServer()) {
$this->modx->log(modX::LOG_LEVEL_FATAL, 'Could not load ' . $options['rpc_type'] . '-RPC Server.');
}
$this->server->service();
ob_get_level() && @ob_end_flush();
while (ob_get_level() && @ob_end_clean()) {
}
exit;
}
示例12: render
/**
* Renders the page by injecting controller data inside a view template
*/
public function render()
{
$viewFile = 'views/' . $this->name . '.php';
if (!file_exists($viewFile)) {
throw new Exception("view file [{$viewFile}] is missing");
}
// inject data and render template
$this->buildPageData();
extract($this->data);
ob_start();
if ((bool) ini_get('short_open_tag') === true) {
include $viewFile;
} else {
$templateCode = file_get_contents($viewFile);
$this->convertShortTags($templateCode);
// Evaluating PHP mixed with HTML requires closing the PHP markup opened by eval()
$templateCode = '?>' . $templateCode;
echo eval($templateCode);
}
// get ouput
$out = ob_get_contents();
// get rid of buffer
@ob_end_clean();
return $out;
}
示例13: process_shortcode
/**
* Replace the default WordPress [gallery] shortcode with a slideshow
*
* @param array $attrs
* @param string $content
*/
public function process_shortcode($params = array(), $content = null)
{
// Extract parameters and provide defaults for the missing ones
extract(shortcode_atts(array('ids' => null, 'transition' => $this->plugin->get_option(BXSG_Settings::$OPTION_DEFAULT_TRANSITION), 'exclude_featured' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_EXCLUDE_FEATURED_IMAGE), 'hide_carousel' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_HIDE_CAROUSEL), 'adaptive_height' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_ADAPTIVE_HEIGHT), 'auto_start' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_AUTO_START), 'speed' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_SPEED), 'duration' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_DURATION), 'extra_options' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_EXTRA_OPTIONS), 'shuffle' => 0, 'size' => 'full', 'thumb_size' => 'thumbnail'), $params));
// If no ids are provided, we will take every image attached to the current post.
// Else, we'll simply fetch them from the DB
$ids = $ids ? explode(',', $ids) : array();
$attachments = $this->get_attached_medias($ids, $exclude_featured);
if ($shuffle == 1) {
shuffle($attachments);
}
// Compute an ID for this particular gallery
$gallery_id = 'bx-gallery-' . $this->current_gallery_id;
$this->current_gallery_id += 1;
// Build the HTML output
ob_start();
include BXSG_INCLUDES_DIR . '/gallery-shortcode.view.php';
$out = ob_get_contents();
ob_end_clean();
// We enqueue the script for inclusion in the WordPress footer
ob_start();
include BXSG_INCLUDES_DIR . '/gallery-shortcode.script.php';
$this->scripts[] = ob_get_contents();
ob_end_clean();
return $out;
}
示例14: init
/**
* Инициализация задачи
*
* @static
* @param $code
*/
private static function init($code)
{
joosRequest::send_headers_by_code($code);
if (ob_get_level()) {
ob_end_clean();
}
}
示例15: test_admin_panel_edit_user
/**
* @covers Starter\routers\RestRouter::admin_panel_edit_user
*/
public function test_admin_panel_edit_user()
{
ob_start();
$this->router->admin_panel_edit_user(1);
ob_end_clean();
self::assertNull(error_get_last());
}