本文整理汇总了PHP中JavascriptLoadManager::addComplementaryScript方法的典型用法代码示例。如果您正苦于以下问题:PHP JavascriptLoadManager::addComplementaryScript方法的具体用法?PHP JavascriptLoadManager::addComplementaryScript怎么用?PHP JavascriptLoadManager::addComplementaryScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavascriptLoadManager
的用法示例。
在下文中一共展示了JavascriptLoadManager::addComplementaryScript方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($ps_plugin_path)
{
$this->description = _t('Adds Google Analytics functionality to Pawtucket');
$this->opo_config = Configuration::load($ps_plugin_path . '/conf/GoogleAnalytics.conf');
$account = $this->opo_config->get('account');
$googleAnalyticsCode = "\n// GoogleAnalytics \n var _gaq = _gaq || []; _gaq.push(['_setAccount', '^account']); _gaq.push(['_trackPageview']); \n (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); \n";
// If a defined GoogleAnalytics account is defined, include the javascript code
if ($account) {
$googleAnalyticsCode = str_replace("^account", $account, $googleAnalyticsCode);
JavascriptLoadManager::addComplementaryScript($googleAnalyticsCode);
}
parent::__construct();
}