本文整理匯總了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();
}
示例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;
}