本文整理汇总了PHP中thebuggenie\core\framework\Context::getThemes方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getThemes方法的具体用法?PHP Context::getThemes怎么用?PHP Context::getThemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::getThemes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: componentOnlineThemes
public function componentOnlineThemes()
{
try {
$client = new \Net_Http_Client();
$client->get('http://www.thebuggenie.com/themes.json');
$json_themes = json_decode($client->getBody());
} catch (\Exception $e) {
}
$themes = array();
$existing_themes = framework\Context::getThemes();
if (isset($json_themes) && isset($json_themes->featured)) {
foreach ($json_themes->featured as $key => $theme) {
if (!array_key_exists($theme->key, $existing_themes)) {
$themes[] = $theme;
}
}
}
$this->themes = $themes;
}
示例2: runEnableTheme
/**
* Enable a theme
*
* @param framework\Request $request
* @Route(name="configuration_enable_theme", url="/configure/themes/:theme_key/enable/:csrf_token")
* @CsrfProtected
*/
public function runEnableTheme(framework\Request $request)
{
$themes = framework\Context::getThemes();
if (array_key_exists($request['theme_key'], $themes)) {
// if (framework\Context::getScope()->isDefault())
// {
// $theme_link_path = THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'css' . DS . $request['theme_key'];
// $theme_path = '..' . DS . '..' . DS . 'themes' . DS . $request['theme_key'] . DS . 'css';
// if (file_exists($theme_link_path)) {
// unlink($theme_link_path);
// }
// symlink($theme_path, $theme_link_path);
// }
framework\Settings::saveSetting(framework\Settings::SETTING_THEME_NAME, $request['theme_key']);
framework\Context::setMessage('theme_message', $this->getI18n()->__('The theme has been enabled'));
} else {
framework\Context::setMessage('theme_error', $this->getI18n()->__('This theme does not exist'));
}
return $this->forward($this->getRouting()->generate('configuration_themes'));
}
示例3: runUserdata
public function runUserdata(framework\Request $request)
{
if ($this->getUser()->isGuest()) {
return $this->renderJSON(array());
} else {
$data = array();
if ($request->isPost()) {
switch ($request['say']) {
case 'install-module':
try {
entities\Module::downloadModule($request['module_key']);
$module = entities\Module::installModule($request['module_key']);
$data['installed'] = true;
$data['module_key'] = $request['module_key'];
$data['module'] = $this->getComponentHTML('configuration/modulebox', array('module' => $module));
} catch (framework\exceptions\ModuleDownloadException $e) {
$this->getResponse()->setHttpStatus(400);
switch ($e->getCode()) {
case framework\exceptions\ModuleDownloadException::JSON_NOT_FOUND:
return $this->renderJSON(array('message' => $this->getI18n()->__('An error occured when trying to retrieve the module data')));
break;
case framework\exceptions\ModuleDownloadException::FILE_NOT_FOUND:
return $this->renderJSON(array('message' => $this->getI18n()->__('The module could not be downloaded')));
break;
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('message' => $this->getI18n()->__('An error occured when trying to install the module')));
}
break;
case 'install-theme':
try {
entities\Module::downloadTheme($request['theme_key']);
$data['installed'] = true;
$data['theme_key'] = $request['theme_key'];
$themes = framework\Context::getThemes();
$data['theme'] = $this->getComponentHTML('configuration/theme', array('theme' => $themes[$request['theme_key']]));
} catch (framework\exceptions\ModuleDownloadException $e) {
$this->getResponse()->setHttpStatus(400);
switch ($e->getCode()) {
case framework\exceptions\ModuleDownloadException::JSON_NOT_FOUND:
return $this->renderJSON(array('message' => $this->getI18n()->__('An error occured when trying to retrieve the module data')));
break;
case framework\exceptions\ModuleDownloadException::FILE_NOT_FOUND:
return $this->renderJSON(array('message' => $this->getI18n()->__('The module could not be downloaded')));
break;
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('message' => $this->getI18n()->__('An error occured when trying to install the module')));
}
break;
case 'notificationstatus':
$notification = tables\Notifications::getTable()->selectById($request['notification_id']);
$data['notification_id'] = $request['notification_id'];
$data['is_read'] = 1;
if ($notification instanceof entities\Notification) {
$notification->setIsRead(!$notification->isRead());
$notification->save();
$data['is_read'] = (int) $notification->isRead();
$this->getUser()->markNotificationGroupedNotificationsRead($notification);
}
break;
case 'notificationsread':
$this->getUser()->markAllNotificationsRead();
$data['all'] = 'read';
break;
}
} else {
switch ($request['say']) {
case 'get_module_updates':
$addons_param = array();
foreach ($request['addons'] as $addon) {
$addons_param[] = 'addons[]=' . $addon;
}
try {
$client = new \Net_Http_Client();
$client->get('http://www.thebuggenie.com/addons.json?' . join('&', $addons_param));
$addons_json = json_decode($client->getBody(), true);
} catch (\Exception $e) {
}
return $this->renderJSON($addons_json);
break;
case 'getsearchcounts':
$counts_json = array();
foreach ($request['search_ids'] as $search_id) {
if (is_numeric($search_id)) {
$search = tables\SavedSearches::getTable()->selectById($search_id);
} else {
$predefined_id = str_replace('predefined_', '', $search_id);
$search = \thebuggenie\core\entities\SavedSearch::getPredefinedSearchObject($predefined_id);
}
if ($search instanceof entities\SavedSearch) {
$counts_json[$search_id] = $search->getTotalNumberOfIssues();
}
}
return $this->renderJSON($counts_json);
break;
case 'get_theme_updates':
$addons_param = array();
//.........这里部分代码省略.........
示例4: __
<?php
$themes = \thebuggenie\core\framework\Context::getThemes();
$languages = \thebuggenie\core\framework\I18n::getLanguages();
?>
<table style="clear: both; width: 700px; margin-top: 5px;" class="padded_table" cellpadding=0 cellspacing=0>
<tr>
<td><label for="disableelevatedlogin"><?php
echo __('Require re-authentication');
?>
</label></td>
<td>
<select name="<?php
echo \thebuggenie\core\framework\Settings::SETTING_ELEVATED_LOGIN_DISABLED;
?>
" id="disableelevatedlogin" style="width: 400px;"<?php
if ($access_level != \thebuggenie\core\framework\Settings::ACCESS_FULL) {
?>
disabled<?php
}
?>
>
<option value=0<?php
if (\thebuggenie\core\framework\Settings::isElevatedLoginRequired()) {
?>
selected<?php
}
?>
><?php
echo __('You need to re-enter your password to access the configuration section');
?>