本文整理汇总了PHP中PageType::GetPageType方法的典型用法代码示例。如果您正苦于以下问题:PHP PageType::GetPageType方法的具体用法?PHP PageType::GetPageType怎么用?PHP PageType::GetPageType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageType
的用法示例。
在下文中一共展示了PageType::GetPageType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TransformedText
/** Constructor.
*
* @param WikiDB_Page $page
* @param string $text The packed page revision content.
* @param hash $meta The version meta-data.
* @param string $type_override For markup of page using a different
* pagetype than that specified in its version meta-data.
*/
function TransformedText($page, $text, $meta, $type_override = false)
{
$pagetype = false;
if ($type_override) {
$pagetype = $type_override;
} elseif (isset($meta['pagetype'])) {
$pagetype = $meta['pagetype'];
}
$this->_type = PageType::GetPageType($pagetype);
$this->CacheableMarkup($this->_type->transform($page, $text, $meta), $page->getName());
}
示例2: getTransformedContent
/**
* Get the transformed content of a page.
*
* @param string $pagetype Override the page-type of the revision.
*
* @return object An XmlContent-like object containing the page transformed
* contents.
*/
function getTransformedContent($pagetype_override = false)
{
$backend =& $this->_wikidb->_backend;
if ($pagetype_override) {
// Figure out the normal page-type for this page.
$type = PageType::GetPageType($this->get('pagetype'));
if ($type->getName() == $pagetype_override) {
$pagetype_override = false;
}
// Not really an override...
}
if ($pagetype_override) {
// Overriden page type, don't cache (or check cache).
return new TransformedText($this->getPage(), $this->getPackedContent(), $this->getMetaData(), $pagetype_override);
}
$possibly_cache_results = true;
if (!USECACHE or WIKIDB_NOCACHE_MARKUP) {
if (WIKIDB_NOCACHE_MARKUP == 'purge') {
// flush cache for this page.
$page = $this->getPage();
$page->set('_cached_html', '');
// ignored with !USECACHE
}
$possibly_cache_results = false;
} elseif (USECACHE and !$this->_transformedContent) {
//$backend->lock();
if ($this->isCurrent()) {
$page = $this->getPage();
$this->_transformedContent = TransformedText::unpack($page->get('_cached_html'));
} else {
$possibly_cache_results = false;
}
//$backend->unlock();
}
if (!$this->_transformedContent) {
$this->_transformedContent = new TransformedText($this->getPage(), $this->getPackedContent(), $this->getMetaData());
if ($possibly_cache_results and !WIKIDB_NOCACHE_MARKUP) {
// If we're still the current version, cache the transfomed page.
//$backend->lock();
if ($this->isCurrent()) {
$page->set('_cached_html', $this->_transformedContent->pack());
}
//$backend->unlock();
}
}
return $this->_transformedContent;
}