當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::append方法代碼示例

本文整理匯總了PHP中Container::append方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::append方法的具體用法?PHP Container::append怎麽用?PHP Container::append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Container的用法示例。


在下文中一共展示了Container::append方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadLanguageSettings

 /**
  * Load language settings
  *
  * @access public
  * @param void
  * @throws DirDnxError If language dir does not exists
  * @throws FileDnxError If language settings file for this local settings
  *   does not exists in lanuage dir
  */
 private function loadLanguageSettings()
 {
     // Check dir...
     if (!is_dir($this->getLanguageDirPath())) {
         throw new DirDnxError($this->getLanguageDirPath());
     }
     // if
     // Get settings file path and include it
     $settings_file = $this->getLanguageDirPath() . '/' . $this->getLocale() . '.php';
     if (is_file($settings_file)) {
         include $settings_file;
     } else {
         throw new FileDnxError($settings_file, "Failed to find language settings file. Expected location: '{$settings_file}'.");
     }
     // if
     // Clear langs
     $this->langs->clear();
     // Get langs dir
     $langs_dir = $this->getLanguageDirPath() . '/' . $this->getLocale();
     if (is_dir($langs_dir)) {
         $files = get_files($langs_dir, 'php');
         // Loop through files and add langs
         if (is_array($files)) {
             sort($files);
             foreach ($files as $file) {
                 $langs = (include $file);
                 if (is_array($langs)) {
                     $this->langs->append($langs);
                 }
             }
             // foreach
         }
         // if
         //Load plugin langs after fengoffice default langs
         $plugins_dir = $langs_dir . '/plugins';
         if (is_dir($plugins_dir)) {
             sort($files);
             $files = get_files($plugins_dir, 'php');
             // Loop through files and add langs
             if (is_array($files)) {
                 foreach ($files as $file) {
                     $langs = (include $file);
                     if (is_array($langs)) {
                         $this->langs->append($langs);
                     }
                 }
                 // foreach
             }
             // if
         }
         // if
     } else {
         throw new DirDnxError($langs_dir);
     }
     // if
     // Done!
     return true;
 }
開發者ID:abhinay100,項目名稱:fengoffice_app,代碼行數:67,代碼來源:Localization.class.php

示例2: loadLanguageFiles

 /**
 * loadLanguageFiles
 *
 * @access private
 * @param String $dir Select files from this dir
 * @param String $ext Select files with given extension
 * @return string
 */
 private function loadLanguageFiles($dir, $ext = 'php') {
   trace(__FILE__,"loadLanguageFiles($dir, $ext):begin");
   $files = get_files($dir, $ext);
     
   // Loop through files and add langs
   if (is_array($files)) {
     foreach ($files as $file) {
       //try {
         $langs = include_once $file;
       //} catch (Exception $e) {}
       if (is_array($langs)) {
         $this->langs->append($langs);
       } // if
     } // foreach
   } // if
 }
開發者ID:rjv,項目名稱:Project-Pier,代碼行數:24,代碼來源:Localization.class.php

示例3: loadLanguageSettings

 /**
  * Load language settings
  *
  * @access public
  * @param void
  * @throws DirDnxError If language dir does not exists
  * @throws FileDnxError If language settings file for this local settings
  * does not exists in lanuage dir
  */
 private function loadLanguageSettings()
 {
     // Check dir...
     if (!is_dir($this->getLanguageDirPath())) {
         throw new DirDnxError($this->getLanguageDirPath());
     }
     // if
     // Get settings file path and include it
     $settings_file = $this->getLanguageDirPath() . '/' . $this->getLocale() . '.php';
     if (is_file($settings_file)) {
         include $settings_file;
     } else {
         $base_settings = $this->getLanguageDirPath() . '/default.php';
         if (is_file($base_settings)) {
             include $base_settings;
         } else {
             throw new FileDnxError($settings_file, "Failed to find language settings file. Expected location: '{$settings_file}'.");
         }
     }
     // Clear langs
     $this->langs->clear();
     // Get langs dir - ONLY PHP langs !
     $langs_dir = $this->getLanguageDirPath() . '/' . $this->getLocale();
     if (is_dir($langs_dir)) {
         $files = get_files($langs_dir, 'php');
         // Loop through files and add langs
         if (is_array($files)) {
             sort($files);
             foreach ($files as $file) {
                 $langs = (include $file);
                 if (is_array($langs)) {
                     $this->langs->append($langs);
                 }
             }
         }
         // Plugins - Only PHP langs - include all installed plugins, no matter if they they have not been activated
         $plugins = Plugins::instance()->getAll();
         foreach ($plugins as $plugin) {
             /* @var $plugin Plugin */
             $plg_dir = $plugin->getLanguagePath() . "/" . $this->getLocale();
             if (is_dir($plg_dir)) {
                 $files = get_files($plg_dir, 'php');
                 // Loop through files and add langs
                 if (is_array($files)) {
                     sort($files);
                     foreach ($files as $file) {
                         $langs = (include $file);
                         if (is_array($langs)) {
                             $this->langs->append($langs);
                         }
                     }
                 }
             }
         }
     } else {
         throw new DirDnxError($langs_dir);
     }
     // if
     // Done!
     return true;
 }
開發者ID:abhinay100,項目名稱:fengoffice_app,代碼行數:70,代碼來源:Localization.class.php


注:本文中的Container::append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。