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


PHP helper::ls方法代码示例

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


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

示例1: setModelFile

 /**
  * Set the model file of one module. If there's an extension file, merge it with the main model file.
  * 
  * @param   string $moduleName the module name
  * @static
  * @access  public
  * @return  string the model file
  */
 public static function setModelFile($moduleName)
 {
     global $app;
     /* Set the main model file and extension and hook pathes and files. */
     $mainModelFile = $app->getModulePath($moduleName) . 'model.php';
     $modelExtPath = $app->getModuleExtPath($moduleName, 'model');
     $modelHookPath = $modelExtPath . 'hook/';
     $extFiles = helper::ls($modelExtPath, '.php');
     $hookFiles = helper::ls($modelHookPath, '.php');
     /* If no extension files and no hook files, return the main file directly. */
     if (empty($extFiles) and empty($hookFiles)) {
         return $mainModelFile;
     }
     /* Else, judge whether needed update or not .*/
     $needUpdate = false;
     $mergedModelFile = $app->getTmpRoot() . 'model' . $app->getPathFix() . $moduleName . '.php';
     $lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
     while (!$needUpdate) {
         foreach ($extFiles as $extFile) {
             if (filemtime($extFile) > $lastTime) {
                 break 2;
             }
         }
         foreach ($hookFiles as $hookFile) {
             if (filemtime($hookFile) > $lastTime) {
                 break 2;
             }
         }
         if (is_dir($modelExtPath) and filemtime($modelExtPath) > $lastTime) {
             break;
         }
         if (is_dir($modelHookPath) and filemtime($modelHookPath) > $lastTime) {
             break;
         }
         if (filemtime($mainModelFile) > $lastTime) {
             break;
         }
         return $mergedModelFile;
     }
     /* If loaded zend opcache module, turn off cache when create tmp model file to avoid the conflics. */
     if (extension_loaded('Zend OPcache')) {
         ini_set('opcache.enable', 0);
     }
     /* Update the cache file. */
     $modelClass = $moduleName . 'Model';
     $extModelClass = 'ext' . $modelClass;
     $extTmpModelClass = 'tmpExt' . $modelClass;
     $modelLines = "<?php\n";
     $modelLines .= "helper::import('{$mainModelFile}');\n";
     $modelLines .= "class {$extTmpModelClass} extends {$modelClass} \n{\n";
     /* Cycle all the extension files. */
     foreach ($extFiles as $extFile) {
         $extLines = self::removeTagsOfPHP($extFile);
         $modelLines .= $extLines . "\n";
     }
     /* Create the merged model file and import it. */
     $replaceMark = '//**//';
     // This mark is for replacing code using.
     $modelLines .= "{$replaceMark}\n}";
     /* Unset conflic function for model. */
     preg_match_all('/.* function\\s+(\\w+)\\s*\\(.*\\)[^\\{]*\\{/Ui', $modelLines, $functions);
     $functions = $functions[1];
     $conflics = array_count_values($functions);
     foreach ($conflics as $functionName => $count) {
         if ($count <= 1) {
             unset($conflics[$functionName]);
         }
     }
     if ($conflics) {
         $modelLines = explode("\n", $modelLines);
         $startDel = false;
         foreach ($modelLines as $line => $code) {
             if ($startDel and preg_match('/.* function\\s+(\\w+)\\s*\\(.*\\)/Ui', $code)) {
                 $startDel = false;
             }
             if ($startDel) {
                 unset($modelLines[$line]);
             } else {
                 foreach ($conflics as $functionName => $count) {
                     if ($count <= 1) {
                         continue;
                     }
                     if (preg_match('/.* function\\s+' . $functionName . '\\s*\\(.*\\)/Ui', $code)) {
                         $conflics[$functionName] = $count - 1;
                         $startDel = true;
                         unset($modelLines[$line]);
                     }
                 }
             }
         }
         $modelLines = join("\n", $modelLines);
     }
//.........这里部分代码省略.........
开发者ID:xianglongzhang,项目名称:zentaopms,代码行数:101,代码来源:helper.class.php

示例2: loadLang

 /**
  * Load lang and return it as the global lang object.
  * 
  * @param   string $moduleName     the module name
  * @param   string $appName        the app name
  * @access  public
  * @return  bool|ojbect the lang object or false.
  */
 public function loadLang($moduleName, $appName = '')
 {
     if ($moduleName == 'common' and $appName == '') {
         $this->loadLang('common', 'sys');
     }
     $modulePath = $this->getModulePath($appName, $moduleName);
     $mainLangFile = $modulePath . 'lang' . DS . $this->clientLang . '.php';
     $extLangPath = $this->getModuleExtPath($appName, $moduleName, 'lang');
     $extLangFiles = helper::ls($extLangPath . $this->clientLang, '.php');
     /* Set the files to includ. */
     if (!is_file($mainLangFile)) {
         if (empty($extLangFiles)) {
             return false;
         }
         // also no extension file.
         $langFiles = $extLangFiles;
     } else {
         $langFiles = array_merge(array($mainLangFile), $extLangFiles);
     }
     global $lang;
     if (!is_object($lang)) {
         $lang = new language();
     }
     static $loadedLangs = array();
     foreach ($langFiles as $langFile) {
         if (in_array($langFile, $loadedLangs)) {
             continue;
         }
         include $langFile;
         $loadedLangs[] = $langFile;
     }
     /* Merge from the db lang. */
     if (empty($appName)) {
         $appName = $this->appName;
     }
     if (isset($lang->db->custom[$appName][$moduleName])) {
         foreach ($lang->db->custom[$appName][$moduleName] as $section => $fields) {
             foreach ($fields as $key => $value) {
                 if ($moduleName == 'common') {
                     unset($lang->{$section}[$key]);
                     $lang->{$section}[$key] = $value;
                 } else {
                     unset($lang->{$moduleName}->{$section}[$key]);
                     $lang->{$moduleName}->{$section}[$key] = $value;
                 }
             }
         }
     }
     $this->lang = $lang;
     return $lang;
 }
开发者ID:leowh,项目名称:colla,代码行数:59,代码来源:router.class.php

示例3: setModelFile

 /**
  * Set the model file of one module. If there's an extension file, merge it with the main model file.
  * 
  * @param   string $moduleName the module name
  * @static
  * @access  public
  * @return  string the model file
  */
 public static function setModelFile($moduleName)
 {
     global $app;
     /* Set the main model file and extension path and files. */
     $mainModelFile = $app->getModulePath($moduleName) . 'model.php';
     $modelExtPaths = $app->getModuleExtPath($moduleName, 'model');
     $extFiles = array();
     foreach ($modelExtPaths as $modelExtPath) {
         $extFiles = array_merge($extFiles, helper::ls($modelExtPath, '.php'));
     }
     /* If no extension file, return the main file directly. */
     if (empty($extFiles)) {
         return $mainModelFile;
     }
     /* Else, judge whether needed update or not .*/
     $mergedModelDir = $app->getTmpRoot() . 'model' . DS . $app->siteCode[0] . DS . $app->siteCode . DS;
     $mergedModelFile = $mergedModelDir . $app->siteCode . '.' . $moduleName . '.php';
     $needUpdate = false;
     $lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
     if (!is_dir($mergedModelDir)) {
         mkdir($mergedModelDir, 0755, true);
     }
     foreach ($extFiles as $extFile) {
         if (filemtime($extFile) > $lastTime) {
             $needUpdate = true;
             break;
         }
     }
     if (filemtime($mainModelFile) > $lastTime) {
         $needUpdate = true;
     }
     /* If need'nt update, return the cache file. */
     if (!$needUpdate) {
         return $mergedModelFile;
     }
     /* Update the cache file. */
     if ($needUpdate) {
         $modelClass = $moduleName . 'Model';
         $extModelClass = 'ext' . $modelClass;
         $modelLines = "<?php\n";
         $modelLines .= "helper::import('{$mainModelFile}');\n";
         $modelLines .= "class {$extModelClass} extends {$modelClass} \n{\n";
         /* Cycle all the extension files. */
         foreach ($extFiles as $extFile) {
             $extLines = trim(file_get_contents($extFile));
             if (strpos($extLines, '<?php') !== false) {
                 $extLines = ltrim($extLines, "<?php");
             }
             if (strpos($extLines, "?>") !== false) {
                 $extLines = rtrim($extLines, '?>');
             }
             $modelLines .= $extLines . "\n";
         }
         /* Create the merged model file. */
         $modelLines .= "}";
         /* Unset conflic function for model. */
         preg_match_all('/.* function\\s+(\\w+)\\s*\\(.*\\)[^\\{]*\\{/Ui', $modelLines, $functions);
         $functions = $functions[1];
         $conflics = array_count_values($functions);
         foreach ($conflics as $functionName => $count) {
             if ($count <= 1) {
                 unset($conflics[$functionName]);
             }
         }
         if ($conflics) {
             $modelLines = explode("\n", $modelLines);
             $startDel = false;
             foreach ($modelLines as $line => $code) {
                 if ($startDel and preg_match('/.* function\\s+(\\w+)\\s*\\(.*\\)/Ui', $code)) {
                     $startDel = false;
                 }
                 if ($startDel) {
                     unset($modelLines[$line]);
                 } else {
                     foreach ($conflics as $functionName => $count) {
                         if ($count <= 1) {
                             continue;
                         }
                         if (preg_match('/.* function\\s+' . $functionName . '\\s*\\(.*\\)/Ui', $code)) {
                             $conflics[$functionName] = $count - 1;
                             $startDel = true;
                             unset($modelLines[$line]);
                         }
                     }
                 }
             }
             $modelLines = join("\n", $modelLines);
         }
         file_put_contents($mergedModelFile, $modelLines);
         return $mergedModelFile;
     }
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:100,代码来源:helper.class.php

示例4: loadLang

 /**
  * Load lang and return it as the global lang object.
  * 
  * @param   string $moduleName     the module name
  * @access  public
  * @return  bool|ojbect the lang object or false.
  */
 public function loadLang($moduleName)
 {
     $modulePath = $this->getModulePath($moduleName);
     $mainLangFile = $modulePath . 'lang' . $this->pathFix . $this->clientLang . '.php';
     $extLangPath = $this->getModuleExtPath($moduleName, 'lang');
     $extLangFiles = helper::ls($extLangPath . $this->clientLang, '.php');
     /* Set the files to includ. */
     if (!is_file($mainLangFile)) {
         if (empty($extLangFiles)) {
             return false;
         }
         // also no extension file.
         $langFiles = $extLangFiles;
     } else {
         $langFiles = array_merge(array($mainLangFile), $extLangFiles);
     }
     global $lang;
     if (!is_object($lang)) {
         $lang = new language();
     }
     /* Set productcommon and projectcommon for flow. */
     if ($moduleName == 'common') {
         $productproject = false;
         if ($this->dbh) {
             $productproject = $this->dbh->query('SELECT value FROM' . TABLE_CONFIG . "WHERE `owner`='system' AND `module`='custom' AND `key`='productproject'")->fetch();
         }
         $productcommon = $projectcommon = 0;
         if ($productproject) {
             $productproject = $productproject->value;
             list($productcommon, $projectcommon) = explode('_', $productproject);
         }
         $lang->productcommon = isset($this->config->productcommonList[$this->clientLang][(int) $productcommon]) ? $this->config->productcommonList[$this->clientLang][(int) $productcommon] : $this->config->productcommonList['zh-cn'][0];
         $lang->projectcommon = isset($this->config->projectcommonList[$this->clientLang][(int) $projectcommon]) ? $this->config->projectcommonList[$this->clientLang][(int) $projectcommon] : $this->config->projectcommonList['zh-cn'][0];
     }
     static $loadedLangs = array();
     foreach ($langFiles as $langFile) {
         if (in_array($langFile, $loadedLangs)) {
             continue;
         }
         include $langFile;
         $loadedLangs[] = $langFile;
     }
     /* Merge from the db lang. */
     if ($moduleName != 'common' and isset($lang->db->custom[$moduleName])) {
         foreach ($lang->db->custom[$moduleName] as $section => $fields) {
             foreach ($fields as $key => $value) {
                 unset($lang->{$moduleName}->{$section}[$key]);
                 $lang->{$moduleName}->{$section}[$key] = $value;
             }
         }
     }
     $this->lang = $lang;
     return $lang;
 }
开发者ID:Wen1750686723,项目名称:zentaopms,代码行数:61,代码来源:router.class.php

示例5: loadLang

 /**
  * Load lang and return it as the global lang object.
  * 
  * @param   string $moduleName     the module name
  * @access  public
  * @return  bool|ojbect the lang object or false.
  */
 public function loadLang($moduleName)
 {
     $modulePath = $this->getModulePath($moduleName);
     $mainLangFile = $modulePath . 'lang' . $this->pathFix . $this->clientLang . '.php';
     $extLangPath = $this->getModuleExtPath($moduleName, 'lang');
     $extLangFiles = helper::ls($extLangPath . $this->clientLang, '.php');
     /* Set the files to includ. */
     if (!is_file($mainLangFile)) {
         if (empty($extLangFiles)) {
             return false;
         }
         // also no extension file.
         $langFiles = $extLangFiles;
     } else {
         $langFiles = array_merge(array($mainLangFile), $extLangFiles);
     }
     global $lang;
     if (!is_object($lang)) {
         $lang = new language();
     }
     static $loadedLangs = array();
     foreach ($langFiles as $langFile) {
         if (in_array($langFile, $loadedLangs)) {
             continue;
         }
         include $langFile;
         $loadedLangs[] = $langFile;
     }
     $this->lang = $lang;
     return $lang;
 }
开发者ID:take7yo,项目名称:zentaophp,代码行数:38,代码来源:router.class.php

示例6: setModelFile

 /**
  * Set the model file of one module. If there's an extension file, merge it with the main model file.
  * 
  * @param   string $moduleName the module name
  * @static
  * @access  public
  * @return  string the model file
  */
 public static function setModelFile($moduleName)
 {
     global $app;
     /* Set the main model file and extension and hook pathes and files. */
     $mainModelFile = $app->getModulePath($moduleName) . 'model.php';
     $modelExtPath = $app->getModuleExtPath($moduleName, 'model');
     $modelHookPath = $modelExtPath . 'hook/';
     $extFiles = helper::ls($modelExtPath, '.php');
     $hookFiles = helper::ls($modelHookPath, '.php');
     /* If no extension files and no hook files, return the main file directly. */
     if (empty($extFiles) and empty($hookFiles)) {
         return $mainModelFile;
     }
     /* Else, judge whether needed update or not .*/
     $needUpdate = false;
     $mergedModelFile = $app->getTmpRoot() . 'model' . $app->getPathFix() . $moduleName . '.php';
     $lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
     while (!$needUpdate) {
         foreach ($extFiles as $extFile) {
             if (filemtime($extFile) > $lastTime) {
                 break 2;
             }
         }
         foreach ($hookFiles as $hookFile) {
             if (filemtime($hookFile) > $lastTime) {
                 break 2;
             }
         }
         if (is_dir($modelExtPath) and filemtime($modelExtPath) > $lastTime) {
             break;
         }
         if (is_dir($modelHookPath) and filemtime($modelHookPath) > $lastTime) {
             break;
         }
         if (filemtime($mainModelFile) > $lastTime) {
             break;
         }
         return $mergedModelFile;
     }
     /* Update the cache file. */
     $modelClass = $moduleName . 'Model';
     $extModelClass = 'ext' . $modelClass;
     $extTmpModelClass = 'tmpExt' . $modelClass;
     $modelLines = "<?php\n";
     $modelLines .= "helper::import('{$mainModelFile}');\n";
     $modelLines .= "class {$extTmpModelClass} extends {$modelClass} \n{\n";
     /* Cycle all the extension files. */
     foreach ($extFiles as $extFile) {
         $extLines = self::removeTagsOfPHP($extFile);
         $modelLines .= $extLines . "\n";
     }
     /* Create the merged model file and import it. */
     $replaceMark = '//**//';
     // This mark is for replacing code using.
     $modelLines .= "{$replaceMark}\n}";
     if (!@file_put_contents($mergedModelFile, $modelLines)) {
         die("ERROR: {$mergedModelFile} not writable, please make sur the " . dirname($mergedModelFile) . ' directory exists and writable');
     }
     if (!class_exists($extTmpModelClass)) {
         include $mergedModelFile;
     }
     /* Get hook codes need to merge. */
     $hookCodes = array();
     foreach ($hookFiles as $hookFile) {
         $fileName = baseName($hookFile);
         list($method) = explode('.', $fileName);
         $hookCodes[$method][] = self::removeTagsOfPHP($hookFile);
     }
     /* Cycle the hook methods and merge hook codes. */
     $hookedMethods = array_keys($hookCodes);
     $mainModelCodes = file($mainModelFile);
     $mergedModelCodes = file($mergedModelFile);
     foreach ($hookedMethods as $method) {
         /* Reflection the hooked method to get it's defined position. */
         $methodRelfection = new reflectionMethod($extTmpModelClass, $method);
         $definedFile = $methodRelfection->getFileName();
         $startLine = $methodRelfection->getStartLine() . ' ';
         $endLine = $methodRelfection->getEndLine() . ' ';
         /* Merge hook codes. */
         $oldCodes = $definedFile == $mergedModelFile ? $mergedModelCodes : $mainModelCodes;
         $oldCodes = join("", array_slice($oldCodes, $startLine - 1, $endLine - $startLine + 1));
         $openBrace = strpos($oldCodes, '{');
         $newCodes = substr($oldCodes, 0, $openBrace + 1) . "\n" . join("\n", $hookCodes[$method]) . substr($oldCodes, $openBrace + 1);
         /* Replace it. */
         if ($definedFile == $mergedModelFile) {
             $modelLines = str_replace($oldCodes, $newCodes, $modelLines);
         } else {
             $modelLines = str_replace($replaceMark, $newCodes . "\n{$replaceMark}", $modelLines);
         }
     }
     /* Save it. */
     $modelLines = str_replace($extTmpModelClass, $extModelClass, $modelLines);
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:zentaoms,代码行数:101,代码来源:helper.class.php

示例7: setModelFile

 /**
  * Set the model file of one module. If there's an extension file, merge it with the main model file.
  * 
  * @param   string $moduleName the module name
  * @static
  * @access  public
  * @return  string the model file
  */
 public static function setModelFile($moduleName)
 {
     global $app;
     /* Set the main model file and extension path and files. */
     $mainModelFile = $app->getModulePath($moduleName) . 'model.php';
     $modelExtPath = $app->getModuleExtPath($moduleName, 'model');
     $extFiles = helper::ls($modelExtPath, '.php');
     /* If no extension file, return the main file directly. */
     if (empty($extFiles)) {
         return $mainModelFile;
     }
     /* Else, judge whether needed update or not .*/
     $mergedModelFile = $app->getTmpRoot() . 'model' . $app->getPathFix() . $moduleName . '.php';
     $needUpdate = false;
     $lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
     foreach ($extFiles as $extFile) {
         if (filemtime($extFile) > $lastTime) {
             $needUpdate = true;
             break;
         }
     }
     if (filemtime($mainModelFile) > $lastTime) {
         $needUpdate = true;
     }
     /* If need'nt update, return the cache file. */
     if (!$needUpdate) {
         return $mergedModelFile;
     }
     /* Update the cache file. */
     if ($needUpdate) {
         $modelClass = $moduleName . 'Model';
         $extModelClass = 'ext' . $modelClass;
         $modelLines = trim(file_get_contents($mainModelFile));
         $modelLines = rtrim($modelLines, '?>');
         // To make sure the last end tag is removed.
         $modelLines .= "class {$extModelClass} extends {$modelClass} {\n";
         /* Cycle all the extension files. */
         foreach ($extFiles as $extFile) {
             $extLines = trim(file_get_contents($extFile));
             if (strpos($extLines, '<?php') !== false) {
                 $extLines = ltrim($extLines, '<?php');
             }
             if (strpos($extLines, '?>') !== false) {
                 $extLines = rtrim($extLines, '?>');
             }
             $modelLines .= $extLines . "\n";
         }
         /* Create the merged model file. */
         $modelLines .= "}";
         file_put_contents($mergedModelFile, $modelLines);
         return $mergedModelFile;
     }
 }
开发者ID:take7yo,项目名称:zentaophp,代码行数:61,代码来源:helper.class.php

示例8: setModelFile

 /**
  * Set the model file of one module. If there's an extension file, merge it with the main model file.
  * 
  * @param   string $moduleName the module name
  * @static
  * @access  public
  * @return  string the model file
  */
 public static function setModelFile($moduleName)
 {
     global $app;
     /* Set the main model file and extension path and files. */
     $mainModelFile = $app->getModulePath($moduleName) . 'model.php';
     $modelExtPaths = $app->getModuleExtPath($moduleName, 'model');
     $extFiles = array();
     foreach ($modelExtPaths as $modelExtPath) {
         $extFiles = array_merge($extFiles, helper::ls($modelExtPath, '.php'));
     }
     /* If no extension file, return the main file directly. */
     if (empty($extFiles)) {
         return $mainModelFile;
     }
     /* Else, judge whether needed update or not .*/
     $mergedModelDir = $app->getTmpRoot() . 'model' . DS . $app->siteCode[0] . DS . $app->siteCode . DS;
     $mergedModelFile = $mergedModelDir . $app->siteCode . '.' . $moduleName . '.php';
     $needUpdate = false;
     $lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
     if (!is_dir($mergedModelDir)) {
         mkdir($mergedModelDir, 0755, true);
     }
     foreach ($extFiles as $extFile) {
         if (filemtime($extFile) > $lastTime) {
             $needUpdate = true;
             break;
         }
     }
     if (filemtime($mainModelFile) > $lastTime) {
         $needUpdate = true;
     }
     /* If need'nt update, return the cache file. */
     if (!$needUpdate) {
         return $mergedModelFile;
     }
     /* Update the cache file. */
     if ($needUpdate) {
         $modelClass = $moduleName . 'Model';
         $extModelClass = 'ext' . $modelClass;
         $modelLines = "<?php\n";
         $modelLines .= "helper::import('{$mainModelFile}');\n";
         $modelLines .= "class {$extModelClass} extends {$modelClass} \n{\n";
         /* Cycle all the extension files. */
         foreach ($extFiles as $extFile) {
             $extLines = trim(file_get_contents($extFile));
             if (strpos($extLines, '<?php') !== false) {
                 $extLines = ltrim($extLines, '<?php');
             }
             if (strpos($extLines, '?>') !== false) {
                 $extLines = rtrim($extLines, '?>');
             }
             $modelLines .= $extLines . "\n";
         }
         /* Create the merged model file. */
         $modelLines .= "}";
         file_put_contents($mergedModelFile, $modelLines);
         return $mergedModelFile;
     }
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:67,代码来源:helper.class.php

示例9: loadLang

 /**
  * Load lang and return it as the global lang object.
  * 
  * @param   string $moduleName     the module name
  * @access  public
  * @return  bool|ojbect the lang object or false.
  */
 public function loadLang($moduleName)
 {
     $modulePath = $this->getModulePath($moduleName);
     $mainLangFile = $modulePath . 'lang' . DS . $this->clientLang . '.php';
     /* get ext lang files. */
     $extLangPath = $this->getModuleExtPath($moduleName, 'lang');
     $commonExtLangFiles = helper::ls($extLangPath['common'] . $this->clientLang, '.php');
     $siteExtLangFiles = helper::ls($extLangPath['site'] . $this->clientLang, '.php');
     $extLangFiles = array_merge($commonExtLangFiles, $siteExtLangFiles);
     /* Set the files to includ. */
     if (!is_file($mainLangFile)) {
         if (empty($extLangFiles)) {
             return false;
         }
         // also no extension file.
         $langFiles = $extLangFiles;
     } else {
         $langFiles = array_merge(array($mainLangFile), $extLangFiles);
     }
     $langPath = $this->getTplRoot() . $this->config->template->name . DS . 'lang' . DS . $moduleName . DS;
     $templateLangFile = $langPath . $this->clientLang . '.php';
     if (file_exists($templateLangFile)) {
         $langFiles[] = $templateLangFile;
     }
     global $lang;
     if (!is_object($lang)) {
         $lang = new language();
     }
     if (!isset($lang->{$moduleName})) {
         $lang->{$moduleName} = new stdclass();
     }
     static $loadedLangs = array();
     foreach ($langFiles as $langFile) {
         if (in_array($langFile, $loadedLangs)) {
             continue;
         }
         include $langFile;
         $loadedLangs[] = $langFile;
     }
     $this->lang = $lang;
     return $lang;
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:49,代码来源:router.class.php

示例10: setViewFile

 /**
  * 设置视图文件,可以获取其他模块的视图文件。
  * Set the view file, thus can use fetch other module's page.
  * 
  * @param  string   $moduleName    module name
  * @param  string   $methodName    method name
  * @access private
  * @return string  the view file
  */
 private function setViewFile($moduleName, $methodName)
 {
     $moduleName = strtolower(trim($moduleName));
     $methodName = strtolower(trim($methodName));
     $modulePath = $this->app->getModulePath($moduleName);
     $viewExtPath = $this->app->getModuleExtPath($moduleName, 'view');
     /*
      * 主视图文件,扩展视图文件和钩子文件。
      * The main view file, extension view file and hook file.
      **/
     $mainViewFile = $modulePath . 'view' . $this->pathFix . $methodName . '.' . $this->viewType . '.php';
     $extViewFile = $viewExtPath . $methodName . ".{$this->viewType}.php";
     $extHookFiles = helper::ls($viewExtPath, '.hook.php');
     $viewFile = file_exists($extViewFile) ? $extViewFile : $mainViewFile;
     if (!is_file($viewFile)) {
         $this->app->triggerError("the view file {$viewFile} not found", __FILE__, __LINE__, $exit = true);
     }
     if (!empty($extHookFiles)) {
         return array('viewFile' => $viewFile, 'hookFiles' => $extHookFiles);
     }
     return $viewFile;
 }
开发者ID:Osub,项目名称:zentaophp,代码行数:31,代码来源:control.class.php


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