本文整理汇总了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());
示例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;
}
示例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());