Why this function don’t work with my script
-
I’ve installed a plugin to count click on link of all the submitted article, when i publish an article it change the link and other things…i don’t understand how can do this, because the plugin is a list of function and stop, it has a table to count click….how can do to parse the content of my article ? I ask this because i have an external form to submit article and the content is not filtered…so the plugin doesn’t work…it works only when i publish an article from the dashboard
function wp_ozh_click_parse ($html="", $all=0) {
global $wp_ozh_click, $doing_rss;preg_match_all ('/[^=]{1,}="[^"]+"/', $html, $wp_ozh_click['link']);
foreach ($wp_ozh_click['link'][0] as $pair) {
list ($tag , $value) = explode ("=", $pair , 2);
$wp_ozh_click['link'][trim($tag)]=trim($value, '"');
}
unset ($wp_ozh_click['link'][0]);$wp_ozh_click['modify_href'] = 0;
// do we want to display clicks ?
if ( !isset($wp_ozh_click['link']['count']) || $wp_ozh_click['link']['count'] != "0" ) {
if (
( ($all == 1) && (eregi("^[a-z]+://", $wp_ozh_click['link']['href'])) )
||
( isset($wp_ozh_click['link']['count'] ) )
) {
$wp_ozh_click['modify_href'] = 1;
}
}if ($wp_ozh_click['modify_href']) {
if ( (!isset($wp_ozh_click['link']['count']) && $wp_ozh_click['track_all_links'] && $wp_ozh_click['in_title'] ) || ( $wp_ozh_click['in_title'] && $wp_ozh_click['link']['count']=="1" ) || stristr($wp_ozh_click['link']['count'],'title') ) {
if (isset($wp_ozh_click['link']['title'])) {
$wp_ozh_click['link']['title']= $wp_ozh_click['link']['title'] . " (" . wp_ozh_click_getclicks($wp_ozh_click['link']['href']) . ")";
} else {
$wp_ozh_click['link']['title']= "(" . wp_ozh_click_getclicks($wp_ozh_click['link']['href']) . ")";
}
}
if ( (!isset($wp_ozh_click['link']['count']) && $wp_ozh_click['track_all_links'] && $wp_ozh_click['in_plain'] ) || ( $wp_ozh_click['in_plain'] && $wp_ozh_click['link']['count']=="1" ) || stristr($wp_ozh_click['link']['count'],'inline') ) {
$wp_ozh_click['after'] = ' <span class="hitcounter">(' . wp_ozh_click_getclicks($wp_ozh_click['link']['href']) . ')</span>' ;
}if ($doing_rss) $wp_ozh_click['method'] = 2;
switch ($wp_ozh_click['method']) :
case 1 :
$wp_ozh_click['link']['onclick'] = "window.location='". $wp_ozh_click['file'] . "?" . $wp_ozh_click['link']['href'] . "'; return false";
break;
case 2 :
$wp_ozh_click['link']['href'] = $wp_ozh_click['file'] . "?" . $wp_ozh_click['link']['href'] ;
break;
case 3 :
$wp_ozh_click['link']['onmouseover']="javascript:window.status='". $wp_ozh_click['link']['href'] ."'; return false;" ;
$wp_ozh_click['link']['onmouseout']="javascript:window.status=''; return false;" ;
$wp_ozh_click['link']['href'] = $wp_ozh_click['file'] . "?" . $wp_ozh_click['link']['href'] ;
endswitch;unset ($wp_ozh_click['link']['count']);
}$html='';
foreach ($wp_ozh_click['link'] as $key => $value) {
$html .= $key . "=\"" . $value . "\" ";
}
$html=trim($html);
return '<a '. $html .'>';
}
- The topic ‘Why this function don’t work with my script’ is closed to new replies.