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


PHP PageTheme::getByFileHandle方法代碼示例

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


在下文中一共展示了PageTheme::getByFileHandle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: install

 public function install($ptHandle = null)
 {
     $th = PageTheme::getByFileHandle($ptHandle);
     if ($ptHandle == null) {
         $this->redirect('/dashboard/pages/themes');
     }
     $v = Loader::helper('validation/error');
     try {
         if (is_object($th)) {
             $t = PageTheme::add($ptHandle);
             $this->redirect('/dashboard/pages/themes/inspect', $t->getThemeID(), 1);
         } else {
             throw new Exception('Invalid Theme');
         }
     } catch (Exception $e) {
         switch ($e->getMessage()) {
             case PageTheme::E_THEME_INSTALLED:
                 $v->add(t('That theme has already been installed.'));
                 break;
             default:
                 $v->add($e->getMessage());
                 break;
         }
         $this->set('error', $v);
     }
     $this->view();
 }
開發者ID:VonUniGE,項目名稱:concrete5-1,代碼行數:27,代碼來源:controller.php

示例2: getAvailableThemes

	public static function getAvailableThemes($filterInstalled = true) {
		// scans the directory for available themes. For those who don't want to go through
		// the hassle of uploading
		
		$db = Loader::db();
		$dh = Loader::helper('file');
		
		$themes = $dh->getDirectoryContents(DIR_FILES_THEMES);
		if ($filterInstalled) {
			// strip out themes we've already installed
			$handles = $db->GetCol("select ptHandle from PageThemes");
			$themesTemp = array();
			foreach($themes as $t) {
				if (!in_array($t, $handles)) {
					$themesTemp[] = $t;
				}
			}
			$themes = $themesTemp;
		}
		
		if (count($themes) > 0) {
			$themesTemp = array();
			// get theme objects from the file system
			foreach($themes as $t) {
				$th = PageTheme::getByFileHandle($t);
				if (!empty($th)) {
					$themesTemp[] = $th;
				}
			}
			$themes = $themesTemp;
		}
		return $themes;
			
	}
開發者ID:remkoj,項目名稱:concrete5,代碼行數:34,代碼來源:page_theme.php


注:本文中的PageTheme::getByFileHandle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。