- Timestamp:
- 07/22/08 21:45:24 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/zend_framework/trunk/library/Revulo/View/Phtmlc.php
r15709 r16094 16 16 * @copyright 2008 revulo 17 17 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 18 * @version Release: 0. 418 * @version Release: 0.5 19 19 * @link http://www.revulo.com/ZendFramework/Component/Phtmlc.html 20 20 */ … … 28 28 29 29 /** 30 * Flag to compile template fragments into one phtml file30 * Compile template fragments into one phtml file 31 31 * @var boolean 32 32 */ … … 84 84 85 85 /** 86 * Sets the flag to compile template fragments into one phtml file. 87 * 88 * @param boolean $flag 89 * @return Revulo_View_Phtmlc 90 */ 91 public function compileFragments($flag = true) 92 { 93 $this->_compileFragments = ($flag) ? true : false; 94 return $this; 95 } 96 97 /** 86 98 * Sets the directory path to compiled view scripts. 87 99 * … … 91 103 public function setCompilePath($path) 92 104 { 93 $path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR;105 $path = rtrim($path, '/\\'); 94 106 if (is_dir($path) && is_writable($path)) { 95 107 $this->_compilePath = $path; … … 100 112 101 113 /** 102 * Sets the flag to compile template fragments into one phtml file. 103 * 104 * @param boolean $flag 105 * @return Revulo_View_Phtmlc 106 */ 107 public function compileFragments($flag = true) 108 { 109 $this->_compileFragments = ($flag) ? true : false; 110 return $this; 114 * Returns the directory path to compiled view scripts. 115 * 116 * @param string $path Directory path to the view script 117 * @return string 118 */ 119 protected function _getCompilePath($path) 120 { 121 if (isset($this->_compilePath)) { 122 if (class_exists('Zend_Controller_Front', false)) { 123 $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName(); 124 return $this->_compilePath . DIRECTORY_SEPARATOR . $module; 125 } else { 126 return $this->_compilePath; 127 } 128 } else { 129 return $this->_getDefaultCompilePath($path); 130 } 111 131 } 112 132 … … 119 139 protected function _getDefaultCompilePath($path) 120 140 { 121 return dirname($path) . DIRECTORY_SEPARATOR . 'compile' . DIRECTORY_SEPARATOR;141 return dirname($path) . DIRECTORY_SEPARATOR . 'compile'; 122 142 } 123 143 … … 143 163 144 164 $filename = substr($filename, strlen($dir)); 145 146 if (isset($this->_compilePath)) { 147 return $this->_compilePath . $filename; 148 } else { 149 return $this->_getDefaultCompilePath($dir) . $filename; 150 } 165 return $this->_getCompilePath($dir) . DIRECTORY_SEPARATOR . $filename; 151 166 } 152 167 … … 162 177 protected function _read($filename) 163 178 { 164 $buffer = trim(file_get_contents($filename));179 $buffer = file_get_contents($filename); 165 180 166 181 if ($this->_compileFragments === true) { … … 202 217 } 203 218 204 $pattern = '/<\?=\s*(.*?)[;\s]*\?>/ ';219 $pattern = '/<\?=\s*(.*?)[;\s]*\?>/s'; 205 220 $replacement = '<?php echo ' . $escape . ' ?>'; 206 221 return preg_replace($pattern, $replacement, $buffer);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)