本文整理汇总了PHP中Concrete\Core\Page\Page::getByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getByPath方法的具体用法?PHP Page::getByPath怎么用?PHP Page::getByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Page\Page
的用法示例。
在下文中一共展示了Page::getByPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
示例2: up
public function up(Schema $schema)
{
/** Add query log db table */
try {
$table = $schema->getTable('SystemDatabaseQueryLog');
} catch (Exception $e) {
$table = null;
}
if (!$table instanceof Table) {
$ql = $schema->createTable('SystemDatabaseQueryLog');
$ql->addColumn('query', 'text');
$ql->addColumn('params', 'text', array('notnull' => false));
$ql->addColumn('executionMS', 'string');
}
/** Add query log single pages */
$sp = Page::getByPath('/dashboard/system/optimization/query_log');
if (!is_object($sp) || $sp->isError()) {
$sp = SinglePage::add('/dashboard/system/optimization/query_log');
$sp->update(array('cName' => 'Database Query Log'));
$sp->setAttribute('meta_keywords', 'queries, database, mysql');
}
/** Refresh image block */
$bt = BlockType::getByHandle('image');
if (is_object($bt)) {
$bt->refresh();
}
}
示例3: import
public function import(\SimpleXMLElement $sx)
{
$siteTree = null;
if (isset($this->home)) {
$siteTree = $this->home->getSiteTreeObject();
}
if (isset($sx->singlepages)) {
foreach ($sx->singlepages->page as $px) {
if ($px['custom-path']) {
$page = Page::getByPath((string) $px['custom-path'], 'RECENT', $siteTree);
} else {
$page = Page::getByPath((string) $px['path'], 'RECENT', $siteTree);
}
if (isset($px->area)) {
$this->importPageAreas($page, $px);
}
if (isset($px->attributes)) {
foreach ($px->attributes->children() as $attr) {
$ak = CollectionKey::getByHandle($attr['handle']);
if (is_object($ak)) {
$page->setAttribute((string) $attr['handle'], $ak->getController()->importValue($attr));
}
}
}
}
}
}
示例4: getByPath
public static function getByPath($path, $version = 'RECENT', TreeInterface $siteTree = null)
{
$c = parent::getByPath(STACKS_PAGE_PATH . '/' . trim($path, '/'), $version, $siteTree);
if (static::isValidStack($c)) {
return $c;
}
return false;
}
示例5: up
public function up(Schema $schema)
{
$sp = Page::getByPath('/dashboard/system/multilingual/copy');
if (!is_object($sp) || $sp->isError()) {
$sp = \Concrete\Core\Page\Single::add('/dashboard/system/multilingual/copy');
$sp->update(array('cName' => 'Copy Languages'));
}
}
示例6: getPermissionObject
public function getPermissionObject()
{
if (is_object($this->page)) {
return $this->page;
}
$page = \Concrete\Core\Page\Page::getByPath($this->page);
if (is_object($page) && !$page->isError()) {
return $page;
}
}
示例7: getChildPages
public function getChildPages($parent)
{
$pages = array();
if ($parent->getCollectionPath() == '/account') {
// Add My Account to the List
$pages[] = Page::getByPath('/account/welcome');
}
$pages = array_merge($pages, parent::getChildPages($parent));
return $pages;
}
示例8: getContentObject
public function getContentObject()
{
if ($this->getReference() == '/' || $this->getReference() == '') {
return Page::getByID(HOME_CID, 'ACTIVE');
}
$c = Page::getByPath($this->getReference(), 'ACTIVE');
if (is_object($c) && !$c->isError()) {
return $c;
}
}
示例9: getChildPages
public function getChildPages($parent)
{
$pages = parent::getChildPages($parent);
if ($parent->getCollectionPath() == '/dashboard/welcome') {
// Add My Account to the List
$pages[] = Page::getByPath('/account');
$site = \Core::make("site")->getSite();
$config = $site->getConfigRepository();
if (is_object($site) && $config->get('user.profiles_enabled')) {
$pages[] = Page::getByPath('/members/profile');
}
}
return $pages;
}
示例10: replace
/**
* Given either a path or a Page object, this is a shortcut to
* 1. Grab the controller of THAT page.
* 2. Grab the view of THAT controller
* 3. Render that view.
* 4. Exit – so we immediately stop all other output in the controller that
* called render().
*
* @param @string|\Concrete\Core\Page\Page $var
*/
public function replace($var)
{
if ($var instanceof Page) {
$page = $var;
$path = $var->getCollectionPath();
} else {
$path = (string) $var;
$page = Page::getByPath($path);
}
$request = Request::getInstance();
$controller = $page->getPageController();
$request->setCurrentPage($page);
if (is_callable([$controller, 'setCustomRequestPath'])) {
$controller->setCustomRequestPath($path);
}
$this->replacement = $controller;
}
示例11: up
public function up(Schema $schema)
{
/* delete customize page themes dashboard single page */
$customize = Page::getByPath('/dashboard/pages/themes/customize');
if (is_object($customize) && !$customize->isError()) {
$customize->delete();
}
/* Add inspect single page back if it's missing */
$sp = Page::getByPath('/dashboard/pages/themes/inspect');
if (!is_object($sp) || $sp->isError()) {
$sp = SinglePage::add('/dashboard/pages/themes/inspect');
$sp->setAttribute('meta_keywords', 'inspect, templates');
$sp->setAttribute('exclude_nav', 1);
}
$sp = Page::getByPath('/members/directory');
if (!is_object($sp) || $sp->isError()) {
$sp = SinglePage::add('/members/directory');
$sp->setAttribute('exclude_nav', 1);
}
$bt = BlockType::getByHandle('feature');
if (is_object($bt)) {
$bt->refresh();
}
$bt = BlockType::getByHandle('image_slider');
if (is_object($bt)) {
$bt->refresh();
}
$db = Database::get();
$sm = $db->getSchemaManager();
$schemaTables = $sm->listTableNames();
if (in_array('signuprequests', $schemaTables)) {
$db->query('alter table signuprequests rename SignupRequestsTmp');
$db->query('alter table SignupRequestsTmp rename SignupRequests');
}
if (in_array('userbannedips', $schemaTables)) {
$db->query('alter table userbannedips rename UserBannedIPsTmp');
$db->query('alter table UserBannedIPsTmp rename UserBannedIPs');
}
// Clean up File stupidity
$r = $db->Execute('select Files.fID from Files left join FileVersions on (Files.fID = FileVersions.fID) where FileVersions.fID is null');
while ($row = $r->FetchRow()) {
$db->Execute('delete from Files where fID = ?', array($row['fID']));
}
}
示例12: on_start
public function on_start()
{
$stacksPage = Page::getByPath('/dashboard/blocks/stacks');
$stacksPerms = new Permissions($stacksPage);
// Make sure we can view the stacks page
if ($stacksPerms->canViewPage()) {
$currentPage = $this->c;
$currentPagePerms = new Permissions($currentPage);
$viewTask = $this->request->get('vtask');
// If the current user can't view this pages versions, or if vtask is not one of the available tasks
if (!$currentPagePerms->canViewPageVersions() || !in_array($viewTask, ['view_versions', 'compare'])) {
$url = $stacksPage->getPageController()->action('view_details', $currentPage->getCollectionID());
// Redirect to the stacks page
return $this->factory->redirect($url);
} else {
// Otherwise set the current theme and render normally
$this->theme = 'dashboard';
}
}
// If we can't view the stacks page, send a 404
return $this->factory->notFound('');
}
示例13: up
public function up(Schema $schema)
{
// image resizing options
$sp = Page::getByPath('/dashboard/system/files/image_uploading');
if (!is_object($sp) || $sp->isError()) {
$sp = \Concrete\Core\Page\Single::add('/dashboard/system/files/image_uploading');
$sp->update(array('cName' => 'Image Uploading'));
}
// background size/position
\Concrete\Core\Database\Schema\Schema::refreshCoreXMLSchema(array('StyleCustomizerInlineStyleSets'));
$bt = \BlockType::getByHandle('image_slider');
if (is_object($bt)) {
$bt->refresh();
}
$bt = \BlockType::getByHandle('youtube');
if (is_object($bt)) {
$bt->refresh();
}
$bt = \BlockType::getByHandle('autonav');
if (is_object($bt)) {
$bt->refresh();
}
}
示例14: add
public static function add($cPath, $pkg = null)
{
// if we get to this point, we create a special collection
// without a specific type. This collection has a special cFilename that
// points to the passed node
$db = Loader::db();
$txt = Loader::helper('text');
Loader::helper('concrete/ui')->clearInterfaceItemsCache();
// trim off a leading / if there is one
$cPath = trim($cPath, '/');
// now we grab the parent collection, if there is a static one.
$pages = explode('/', $cPath);
// instantiate the home collection so we have someplace to add these to
$parent = CorePage::getByID(1);
// now we iterate through the pages to ensure that they exist in the system before adding the new guy
$pathPrefix = '';
for ($i = 0; $i < count($pages); $i++) {
$currentPath = $pathPrefix . $pages[$i];
$pathToFile = static::getPathToNode($currentPath, $pkg);
// check to see if a page at this point in the tree exists
$c = CorePage::getByPath("/" . $currentPath);
if ($c->isError() && $c->getError() == COLLECTION_NOT_FOUND) {
// create the page at that point in the tree
$data = array();
$data['handle'] = $pages[$i];
$data['name'] = $txt->unhandle($data['handle']);
$data['filename'] = $pathToFile;
$data['uID'] = USER_SUPER_ID;
if ($pkg != null) {
$data['pkgID'] = $pkg->getPackageID();
}
$newC = $parent->addStatic($data);
$parent = $newC;
} else {
$parent = $c;
}
$pathPrefix = $currentPath . '/';
}
$env = Environment::get();
$env->clearOverrideCache();
return $parent;
}
示例15: forbidden
/**
* @inheritdoc
*/
public function forbidden($requestUrl, $code = Response::HTTP_FORBIDDEN, $headers = array())
{
// set page for redirection after successful login
$this->session->set('rUri', $requestUrl);
// load page forbidden
$item = '/page_forbidden';
$c = Page::getByPath($item);
if (is_object($c) && !$c->isError()) {
return $this->collection($c, $code, $headers);
}
$cnt = $this->app->make(PageForbidden::class);
$this->controller($cnt, $code, $headers);
}