Changeset 561 in t29-www for lib/host.php


Ignore:
Timestamp:
May 30, 2014, 3:35:30 AM (5 years ago)
Author:
sven
Message:
  • lib: Weitere Fixes, um externe Einbindungen auch ueber Hostgrenzen zu schaffen
  • de/geraete: Zeichensatzfixes
  • menu.js: Keine Buttons, wenn in der Seitenleiste kein Menü eingeblendet wird
  • preferences.js: Versucht, den Bug anzugehen, dass mehrere Cookies angelegt werden
  • mobile.css: Breite vergrößert, ab der man das Tablet-Design angezeigt bekommt
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/host.php

    r517 r561  
    144144                return $publichost;
    145145        }
     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        }
    146156       
    147157        /**
     
    154164         *   1. if this host does Clean URLs (Suffix rewriting)
    155165         *   2. if this host is *not* installed in its own virtualhost (i.e. on docroot).
     166         *
     167         * @returns $this for chaining
    156168         **/
    157169        private function setup() {
     
    223235               
    224236                //phpinfo(); exit;
     237                return $this; // Chaining
    225238        }
    226239       
     
    308321        }
    309322}
     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 **/
     329class 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.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License