本文整理匯總了PHP中Horde::contentSent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde::contentSent方法的具體用法?PHP Horde::contentSent怎麽用?PHP Horde::contentSent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Horde
的用法示例。
在下文中一共展示了Horde::contentSent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addInlineScript
/**
* Add inline javascript to the output buffer.
*
* @param mixed $script The script text to add (can be stored in an
* array).
* @param boolean $onload Load the script after the page (DOM) has
* loaded?
* @param boolean $top Add script to top of stack?
*/
public function addInlineScript($script, $onload = false, $top = false)
{
$script = is_array($script) ? implode(';', array_map('trim', $script)) : trim($script);
if (!strlen($script)) {
return;
}
$onload = intval($onload);
$script = rtrim($script, ';') . ';';
if ($top && isset($this->inlineScript[$onload])) {
array_unshift($this->inlineScript[$onload], $script);
} else {
$this->inlineScript[$onload][] = $script;
}
// If headers have already been sent, we need to output a
// <script> tag directly.
if (!$this->deferScripts && Horde::contentSent()) {
$this->outputInlineScript();
}
}
示例2: header
//.........這裏部分代碼省略.........
$view = new Horde_View(array('templatePath' => $registry->get('templates', 'horde') . '/common'));
$view->outputJs = !$this->deferScripts;
$view->stylesheetOpts = array();
$this->_view = empty($opts['view']) ? $registry->hasView($registry->getView()) ? $registry->getView() : Horde_Registry::VIEW_BASIC : $opts['view'];
if ($session->regenerate_due) {
$session->regenerate();
}
switch ($this->_view) {
case $registry::VIEW_BASIC:
$this->_addBasicScripts();
break;
case $registry::VIEW_DYNAMIC:
$this->ajax = true;
$this->growler = true;
$this->_addBasicScripts();
$this->addScriptPackage('Horde_Core_Script_Package_Popup');
break;
case $registry::VIEW_MINIMAL:
$view->stylesheetOpts['subonly'] = true;
$view->minimalView = true;
$this->sidebar = $this->topbar = false;
break;
case $registry::VIEW_SMARTMOBILE:
$smobile_files = array($this->debug ? 'jquery.mobile/jquery.js' : 'jquery.mobile/jquery.min.js', 'growler-jquery.js', 'horde-jquery.js', 'smartmobile.js', 'horde-jquery-init.js', $this->debug ? 'jquery.mobile/jquery.mobile.js' : 'jquery.mobile/jquery.mobile.min.js');
foreach ($smobile_files as $val) {
$ob = $this->addScriptFile(new Horde_Script_File_JsFramework($val, 'horde'));
$ob->cache = 'package_smartmobile';
}
$this->smartmobileInit = array_merge(array('$.mobile.page.prototype.options.backBtnText = "' . Horde_Core_Translation::t("Back") . '";', '$.mobile.dialog.prototype.options.closeBtnText = "' . Horde_Core_Translation::t("Close") . '";', '$.mobile.listview.prototype.options.filterPlaceholder = "' . Horde_Core_Translation::t("Filter items...") . '";', '$.mobile.loader.prototype.options.text = "' . Horde_Core_Translation::t("loading") . '";'), isset($opts['smartmobileinit']) ? $opts['smartmobileinit'] : array(), $this->smartmobileInit);
$this->addInlineJsVars(array('HordeMobile.conf' => array('ajax_url' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'logout_url' => strval($registry->getServiceLink('logout')), 'sid' => SID, 'token' => $session->getToken())));
$this->addMetaTag('viewport', 'width=device-width, initial-scale=1', false);
$view->stylesheetOpts['subonly'] = true;
$this->addStylesheet($registry->get('jsfs', 'horde') . '/jquery.mobile/jquery.mobile.min.css', $registry->get('jsuri', 'horde') . '/jquery.mobile/jquery.mobile.min.css');
$view->smartmobileView = true;
// Force JS to load at top of page, so we don't see flicker when
// mobile styles are applied.
$view->outputJs = true;
$this->sidebar = $this->topbar = false;
break;
}
$view->stylesheetOpts['sub'] = Horde_Themes::viewDir($this->_view);
if ($this->ajax || $this->growler) {
$this->addScriptFile(new Horde_Script_File_JsFramework('hordecore.js', 'horde'));
/* Configuration used in core javascript files. */
$js_conf = array_filter(array('URI_AJAX' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'URI_DLOAD' => strval($registry->getServiceLink('download', $registry->getApp())), 'URI_LOGOUT' => strval($registry->getServiceLink('logout')), 'URI_SNOOZE' => strval(Horde::url($registry->get('webroot', 'horde') . '/services/snooze.php', true, -1)), 'SID' => SID, 'TOKEN' => $session->getToken(), 'growler_log' => $this->topbar, 'popup_height' => 610, 'popup_width' => 820));
/* Gettext strings used in core javascript files. */
$js_text = array('ajax_error' => Horde_Core_Translation::t("Error when communicating with the server."), 'ajax_recover' => Horde_Core_Translation::t("The connection to the server has been restored."), 'ajax_timeout' => Horde_Core_Translation::t("There has been no contact with the server for several minutes. The server may be temporarily unavailable or network problems may be interrupting your session. You will not see any updates until the connection is restored."), 'snooze' => sprintf(Horde_Core_Translation::t("You can snooze it for %s or %s dismiss %s it entirely"), '#{time}', '#{dismiss_start}', '#{dismiss_end}'), 'snooze_select' => array('0' => Horde_Core_Translation::t("Select..."), '5' => Horde_Core_Translation::t("5 minutes"), '15' => Horde_Core_Translation::t("15 minutes"), '60' => Horde_Core_Translation::t("1 hour"), '360' => Horde_Core_Translation::t("6 hours"), '1440' => Horde_Core_Translation::t("1 day")), 'dismissed' => Horde_Core_Translation::t("The alarm was dismissed."));
if ($this->topbar) {
$js_text['growlerclear'] = Horde_Core_Translation::t("Clear All");
$js_text['growlerinfo'] = Horde_Core_Translation::t("This is the notification log.");
$js_text['growlernoalerts'] = Horde_Core_Translation::t("No Alerts");
}
$this->addInlineJsVars(array('HordeCore.conf' => $js_conf, 'HordeCore.text' => $js_text), array('top' => true));
}
if ($this->growler) {
$this->addScriptFile('growler.js', 'horde');
$this->addScriptFile('scriptaculous/effects.js', 'horde');
$this->addScriptFile('scriptaculous/sound.js', 'horde');
}
if (isset($opts['stylesheet_opts'])) {
$view->stylesheetOpts = array_merge($view->stylesheetOpts, $opts['stylesheet_opts']);
}
$html = '';
if (isset($language)) {
$html .= ' lang="' . htmlspecialchars(strtr($language, '_', '-')) . '"';
}
if (isset($opts['html_id'])) {
$html .= ' id="' . htmlspecialchars($opts['html_id']) . '"';
}
$view->htmlAttr = $html;
$body = '';
if (isset($opts['body_class'])) {
$body .= ' class="' . htmlspecialchars($opts['body_class']) . '"';
}
if (isset($opts['body_id'])) {
$body .= ' id="' . htmlspecialchars($opts['body_id']) . '"';
}
$view->bodyAttr = $body;
$page_title = $registry->get('name');
if (isset($opts['title'])) {
$page_title .= ' :: ' . $opts['title'];
}
$view->pageTitle = htmlspecialchars($page_title);
$view->pageOutput = $this;
header('Content-type: text/html; charset=UTF-8');
if (isset($language)) {
header('Vary: Accept-Language');
}
echo $view->render('header');
if ($this->topbar) {
echo $injector->getInstance('Horde_View_Topbar')->render();
}
// Send what we have currently output so the browser can start
// loading CSS/JS. See:
// http://developer.yahoo.com/performance/rules.html#flush
if (Horde::contentSent()) {
echo Horde::endBuffer();
flush();
}
}