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


PHP Language::setWorkingLanguage方法代码示例

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


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

示例1: setLanguage

 /**
  * @param string $language
  *
  * @throws Exception If the provided language is not valid
  */
 public function setLanguage($language)
 {
     // get the possible languages
     $possibleLanguages = BackendLanguage::getWorkingLanguages();
     // validate
     if (!array_key_exists($language, $possibleLanguages)) {
         throw new Exception('Language invalid.');
     }
     // set working language
     BackendLanguage::setWorkingLanguage($language);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:16,代码来源:Ajax.php

示例2: setWorkingLanguage

 /**
  * Set the current working language
  *
  * @param string $language The language to use, if not provided we will use the working language.
  */
 public static function setWorkingLanguage($language)
 {
     trigger_error('Backend\\Core\\Engine\\Language is deprecated.
          It has been moved to Backend\\Core\\Language\\Language', E_USER_DEPRECATED);
     parent::setWorkingLanguage($language);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:11,代码来源:Language.php

示例3: processRegularRequest

 /**
  * Process a regular request
  *
  * @param string $module The requested module.
  * @param string $action The requested action.
  * @param string $language The requested language.
  */
 private function processRegularRequest($module, $action, $language)
 {
     // the person isn't logged in? or the module doesn't require authentication
     if (!Authentication::isLoggedIn() && !Authentication::isAllowedModule($module)) {
         // redirect to login
         $this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication?querystring=' . rawurlencode('/' . $this->getQueryString()));
     } elseif (Authentication::isLoggedIn() && !Authentication::isAllowedModule($module)) {
         // the person is logged in, but doesn't have access to our action
         // if the module is the dashboard redirect to the first allowed module
         if ($module == 'Dashboard') {
             // require navigation-file
             require_once Navigation::getCacheDirectory() . 'navigation.php';
             // loop the navigation to find the first allowed module
             foreach ($navigation as $value) {
                 // split up chunks
                 list($module, $action) = explode('/', $value['url']);
                 // user allowed?
                 if (Authentication::isAllowedModule($module)) {
                     // redirect to the page
                     $this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $value['url']);
                 } else {
                     if (array_key_exists('children', $value)) {
                         foreach ($value['children'] as $subItem) {
                             // split up chunks
                             list($module, $action) = explode('/', $subItem['url']);
                             // user allowed?
                             if (Authentication::isAllowedModule($module)) {
                                 $finder = new Finder();
                                 $files = $finder->files()->name('*.php')->in(BACKEND_MODULES_PATH . '/' . \SpoonFilter::toCamelCase($module) . '/Actions');
                                 foreach ($files as $file) {
                                     $moduleAction = mb_substr($file->getFilename(), 0, -4);
                                     if (Authentication::isAllowedAction($moduleAction, $module)) {
                                         $this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $module . '/' . $moduleAction);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // the user doesn't have access, redirect to error page
         $this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . rawurlencode('/' . $this->getQueryString()), 307);
     } elseif (!Authentication::isAllowedAction($action, $module)) {
         // the user hasn't access, redirect to error page
         $this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . rawurlencode('/' . $this->getQueryString()), 307);
     } else {
         // set the working language, this is not the interface language
         BackendLanguage::setWorkingLanguage($language);
         $this->setLocale();
         $this->setModule($module);
         $this->setAction($action);
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:61,代码来源:Url.php

示例4: copy


//.........这里部分代码省略.........
             // delete meta records
             if (!empty($metaIDs)) {
                 $db->delete('meta', 'id IN (' . implode(',', $metaIDs) . ')');
             }
             // delete blocks and their revisions
             if (!empty($revisionIDs)) {
                 $db->delete('pages_blocks', 'revision_id IN (' . implode(',', $revisionIDs) . ')');
             }
             // delete page and the revisions
             if (!empty($revisionIDs)) {
                 $db->delete('pages', 'revision_id IN (' . implode(',', $revisionIDs) . ')');
             }
         }
     }
     // delete search indexes
     $db->delete('search_index', 'module = ? AND language = ?', array('pages', $to));
     // get all active pages
     $ids = BackendModel::getContainer()->get('database')->getColumn('SELECT id
          FROM pages AS i
          WHERE i.language = ? AND i.status = ?', array($from, 'active'));
     // loop
     foreach ($ids as $id) {
         // get data
         $sourceData = self::get($id, null, $from);
         // get and build meta
         $meta = $db->getRecord('SELECT *
              FROM meta
              WHERE id = ?', array($sourceData['meta_id']));
         // remove id
         unset($meta['id']);
         // init page
         $page = array();
         // build page
         $page['id'] = $sourceData['id'];
         $page['user_id'] = BackendAuthentication::getUser()->getUserId();
         $page['parent_id'] = $sourceData['parent_id'];
         $page['template_id'] = $sourceData['template_id'];
         $page['meta_id'] = (int) $db->insert('meta', $meta);
         $page['language'] = $to;
         $page['type'] = $sourceData['type'];
         $page['title'] = $sourceData['title'];
         $page['navigation_title'] = $sourceData['navigation_title'];
         $page['navigation_title_overwrite'] = $sourceData['navigation_title_overwrite'];
         $page['hidden'] = $sourceData['hidden'];
         $page['status'] = 'active';
         $page['publish_on'] = BackendModel::getUTCDate();
         $page['created_on'] = BackendModel::getUTCDate();
         $page['edited_on'] = BackendModel::getUTCDate();
         $page['allow_move'] = $sourceData['allow_move'];
         $page['allow_children'] = $sourceData['allow_children'];
         $page['allow_edit'] = $sourceData['allow_edit'];
         $page['allow_delete'] = $sourceData['allow_delete'];
         $page['sequence'] = $sourceData['sequence'];
         $page['data'] = $sourceData['data'] !== null ? serialize($sourceData['data']) : null;
         // insert page, store the id, we need it when building the blocks
         $revisionId = self::insert($page);
         // init var
         $blocks = array();
         // get the blocks
         $sourceBlocks = self::getBlocks($id, null, $from);
         // loop blocks
         foreach ($sourceBlocks as $sourceBlock) {
             // build block
             $block = $sourceBlock;
             $block['revision_id'] = $revisionId;
             $block['created_on'] = BackendModel::getUTCDate();
             $block['edited_on'] = BackendModel::getUTCDate();
             if (in_array($block['extra_id'], $contentBlockOldIds)) {
                 $block['extra_id'] = $contentBlockIds[$block['extra_id']];
             }
             // add block
             $blocks[] = $block;
         }
         // insert the blocks
         self::insertBlocks($blocks);
         // init var
         $text = '';
         // build search-text
         foreach ($blocks as $block) {
             $text .= ' ' . $block['html'];
         }
         // add
         BackendSearchModel::saveIndex('Pages', (int) $page['id'], array('title' => $page['title'], 'text' => $text), $to);
         // get tags
         $tags = BackendTagsModel::getTags('pages', $id, 'string', $from);
         // save tags
         if ($tags != '') {
             $saveWorkingLanguage = BL::getWorkingLanguage();
             // If we don't set the working language to the target language,
             // BackendTagsModel::getURL() will use the current working
             // language, possibly causing unnecessary '-2' suffixes in
             // tags.url
             BL::setWorkingLanguage($to);
             BackendTagsModel::saveTags($page['id'], $tags, 'pages', $to);
             BL::setWorkingLanguage($saveWorkingLanguage);
         }
     }
     // build cache
     self::buildCache($to);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:101,代码来源:Model.php

示例5: setLanguage

 /**
  * Set language
  *
  * @param string $value The language to load.
  *
  * @throws Exception
  */
 public function setLanguage($value)
 {
     // get the possible languages
     $possibleLanguages = BackendLanguage::getWorkingLanguages();
     // validate
     if (!array_key_exists($value, $possibleLanguages)) {
         throw new Exception('Invalid language.');
     }
     // set property
     $this->language = $value;
     // set the locale (we need this for the labels)
     BackendLanguage::setLocale($this->language);
     // set working language
     BackendLanguage::setWorkingLanguage($this->language);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:22,代码来源:Cronjob.php


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