'> '> Warning : ALL Amazon links will be redirected to this single URL! Leave blank if you don't want to. value='1'> value='1'>
Catch all : If you want to catch all Amazon links and redirect them to a single URL, a links proxy for example, just add this URL in the appropriate field below. Leave it blank if you don\'t want to, the plugin will still replace all tags as usual.', 'wordpress' ); } function amazify_options_page(){ ?>
]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; if(preg_match_all("/$regexp/siU", $content, $link_matches, PREG_SET_ORDER)) { foreach($link_matches as $match) { if(preg_match('/(.*)amazon\.(com|co.uk|de|fr|es|it|co.jp|ca)+/i', $match[2])){ $thelink = str_replace('&',"&",$match[2]); $parsed = parse_url($thelink); $options_attr = ""; //Set up the right tag depending on the country //TODO //Replacing tag if it already exists in URL if(preg_match('#tag#i',$parsed['query'])){ $query_string = html_entity_decode($parsed['query']); parse_str($query_string, $variables); $variables["tag"] = $TagAmazify; $new_query = http_build_query($variables, '', '&'); if($options_amazify['amazify_nofollow'] == '1'){ $options_attr .= ' rel="nofollow"'; } if($options_amazify['amazify_target'] == '1'){ $options_attr .= ' target="_blank"'; } $newlink = ''.$match[3].''; }else{ if($options_amazify['amazify_nofollow'] == '1'){ $options_attr .= ' rel="nofollow"'; } if($options_amazify['amazify_target'] == '1'){ $options_attr .= ' target="_blank"'; } //Check if link have a query if (isset($parsed['query'])){ $newlink = ''.$match[3].''; } else { $newlink = ''.$match[3].''; } } //If the catch all option is filled, plugin will redirect all links to the catch all URL if($catchall_option != ''){ $newlink = ''.$match[3].''; $content = str_replace($match[0], $newlink, $content); }else{ $content = str_replace($match[0], $newlink, $content); } } } } return $content; } add_filter( 'the_content', 'AddTag'); ?>