Skip to content

Commit

Permalink
More renovation of WordPress plugin. moved all global functions to pr…
Browse files Browse the repository at this point in the history
…oper class methods. Open-Web-Analytics#446
  • Loading branch information
Peter Adams committed Mar 21, 2020
1 parent 75065a3 commit c47f945
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 412 deletions.
43 changes: 0 additions & 43 deletions owa_wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,6 @@ function __construct($config = null) {
return parent::__construct($config);

}


function add_link_tracking($link) {

// check for presence of '?' which is not present under URL rewrite conditions

if ($this->config['track_feed_links'] == true):

if (strpos($link, "?") === false):
// add the '?' if not found
$link .= '?';
endif;

// setup link template
$link_template = "%s&%s=%s&%s=%s";

return sprintf($link_template,
$link,
$this->config['ns'].'medium',
'feed',
$this->config['ns'].$this->config['feed_subscription_param'],
$_GET[$this->config['ns'].$this->config['feed_subscription_param']]);
else:
return;
endif;
}

/**
* Wordpress filter method. Adds tracking to feed links.
*
* @var string the feed link
* @return string link string with special tracking id
*/
function add_feed_tracking( $binfo ) {

if ($this->config['track_feed_links'] == true) {
$guid = crc32(getmypid().microtime());

return $binfo."&".$this->config['ns'].$this->config['feed_subscription_param']."=".$guid;
} else {
return;
}
}
}

?>
Loading

0 comments on commit c47f945

Please sign in to comment.