Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Using PHP 8.2 dynamic properties removed #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -154,29 +155,40 @@ function gtag() {
!$markupDisabledConfig && !$markupDisabledPost) {
$element = $element['element'];
$eventData[$element] = preg_replace_callback(
"#<a (.*)href=(\"|')(http://|https://|)([^\"']+)(\"|')([^>]*)>#isUm",
"#<a\\s+(.*)href\\s*=\\s*[\"|'](http://|https://|)([^\"']*)[\"|']([^>]*)>#isUm",
array($this, 'analytics_tracker_callback'),
$eventData[$element]
);
}
}
return true;

default :
default:
return false;
} // end switch ($event) {
}

/**
* matches:
* 0 = entire regexp match
* 1 = anything between "<a" and "href"
* 2 = scheme
* 3 = address
* 4 = anything after "href" and ">"
*/
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 '<a onclick="_gaq.push([\'_trackPageview\', \'/extlink/' .
(function_exists('serendipity_specialchars') ? serendipity_specialchars($matches[4]) : htmlspecialchars($matches[4], ENT_COMPAT, LANG_CHARSET)) .
(function_exists('serendipity_specialchars') ? serendipity_specialchars($matches[3]) : htmlspecialchars($matches[3], ENT_COMPAT, LANG_CHARSET)) .
'\']);" ' . substr($matches[0], 2);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php #

# (c) by Falk D�ring
# (c) by Falk D�ring


if (IN_serendipity !== true) {
Expand All @@ -10,11 +10,12 @@
@serendipity_plugin_api::load_language(dirname(__FILE__));

class serendipity_plugin_userprofiles extends serendipity_plugin {
protected $dependencies = array();

function introspect(&$propbag) {
$propbag->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'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down