當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filter::getCsrfToken方法代碼示例

本文整理匯總了PHP中Fisharebest\Webtrees\Filter::getCsrfToken方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filter::getCsrfToken方法的具體用法?PHP Filter::getCsrfToken怎麽用?PHP Filter::getCsrfToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fisharebest\Webtrees\Filter的用法示例。


在下文中一共展示了Filter::getCsrfToken方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: pageHeader

    /**
     * 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;
    }
開發者ID:pal-saugstad,項目名稱:webtrees,代碼行數:36,代碼來源:PageController.php

示例2: pageHeader

    /**
     * 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;
    }
開發者ID:jflash,項目名稱:webtrees,代碼行數:48,代碼來源:PageController.php


注:本文中的Fisharebest\Webtrees\Filter::getCsrfToken方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。