File indexing completed on 2025-01-19 05:21:36
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Tool 0017 * @subpackage Framework 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * @see Zend_Tool_Project_Context_Filesystem_Directory 0025 */ 0026 // require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php'; 0027 0028 /** 0029 * This class is the front most class for utilizing Zend_Tool_Project 0030 * 0031 * A profile is a hierarchical set of resources that keep track of 0032 * items within a specific project. 0033 * 0034 * @category Zend 0035 * @package Zend_Tool 0036 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0037 * @license http://framework.zend.com/license/new-bsd New BSD License 0038 */ 0039 class Zend_Tool_Project_Context_Zf_ZfStandardLibraryDirectory extends Zend_Tool_Project_Context_Filesystem_Directory 0040 { 0041 0042 /** 0043 * @var string 0044 */ 0045 protected $_filesystemName = 'Zend'; 0046 0047 /** 0048 * getName() 0049 * 0050 * @return string 0051 */ 0052 public function getName() 0053 { 0054 return 'ZfStandardLibraryDirectory'; 0055 } 0056 0057 /** 0058 * create() 0059 * 0060 */ 0061 public function create() 0062 { 0063 parent::create(); 0064 $zfPath = $this->_getZfPath(); 0065 if ($zfPath != false) { 0066 $zfIterator = new RecursiveDirectoryIterator($zfPath); 0067 foreach ($rii = new RecursiveIteratorIterator($zfIterator, RecursiveIteratorIterator::SELF_FIRST) as $file) { 0068 $relativePath = preg_replace('#^'.preg_quote(realpath($zfPath), '#').'#', '', realpath($file->getPath())) . DIRECTORY_SEPARATOR . $file->getFilename(); 0069 if (strpos($relativePath, DIRECTORY_SEPARATOR . '.') !== false) { 0070 continue; 0071 } 0072 0073 if ($file->isDir()) { 0074 mkdir($this->getBaseDirectory() . DIRECTORY_SEPARATOR . $this->getFilesystemName() . $relativePath); 0075 } else { 0076 copy($file->getPathname(), $this->getBaseDirectory() . DIRECTORY_SEPARATOR . $this->getFilesystemName() . $relativePath); 0077 } 0078 0079 } 0080 } 0081 } 0082 0083 /** 0084 * _getZfPath() 0085 * 0086 * @return string|false 0087 */ 0088 protected function _getZfPath() 0089 { 0090 // require_once 'Zend/Loader.php'; 0091 foreach (Zend_Loader::explodeIncludePath() as $includePath) { 0092 if (!file_exists($includePath) || $includePath[0] == '.') { 0093 continue; 0094 } 0095 0096 if (realpath($checkedPath = rtrim($includePath, '\\/') . '/Zend/Loader.php') !== false && file_exists($checkedPath)) { 0097 return dirname($checkedPath); 0098 } 0099 } 0100 0101 return false; 0102 } 0103 0104 }