Ejemplo n.º 1
0
    /**
     * Print the page header, using the theme
     *
     * @param bool $popup Is this a popup window
     *
     * @return $this
     */
    public function pageHeader($popup = false)
    {
        global $WT_TREE;
        $this->popup = $popup;
        // Give Javascript access to some PHP constants
        $this->addInlineJavascript('
			var WT_STATIC_URL  = "' . Filter::escapeJs(WT_STATIC_URL) . '";
			var WT_MODULES_DIR = "' . Filter::escapeJs(WT_MODULES_DIR) . '";
			var WT_GEDCOM      = "' . Filter::escapeJs($WT_TREE ? $WT_TREE->getName() : '') . '";
			var textDirection  = "' . Filter::escapeJs(I18N::direction()) . '";
			var WT_SCRIPT_NAME = "' . Filter::escapeJs(WT_SCRIPT_NAME) . '";
			var WT_LOCALE      = "' . Filter::escapeJs(WT_LOCALE) . '";
			var WT_CSRF_TOKEN  = "' . Filter::escapeJs(Filter::getCsrfToken()) . '";
		', self::JS_PRIORITY_HIGH);
        Theme::theme()->sendHeaders();
        echo Theme::theme()->doctype();
        echo Theme::theme()->html();
        echo Theme::theme()->head($this);
        if ($this->popup) {
            echo Theme::theme()->bodyHeaderPopupWindow();
            // We've displayed the header - display the footer automatically
            register_shutdown_function(array($this, 'pageFooterPopupWindow'), $this->popup);
        } else {
            echo Theme::theme()->bodyHeader();
            // We've displayed the header - display the footer automatically
            register_shutdown_function(array($this, 'pageFooter'), $this->popup);
        }
        return $this;
    }
Ejemplo n.º 2
0
    /**
     * Print the page header, using the theme
     *
     * @param bool $popup Is this a popup window
     *
     * @return $this
     */
    public function pageHeader($popup = false)
    {
        global $WT_TREE;
        $this->popup = $popup;
        // Give Javascript access to some PHP constants
        $this->addInlineJavascript('
			var WT_STATIC_URL  = "' . Filter::escapeJs(WT_STATIC_URL) . '";
			var WT_MODULES_DIR = "' . Filter::escapeJs(WT_MODULES_DIR) . '";
			var WT_GEDCOM      = "' . Filter::escapeJs($WT_TREE ? $WT_TREE->getName() : '') . '";
			var textDirection  = "' . Filter::escapeJs(I18N::direction()) . '";
			var WT_SCRIPT_NAME = "' . Filter::escapeJs(WT_SCRIPT_NAME) . '";
			var WT_LOCALE      = "' . Filter::escapeJs(WT_LOCALE) . '";
			var WT_CSRF_TOKEN  = "' . Filter::escapeJs(Filter::getCsrfToken()) . '";
		', self::JS_PRIORITY_HIGH);
        // Temporary fix for access to main menu hover elements on android/blackberry touch devices
        $this->addInlineJavascript('
			if(navigator.userAgent.match(/Android|PlayBook/i)) {
				jQuery(".primary-menu > li > a").attr("href", "#");
			}
		');
        Theme::theme()->sendHeaders();
        echo Theme::theme()->doctype();
        echo Theme::theme()->html();
        echo Theme::theme()->head($this);
        if ($this->popup) {
            echo Theme::theme()->bodyHeaderPopupWindow();
            // We've displayed the header - display the footer automatically
            register_shutdown_function(array($this, 'pageFooterPopupWindow'), $this->popup);
        } else {
            echo Theme::theme()->bodyHeader();
            // We've displayed the header - display the footer automatically
            register_shutdown_function(array($this, 'pageFooter'), $this->popup);
        }
        // Flush the output, so the browser can render the header and load javascript
        // while we are preparing data for the page
        if (ini_get('output_buffering')) {
            ob_flush();
        }
        flush();
        return $this;
    }