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


PHP Hook::addHook方法代碼示例

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


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

示例1: __construct

     * @return \Plugin_GoogleAnalytics
     */
    public function __construct()
    {
        $this->pluginName = "Google Analytics Integration";
        $this->pluginVersion = "1.0";
    }
    /**
     * Show Google Analytics code.
     *
     * @return string
     */
    public function onFrontHtmlEnd()
    {
        if (Core::getConfig()->get("GOOGLE_ANALYTICS_ACCOUNT")) {
            return '<script type="text/javascript">
//<![CDATA[
var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
try{var pageTracker=_gat._getTracker("' . Core::getConfig()->get("GOOGLE_ANALYTICS_ACCOUNT") . '");pageTracker._trackPageview();}catch(err){}
//]]>
</script>';
        }
        return null;
    }
}
Hook::addHook("FrontHtmlEnd", new Plugin_GoogleAnalytics());
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:30,代碼來源:GoogleAnalytics.plugin.php

示例2: onTemplatePreDisplay

 /**
  * Adds an event to all position names.
  *
  * @param Recipe_Template_Adapter_Default $engine
  * @param string $template
  * @param boolean $noLayout
  *
  * @return Plugin_Commercials
  */
 public function onTemplatePreDisplay(Recipe_Template_Adapter_Default $engine, $template, $noLayout)
 {
     if (!$noLayout && Core::getConfig()->get("COMMERCIALS_ENABLED")) {
         $this->loadAds();
         foreach ($this->ads as $position => $none) {
             Hook::addHook($position, $this);
         }
     }
     return $this;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:19,代碼來源:Commercials.plugin.php

示例3: __construct

     * @return \Plugin_ShareButton
     */
    public function __construct()
    {
        $this->pluginName = "Share Button: Combat Report";
        $this->pluginVersion = "1.0";
    }
    /**
     * Show share button code.
     *
     * @return string
     */
    public function onFrontHtmlEnd()
    {
        switch (Core::getRequest()->getGET("controller")) {
            case "combat":
            case "alliance":
                return '<div style="margin: 1em 3em 1em 0; text-align: right;">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><br/>
<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Teilen</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br/>
<g:plusone size="tall"></g:plusone>
<script type="text/javascript">window.___gcfg={lang:"' . Core::getLang()->getOpt("code") . '"};(function(){var po=document.createElement("script");po.type="text/javascript";po.async=true;po.src="https://apis.google.com/js/plusone.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po,s);})();</script>
</div>';
                break;
        }
        return null;
    }
}
Hook::addHook("FrontHtmlEnd", new Plugin_ShareButton());
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:30,代碼來源:ShareButton.plugin.php


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