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


PHP Dir::read方法代碼示例

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


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

示例1: templateNames

 /**
  *	Return possible template names that can be used by the nodes
  *	for rendering by listing all files from the node view directory
  *	
  * 	@return array(string)
  */
 public function templateNames()
 {
     $templateNames = new IndexedArray();
     // get correct template directory from appcontroller’s theme
     $r = get_class_vars('AppController');
     if (empty($r['theme'])) {
         $templateDir = VIEW_DIR . 'node/';
     } else {
         $templateDir = VIEW_DIR . 'theme/' . $r['theme'] . '/node/';
     }
     // list files
     $dir = new Dir($templateDir);
     foreach ($dir->read('@\\.php$@') as $file) {
         if (!$file->isFile()) {
             continue;
         }
         // ignore directories
         if (in_array($file->basename(false), array())) {
             continue;
         }
         // ignore files?
         $templateNames[$file->basename(false)] = $file->basename(false);
     }
     return $templateNames->toArray();
 }
開發者ID:Ephigenia,項目名稱:harrison,代碼行數:31,代碼來源:AdminNodeForm.php

示例2: bundles

 /**
  * Generate a list of bundle language files
  *
  * @param array $from
  * @param array $to
  * @return array
  */
 protected static function bundles($from, $to)
 {
     // First start with the application dir
     $from_files = Dir::bundles($from);
     $files = array();
     foreach ($from_files as $bundle) {
         $bundle_files = Dir::read($bundle['path'] . $from);
         foreach ($bundle_files as $key => $file) {
             $from_array = (require $file);
             $to_file = str_replace($from, $to, $file);
             $to_array = is_file($to_file) ? require $to_file : array();
             $files['all'][] = array('location' => $bundle['name'], 'name' => str_replace(path('bundle'), '', basename($to_file, '.php')));
             // Do all our keys match?
             if (static::keys($from_array, $to_array)) {
                 $files['missing'][] = array('location' => $bundle['name'], 'name' => str_replace(path('bundle'), '', basename($to_file, '.php')));
             } else {
                 // If all our keys match we need check our values aren't empty.
                 if (static::values($to_array)) {
                     $files['missing'][] = array('location' => $bundle['name'], 'name' => str_replace(path('bundle'), '', basename($to_file, '.php')));
                 }
             }
         }
     }
     return $files;
 }
開發者ID:acmadi,項目名稱:language-builder,代碼行數:32,代碼來源:compare.php


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