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


PHP SinglePage::getPathToNode方法代码示例

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


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

示例1: 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

示例2: view

 public function view()
 {
     $this->set('generated', SinglePage::getList());
     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($path);
                     $this->redirect('/dashboard/pages/single', 'single_page_added');
                 } else {
                     $this->error->add(t("That page has already been added."));
                 }
             } else {
                 $this->error->add(t('That specified path doesn\'t appear to be a valid static page.'));
             }
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:22,代码来源:single.php

示例3: add

	public 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');
		
		// 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 = Page::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 = SinglePage::getPathToNode($currentPath, $pkg);

			// check to see if a page at this point in the tree exists
			$c = Page::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;
				
				$pxml = SinglePage::obtainPermissionsXML($currentPath, $pkg);
				
				if ($pxml) {
					$newC->assignPermissionSet($pxml); // pass it an array
				}					
				
			} else {
				$parent = $c;
			}				
			
			$pathPrefix = $currentPath . '/';
		}
		
		return $newC;
		
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:59,代码来源:single_page.php

示例4: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$ih = Loader::helper('concrete/interface');
Loader::model('single_page');
$valt = Loader::helper('validation/token');
if ($_REQUEST['p'] && $_REQUEST['task'] == 'refresh' && $valt->validate('refresh')) {
    $p = SinglePage::getByID($_REQUEST['p']);
    $p->refresh();
    $this->controller->redirect('/dashboard/pages/single?refreshed=1');
    exit;
}
if ($_POST['add_static_page']) {
    if ($valt->validate("add_single_page")) {
        $pathToNode = SinglePage::getPathToNode($_POST['pageURL'], false);
        $path = SinglePage::sanitizePath($_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($_POST['pageURL']);
                $this->controller->redirect('/dashboard/pages/single?page_created=1');
            } else {
                $error[] = t("That page has already been added.");
            }
        } else {
            $error[] = t('That specified path doesn\'t appear to be a valid static page.');
        }
    } else {
        $error[] = $valt->getErrorMessage();
    }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:single.php


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