use old-style plugin initializers as fallback for GoogleAnalytics

This commit is contained in:
Evan Prodromou 2011-06-20 17:06:17 -04:00
parent 34a2152d0a
commit 42f3fedd43

View File

@ -49,6 +49,9 @@ if (!defined('STATUSNET')) {
*/ */
class GoogleAnalyticsPlugin extends Plugin class GoogleAnalyticsPlugin extends Plugin
{ {
var $code;
var $domain;
const VERSION = '0.2'; const VERSION = '0.2';
function __construct($code=null) function __construct($code=null)
@ -64,7 +67,13 @@ class GoogleAnalyticsPlugin extends Plugin
function onEndShowScripts($action) function onEndShowScripts($action)
{ {
$code = common_config('googleanalytics', 'code'); $code = common_config('googleanalytics', 'code');
if (empty($code)) {
$code = $this->code;
}
$domain = common_config('googleanalytics', 'domain'); $domain = common_config('googleanalytics', 'domain');
if (empty($domain)) {
$domain = $this->domain;
}
$js = <<<ENDOFSCRIPT0 $js = <<<ENDOFSCRIPT0