当前位置: 首页>>代码示例>>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;未经允许,请勿转载。