Changeset 561 in t29-www for lib/host.php
- Timestamp:
- May 30, 2014, 3:35:30 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/host.php
r517 r561 144 144 return $publichost; 145 145 } 146 147 /** 148 * "Factory" for creating an instance of $className as a singleton. 149 * You should really use detect() for auto-detection instead of 150 * forcing a host. 151 * Only useful for explicitely calling t29ExternalHost by $external call. 152 **/ 153 static function create($className) { 154 return self::new_singleton($className)->setup(); 155 } 146 156 147 157 /** … … 154 164 * 1. if this host does Clean URLs (Suffix rewriting) 155 165 * 2. if this host is *not* installed in its own virtualhost (i.e. on docroot). 166 * 167 * @returns $this for chaining 156 168 **/ 157 169 private function setup() { … … 223 235 224 236 //phpinfo(); exit; 237 return $this; // Chaining 225 238 } 226 239 … … 308 321 } 309 322 } 323 324 /** 325 * Ein "external" Host, der Links mit voller URL angeben muss, etwa bei der 326 * Einbindung von CSS/JS, aber auch von Links. 327 * Genutzt fuer $external-Einbindung von technikum29.php 328 **/ 329 class t29ExternalHost extends t29Host { 330 public $hostname = "external"; 331 public $target_host = 'http://www.technikum29.de'; 332 333 function rewrite_link($link_target, $also_rewrite_prefix=false) { 334 $link_target = parent::rewrite_link($link_target, $also_rewrite_prefix); 335 336 if($also_rewrite_prefix) { 337 // check if link has host part 338 if(!preg_match('#^http:#i', $link_target)) { 339 $sep = ($link_target{0} == '/') ? '' : '/'; 340 $link_target = $this->target_host . $sep . $link_target; 341 } 342 } 343 344 return $link_target; 345 } 346 347 function fillup_template_conf(&$template_conf) { 348 $template_conf['header_prepend'][] = 349 '<meta name="t29.host.from" content="'.$_SERVER['SERVER_NAME'].'">'; 350 } 351 }
Note: See TracChangeset
for help on using the changeset viewer.