本文整理汇总了PHP中FrontController::contentCache方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::contentCache方法的具体用法?PHP FrontController::contentCache怎么用?PHP FrontController::contentCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontController
的用法示例。
在下文中一共展示了FrontController::contentCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Implements Actioner.
*/
public function execute($args = NULL)
{
$fc =& FrontController::fc();
$fc->outputHeader($this->title(), 'masterserver');
$fc->beginPage($this->title(), 'masterserver');
?>
<div id="contentbox"><div class="masterbrowser block"><?php
// Output a "join us" foreword.
includeHTML('joinus', self::$name);
try {
FrontController::contentCache()->import(self::$serverSummaryCacheName);
$this->outputJavascript();
} catch (Exception $e) {
?>
<p>A master server listing is not presently available. Please try again later.</p><?php
}
// Output footnotes.
includeHTML('footnotes', self::$name);
?>
</div><?php
?>
<div class="block"><section><p>A server admin is not required to publish their server to this central list (located at <em>http://dengine.net/master.php</em>), however it will then only be findable by clients who enter the IP address manually. A server may be published here but remain "closed" (requiring a password to join). Further information about the master server is available <a href="/dew/index.php?title=Master_server" title="Documentation for the master server">here</a>.</p></section></div><?php
?>
</div><?php
$fc->endPage();
}
示例2: execute
/**
* Implements Actioner.
*/
public function execute($args = NULL)
{
$fc =& FrontController::fc();
if (!is_array($args) && !array_key_exists('page', $args)) {
throw new Exception('Unexpected arguments passed.');
}
$page = $args['page'];
$mainHeading = ucwords(mb_ereg_replace('_', ' ', $page));
$pageFile = 'pages/' . $args['page'] . '.html';
$fc->outputHeader($mainHeading);
$fc->beginPage($mainHeading, $page);
?>
<div id="contentbox"><?php
try {
FrontController::contentCache()->import($pageFile);
} catch (Exception $e) {
?>
<p>No content for this page</p>
<?php
}
?>
</div><?php
$fc->endPage();
}
示例3: outputPackageGraph
private function outputPackageGraph(&$pack)
{
$fc =& FrontController::fc();
if (!$pack instanceof BasePackage) {
throw new Exception('Received invalid Package.');
}
$cacheName = $this->composePackageGraphCacheName($pack);
try {
if (!FrontController::contentCache()->has($cacheName)) {
// Generate a graph template for this package.
$template = array();
$pack->populateGraphTemplate($template);
$json = json_encode_clean($template);
// Store the graph in the cache.
FrontController::contentCache()->store($cacheName, $json);
}
$contentInfo = new ContentInfo();
if (FrontController::contentCache()->info($cacheName, $contentInfo)) {
header('Pragma: public');
header('Cache-Control: public');
header('Content-Type: application/json');
header('Last-Modified: ' . date(DATE_RFC1123, $contentInfo->modifiedTime));
header('Expires: ' . date(DATE_RFC1123, strtotime('+5 days')));
FrontController::contentCache()->import($cacheName);
}
} catch (Exception $e) {
// Log the error.
trigger_error(sprintf('Failed reading Package JSON from cache.\\nError:%s', $e->getMessage()), E_USER_WARNING);
}
return TRUE;
}
示例4: outputCommitLog
/**
* @param build (object) BuildEvent to generate a commit log for.
* @return (boolean) @c true if a commit log was sent to output.
*/
function outputCommitLog(&$build)
{
if (!$build instanceof BuildEvent) {
throw new Exception('Received invalid BuildEvent');
}
if (count($build->commits) <= 0) {
return FALSE;
}
$commitsCacheName = 'buildrepository/' . $build->uniqueId() . '/commits.html';
try {
FrontController::contentCache()->import($commitsCacheName);
} catch (Exception $e) {
$OutputCache = new OutputCache();
$OutputCache->start();
outputCommitLogHTML($build);
$content = $OutputCache->stop();
FrontController::contentCache()->store($commitsCacheName, $content);
print $content;
}
return TRUE;
}