Changeset 1331
- Timestamp:
- 05/09/06 16:49:57 (3 years ago)
- Files:
-
- trunk/lib/controller/sfWebController.class.php (modified) (1 diff)
- trunk/lib/helper/AssetHelper.php (modified) (7 diffs)
- trunk/lib/helper/UrlHelper.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/controller/sfWebController.class.php
r1027 r1331 114 114 if ($absolute) 115 115 { 116 $url = 'http://'.$this->getContext()->getRequest()->getHost().$url; 116 $request = $this->getContext()->getRequest(); 117 $url = 'http'.($request->isSecure() ? 's' : '').'://'.$request->getHost().$url; 117 118 } 118 119 trunk/lib/helper/AssetHelper.php
r1145 r1331 51 51 * /js/ajax.js 52 52 */ 53 function javascript_path($source )54 { 55 return _compute_public_path($source, 'js', 'js' );53 function javascript_path($source, $absolute = false) 54 { 55 return _compute_public_path($source, 'js', 'js', $absolute); 56 56 } 57 57 … … 87 87 * stylesheet_path('style') => /css/style.css 88 88 */ 89 function stylesheet_path($source )90 { 91 return _compute_public_path($source, 'css', 'css' );89 function stylesheet_path($source, $absolute = false) 90 { 91 return _compute_public_path($source, 'css', 'css', $absolute); 92 92 } 93 93 … … 133 133 * * file name without extension, like "logo", that gets expanded to "/images/logo.png" 134 134 */ 135 function image_path($source )136 { 137 return _compute_public_path($source, 'images', 'png' );135 function image_path($source, $absolute = false) 136 { 137 return _compute_public_path($source, 'images', 'png', $absolute); 138 138 } 139 139 … … 158 158 $options = _parse_attributes($options); 159 159 160 $options['src'] = image_path($source); 160 $absolute = false; 161 if (isset($options['absolute'])) 162 { 163 unset($options['absolute']); 164 $absolute = true; 165 } 166 167 $options['src'] = image_path($source, $absolute); 161 168 162 169 if (!isset($options['alt'])) … … 178 185 } 179 186 180 function _compute_public_path($source, $dir, $ext )187 function _compute_public_path($source, $dir, $ext, $absolute = false) 181 188 { 182 189 if (strpos($source, '://')) … … 185 192 } 186 193 187 $sf_relative_url_root = sfContext::getInstance()->getRequest()->getRelativeUrlRoot(); 194 $request = sfContext::getInstance()->getRequest(); 195 $sf_relative_url_root = $request->getRelativeUrlRoot(); 188 196 if (strpos($source, '/') !== 0) 189 197 { … … 199 207 } 200 208 209 if ($absolute) 210 { 211 $source = 'http'.($request->isSecure() ? 's' : '').'://'.$request->getHost().$source; 212 } 213 201 214 return $source; 202 215 } trunk/lib/helper/UrlHelper.php
r1282 r1331 47 47 48 48 $absolute = false; 49 if (isset($html_options['absolute_url']) )49 if (isset($html_options['absolute_url']) || isset($html_options['absolute'])) 50 50 { 51 51 unset($html_options['absolute_url']); 52 unset($html_options['absolute']); 52 53 $absolute = true; 53 54 }