当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme::getAll方法代码示例

本文整理汇总了PHP中Theme::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getAll方法的具体用法?PHP Theme::getAll怎么用?PHP Theme::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


在下文中一共展示了Theme::getAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * Display the widget
  *
  * @return string The generated HTML
  */
 public function display()
 {
     // The number of updates
     $updates = array();
     $titles = array();
     $api = new HawkApi();
     $plugins = array_map(function ($plugin) {
         return $plugin->getDefinition('version');
     }, Plugin::getAll(false));
     $themes = array_map(function ($theme) {
         return $theme->getDefinition('version');
     }, Theme::getAll());
     try {
         $updates = $api->getAllAvailableUpdates($plugins, $themes);
     } catch (\Hawk\HawkApiException $e) {
         $updates = array();
     }
     if (!empty($updates)) {
         if (!empty($updates['hawk'])) {
             \Hawk\Plugins\Main\MenuItem::getByName('admin.settings')->label .= View::make(Plugin::current()->getView('available-updates.tpl'), array('updates' => count($updates['hawk']), 'title' => Lang::get('admin.available-updates-title-core', array('number' => count($updates['hawk'])), count($updates['hawk']))));
         }
         if (!empty($updates['plugins'])) {
             \Hawk\Plugins\Main\MenuItem::getByName('admin.plugins')->label .= View::make(Plugin::current()->getView('available-updates.tpl'), array('updates' => count($updates['plugins']), 'title' => Lang::get('admin.available-updates-title-plugins', array('number' => count($updates['plugins'])), count($updates['plugins']))));
         }
         if (!empty($updates['themes'])) {
             \Hawk\Plugins\Main\MenuItem::getByName('admin.themes')->label .= View::make(Plugin::current()->getView('available-updates.tpl'), array('updates' => count($updates['themes']), 'title' => Lang::get('admin.available-updates-title-plugins', array('number' => count($updates['themes'])), count($updates['themes']))));
         }
     }
     return '';
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:35,代码来源:SearchUpdatesWidget.php

示例2: indexSection

 /**
  * Lists all of the themes and allows the user to change
  * the theme for the different site types.
  *
  * @return strng
  */
 public function indexSection()
 {
     $this->setOutputType(self::_OT_CONFIG);
     // Check which site type to change theme for
     try {
         $siteType = strtolower($this->_input->get('type'));
     } catch (Input_KeyNoExist $e) {
         $siteType = $this->_router->getDefaultSiteType();
     }
     if (!$this->_router->siteTypeExists($siteType)) {
         $this->_event->error(t('Selected site type does not exist'));
         $siteType = $this->_router->getDefaultSiteType();
     }
     $this->setTitle(sprintf(t('"%s" theme & style'), ucfirst($siteType)), false);
     $view = $this->loadView('overview.html');
     $view->assign(array('THEMES' => Theme::getAll(), 'CURRENT' => $this->_config->get('theme/' . $siteType . '_default'), 'SITE_TYPE' => $siteType));
     $view->assignHtml(array('CSRF' => $this->_input->createToken(true)));
     return $view->getOutput();
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:25,代码来源:index.php

示例3: create

 /**
  * Create a custom theme
  */
 public function create()
 {
     $form = new Form(array('id' => 'create-theme-form', 'labelWidth' => '20em', 'fieldsets' => array('form' => array(new TextInput(array('name' => 'name', 'required' => true, 'pattern' => '/^[\\w\\-]+$/', 'label' => Lang::get($this->_plugin . '.theme-create-name-label'))), new TextInput(array('name' => 'title', 'required' => true, 'label' => Lang::get($this->_plugin . '.theme-create-title-label'))), new SelectInput(array('name' => 'extends', 'invitation' => '-', 'options' => array_map(function ($theme) {
         return $theme->getTitle();
     }, Theme::getAll()), 'label' => Lang::get($this->_plugin . '.theme-create-extends-label'))), new TextInput(array('name' => 'version', 'required' => true, 'pattern' => '/^(\\d+\\.){2,3}\\d+$/', 'label' => Lang::get($this->_plugin . '.theme-create-version-label'), 'default' => '0.0.1')), new TextInput(array('name' => 'author', 'label' => Lang::get($this->_plugin . '.theme-create-author-label')))), 'submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.load(app.getUri("available-themes"), { selector : $("#admin-themes-select-tab")} );'));
     if (!$form->submitted()) {
         // Display the form
         return View::make(Theme::getSelected()->getView('dialogbox.tpl'), array('title' => Lang::get($this->_plugin . '.theme-create-title'), 'icon' => 'picture-o', 'page' => $form));
     } else {
         if ($form->check()) {
             $dir = THEMES_DIR . $form->getData('name') . '/';
             if (is_dir($dir)) {
                 $form->error('name', Lang::get($this->_plugin . '.theme-create-name-already-exists-error'));
                 return $form->response(Form::STATUS_CHECK_ERROR, Lang::get($this->_plugin . '.theme-create-name-already-exists-error'));
             }
             // The theme can be created
             try {
                 // Create the main directory
                 if (!mkdir($dir)) {
                     throw new \Exception('Impossible to create the directory ' . $dir);
                 }
                 // Create the directory views
                 if (!mkdir($dir . 'views')) {
                     throw new \Exception('Impossible to create the directory ' . $dir . 'views');
                 }
                 // Get the parent theme
                 $parent = null;
                 if ($form->getData('extends')) {
                     $parent = Theme::get($form->getData('extends'));
                 }
                 // Create the file manifest.json
                 $conf = array('title' => $form->getData('title'), 'version' => $form->getData('version'), 'author' => $form->getData('author'));
                 if ($parent) {
                     $conf['extends'] = $parent->getName();
                 }
                 if (file_put_contents($dir . Theme::MANIFEST_BASENAME, json_encode($conf, JSON_PRETTY_PRINT)) === false) {
                     throw new \Exception('Impossible to create the file ' . $dir . Theme::MANIFEST_BASENAME);
                 }
                 $theme = Theme::get($form->getData('name'));
                 if ($parent) {
                     // The theme extends another one, make a copy of the parent theme except manifest.json and views
                     foreach (glob($parent->getRootDir() . '*') as $element) {
                         if (!in_array(basename($element), array(Theme::MANIFEST_BASENAME, 'views'))) {
                             App::fs()->copy($element, $theme->getRootDir());
                         }
                     }
                 } else {
                     // Create the directory less
                     if (!mkdir($dir . 'less')) {
                         throw new \Exception('Impossible to create the directory ' . $dir . 'less');
                     }
                     // Create the file theme.less
                     if (!touch($theme->getBaseLessFile())) {
                         throw new \Exception('Impossible to create the file ' . $theme->getBaseLessFile());
                     }
                 }
                 return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.theme-create-success'));
             } catch (\Exception $e) {
                 if (is_dir($dir)) {
                     App::fs()->remove($dir);
                 }
                 return $form->response(Form::STATUS_ERROR, DEBUG_MODE ? $e->getMessage() : Lang::get($this->_plugin . '.theme-create-error'));
             }
         }
     }
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:69,代码来源:ThemeController.php

示例4: settingsSection

 /**
  * Allows the current user to edit account details, such as password and email.
  *
  * @return string
  */
 public function settingsSection()
 {
     if (!$this->_session->isLoggedIn()) {
         throw new Module_NoPermission();
     }
     $this->setTitle(t('Edit account settings'));
     // Gather user details
     $this->displayPageLinks();
     $user = $this->_session->getUser();
     if (!isset($user['theme'])) {
         $user['theme'] = null;
     }
     /**
      * Prepare form validation
      */
     $form = new View_Form('profile/settings.html', 'users');
     $form->addElement('users/passwd/current', null, t('Current password'), array(array($this, 'validatePassword')));
     $form->addElement('users/passwd/new', null, t('Password'), array(new Validator_Length(4, 32), new Validator_Confirm('users/passwd/conf', Validator_Confirm::_POST)), false);
     $form->addElement('users/hide_email', $user['hide_email'], t('Hide email'), new Validator_Bool());
     $form->addElement('users/theme', $user['theme'], t('Theme name'), new Validator_InArray(Theme::getAll()), false);
     try {
         // Add Email validation if needed
         $emailConf = $this->_input->post('users/email_confirm');
         if ($emailConf) {
             $form->addElement('users/email', $user['email'], t('Email'), array(new Validator_Email(), new Validator_Confirm($emailConf)));
         } else {
             throw new Exception();
         }
     } catch (Exception $e) {
         $form->assign(array('USERS' => array('EMAIL' => $user['email'])));
     }
     if ($form->hasInput() && $form->isValid()) {
         try {
             $fd = $form->getValues('users');
             if (empty($fd['theme'])) {
                 $fd['theme'] = null;
             }
             $fd['password'] = $fd['passwd']['new'];
             unset($fd['passwd']);
             $this->_ugmanager->editUser($this->_session->getUserId(), $fd);
             $this->_event->success(t('Updated Profile'));
             return zula_redirect($this->_router->makeUrl('users', 'profile', 'settings'));
         } catch (Exception $e) {
             $this->_event->error($e->getMessage());
         }
     }
     return $form->getOutput();
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:53,代码来源:profile.php

示例5: gestionThemes

 public function gestionThemes()
 {
     $this->load->model("Theme");
     $data['themes'] = Theme::getAll();
     $this->load->view("gestionThemes", $data);
 }
开发者ID:LaCongolexicomatisation,项目名称:CodeIgniter-3.0.3,代码行数:6,代码来源:activites.php


注:本文中的Theme::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。