當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SinglePage::sanitizePath方法代碼示例

本文整理匯總了PHP中SinglePage::sanitizePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP SinglePage::sanitizePath方法的具體用法?PHP SinglePage::sanitizePath怎麽用?PHP SinglePage::sanitizePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SinglePage的用法示例。


在下文中一共展示了SinglePage::sanitizePath方法的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: obtainPermissionsXML

	public static function obtainPermissionsXML($node, $pkg = null) {
		// this function reads a file in, and grabs all the various filesystem permissions xml that applies to that file
		// and returns it in a DOM object
		
		$node = SinglePage::sanitizePath($node);
		
		
		// first, we operate on this if it's not in a package
		
		if (!is_object($pkg)) {
			
			if (is_dir(DIR_FILES_CONTROLLERS . '/' . $node) || is_dir(DIR_FILES_CONTROLLERS_REQUIRED . '/' . $node)) {
				if (is_dir(DIR_FILES_CONTROLLERS . '/' . $node)) {
					$pathToPerms = DIR_FILES_CONTROLLERS . '/' . $node;
					if (file_exists($pathToPerms . '/' . FILENAME_COLLECTION_ACCESS)) {
						$xmlweb = $pathToPerms . '/' . FILENAME_COLLECTION_ACCESS;
					}
				}
				
				if (is_dir(DIR_FILES_CONTROLLERS_REQUIRED . '/' . $node)) {
					$pathToPerms = DIR_FILES_CONTROLLERS_REQUIRED . '/' . $node;
					if (file_exists($pathToPerms . '/' . FILENAME_COLLECTION_ACCESS)) {
						$xmlcore = $pathToPerms . '/' . FILENAME_COLLECTION_ACCESS;
					}
				}
			} else {
				if (strpos($node, '/') === false) {
					if (file_exists(DIR_FILES_CONTROLLERS . '/' . FILENAME_COLLECTION_ACCESS)) {
						$xmlweb = DIR_FILES_CONTROLLERS . '/' . FILENAME_COLLECTION_ACCESS;
					} else if (file_exists(DIR_FILES_CONTROLLERS_REQUIRED . '/' . FILENAME_COLLECTION_ACCESS)) {
						$xmlcore = DIR_FILES_CONTROLLERS_REQUIRED . '/' . FILENAME_COLLECTION_ACCESS;
					}
				}			
			}
				
			
			if (isset($xmlweb)) {
				$perms = SinglePage::checkPermissionsXML($xmlweb, $node);
				if ($perms != null) {
					return $perms;
				}
			} 

			
			if (isset($xmlcore)) {
				$perms = SinglePage::checkPermissionsXML($xmlcore, $node);
				if ($perms != null) {
					return $perms;
				}
			}

		} else {
		
			if (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) {
				$dirp = DIR_PACKAGES;			
			} else {
				$dirp = DIR_PACKAGES_CORE;
			}

			$file1 = $dirp . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_PAGES . '/' . $node . '/' . FILENAME_COLLECTION_VIEW;
			$file2 = $dirp . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_PAGES . '/' . $node . '.php';
			if (file_exists($file1)) {
				$pathToPerms = $dirp . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_CONTROLLERS . '/' . $node;
			} else if (file_exists($file2)) {
				$pathNode = '/' . substr($node, 0, strrpos($node, '/'));
				$pathToPerms = $dirp . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_CONTROLLERS . $pathNode;
			}
			
			if (file_exists($pathToPerms . '/' . FILENAME_COLLECTION_ACCESS)) {
				$xml = $pathToPerms . '/' . FILENAME_COLLECTION_ACCESS;
			}
			
			if (isset($xml)) {
				$perms = SinglePage::checkPermissionsXML($xml, $node);
				if ($perms != null) {
					return $perms;
				}
			}
		}

		return false;
	}
開發者ID:rii-J,項目名稱:concrete5-de,代碼行數:82,代碼來源: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::sanitizePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。