本文整理汇总了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;
}