本文整理汇总了PHP中ob_get_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_get_clean函数的具体用法?PHP ob_get_clean怎么用?PHP ob_get_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_get_clean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump
function dump($var, $echo = true, $label = null, $strict = true)
{
$label = $label === null ? '' : rtrim($label) . ' ';
if (!$strict) {
if (ini_get('html_errors')) {
$output = print_r($var, true);
$output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
} else {
$output = $label . " : " . print_r($var, true);
}
} else {
ob_start();
var_dump($var);
$output = ob_get_clean();
if (!extension_loaded('xdebug')) {
$output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
$output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
}
}
if ($echo) {
echo $output;
return null;
} else {
return $output;
}
}
示例2: testAuth
/**
* Test for AuthenticationSignon::auth
*
* @return void
*/
public function testAuth()
{
if (!defined('PMA_TEST_HEADERS')) {
$this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
}
// case 1
$GLOBALS['cfg']['Server']['SignonURL'] = '';
ob_start();
$this->object->auth();
$result = ob_get_clean();
$this->assertContains('You must set SignonURL!', $result);
// case 2
$GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
$_REQUEST['old_usr'] = 'oldUser';
$GLOBALS['cfg']['Server']['LogoutURL'] = 'http://phpmyadmin.net/logoutURL';
$this->object->auth();
$this->assertContains('Location: http://phpmyadmin.net/logoutURL?PHPSESSID=', $GLOBALS['header'][0]);
// case 3
$GLOBALS['header'] = array();
$GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
$_REQUEST['old_usr'] = '';
$GLOBALS['cfg']['Server']['LogoutURL'] = '';
$this->object->auth();
$this->assertContains('Location: http://phpmyadmin.net/SignonURL?PHPSESSID=', $GLOBALS['header'][0]);
}
示例3: parse
/**
* Parses YAML into a PHP array.
*
* The parse method, when supplied with a YAML stream (string or file),
* will do its best to convert YAML in a file into a PHP array.
*
* Usage:
* <code>
* $array = Yaml::parse('config.yml');
* print_r($array);
* </code>
*
* @param string $input Path to a YAML file or a string containing YAML
*
* @return array The YAML converted to a PHP array
*
* @throws \InvalidArgumentException If the YAML is not valid
*
* @api
*/
public static function parse($input)
{
// if input is a file, process it
$file = '';
if (strpos($input, "\n") === false && is_file($input)) {
if (false === is_readable($input)) {
throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input));
}
$file = $input;
if (self::$enablePhpParsing) {
ob_start();
$retval = (include $file);
$content = ob_get_clean();
// if an array is returned by the config file assume it's in plain php form else in YAML
$input = is_array($retval) ? $retval : $content;
// if an array is returned by the config file assume it's in plain php form else in YAML
if (is_array($input)) {
return $input;
}
} else {
$input = file_get_contents($file);
}
}
$yaml = new Parser();
try {
return $yaml->parse($input);
} catch (ParseException $e) {
if ($file) {
$e->setParsedFile($file);
}
throw $e;
}
}
示例4: render
public function render()
{
extract($this->pageVars);
ob_start();
require $this->template;
echo ob_get_clean();
}
示例5: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f = $this->env->getExtension("native_profiler");
$__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f->enter($__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "WebProfilerBundle:Profiler:toolbar_item.html.twig"));
// line 1
if (isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")) {
// line 2
echo " ";
ob_start();
// line 3
echo " <a href=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"), "panel" => isset($context["name"]) ? $context["name"] : $this->getContext($context, "name"))), "html", null, true);
echo "\">";
echo twig_escape_filter($this->env, isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "html", null, true);
echo "</a>\n ";
$context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
}
// line 6
echo "<div class=\"sf-toolbar-block\">\n <div class=\"sf-toolbar-icon\">";
// line 7
echo twig_escape_filter($this->env, array_key_exists("icon", $context) ? _twig_default_filter(isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "") : "", "html", null, true);
echo "</div>\n <div class=\"sf-toolbar-info\">";
// line 8
echo twig_escape_filter($this->env, array_key_exists("text", $context) ? _twig_default_filter(isset($context["text"]) ? $context["text"] : $this->getContext($context, "text"), "") : "", "html", null, true);
echo "</div>\n</div>\n";
$__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f->leave($__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f_prof);
}
开发者ID:valeriemontoya90,项目名称:findWorker,代码行数:27,代码来源:8d4635b47ab8ab3bf3352cb81a02e822f23088a5da0711f03c5ad81c103fe122.php
示例6: cf_shortcode
function cf_shortcode()
{
ob_start();
submitted();
html_form_code();
return ob_get_clean();
}
示例7: content_565ead2acc18a3_66288090
function content_565ead2acc18a3_66288090($_smarty_tpl)
{
echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['addJsDef'][0][0]->addJsDef(array('wishlistProductsIds' => $_smarty_tpl->tpl_vars['wishlist_products']->value), $_smarty_tpl);
$_smarty_tpl->smarty->_tag_stack[] = array('addJsDefL', array('name' => 'loggin_required'));
$_block_repeat = true;
echo $_smarty_tpl->smarty->registered_plugins['block']['addJsDefL'][0][0]->addJsDefL(array('name' => 'loggin_required'), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
echo smartyTranslate(array('s' => 'You must be logged in to manage your wishlist.', 'mod' => 'blockwishlist', 'js' => 1), $_smarty_tpl);
$_block_content = ob_get_clean();
$_block_repeat = false;
echo $_smarty_tpl->smarty->registered_plugins['block']['addJsDefL'][0][0]->addJsDefL(array('name' => 'loggin_required'), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_tag_stack);
$_smarty_tpl->smarty->_tag_stack[] = array('addJsDefL', array('name' => 'added_to_wishlist'));
$_block_repeat = true;
echo $_smarty_tpl->smarty->registered_plugins['block']['addJsDefL'][0][0]->addJsDefL(array('name' => 'added_to_wishlist'), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
echo smartyTranslate(array('s' => 'The product was successfully added to your wishlist.', 'mod' => 'blockwishlist', 'js' => 1), $_smarty_tpl);
$_block_content = ob_get_clean();
$_block_repeat = false;
echo $_smarty_tpl->smarty->registered_plugins['block']['addJsDefL'][0][0]->addJsDefL(array('name' => 'added_to_wishlist'), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_tag_stack);
echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['addJsDef'][0][0]->addJsDef(array('mywishlist_url' => preg_replace("%(?<!\\\\)'%", "\\'", $_smarty_tpl->tpl_vars['link']->value->getModuleLink('blockwishlist', 'mywishlist', array(), true))), $_smarty_tpl);
?>
<?php
}
开发者ID:Nyura95,项目名称:prestashop,代码行数:30,代码来源:15bffc57343dd65e5f46b2604564e9e33408cfad.file.blockwishlist_top.tpl.php
示例8: testPathCommand
/**
* @outputBuffering enabled
* @dataProvider argumentsProvider
* @depends testUseLatestPHP
*/
public function testPathCommand($arg, $pattern)
{
ob_start();
$this->runCommandWithStdout("phpbrew path {$arg}");
$path = ob_get_clean();
$this->assertRegExp($pattern, $path);
}
示例9: jigoshop_product_tag
function jigoshop_product_tag($attributes)
{
global $paged;
$jigoshop_options = Jigoshop_Base::get_options();
$attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
if (isset($_REQUEST['tag'])) {
$attributes['tag'] = $_REQUEST['tag'];
}
/** Operator validation. */
if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
$tax_operator = 'IN';
}
/** Multiple category values. */
if (!empty($slug)) {
$slug = explode(',', esc_attr($slug));
$slug = array_map('trim', $slug);
}
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
query_posts($args);
ob_start();
jigoshop_get_template_part('loop', 'shop');
if ($attributes['pagination']) {
do_action('jigoshop_pagination');
}
wp_reset_query();
return ob_get_clean();
}
示例10: block_toolbar
public function block_toolbar($context, array $blocks = array())
{
// line 4
echo " ";
ob_start();
// line 5
echo " <span>\n <img width=\"13\" height=\"28\" alt=\"Memory Usage\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAcBAMAAABITyhxAAAAJ1BMVEXNzc3///////////////////////8/Pz////////////+NjY0/Pz9lMO+OAAAADHRSTlMAABAgMDhAWXCvv9e8JUuyAAAAQ0lEQVQI12MQBAMBBmLpMwoMDAw6BxjOOABpHyCdAKRzsNDp5eXl1KBh5oHBAYY9YHoDQ+cqIFjZwGCaBgSpBrjcCwCZgkUHKKvX+wAAAABJRU5ErkJggg==\" />\n <span>";
// line 7
echo twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memory") / 1024 / 1024), "html", null, true);
echo " MB</span>\n </span>\n ";
$context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
// line 10
echo " ";
ob_start();
// line 11
echo " <div class=\"sf-toolbar-info-piece\">\n <b>Memory usage</b>\n <span>";
// line 13
echo twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memory") / 1024 / 1024), "html", null, true);
echo " / ";
echo $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memoryLimit") == -1 ? "∞" : twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memoryLimit") / 1024 / 1024));
echo " MB</span>\n </div>\n ";
$context["text"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
// line 16
echo " ";
$this->env->loadTemplate("@WebProfiler/Profiler/toolbar_item.html.twig")->display(array_merge($context, array("link" => false)));
}
开发者ID:NickPolyder,项目名称:WebVillas-Symfony2Edition-,代码行数:26,代码来源:ffe26a9a069fb38f1ae6a5b4c3d95b460995085423a62ae5d80b53fbea61.php
示例11: return_wpsc_end_category_query
/**
* modified wpsc end category query function
*/
function return_wpsc_end_category_query()
{
global $wpdb, $wpsc_category_query;
$category_html = ob_get_clean();
return wpsc_display_category_loop($wpsc_category_query, $category_html);
unset($GLOBALS['wpsc_category_query']);
}
示例12: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$__internal_47e46a679ebe1f6c3fe3890c127d510e112b274d7f29ddc36299a2ef0416fbee = $this->env->getExtension("native_profiler");
$__internal_47e46a679ebe1f6c3fe3890c127d510e112b274d7f29ddc36299a2ef0416fbee->enter($__internal_47e46a679ebe1f6c3fe3890c127d510e112b274d7f29ddc36299a2ef0416fbee_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@WebProfiler/Profiler/toolbar_item.html.twig"));
// line 1
if (isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")) {
// line 2
echo " ";
ob_start();
// line 3
echo " <a href=\"";
echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"), "panel" => isset($context["name"]) ? $context["name"] : $this->getContext($context, "name"))), "html", null, true);
echo "\">";
echo twig_escape_filter($this->env, isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "html", null, true);
echo "</a>\n ";
$context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
}
// line 6
echo "<div class=\"sf-toolbar-block\">\n <div class=\"sf-toolbar-icon\">";
// line 7
echo twig_escape_filter($this->env, array_key_exists("icon", $context) ? _twig_default_filter(isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "") : "", "html", null, true);
echo "</div>\n <div class=\"sf-toolbar-info\">";
// line 8
echo twig_escape_filter($this->env, array_key_exists("text", $context) ? _twig_default_filter(isset($context["text"]) ? $context["text"] : $this->getContext($context, "text"), "") : "", "html", null, true);
echo "</div>\n</div>\n";
$__internal_47e46a679ebe1f6c3fe3890c127d510e112b274d7f29ddc36299a2ef0416fbee->leave($__internal_47e46a679ebe1f6c3fe3890c127d510e112b274d7f29ddc36299a2ef0416fbee_prof);
}
开发者ID:johnpaulada,项目名称:oauth-api-test,代码行数:27,代码来源:f475485a497ede848cdaab50624ee3f9d4d71ce702f0279c7a1553f20f803767.php
示例13: render
/**
* Render a template
*
* Example:
*
* $template->render('template_name', ['bla' => 'value']);
*
* @access public
* @param string $__template_name Template name
* @param array $__template_args Key/Value map of template variables
* @return string
*/
public function render($__template_name, array $__template_args = array())
{
extract($__template_args);
ob_start();
include $this->getTemplateFile($__template_name);
return ob_get_clean();
}
示例14: debugPrint
function debugPrint($var, $file = '')
{
$more_info = '';
if (is_string($var)) {
$more_info = 'size: ' . strlen($var);
} elseif (is_bool($var)) {
$more_info = 'val: ' . ($var ? 'true' : 'false');
} elseif (is_null($var)) {
$more_info = 'is null';
} elseif (is_array($var)) {
$more_info = count($var);
}
if ($file === true) {
$file = '/tmp/logDebug';
}
if (strlen($file) > 0) {
$f = fopen($file, "a");
ob_start();
echo date("Y/m/d H:i:s") . " (" . gettype($var) . ") " . $more_info . "\n";
print_r($var);
echo "\n\n";
$output = ob_get_clean();
fprintf($f, "%s", $output);
fclose($f);
} else {
echo "<pre>" . date("Y/m/d H:i:s") . " (" . gettype($var) . ") " . $more_info . "</pre>";
echo "<pre>";
print_r($var);
echo "</pre>";
}
}
示例15: execute
public function execute()
{
$params = $this->extractRequestParams();
$modules = array();
foreach ($params['modules'] as $path) {
$modules[] = $this->getModuleFromPath($path);
}
// Get the help
$context = new DerivativeContext($this->getMain()->getContext());
$context->setSkin(SkinFactory::getDefaultInstance()->makeSkin('apioutput'));
$context->setLanguage($this->getMain()->getLanguage());
$context->setTitle(SpecialPage::getTitleFor('ApiHelp'));
$out = new OutputPage($context);
$out->setCopyrightUrl('https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright');
$context->setOutput($out);
self::getHelp($context, $modules, $params);
// Grab the output from the skin
ob_start();
$context->getOutput()->output();
$html = ob_get_clean();
$result = $this->getResult();
if ($params['wrap']) {
$data = array('mime' => 'text/html', 'help' => $html);
ApiResult::setSubelementsList($data, 'help');
$result->addValue(null, $this->getModuleName(), $data);
} else {
$result->reset();
$result->addValue(null, 'text', $html, ApiResult::NO_SIZE_CHECK);
$result->addValue(null, 'mime', 'text/html', ApiResult::NO_SIZE_CHECK);
}
}