本文整理汇总了PHP中Concrete\Core\Page\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: publish
public function publish(CollectionKey $ak, Page $page, AttributeValue $value)
{
$inspector = \Core::make('import/value_inspector');
$result = $inspector->inspect($value->getValue());
$content = $result->getReplacedContent();
$page->setAttribute($ak->getAttributeKeyHandle(), $content);
}
示例2: getCacheHeaders
public function getCacheHeaders(Page $c)
{
$lifetime = $c->getCollectionFullPageCachingLifetimeValue();
$expires = gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT';
$headers = array('Pragma' => 'public', 'Cache-Control' => 'max-age=' . $lifetime . ',s-maxage=' . $lifetime, 'Expires' => $expires);
return $headers;
}
示例3: getPublishButtonTitle
public function getPublishButtonTitle(Page $c)
{
if ($c->isPageDraft()) {
$publishTitle = t('Publish Page');
} else {
$publishTitle = t('Publish Changes');
}
$pk = Key::getByHandle('approve_page_versions');
$pk->setPermissionObject($c);
$pa = $pk->getPermissionAccessObject();
$workflows = array();
$canApproveWorkflow = true;
if (is_object($pa)) {
$workflows = $pa->getWorkflows();
}
foreach ($workflows as $wf) {
if (!$wf->canApproveWorkflow()) {
$canApproveWorkflow = false;
}
}
if (count($workflows) > 0 && !$canApproveWorkflow) {
$publishTitle = t('Submit to Workflow');
}
return $publishTitle;
}
示例4: isActive
/**
* Determines whether this nav item is the current page the user is on.
*
* @param \Concrete\Core\Page\Page $c The page object for the current page
*
* @return bool
*/
public function isActive(&$c)
{
if ($c) {
$cID = $c->getCollectionPointerID() > 0 ? $c->getCollectionPointerOriginalID() : $c->getCollectionID();
return $cID == $this->cID;
}
}
示例5: canPublishPageTypeBeneathTarget
public function canPublishPageTypeBeneathTarget(Type $pagetype, \Concrete\Core\Page\Page $page)
{
if ($page->getAttribute('blog_section') > 0) {
return true;
} else {
return false;
}
}
示例6: publish
public function publish(CollectionKey $ak, Page $page, AttributeValue $value)
{
$links = $value->getValue();
$r = array();
foreach ($links as $link) {
$r[$link['service']] = $link['detail'];
}
$page->setAttribute($ak->getAttributeKeyHandle(), $r);
}
示例7: publish
public function publish(CollectionKey $ak, Page $page, AttributeValue $value)
{
$inspector = \Core::make('import/value_inspector');
$result = $inspector->inspect($value->getValue());
$items = $result->getMatchedItems();
if (isset($items[0]) && $items[0] instanceof FileItem) {
$file = $items[0]->getContentObject();
$page->setAttribute($ak->getAttributeKeyHandle(), $file);
}
}
示例8: getMenuItemClass
public function getMenuItemClass(Page $page)
{
$classes = [];
if (is_object($this->currentPage) && $page->getCollectionID() == $this->currentPage->getCollectionID()) {
$classes[] = 'nav-selected';
}
if (in_array($page->getCollectionID(), $this->trail)) {
$classes[] = 'nav-path-selected';
}
return implode($classes, ' ');
}
示例9: publish
/**
* @param CollectionKey $ak
* @param Page $page
* @param AddressAttributeValue $address
*/
public function publish(CollectionKey $ak, Page $page, AttributeValue $address)
{
$value = new Value();
$value->address1 = $address->getAddress1();
$value->address2 = $address->getAddress2();
$value->address3 = $address->getAddress3();
$value->city = $address->getCity();
$value->country = $address->getCountry();
$value->state_province = $address->getStateProvince();
$value->postal_code = $address->getPostalCode();
$page->setAttribute($ak->getAttributeKeyHandle(), $value);
}
示例10: set
public function set(ConcretePage $c, $content)
{
if (!is_dir(Config::get('concrete.cache.page.directory'))) {
@mkdir(Config::get('concrete.cache.page.directory'));
@touch(Config::get('concrete.cache.page.directory') . '/index.html');
}
$lifetime = $c->getCollectionFullPageCachingLifetimeValue();
$file = $this->getCacheFile($c);
if ($file) {
$response = new PageCacheRecord($c, $content, $lifetime);
if ($content) {
file_put_contents($file, serialize($response));
}
}
}
示例11: publishToPage
public function publishToPage(Page $c, $data, $controls)
{
array_push(self::$ptComposerRequestControlsProcessed, $this);
// now we check to see if we have any more core controls to process in this request
$coreControls = array();
foreach ($controls as $cnt) {
if ($cnt->getPageTypeComposerControlTypeHandle() == $this->ptComposerControlTypeHandle) {
$coreControls[] = $controls;
}
}
if (count(self::$ptComposerRequestControlsProcessed) == count($coreControls)) {
// this was the last one. so we're going to loop through our saved request
// and do the page update once, rather than four times.
$c->update(self::$ptComposerSaveRequest);
}
}
示例12: import
public function import(\SimpleXMLElement $sx)
{
$siteTree = null;
if (isset($this->home)) {
$siteTree = $this->home->getSiteTreeObject();
}
if (isset($sx->pages)) {
foreach ($sx->pages->page as $px) {
if ($px['path'] != '') {
$page = Page::getByPath($px['path'], 'RECENT', $siteTree);
} else {
if (isset($this->home)) {
$page = $this->home;
} else {
$page = Page::getByID(HOME_CID, 'RECENT');
}
}
if (isset($px->area)) {
$this->importPageAreas($page, $px);
}
if (isset($px->attributes)) {
foreach ($px->attributes->children() as $attr) {
$handle = (string) $attr['handle'];
$ak = CollectionKey::getByHandle($handle);
if (is_object($ak)) {
$value = $ak->getController()->importValue($attr);
$page->setAttribute($handle, $value);
}
}
}
$page->reindex();
}
}
}
示例13: setupSiteInterfaceLocalization
public static function setupSiteInterfaceLocalization(Page $c = null)
{
$loc = \Localization::getInstance();
if (!(\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale'))) {
if (!$c) {
$c = Page::getCurrentPage();
}
// don't translate dashboard pages
$dh = \Core::make('helper/concrete/dashboard');
if ($dh->inDashboard($c)) {
return;
}
$locale = null;
$ms = Section::getBySectionOfSite($c);
if ($ms) {
$locale = $ms->getLocale();
}
if (!$locale) {
if (Config::get('concrete.multilingual.use_previous_locale') && Session::has('previous_locale')) {
$locale = Session::get('previous_locale');
}
if (!$locale) {
$ms = static::getPreferredSection();
if ($ms) {
$locale = $ms->getLocale();
}
}
}
if ($locale) {
$loc->setLocale($locale);
}
}
Session::set('previous_locale', $loc->getLocale());
}
示例14: setupSiteInterfaceLocalization
public static function setupSiteInterfaceLocalization(Page $c = null)
{
if (!$c) {
$c = Page::getCurrentPage();
}
$app = Facade::getFacadeApplication();
// don't translate dashboard pages
$dh = $app->make('helper/concrete/dashboard');
if ($dh->inDashboard($c)) {
return;
}
$ms = Section::getBySectionOfSite($c);
if (!is_object($ms)) {
$ms = static::getPreferredSection();
}
if (!$ms) {
return;
}
$locale = $ms->getLocale();
if ($locale) {
$app->make('session')->set('multilingual_default_locale', $locale);
$loc = Localization::getInstance();
$loc->setContextLocale('site', $locale);
}
}
示例15: registerEvents
public function registerEvents()
{
$app = $this->app;
$events = $this->app->make('director');
// Add the sitemap icons listener
$events->addListener('on_before_render', function ($event) use($app) {
$c = Page::getCurrentPage();
$view = $event->getArgument('view');
$assets = $app->make('asset_pipeline/helper/assets');
$theme = null;
if (is_object($c)) {
$theme = $c->getCollectionThemeObject();
} else {
$theme = Theme::getSiteTheme();
}
// TODO: If there are page-specific styles set, should we use
// this one instead:
//$style = $c->getCustomStyleObject();
$style = $theme->getThemeCustomStyleObject();
if (is_object($style)) {
$valueList = $style->getValueList();
if ($valueList instanceof \Concrete\Core\StyleCustomizer\Style\ValueList) {
$variables = array();
foreach ($valueList->getValues() as $value) {
$variables = array_merge($value->toLessVariablesArray(), $variables);
}
$assets->setStylesheetVariables('theme', $variables);
}
}
$view->addScopeItems(array('assets' => $assets));
});
}