本文整理汇总了PHP中Cms\Classes\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getParentOptions
public function getParentOptions()
{
$ParentOptions = array('' => '-- chose one --');
$pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
$ParentOptions = array_merge($ParentOptions, $pages);
return $ParentOptions;
}
开发者ID:fuunnx,项目名称:loveandzucchini,代码行数:7,代码来源:Archive.php
示例2: getCmsPageOptions
public function getCmsPageOptions()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException('Unable to find the active theme.');
}
return Page::listInTheme($theme)->lists('fileName', 'fileName');
}
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:7,代码来源:MaintenanceSetting.php
示例3: getPropertyOptions
public function getPropertyOptions($property)
{
if ($property == 'eventPage') {
return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
}
return self::getPropertyOptions($property);
}
开发者ID:anqqa,项目名称:klubitus-octobercms-plugins,代码行数:7,代码来源:EventList.php
示例4: getUrlPageName
public function getUrlPageName()
{
if (static::$urlPageName !== null) {
return static::$urlPageName;
}
/*
* Cache
*/
$key = 'urlMaker' . $this->urlComponentName . crc32(get_class($this));
$cached = Cache::get($key, false);
if ($cached !== false && ($cached = @unserialize($cached)) !== false) {
$filePath = array_get($cached, 'path');
$mtime = array_get($cached, 'mtime');
if (!File::isFile($filePath) || $mtime != File::lastModified($filePath)) {
$cached = false;
}
}
if ($cached !== false) {
return static::$urlPageName = array_get($cached, 'fileName');
}
$page = Page::useCache()->whereComponent($this->urlComponentName, 'isPrimary', '1')->first();
if (!$page) {
throw new ApplicationException(sprintf('Unable to a find a primary component "%s" for generating a URL in %s.', $this->urlComponentName, get_class($this)));
}
$baseFileName = $page->getBaseFileName();
$filePath = $page->getFullPath();
$cached = ['path' => $filePath, 'fileName' => $baseFileName, 'mtime' => @File::lastModified($filePath)];
Cache::put($key, serialize($cached), Config::get('cms.parsedPageCacheTTL', 1440));
return static::$urlPageName = $baseFileName;
}
开发者ID:chesterx,项目名称:pay-plugin,代码行数:30,代码来源:UrlMaker.php
示例5: onRun
public function onRun()
{
$theme = Theme::getActiveTheme();
$page = Page::load($theme, $this->page->baseFileName);
$this->page["hasBlog"] = false;
if (!$page->hasComponent("blogPost")) {
$this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
$this->seo_description = $this->page["seo_description"] = $this->page->meta_description;
$this->seo_keywords = $this->page["seo_keywords"] = $this->page->seo_keywords;
$this->canonical_url = $this->page["canonical_url"] = $this->page->canonical_url;
$this->redirect_url = $this->page["redirect_url"] = $this->page->redirect_url;
$this->robot_follow = $this->page["robot_follow"] = $this->page->robot_follow;
$this->robot_index = $this->page["robot_index"] = $this->page->robot_index;
$settings = Settings::instance();
if ($settings->enable_og_tags) {
$this->ogTitle = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
$this->ogDescription = $this->page->meta_description;
$this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url;
$this->ogSiteName = $settings->og_sitename;
$this->ogFbAppId = $settings->og_fb_appid;
}
} else {
$this->hasBlog = $this->page["hasBlog"] = true;
}
}
开发者ID:janusnic,项目名称:oc-seo-extension,代码行数:25,代码来源:CmsPage.php
示例6: init
/**
* Initialize.
*
* @return void
* @throws \Krisawzm\DemoManager\Classes\DemoManagerException
*/
protected function init()
{
$backendUser = BackendAuth::getUser();
$baseTheme = $this->theme = Config::get('krisawzm.demomanager::base_theme', null);
if ($backendUser) {
if ($backendUser->login == Config::get('krisawzm.demomanager::admin.login', 'admin')) {
$this->theme = $baseTheme;
} else {
$this->theme = $backendUser->login;
}
} else {
if (UserCounter::instance()->limit()) {
$action = Config::get('krisawzm.demomanager::limit_action', 'reset');
if ($action == 'reset') {
DemoManager::instance()->resetEverything();
// @todo queue/async?
$this->theme = $this->newDemoUser()->login;
} elseif ($action == 'maintenance') {
$theme = Theme::load($baseTheme);
Event::listen('cms.page.beforeDisplay', function ($controller, $url, $page) use($theme) {
return Page::loadCached($theme, 'maintenance');
});
} elseif ($action == 'nothing') {
$this->theme = $baseTheme;
} else {
throw new DemoManagerException('User limit is reached, but an invalid action is defined.');
}
} else {
$this->theme = $this->newDemoUser()->login;
// @todo Remember the username after signing out.
// Could prove useful as some plugins may
// have some different offline views.
}
}
}
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:41,代码来源:DemoAuth.php
示例7: getDetaultPaymentPage
public static function getDetaultPaymentPage($params = [])
{
$settings = self::instance();
if (empty($settings->default_payment_page)) {
return null;
}
return Page::url($settings->default_payment_page, $params);
}
开发者ID:dogiedog,项目名称:pay-plugin,代码行数:8,代码来源:Settings.php
示例8: getSpecificOptions
public function getSpecificOptions()
{
$renderType = Request::input('render');
// Load the country property value from POST
$pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
$Options = ['none' => [], 'settings' => [], 'parent' => [], 'specific' => $pages];
return $Options[$renderType];
}
开发者ID:betes-curieuses-design,项目名称:AllianceEducation,代码行数:8,代码来源:Bloglist.php
示例9: getUrlOptions
/**
* Get a list of all pages. Prepend an empty option to the start
*
* @return array
*/
public function getUrlOptions()
{
$allPages = Page::sortBy('baseFileName')->lists('title', 'baseFileName');
$pages = array('' => 'No page link');
foreach ($allPages as $key => $value) {
$pages[$key] = "{$key}";
}
return $pages;
}
开发者ID:aydancoskun,项目名称:octobercms,代码行数:14,代码来源:Cookielawbanner.php
示例10: spoofPageCode
private function spoofPageCode()
{
// Spoof all the objects we need to make a page object
$theme = Theme::load('test');
$page = Page::load($theme, 'index.htm');
$layout = Layout::load($theme, 'content.htm');
$controller = new Controller($theme);
$parser = new CodeParser($page);
$pageObj = $parser->source($page, $layout, $controller);
return $pageObj;
}
开发者ID:mechiko,项目名称:staff-october,代码行数:11,代码来源:ComponentManagerTest.php
示例11: testLists
public function testLists()
{
// Default theme: test
$pages = Page::lists('baseFileName');
sort($pages);
$this->assertEquals(["404", "a/a-page", "ajax-test", "authors", "b/b-page", "blog-archive", "blog-post", "code-namespaces", "component-custom-render", "component-partial", "component-partial-nesting", "component-partial-override", "cycle-test", "index", "no-component", "no-component-class", "no-layout", "no-partial", "optional-full-php-tags", "optional-short-php-tags", "throw-php", "with-component", "with-components", "with-content", "with-layout", "with-partials", "with-placeholder"], $pages);
$layouts = Layout::lists('baseFileName');
sort($layouts);
$this->assertEquals(["a/a-layout", "ajax-test", "content", "cycle-test", "no-php", "partials", "php-parser-test", "placeholder", "sidebar"], $layouts);
$pages = Page::inTheme('NON_EXISTENT_THEME')->lists('baseFileName');
$this->assertEmpty($pages);
}
开发者ID:mechiko,项目名称:staff-october,代码行数:12,代码来源:CmsObjectQueryTest.php
示例12: testTargetCmsPageRedirect
public function testTargetCmsPageRedirect()
{
$page = Page::load(Theme::getActiveTheme(), 'adrenth-redirect-testpage');
if ($page === null) {
$page = new Page();
$page->title = 'Testpage';
$page->url = '/adrenth/redirect/testpage';
$page->setFileNameAttribute('adrenth-redirect-testpage');
$page->save();
}
$redirect = new Redirect(['match_type' => Redirect::TYPE_EXACT, 'target_type' => Redirect::TARGET_TYPE_CMS_PAGE, 'from_url' => '/this-should-be-source', 'cms_page' => 'adrenth-redirect-testpage', 'requirements' => null, 'status_code' => 302, 'from_date' => Carbon::now(), 'to_date' => Carbon::now()->addWeek()]);
self::assertTrue($redirect->save());
$rule = RedirectRule::createWithModel($redirect);
self::assertInstanceOf(RedirectRule::class, $rule);
$manager = RedirectManager::createWithRule($rule);
self::assertInstanceOf(RedirectManager::class, $manager);
$result = $manager->match('/this-should-be-source');
self::assertInstanceOf(RedirectRule::class, $result);
self::assertEquals('http://localhost/adrenth/redirect/testpage', $manager->getLocation($result));
self::assertTrue($page->delete());
}
开发者ID:adrenth,项目名称:redirect,代码行数:21,代码来源:RedirectManagerTest.php
示例13: getPagesDropDown
public function getPagesDropDown()
{
if (!$this->pages) {
$theme = Theme::getEditTheme();
$pages = Page::listInTheme($theme, true);
$this->pages = [];
foreach ($pages as $page) {
$this->pages[$page->baseFileName] = $page->title . ' (' . $page->url . ')';
}
}
return $this->pages;
}
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:12,代码来源:Settings.php
示例14: getUrl
/**
*
* Generates url for the item to be resolved
*
* @param int $year - year number
* @param string $pageCode - page code to be used
* @param $theme
* @return string
*/
protected static function getUrl($year, $pageCode, $theme)
{
$page = CmsPage::loadCached($theme, $pageCode);
if (!$page) {
return '';
}
$properties = $page->getComponentProperties('blogArchive');
if (!isset($properties['yearParam'])) {
return '';
}
$paramName = $properties['yearParam'];
$url = CmsPage::url($page->getBaseFileName(), [$paramName => $year]);
return $url;
}
开发者ID:graker,项目名称:blogarchive,代码行数:23,代码来源:SitemapProvider.php
示例15: scanForMessages
/**
* Scans the theme templates for message references.
* @return void
*/
public function scanForMessages()
{
$messages = [];
foreach (Layout::all() as $layout) {
$messages = array_merge($messages, $this->parseContent($layout->markup));
}
foreach (Page::all() as $page) {
$messages = array_merge($messages, $this->parseContent($page->markup));
}
foreach (Partial::all() as $partial) {
$messages = array_merge($messages, $this->parseContent($partial->markup));
}
Message::importMessages($messages);
}
开发者ID:aydancoskun,项目名称:octobercms,代码行数:18,代码来源:ThemeScanner.php
示例16: fire
/**
* Execute the console command.
* @return void
*/
public function fire()
{
$this->output->writeln('Hello world!');
$crmusers = CRMUser::isNotUpdated()->isHaveEmail()->get();
echo "Processing Users: \n";
$crmusers->each(function ($user) {
$validator = \Validator::make(['email' => $user->email], ['email' => 'email']);
if ($validator->fails()) {
echo $user->email . " not valid email! [-]" . "\n";
} else {
$cmsuser = CMSUser::firstOrNew(['username' => $user->email]);
echo $user->email . " ";
$cmsuser->fill($user->toArray());
if (!$cmsuser->is_activated) {
$pass = str_random(12);
$cmsuser->password = $pass;
$cmsuser->password_confirmation = $pass;
echo ": " . $pass;
}
$user->is_updated = true;
$user->save();
$cmsuser->save();
if (!$cmsuser->is_activated) {
$code = implode('!', [$cmsuser->id, $cmsuser->getActivationCode()]);
$link = Page::url('personal', ['code' => $code]);
$data = ['name' => $cmsuser->name, 'link' => $link, 'code' => $code];
Mail::send('abnmt.mrc::mail.activate', $data, function ($message) use($cmsuser) {
$message->to($cmsuser->email, $cmsuser->name);
});
}
// if (!$cmsuser->is_activated) {
// try { $cmsuser->attemptActivation($cmsuser->activation_code);} catch (\Exception $e) {echo " EXCEPTION!";}
// }
// \Mail::sendTo($this, 'backend::mail.invite', [
// 'name' => $user->name,
// 'email' => '[email protected]',
// 'password' => $pass,
// ]);
echo " [+]\n";
}
});
echo "\n";
$cmsusers = CMSUser::count();
// echo "\n";
// print_r($crmusers);
// echo "\n";
// print_r($cmsusers);
// echo "\n";
}
开发者ID:abnmt,项目名称:oc-mrc-plugin,代码行数:53,代码来源:SyncUsers.php
示例17: listPages
private static function listPages()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$pages = Page::listInTheme($theme, true);
$result = [];
foreach ($pages as $page) {
if ($page->show_menu == "1") {
$result[$page->menu_order] = ['text' => $page->menu_text, 'path' => $page->getBaseFileName(), 'order' => $page->menu_order];
}
}
ksort($result);
return $result;
}
开发者ID:janusnic,项目名称:oc-simplemenu-plugin,代码行数:15,代码来源:Menu.php
示例18: bootBackend
/**
* Boot stuff for Backend
*
* @return void
*/
public function bootBackend()
{
Page::extend(function (Page $page) {
$handler = new PageHandler($page);
$page->bindEvent('model.beforeUpdate', function () use($handler) {
$handler->onBeforeUpdate();
});
$page->bindEvent('model.afterDelete', function () use($handler) {
$handler->onAfterDelete();
});
});
Event::listen('redirects.changed', function () {
PublishManager::instance()->publish();
});
}
开发者ID:adrenth,项目名称:redirect,代码行数:20,代码来源:Plugin.php
示例19: onRun
public function onRun()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$currentPage = $this->page->baseFileName;
$pages = Page::listInTheme($theme, true);
$this->pagesList = $this->buildPagesList($pages);
$breadcrumbList = $this->buildCrumbTrail($currentPage);
$currentCrumb = array_slice($breadcrumbList, -1, 1, true);
$currentCrumb = array_shift($currentCrumb);
$this->page['breadcrumbs'] = $breadcrumbList;
$this->page['currentCrumb'] = $currentCrumb;
return;
}
开发者ID:tysonrude,项目名称:bloom7,代码行数:15,代码来源:Breadcrumbs.php
示例20: register
public function register()
{
\Event::listen('backend.form.extendFields', function ($widget) {
if (!$widget->model instanceof \Cms\Classes\Page) {
return;
}
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$pages = Page::all()->sort(function ($a, $b) {
return strcasecmp($a->title, $b->title);
});
$pageOptions = $this->buildPageOptions($pages);
$widget->addFields(['settings[child_of]' => ['label' => 'Child Of', 'type' => 'dropdown', 'tab' => 'Breadcrumbs', 'span' => 'left', 'options' => $pageOptions, 'comment' => 'The parent of this page. Set to "None" if root page'], 'settings[hide_crumb]' => ['label' => 'Hide Breadcrumbs', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Hide the breadcrumb trail on this page'], 'settings[crumb_title]' => ['label' => 'Crumb Title (Optional)', 'type' => 'text', 'tab' => 'Breadcrumbs', 'span' => 'left', 'comment' => 'Title text for this pages crumb, by default will use page title'], 'settings[remove_crumb_trail]' => ['label' => 'Remove From Breadcrumbs', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Do not show this page in the breadcrumb trail'], 'settings[crumbElementTitle]' => ['label' => 'Crumb Title From Id (Optional)', 'type' => 'text', 'tab' => 'Breadcrumbs', 'span' => 'left', 'comment' => 'Use a DOM element as the crumb title for this page. Must be a a unique #id on the page.'], 'settings[crumb_disabled]' => ['label' => 'Disabled', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Disable the link and add the disabled class to this crumb item in the breadcrumb list']], 'primary');
});
}
开发者ID:tysonrude,项目名称:bloom7,代码行数:16,代码来源:Plugin.php
注:本文中的Cms\Classes\Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论