diff --git a/serendipity_event_google_analytics/serendipity_event_google_analytics.php b/serendipity_event_google_analytics/serendipity_event_google_analytics.php index c27596733..d30a18098 100644 --- a/serendipity_event_google_analytics/serendipity_event_google_analytics.php +++ b/serendipity_event_google_analytics/serendipity_event_google_analytics.php @@ -8,6 +8,7 @@ class serendipity_event_google_analytics extends serendipity_event { var $title = PLUGIN_EVENT_GOOGLE_ANALYTICS_NAME; + protected $markup_elements = array(); // Docs: // - Install Google Tag Manager for web pages: https://developers.google.com/tag-platform/tag-manager/web @@ -154,7 +155,7 @@ function gtag() { !$markupDisabledConfig && !$markupDisabledPost) { $element = $element['element']; $eventData[$element] = preg_replace_callback( - "#]*)>#isUm", + "#]*)>#isUm", array($this, 'analytics_tracker_callback'), $eventData[$element] ); @@ -162,21 +163,32 @@ function gtag() { } return true; - default : + default: return false; } // end switch ($event) { } + /** + * matches: + * 0 = entire regexp match + * 1 = anything between "" + */ function analytics_tracker_callback($matches) { - $parsed_url = parse_url($matches[3].$matches[4]); + $parsed_url = parse_url($matches[2].$matches[3]); + + // Skip tracking for local URLs without scheme, or unknown scheme. if (!isset($parsed_url["scheme"])) - return; + return $matches[0]; if (!in_array($parsed_url["scheme"], array("http", "https"))) - return; + return $matches[0]; + // Note: Assume, there is no second onclick-event in substr($matches[0], 2) return ' array('desc' => USERCONF_REALNAME, 'type' => 'string'), 'username' => array('desc' => USERCONF_USERNAME, @@ -177,6 +177,7 @@ function &getLocalProperties() { 'email' => array('desc' => USERCONF_EMAIL, 'type' => 'string') ); + return $props; } function getShow($type, $user) { @@ -315,7 +316,7 @@ function show() { function selected() { global $serendipity; - if ($serendipity['GET']['subpage'] == 'userprofiles') { + if (isset($serendipity['GET']['subpage']) && $serendipity['GET']['subpage'] == 'userprofiles') { return true; } @@ -417,7 +418,7 @@ function editUser(&$user) { $this->updateConfigVar($property, $profile, $user[$property], $user['authorid']); $profile[$property] = $user[$property]; } else { - $user[$property] = $profile[$property]; + $user[$property] = $profile[$property] ?? null; } $this->showCol($property, $info, $user); @@ -442,7 +443,7 @@ function editOptions(&$user) { $this->updateConfigVar($property, $profile, $user[$property], $user['authorid']); $profile[$property] = $user[$property]; } else { - $user[$property] = $profile[$property]; + $user[$property] = $profile[$property] ?? null; } $this->showCol($property, $info, $user); @@ -538,12 +539,19 @@ function event_hook($event, &$bag, &$eventData, $addData = null) { if (!$tfile) { $tfile = dirname(__FILE__) . '/plugin_userprofile.tpl'; } - $inclusion = $serendipity['smarty']->security_settings['INCLUDE_ANY']; - $serendipity['smarty']->security_settings['INCLUDE_ANY'] = true; + if ($serendipity['smarty']->security_settings) { + $inclusion = $serendipity['smarty']->security_settings['INCLUDE_ANY']; + $serendipity['smarty']->security_settings['INCLUDE_ANY'] = true; + } $profile = $this->getConfigVars($serendipity['GET']['viewAuthor']); $local_properties =& $this->getLocalProperties(); foreach($local_properties as $property => $info) { - $profile[$property] = $GLOBALS['uInfo'][0][$property]; + if (isset($GLOBALS['uInfo'])) { + $profile[$property] = $GLOBALS['uInfo'][0][$property]; + } + else { + $profile[$property] = null; + } } $properties = array(); @@ -559,7 +567,9 @@ function event_hook($event, &$bag, &$eventData, $addData = null) { $serendipity['smarty']->assign('userProfileTitle', PLUGIN_EVENT_USERPROFILES_SHOW); $content = $serendipity['smarty']->fetch('file:'. $tfile); - $serendipity['smarty']->security_settings['INCLUDE_ANY'] = $inclusion; + if ($serendipity['smarty']->security_settings) { + $serendipity['smarty']->security_settings['INCLUDE_ANY'] = $inclusion; + } echo $content; } @@ -619,6 +629,9 @@ function event_hook($event, &$bag, &$eventData, $addData = null) { return true; } + if (!isset($eventData['authorid'])) { + return true; + } if (empty($eventData['author'])) { $tmp = serendipity_fetchAuthor($eventData['authorid']); $author = $tmp[0]['realname']; diff --git a/serendipity_event_userprofiles/serendipity_plugin_userprofiles.php b/serendipity_event_userprofiles/serendipity_plugin_userprofiles.php index b983f8a0e..649f3fb57 100644 --- a/serendipity_event_userprofiles/serendipity_plugin_userprofiles.php +++ b/serendipity_event_userprofiles/serendipity_plugin_userprofiles.php @@ -1,6 +1,6 @@ add('name', PLUGIN_USERPROFILES_NAME); $propbag->add('description', PLUGIN_USERPROFILES_NAME_DESC); - $propbag->add('author', "Falk Döring"); + $propbag->add('author', "Falk D�ring"); $propbag->add('stackable', false); $propbag->add('version', '1.2.2'); $propbag->add('configuration', array('title', 'show_groups', 'show_users')); diff --git a/serendipity_event_userprofiles/serendipity_plugin_userprofiles_birthdays.php b/serendipity_event_userprofiles/serendipity_plugin_userprofiles_birthdays.php index 4ef348843..f894547ff 100644 --- a/serendipity_event_userprofiles/serendipity_plugin_userprofiles_birthdays.php +++ b/serendipity_event_userprofiles/serendipity_plugin_userprofiles_birthdays.php @@ -8,6 +8,7 @@ @serendipity_plugin_api::load_language(dirname(__FILE__)); class serendipity_plugin_userprofiles_birthdays extends serendipity_plugin { + protected $dependencies = array(); function introspect(&$propbag) { $propbag->add('name', PLUGIN_USERPROFILES_BIRTHDAYSNAME);