示例#1
0
文件: I18nInfo.php 项目: jivoo/jivoo
 /**
  * {@inheritdoc}
  */
 public function before()
 {
     $this->view->data->title = tr('I18n');
     if (isset($this->m->Extensions)) {
         $this->viewData['extensions'] = $this->m->Extensions->listAllExtensions();
     } else {
         $this->viewData['extensions'] = null;
     }
     if (isset($this->m->Themes)) {
         $this->viewData['themes'] = $this->m->Themes->listAllThemes();
     } else {
         $this->viewData['themes'] = null;
     }
     $this->viewData['dir'] = $this->p('app/languages');
     $this->viewData['project'] = $this->app->name . ' ' . $this->app->version;
     $this->rootDir = $this->p('app');
     if (isset($this->request->query['scope'])) {
         $scope = $this->request->query['scope'];
         if ($scope === 'lib') {
             $this->scope = 'lib';
             $this->viewData['dir'] = $this->p('Core/languages');
             $this->viewData['project'] = 'Jivoo ' . \Jivoo\VERSION;
             $this->rootDir = \Jivoo\PATH;
         } else {
             if (strpos($scope, '-') !== false) {
                 $scope = explode('-', $scope);
                 if (isset($this->m->Extensions) and $scope[0] === 'extension') {
                     if (isset($this->viewData['extensions'][$scope[1]])) {
                         $this->scope = 'extension';
                         $this->extension = $this->viewData['extensions'][$scope[1]];
                         $this->viewData['dir'] = $this->extension->p($this->app, 'languages');
                         $this->viewData['project'] = $this->extension->name . ' ' . $this->extension->version;
                         $this->rootDir = $this->extension->p($this->app, '');
                     }
                 } else {
                     if (isset($this->m->Themes) and $scope[0] === 'theme') {
                         if (isset($this->viewData['themes'][$scope[1]])) {
                             $this->scope = 'theme';
                             $this->theme = $this->viewData['themes'][$scope[1]];
                             $this->viewData['dir'] = $this->theme->p($this->app, 'languages');
                             $this->viewData['project'] = $this->theme->name . ' ' . $this->theme->version;
                             $this->rootDir = $this->theme->p($this->app, '');
                         }
                     }
                 }
             }
         }
     }
     $this->viewData['dirExists'] = Utilities::dirExists($this->viewData['dir']);
     if ($this->viewData['dirExists']) {
         $this->viewData['languages'] = $this->findLanguages($this->viewData['dir']);
     }
     return parent::before();
 }
示例#2
0
文件: ThemeInfo.php 项目: jivoo/jivoo
 /**
  * {@inheritdoc}
  */
 public function __isset($property)
 {
     switch ($property) {
         case 'extend':
         case 'zones':
             return true;
     }
     return parent::__isset($property);
 }
示例#3
0
文件: Assets.php 项目: jivoo/jivoo
 /**
  * Handle "resources" extension feature.
  * @param ExtensionInfo $info Extension information.
  */
 public function handleResources(ExtensionInfo $info)
 {
     foreach ($info->resources as $resource => $resInfo) {
         $dependencies = isset($resInfo['dependencies']) ? $resInfo['dependencies'] : array();
         $condition = isset($resInfo['condition']) ? $resInfo['condition'] : null;
         if (isset($resInfo['cdn']) and $this->config['useCdnIfAvailable']) {
             $file = $info->replaceVariables($resInfo['cdn']);
         } else {
             $file = $info->getAsset($this, $info->replaceVariables($resInfo['file']));
         }
         $this->m->View->resources->provide($resource, $file, $dependencies, $condition);
     }
 }
示例#4
0
 /**
  * Handle "include" feature.
  * @param ExtensionInfo $info Extension information.
  */
 public function handleInclude(ExtensionInfo $info)
 {
     if (is_string($info->include)) {
         require $info->p($this->app, $info->include);
     } else {
         foreach ($info->include as $file) {
             require $info->p($this->app, $file);
         }
     }
 }