Changeset 204179
- Timestamp:
- 02/11/2010 12:47:51 PM (16 years ago)
- File:
-
- 1 edited
-
wp-markkeyword/trunk/index.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-markkeyword/trunk/index.php
r202738 r204179 4 4 Plugin URI: http://conis.cn/1365/ 5 5 Description: This plugin can high light keyword after someone searchecd it, which supports the search engines like google, baidu, ask, yahoo&bing.wp-markKeyword可以高亮显示来自搜索引擎的关键字,支持多个搜索引擎,更多请访问我的博客 6 Version: 0. 66 Version: 0.8 7 7 Author: Conis 8 8 Author URI: http://conis.cn/ … … 11 11 $mmkKeyword; 12 12 $mmkIsShowMsg; 13 13 function momoReplace($content) 14 { 15 global $mmkKeyword; 16 if(isset($mmkKeyword)) 17 { 18 $arrKeyword = explode(' ', $mmkKeyword); 19 foreach($arrKeyword as $item) 20 { 21 $pattern = "/(".$item.")(?=[^<>]*<)/"; 22 $content = preg_replace($pattern,'<span class="wmkHighLight">\1</span>',$content); 23 } 24 } 25 return $content; 26 } 14 27 function momoMarkKeywordMsg() 15 28 { … … 34 47 global $mmkIsShowMsg; 35 48 if($mmkIsShowMsg) return $content; 36 if(isset($mmkKeyword)) 37 { 38 $arrKeyword = explode(' ', $mmkKeyword); 39 foreach($arrKeyword as $item) 40 { 41 $content = str_ireplace('/(>.*)('.$item.')(.*<)/U', '<span class="wmkHighLight">'.$item.'</span>', $content); 42 //$content = str_ireplace( $item, '<span class="wmkHighLight">'.$item.'</span>', $content); 43 } 44 } 49 $content = momoReplace($content); 45 50 $mmkIsShowMsg = true; 46 51 return momoMarkKeywordMsg().$content; … … 49 54 function momoMarkKeywordExcerpt($content = '') 50 55 { 51 global $mmkKeyword; 52 if(isset($mmkKeyword)) 53 { 54 $arrKeyword = explode(' ', $mmkKeyword); 55 foreach($arrKeyword as $item) 56 { 57 $content = str_ireplace( $item, '<span class="wmkHighLight">'.$item.'</span>', $content); 58 } 59 } 56 $content = momoReplace($content); 60 57 return $content; 61 58 }
Note: See TracChangeset
for help on using the changeset viewer.