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(); } }
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; }
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; } }
/** * 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; }
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'); } }
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; }
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'); } }
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)); } }
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; }
/** * @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); } }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Инициализация задачи * * @static * @param $code */ private static function init($code) { joosRequest::send_headers_by_code($code); if (ob_get_level()) { ob_end_clean(); } }
/** * @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()); }
public function render($layout, $args = array()) { // prevent render to recurse indefinitely static $count = 0; $count++; if ($count < self::MAX_RENDER_RECURSIONS) { // init vars $parts = explode($this->_separator, $layout); $this->_layout = preg_replace('/[^A-Z0-9_\\.-]/i', '', array_pop($parts)); // render layout if ($__layout = JPath::find($this->_getPath(implode(DIRECTORY_SEPARATOR, $parts)), $this->_layout . $this->_extension)) { // import vars and layout output extract($args); ob_start(); include $__layout; $output = ob_get_contents(); ob_end_clean(); $count--; return $output; } $count--; // raise warning, if layout was not found JError::raiseWarning(0, 'Renderer Layout "' . $layout . '" not found. (' . YUtility::debugInfo(debug_backtrace()) . ')'); return null; } // raise warning, if render recurses indefinitly JError::raiseWarning(0, 'Warning! Render recursed indefinitly. (' . YUtility::debugInfo(debug_backtrace()) . ')'); return null; }
public function testPages() { $pages = FannieAPI::listModules('FanniePage', true); $config = FannieConfig::factory(); $logger = new FannieLogger(); $op_db = $config->get('OP_DB'); $dbc = FannieDB::get($op_db); $dbc->throwOnFailure(true); foreach ($pages as $page_class) { $obj = new $page_class(); $obj->setConfig($config); $obj->setLogger($logger); $dbc->selectDB($op_db); $obj->setConnection($dbc); if ($page_class == 'WfcHtViewSalaryPage') { continue; } // header/redirect problem ob_start(); $pre = $obj->preprocess(); ob_end_clean(); $this->assertInternalType('boolean', $pre); $help = $obj->helpContent(); $this->assertInternalType('string', $help); $auth = $obj->checkAuth(); $this->assertInternalType('boolean', $pre); $obj->unitTest($this); } }
/** * Prints the stack trace for this exception. */ public function printStackTrace() { if (null === $this->wrappedException) { $this->setWrappedException($this); } $exception = $this->wrappedException; if (!sfConfig::get('sf_test')) { // log all exceptions in php log error_log($exception->getMessage()); // clean current output buffer while (ob_get_level()) { if (!ob_end_clean()) { break; } } ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : ''); header('HTTP/1.0 500 Internal Server Error'); } try { $this->outputStackTrace($exception); } catch (Exception $e) { } if (!sfConfig::get('sf_test')) { exit(1); } }
/** * The default template for displaying single post content * * @package Customizr * @since Customizr 3.0 */ function tc_post_content() { //check conditional tags : we want to show single post or single custom post types global $post; $tc_show_single_post_content = isset($post) && 'page' != $post->post_type && 'attachment' != $post->post_type && is_singular() && !tc__f('__is_home_empty'); if (!apply_filters('tc_show_single_post_content', $tc_show_single_post_content)) { return; } //display an icon for div if there is no title $icon_class = in_array(get_post_format(), array('quote', 'aside', 'status', 'link')) ? apply_filters('tc_post_format_icon', 'format-icon') : ''; ob_start(); do_action('__before_content'); ?> <section class="entry-content <?php echo $icon_class; ?> "> <?php the_content(__('Continue reading <span class="meta-nav">→</span>', 'customizr')); ?> <?php wp_link_pages(array('before' => '<div class="pagination pagination-centered">' . __('Pages:', 'customizr'), 'after' => '</div>')); ?> </section><!-- .entry-content --> <?php do_action('__after_content'); $html = ob_get_contents(); if ($html) { ob_end_clean(); } echo apply_filters('tc_post_content', $html); }
/** * http://www.php.net/manual/en/function.phpinfo.php * code at adspeed dot com * 09-Dec-2005 11:31 * This function parses the phpinfo output to get details about a PHP module. */ function ckeditor_parse_php_info() { ob_start(); phpinfo(INFO_MODULES); $s = ob_get_contents(); ob_end_clean(); $s = strip_tags($s, '<h2><th><td>'); $s = preg_replace('/<th[^>]*>([^<]+)<\\/th>/', "<info>\\1</info>", $s); $s = preg_replace('/<td[^>]*>([^<]+)<\\/td>/', "<info>\\1</info>", $s); $vTmp = preg_split('/(<h2>[^<]+<\\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE); $vModules = array(); for ($i = 1; $i < count($vTmp); $i++) { if (preg_match('/<h2>([^<]+)<\\/h2>/', $vTmp[$i], $vMat)) { $vName = trim($vMat[1]); $vTmp2 = explode("\n", $vTmp[$i + 1]); foreach ($vTmp2 as $vOne) { $vPat = '<info>([^<]+)<\\/info>'; $vPat3 = "/{$vPat}\\s*{$vPat}\\s*{$vPat}/"; $vPat2 = "/{$vPat}\\s*{$vPat}/"; if (preg_match($vPat3, $vOne, $vMat)) { // 3cols $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3])); } elseif (preg_match($vPat2, $vOne, $vMat)) { // 2cols $vModules[$vName][trim($vMat[1])] = trim($vMat[2]); } } } } return $vModules; }
function getLatandLong($addr, $region) { $url = "http://maps.google.com/maps/api/geocode/json?address=" . $addr . "®ion=" . $region . "&sensor=false"; $response = file_get_contents($url); if ($response == false) { throw new Exception("Failure to obtain data"); } $places = json_decode($response); if (!$places) { throw new Exception("Invalid JSON response"); } if (is_array($places->results) && count($places->results)) { $result = $places->results[0]; $geometry = $result->{'geometry'}; $location = $geometry->{'location'}; $lat = $location->{'lat'}; $long = $location->{'lng'}; ob_start(); // ensures anything dumped out will be caught // do stuff here //header( "Location: $url" ); //return $lat.",".$long; // clear out the output buffer while (ob_get_status()) { ob_end_clean(); } } else { return "Unknown"; } }
/** * Check that the user has sufficient permissions, or die in error * */ private function _checkPermissions() { // Is frontend backup enabled? $febEnabled = Platform::getInstance()->get_platform_configuration_option('failure_frontend_enable', 0) != 0; // Is the Secret Key strong enough? $validKey = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', ''); if (!\Akeeba\Engine\Util\Complexify::isStrongEnough($validKey, false)) { $febEnabled = false; } if (!$febEnabled) { @ob_end_clean(); echo '403 ' . JText::_('ERROR_NOT_ENABLED'); flush(); JFactory::getApplication()->close(); } // Is the key good? $key = $this->input->get('key', '', 'none', 2); $validKeyTrim = trim($validKey); if ($key != $validKey || empty($validKeyTrim)) { @ob_end_clean(); echo '403 ' . JText::_('ERROR_INVALID_KEY'); flush(); JFactory::getApplication()->close(); } }
/** * Send a 304 Not Modified Response to the client if HTTP_IF_NONE_MATCH matched $etag and headers have not already been sent * Othewise, send the etag * @param string $etag The calculated etag for the current page * */ public static function Send304($etag) { global $config; if (!$config['etag_headers']) { return; } if (headers_sent()) { return; } //always send the etag header('ETag: "' . $etag . '"'); if (empty($_SERVER['HTTP_IF_NONE_MATCH']) || trim($_SERVER['HTTP_IF_NONE_MATCH'], '"') != $etag) { return; } //don't use ob_get_level() in while loop to prevent endless loops; $level = ob_get_level(); while ($level > 0) { @ob_end_clean(); $level--; } // 304 should not have a response body or Content-Length header //header('Not Modified',true,304); self::status_header(304, 'Not Modified'); header('Connection: close'); exit; }
function usage() { ob_start(); ?> This plug-in is designed to help you create input buttons which perform an action 'onClick'. The plug-in also can also optionally add a 'class' to the input button. BASIC USAGE: {exp:np_jsbutton value="Cancel" onclick='history.go(-1);'} PARAMETERS: value = 'Cancel' (no default - must be specified) - The input button text. onclick = 'some javascript' (no default - must be specified) - The javascript that you want to execute on click. RELEASE NOTES: 1.0 - Initial Release. For updates and support check the developers website: http://nathanpitman.com/ <?php $buffer = ob_get_contents(); ob_end_clean(); return $buffer; }
/** * Displays the captcha image * * @access public * @param int $key Captcha key * @return mixed Captcha raw image data */ function image($key) { $value = Jaws_Utils::RandomText(); $result = $this->update($key, $value); if (Jaws_Error::IsError($result)) { $value = ''; } $bg = dirname(__FILE__) . '/resources/simple.bg.png'; $im = imagecreatefrompng($bg); imagecolortransparent($im, imagecolorallocate($im, 255, 255, 255)); // Write it in a random position.. $darkgray = imagecolorallocate($im, 0x10, 0x70, 0x70); $x = 5; $y = 20; $text_length = strlen($value); for ($i = 0; $i < $text_length; $i++) { $fnt = rand(7, 10); $y = rand(6, 10); imagestring($im, $fnt, $x, $y, $value[$i], $darkgray); $x = $x + rand(15, 25); } header("Content-Type: image/png"); ob_start(); imagepng($im); $content = ob_get_contents(); ob_end_clean(); imagedestroy($im); return $content; }
/** * * @return string */ public function render() { ob_start(); require $this->file_path; $contents = ob_get_contents(); ob_end_clean(); return $contents; }
function __construct() { $this->l = \OC::$server->getL10N('lib'); $version = OC_Util::getVersion(); $this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */ $this->defaultName = 'ownCloud'; /* short name, used when referring to the software */ $this->defaultTitle = 'ownCloud'; /* can be a longer name, for titles */ $this->defaultBaseUrl = 'https://owncloud.org'; $this->defaultSyncClientUrl = 'https://owncloud.org/sync-clients/'; $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8'; $this->defaultiTunesAppId = '543672169'; $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android'; $this->defaultDocBaseUrl = 'https://doc.owncloud.org'; $this->defaultDocVersion = $version[0] . '.' . $version[1]; // used to generate doc links $this->defaultSlogan = $this->l->t('web services under your control'); $this->defaultLogoClaim = ''; $this->defaultMailHeaderColor = '#1d2d44'; /* header color of mail notifications */ $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; if (file_exists($themePath)) { // prevent defaults.php from printing output ob_start(); require_once $themePath; ob_end_clean(); if (class_exists('OC_Theme')) { $this->theme = new OC_Theme(); } } }
public function actionUpdate($fid = 0, $gid = 0, $sort = '') { $timer = new CountTimer(); $cacheToken = 'cache-update'; Yii::beginProfile($cacheToken); ob_start(); // 生成版块列表缓存 $this->forward('forum/forumlist', false); // 生成帖子列表缓存 $sortArr = array('', 'new', 'marrow', 'top'); $fids = $this->_getFids($fid); $uids = $this->_getUidsByGid($gid); foreach ($sortArr as $sort) { foreach ($fids as $fid) { foreach ($uids as $uid) { $_GET = array_merge($_GET, array('hacker_uid' => $uid, 'boardId' => $fid, 'page' => 1, 'pageSize' => 10, 'sortby' => $sort)); $res = $this->forward('forum/topiclist', false); ob_clean(); } } } ob_end_clean(); var_dump($timer->stop()); Yii::endProfile($cacheToken); }
/** * Stop the cache * * @access public */ function end() { $data = ob_get_contents(); ob_end_clean(); $this->save($data, $this->_id, $this->_group); echo $data; }
protected function setup() { $this->app = new Application(BASE_PATH, Environment::testing()); ob_start(); $this->app->run(); ob_end_clean(); // Override things so that Spot2 is using in-memory tables $cfg = new \Spot\Config(); $cfg->addConnection('sqlite', ['dbname' => 'sqlite::memory', 'driver' => 'pdo_sqlite']); $this->app['spot'] = new \Spot\Locator($cfg); // Initialize the talk table in the sqlite database $talk_mapper = $this->app['spot']->mapper('OpenCFP\\Domain\\Entity\\Talk'); $talk_mapper->migrate(); // Set things up so Sentry believes we're logged in $user = m::mock('StdClass'); $user->shouldReceive('getId')->andReturn(uniqid()); $user->shouldReceive('getLogin')->andReturn(uniqid() . '@grumpy-learning.com'); // Create a test double for Sentry $sentry = m::mock('StdClass'); $sentry->shouldReceive('check')->andReturn(true); $sentry->shouldReceive('getUser')->andReturn($user); $this->app['sentry'] = $sentry; // Create a test double for sessions so we can control what happens $this->app['session'] = new SessionDouble(); // Create our test double for the request object $this->req = m::mock('Symfony\\Component\\HttpFoundation\\Request'); }