Commit 2ccb04d9 authored by cobalt74's avatar cobalt74

v2.0.0 Plugin Url Clean - clean feedproxy(feed burner)/feadpostal url

+ correction d'une regex + correction d'un cas d'undefined
parent a7072763
......@@ -4,18 +4,27 @@
@author Olivier <http://olivierlebris.me>
@link http://cybride.net/olivier
@licence CC by nc sa http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
@version 1.0.0
@description Used to cleanup url from some crap (xtor, utm_)
@version 2.0.0
@description Used to cleanup url from some crap (xtor, utm_) and use url id of RSS feed for clean Feedbrner(feedproxy), feedsportal url
*/
function urlclean_plugin_link(&$events){
foreach($events as $event){
$link = $event->getLink();
$link = $event->getLink();
if (preg_match('#feedproxy#',$link) or preg_match('#feedsportal#',$link)){
$events_load = new Event();
$event_load = $events_load->load(array('id'=>$event->getid()));
$link = $event_load->getGuid();
}
$link = preg_replace("/[&#?]xtor=(.)+/", "", $link);
$link = preg_replace("/&utm_[^&#]+/", "", $link);
$link = preg_replace("/utm_[^&#]+&*/", "", $link);
$link = preg_replace("/\?&/", "", $link);
if ($link[strlen($link) -1] == '?')
$link = substr($link, 0, str_length($link) -1);
if (isset($link[strlen($link) -1])){
if ($link[strlen($link) -1] == '?')
$link = substr($link, 0, strlen($link) -1);
}
$event->setLink($link);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment