当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::getByPath方法代码示例

本文整理汇总了PHP中Page::getByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getByPath方法的具体用法?PHP Page::getByPath怎么用?PHP Page::getByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Page的用法示例。


在下文中一共展示了Page::getByPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createDraft

 public static function createDraft($ct)
 {
     $parent = Page::getByPath(COMPOSER_DRAFTS_PAGE_PATH);
     $data['cvIsApproved'] = 0;
     $p = $parent->add($ct, $data);
     $p->deactivate();
     $db = Loader::db();
     $targetPageID = 0;
     if ($ct->getCollectionTypeComposerPublishMethod() == 'PARENT') {
         $targetPageID = $ct->getCollectionTypeComposerPublishPageParentID();
     }
     $db->Execute('insert into ComposerDrafts (cID, cpPublishParentID) values (?, ?)', array($p->getCollectionID(), $targetPageID));
     $entry = ComposerPage::getByID($p->getCollectionID());
     if (is_object($entry)) {
         // duplicate all composer blocks onto the new page and make them into new blocks
         $blocks = $entry->getComposerBlocks();
         foreach ($blocks as $b) {
             $b2 = Block::getByID($b->getBlockID(), $p, $b->getAreaHandle());
             $nb = $b2->duplicate($p);
             $b2->deleteBlock();
             $b2 = $nb;
         }
         return $entry;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:25,代码来源:composer_page.php

示例2: run

 public function run()
 {
     $sp = Page::getByPath('/dashboard/users/group_sets');
     if (is_object($sp) && !$sp->isError()) {
         $sp->setAttribute('exclude_nav', 0);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:7,代码来源:version_5601.php

示例3: run

 public function run()
 {
     if (!ENABLE_USER_PROFILES) {
         $membersPage = Page::getByPath('/members');
         if ($membersPage instanceof Page && !$membersPage->isError()) {
             $membersPage->delete();
         }
     }
     // Update robots.txt
     $delete_rules = array('Disallow: /blocks', 'Disallow: /concrete', 'Disallow: /css', 'Disallow: /js', 'Disallow: /themes', 'Disallow: /packages', 'Disallow: /updates');
     $add_rules = array('Disallow: /blocks/*.php$', 'Disallow: /blocks/*.xml$', 'Disallow: /concrete/*.php$', 'Disallow: /concrete/*.xml$', 'Disallow: /packages/*.php$', 'Disallow: /packages/*.xml$', 'Disallow: /updates/*.php$', 'Disallow: /updates/*.xml$');
     $robotspath = DIR_BASE . '/robots.txt';
     $fh = Loader::helper('file');
     if (file_exists($robotspath) && is_writable($robotspath)) {
         $rules = array();
         $robotstxt = @file($robotspath, FILE_IGNORE_NEW_LINES);
         foreach ($robotstxt as $line) {
             $line = trim($line);
             if (!in_array($line, $delete_rules)) {
                 $rules[] = $line;
             }
         }
         $new_rules = array_merge($rules, $add_rules);
         $new_robotstxt = implode("\n", $new_rules);
         $fh->clear($robotspath);
         $fh->append($robotspath, $new_robotstxt);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:28,代码来源:version_5633.php

示例4: view

 public function view()
 {
     $c = Page::getByPath('/dashboard/home');
     $v = View::getInstance();
     $v->disableEditing();
     $v->render($c);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:7,代码来源:news.php

示例5: run

 public function run()
 {
     $db = Loader::db();
     $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user'));
     if ($cnt < 1) {
         $g3 = Group::getByID(ADMIN_GROUP_ID);
         $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false);
         if (is_object($g3)) {
             $tip->addAccess($g3);
         }
     }
     Loader::model('single_page');
     $sp = Page::getByPath('/dashboard/settings/multilingual');
     if ($sp->isError()) {
         $d1a = SinglePage::add('/dashboard/settings/multilingual');
         $d1a->update(array('cName' => t('Multilingual Setup')));
     }
     $sp = Page::getByPath('/dashboard/composer');
     if ($sp->isError()) {
         $d2 = SinglePage::add('/dashboard/composer');
         $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.')));
     }
     $sp = Page::getByPath('/dashboard/composer/write');
     if ($sp->isError()) {
         $d3 = SinglePage::add('/dashboard/composer/write');
     }
     $sp = Page::getByPath('/dashboard/composer/drafts');
     if ($sp->isError()) {
         $d4 = SinglePage::add('/dashboard/composer/drafts');
     }
     $sp = Page::getByPath('/dashboard/pages/types/composer');
     if ($sp->isError()) {
         $d5 = SinglePage::add('/dashboard/pages/types/composer');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:35,代码来源:version_542.php

示例6: run

 public function run()
 {
     $sp = Page::getByPath('/dashboard/system/seo/excluded');
     if (!is_object($sp) || $sp->isError()) {
         $sp = SinglePage::add('/dashboard/system/seo/excluded');
         $sp->update(array('cName' => t('Excluded URL Word List')));
         $sp->setAttribute('meta_keywords', 'pretty, slug');
     }
     $bt = BlockType::getByHandle('next_previous');
     if (is_object($bt)) {
         $bt->refresh();
     }
     $db = Loader::db();
     $columns = $db->MetaColumns('Pages');
     if (isset($columns['PTID'])) {
         $db->Execute('alter table Pages drop column ptID');
     }
     if (isset($columns['CTID'])) {
         $db->Execute('alter table Pages drop column ctID');
     }
     $bt = BlockType::getByHandle('search');
     if (is_object($bt)) {
         $bt->refresh();
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:25,代码来源:version_561.php

示例7: view

 public function view($message = null, $error = null)
 {
     Loader::model('single_page');
     $this->set('generated', SinglePage::getList());
     if ($message && !$error) {
         $this->set('message', $message);
     } else {
         if ($message) {
             $this->error->add($message);
         }
     }
     if ($this->isPost()) {
         if ($this->token->validate('add_single_page')) {
             $pathToNode = SinglePage::getPathToNode($this->post('pageURL'), false);
             $path = SinglePage::sanitizePath($this->post('pageURL'));
             if (strlen($pathToNode) > 0) {
                 // now we check to see if this is already added
                 $pc = Page::getByPath('/' . $path, 'RECENT');
                 if ($pc->getError() == COLLECTION_NOT_FOUND) {
                     SinglePage::add($this->post('pageURL'));
                     $this->redirect('/dashboard/pages/single', t('Page Successfully Added.'));
                 } else {
                     $this->redirect('/dashboard/pages/single', t("That page has already been added."), 1);
                 }
             } else {
                 $this->redirect('/dashboard/pages/single', t('That specified path doesn\'t appear to be a valid static page.'), 1);
             }
         }
         $this->redirect('/dashboard/pages/single', $this->token->getErrorMessage(), 1);
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:single.php

示例8: update_profiles

 public function update_profiles()
 {
     /** @var Token $token */
     $token = \Core::make('token');
     if (!$token->validate("update_profile")) {
         $this->error->add('Invalid Token.');
         return;
     }
     if ($this->isPost()) {
         $config = $this->getSite()->getConfigRepository();
         $config->save('user.profiles_enabled', $this->post('public_profiles') ? true : false);
         $config->save('user.gravatar.enabled', $this->post('gravatar_fallback') ? true : false);
         $config->save('user.gravatar.max_level', Loader::helper('security')->sanitizeString($this->post('gravatar_max_level')));
         $config->save('user.gravatar.image_set', Loader::helper('security')->sanitizeString($this->post('gravatar_image_set')));
         // $message = ($this->post('public_profiles')?t('Public profiles have been enabled'):t('Public profiles have been disabled.'));
         if ($this->post('public_profiles')) {
             Single::add('/members');
             $c = Single::add('/members/profile');
             Single::add('/members/directory');
             $c->update(['cName' => 'View Profile']);
             $this->redirect('/dashboard/system/registration/profiles/profiles_enabled');
         } else {
             foreach ($this->app->make('site')->getList() as $site) {
                 foreach (['/members/directory', '/members/profile', '/members'] as $path) {
                     $c = \Page::getByPath($path, 'RECENT', $site);
                     $c->delete();
                 }
             }
             $this->redirect('/dashboard/system/registration/profiles/profiles_disabled');
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:32,代码来源:profiles.php

示例9: installSinglePages

 protected function installSinglePages($pkg)
 {
     foreach ($this->singlePages as $path) {
         if (Page::getByPath($path)->getCollectionID() <= 0) {
             SinglePage::add($path, $pkg);
         }
         $pp = Page::getByPath($path);
         if (in_array($path, $this->singlePagesToExclude)) {
             if (is_object($pp) && !$pp->isError()) {
                 $pp->setAttribute('exclude_nav', true);
                 $pp->setAttribute('exclude_search_index', true);
             }
         }
         $title = $this->getSinglePageTitle($path);
         if (isset($title)) {
             $pp->update(array('cName' => $title));
         }
     }
     $batches = \Page::getByPath('/!import_batches');
     if (!is_object($batches) || $batches->isError()) {
         $c = SinglePage::add('/!import_batches', $pkg);
         $c->update(array('cName' => 'Import Batches'));
         $c->setOverrideTemplatePermissions(1);
         $c->setAttribute('icon_dashboard', 'fa fa-cubes');
         $c->moveToRoot();
     }
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:27,代码来源:controller.php

示例10: __construct

 public function __construct(Page $currentPage)
 {
     $dashboard = \Page::getByPath('/account');
     $this->setTitle(t('My Account'));
     $this->setWrapperClass('ccm-nav-wrapper');
     parent::__construct($dashboard, $currentPage);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:account_menu.php

示例11: createPage

 protected static function createPage($name, $parent = false, $type = false, $template = false)
 {
     if ($parent === false) {
         $parent = Page::getByID(HOME_CID);
     } else {
         if (is_string($parent)) {
             $parent = Page::getByPath($parent);
         }
     }
     if ($type === false) {
         $type = 1;
     }
     if (is_string($type)) {
         $pt = PageType::getByHandle($type);
     } else {
         $pt = PageType::getByID($type);
     }
     if ($template === false) {
         $template = 1;
     }
     if (is_string($template)) {
         $template = PageTemplate::getByHandle($template);
     } else {
         $template = PageTemplate::getByID($template);
     }
     $page = $parent->add($pt, array('cName' => $name, 'pTemplateID' => $template->getPageTemplateID()));
     return $page;
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:28,代码来源:PageTestCase.php

示例12: on_start

 public function on_start()
 {
     $c = Page::getByPath('/dashboard/blocks/stacks');
     $cp = new Permissions($c);
     if ($cp->canViewPage()) {
         $c = Page::getCurrentPage();
         $pcp = new Permissions($c);
         if (!$pcp->canViewPageVersions() || $_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare') {
             $cID = $c->getCollectionID();
             $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
         } else {
             $this->theme = 'dashboard';
         }
     } else {
         global $c;
         // ugh
         $v = View::getInstance();
         $c = new Page();
         $c->loadError(COLLECTION_NOT_FOUND);
         $v->setCollectionObject($c);
         $this->c = $c;
         $cont = Loader::controller("/page_not_found");
         $v->setController($cont);
         $v->render('/page_not_found');
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:26,代码来源:core_stack.php

示例13: addStack

	public static function addStack($stackName, $type = self::ST_TYPE_USER_ADDED) {
		$ct = new CollectionType();
		$data = array();

		$parent = Page::getByPath(STACKS_PAGE_PATH);
		$data = array();
		$data['name'] = $stackName;
		if (!$stackName) {
			$data['name'] = t('No Name');
		}
		$pagetype = CollectionType::getByHandle(STACKS_PAGE_TYPE);
		$page = $parent->add($pagetype, $data);	

		// we have to do this because we need the area to exist before we try and add something to it.
		$a = Area::getOrCreate($page, STACKS_AREA_NAME);
		
		// finally we add the row to the stacks table
		$db = Loader::db();
		$stackCID = $page->getCollectionID();
		$v = array($stackName, $stackCID, $type);
		$db->Execute('insert into Stacks (stName, cID, stType) values (?, ?, ?)', $v);
		
		//Return the new stack
		return self::getByID($stackCID);
	}
开发者ID:nveid,项目名称:concrete5,代码行数:25,代码来源:model.php

示例14: run

 public function run()
 {
     // Since 5.1.0 we've moved around a number of pages in the dashboard
     Loader::model('single_page');
     // Rename Forms to Reports
     $p = Page::getByPath('/dashboard/form_results');
     // We can only run these once so we do a check to see if that's the case.
     if ($p->isError()) {
         return false;
     }
     $p->update(array('cName' => t('Reports'), 'cDescription' => t('Get data from forms and logs.'), 'cHandle' => 'reports'));
     $p->rescanCollectionPath();
     $p = SinglePage::getByID($p->getCollectionID());
     $p->refresh();
     $d3a = SinglePage::add('/dashboard/reports/forms');
     $d3b = SinglePage::add('/dashboard/reports/logs');
     $d3c = SinglePage::add('/dashboard/reports/database');
     $d4 = Page::getByPath('/dashboard/users');
     $d4a = SinglePage::add('/dashboard/users/search');
     $d4b = SinglePage::add('/dashboard/users/add');
     $d4c = SinglePage::add('/dashboard/users/groups');
     $d4d = Page::getByPath("/dashboard/users/attributes");
     $db = Loader::db();
     $db->query("update Pages set cDisplayOrder = 0 where cID = ?", array($d4a->getCollectionID()));
     $db->query("update Pages set cDisplayOrder = 1 where cID = ?", array($d4b->getCollectionID()));
     $db->query("update Pages set cDisplayOrder = 2 where cID = ?", array($d4c->getCollectionID()));
     $db->query("update Pages set cDisplayOrder = 3 where cID = ?", array($d4d->getCollectionID()));
     $p = Page::getByPath('/dashboard/groups');
     $p->delete();
     $p = Page::getByPath('/dashboard/collection_types');
     $p->update(array('cHandle' => 'pages'));
     $p->rescanCollectionPath();
     $p = SinglePage::getByID($p->getCollectionID());
     $p->refresh();
     $p = Page::getByPath('/dashboard/pages/attributes');
     $p->delete();
     $d7a = SinglePage::add('/dashboard/pages/themes');
     $d7b = SinglePage::add('/dashboard/pages/themes/add');
     $d7c = SinglePage::add('/dashboard/pages/themes/inspect');
     $d7d = SinglePage::add('/dashboard/pages/themes/customize');
     $d7e = SinglePage::add('/dashboard/pages/themes/marketplace');
     $d7f = SinglePage::add('/dashboard/pages/types');
     $d7g = SinglePage::add('/dashboard/pages/types/attributes');
     $d7h = SinglePage::add('/dashboard/pages/single');
     $p = Page::getByPath('/dashboard/themes');
     $p->delete();
     $d3a->update(array('cName' => t('Form Results'), 'cDescription' => t('Get submission data.')));
     $d4->update(array('cName' => t('Users and Groups'), 'cDescription' => t('Add and manage people.')));
     $d4a->update(array('cName' => t('Find Users')));
     $d4b->update(array('cName' => t('Add User')));
     $d4c->update(array('cName' => t('Groups')));
     $d4d->update(array('cName' => t('User Attributes')));
     $d7 = Page::getByPath('/dashboard/pages');
     $d7->update(array('cName' => t('Pages and Themes'), 'cDescription' => t('Reskin your site.')));
     $d7f->update(array('cName' => t('Page Types'), 'cDescription' => t('What goes in your site.')));
     $d7h->update(array('cName' => t('Single Pages')));
     $p = Page::getByPath('/dashboard/logs');
     $p->delete();
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:59,代码来源:version_510.php

示例15: execute

 public function execute(Batch $batch)
 {
     // Has the batch already been created? If so, we move to trash.
     $orphaned = \Page::getByPath('/!import_batches/' . $batch->getID());
     if (is_object($orphaned) && !$orphaned->isError()) {
         $orphaned->moveToTrash();
     }
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:8,代码来源:ClearBatchRoutine.php


注:本文中的Page::getByPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。