article_seo.inc.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3. exit('Access Denied');
  4. }
  5. require_once(DISCUZ_ROOT.'source/plugin/milu_seotool/config.inc.php');
  6. sload('F:copyright,F:seo');
  7. $header_arr = array('article_seo_set', 'seo_word_set', 'seo_word_import');
  8. if(!VIP) unset($header_arr);
  9. $args = array('default_ac' => 'article_seo_set');
  10. $article_seo_type = array(1 => stlang('portal'), 2 => stlang('bbs'), 3 => stlang('blog'));
  11. $article_seo_set = tool_common_get('article_seo');
  12. $article_seo_set['open_type'] = dunserialize($article_seo_set['open_type']);
  13. $article_seo_set['open_forum'] = dunserialize($article_seo_set['open_forum']);
  14. seo_tpl($args);
  15. function article_seo_set(){
  16. global $_G,$pluin_info,$article_seo_set,$article_seo_type;
  17. if($_GET['editsubmit']){
  18. $set = $_GET['set'];
  19. $set['open_type'] = serialize($_GET['open_type']);
  20. $set['open_forum'] = serialize($set['open_forum']);
  21. tool_common_set('article_seo', $set);
  22. cpmsg(stlang('op_success'), PLUGIN_GO."article_seo", 'succeed');
  23. }else{
  24. $info = $article_seo_set;
  25. $show .= seoOutput::show_title(stlang('base_set'));
  26. $show .= seoOutput::show_tr(
  27. array(
  28. 'name' => stlang('open_seo'),
  29. 'desc' => stlang('show_open_seo_mod'),
  30. 'arr' => array(
  31. 'name' => 'is_open',
  32. 'info' => $info,
  33. 'int_val' => 2,
  34. 'lang_type' => 2,
  35. ),
  36. )
  37. ,'radio');
  38. $show .= seoOutput::show_tr(
  39. array(
  40. 'name' => stlang('can_see_seo_uid'),
  41. 'desc' => stlang('can_see_seo_uid_notice'),
  42. 'arr' => array(
  43. 'name' => 'view_seo_uid',
  44. 'info' => $info,
  45. ),
  46. )
  47. ,'input');
  48. $show .= seoOutput::show_tr(
  49. array(
  50. 'name' => stlang('seo_run_range'),
  51. 'desc' => stlang('seo_run_range_notice'),
  52. 'arr' => array(
  53. 'name' => 'open_type',
  54. 'info' => $info,
  55. 'option_arr' => $article_seo_type,
  56. ),
  57. )
  58. ,'checkbox');
  59. require_once libfile('function/forumlist');
  60. $show .= seoOutput::add_tr(array(''), stlang('seo_run_forum'));
  61. $show .= seoOutput::add_tr(array(''), '<select name="set[open_forum][]" size="10" multiple="multiple">'.forumselect(FALSE, 0, $info['open_forum'], TRUE).'</select><div>'.stlang('seo_run_forum_notice').'</div>');
  62. if(VIP){
  63. $show .= seoOutput::show_title(stlang('seo_word_set'));
  64. $show .= seoOutput::show_tr(
  65. array(
  66. 'name' => stlang('is_open_seo_word'),
  67. 'desc' => '',
  68. 'arr' => array(
  69. 'name' => 'is_open_word',
  70. 'info' => $info,
  71. 'int_val' => 2,
  72. 'lang_type' => 2,
  73. ),
  74. )
  75. ,'radio');
  76. $show .= seoOutput::show_tr(
  77. array(
  78. 'name' => stlang('seo_word_open_mode'),
  79. 'desc' => '',
  80. 'arr' => array(
  81. 'name' => 'word_open_mode',
  82. 'info' => $info,
  83. 'int_val' => 1,
  84. 'lang_arr' => array(stlang('seo_for_spider').stlang('tuijian'), stlang('seo_for_all')),
  85. 'lang_type' => 2,
  86. ),
  87. )
  88. ,'radio');
  89. }
  90. $show .= seoOutput::show_title(stlang('text_and_title_set'));
  91. $show .= seoOutput::show_tr(
  92. array(
  93. 'name' => stlang('is_open_seo_push'),
  94. 'desc' => '',
  95. 'arr' => array(
  96. 'name' => 'is_open_seo_push',
  97. 'info' => $info,
  98. 'int_val' => 2,
  99. 'lang_type' => 2,
  100. ),
  101. )
  102. ,'radio');
  103. $show .= seoOutput::show_tr(
  104. array(
  105. 'name' => stlang('text_push_mode'),
  106. 'desc' => '',
  107. 'arr' => array(
  108. 'name' => 'push_open_mode',
  109. 'info' => $info,
  110. 'int_val' => 2,
  111. 'lang_arr' => array(stlang('seo_for_spider'), stlang('seo_for_all')),
  112. 'lang_type' => 2,
  113. ),
  114. )
  115. ,'radio');
  116. $show .= seoOutput::show_tr(
  117. array(
  118. 'name' => stlang('push_title_header'),
  119. 'desc' => stlang('push_title_footer_notice'),
  120. 'arr' => array(
  121. 'name' => 'push_title_header',
  122. 'info' => $info,
  123. ),
  124. )
  125. ,'textarea');
  126. $show .= seoOutput::show_tr(
  127. array(
  128. 'name' => stlang('push_title_footer'),
  129. 'desc' => stlang('push_title_footer_notice'),
  130. 'arr' => array(
  131. 'name' => 'push_title_footer',
  132. 'info' => $info,
  133. ),
  134. )
  135. ,'textarea');
  136. $show .= seoOutput::show_tr(
  137. array(
  138. 'name' => stlang('push_content_header'),
  139. 'desc' => stlang('row_class'),
  140. 'arr' => array(
  141. 'name' => 'push_content_header',
  142. 'info' => $info,
  143. ),
  144. )
  145. ,'textarea');
  146. $show .= seoOutput::show_tr(
  147. array(
  148. 'name' => stlang('push_content_body'),
  149. 'desc' => stlang('row_class'),
  150. 'arr' => array(
  151. 'name' => 'push_content_body',
  152. 'info' => $info,
  153. ),
  154. )
  155. ,'textarea');
  156. $show .= seoOutput::show_tr(
  157. array(
  158. 'name' => stlang('push_content_footer'),
  159. 'desc' => stlang('row_class'),
  160. 'arr' => array(
  161. 'name' => 'push_content_footer',
  162. 'info' => $info,
  163. ),
  164. )
  165. ,'textarea');
  166. $show .= seoOutput::show_tr(
  167. array(
  168. 'name' => stlang('push_reply_header'),
  169. 'desc' => stlang('row_class'),
  170. 'arr' => array(
  171. 'name' => 'push_reply_header',
  172. 'info' => $info,
  173. ),
  174. )
  175. ,'textarea');
  176. $show .= seoOutput::show_tr(
  177. array(
  178. 'name' => stlang('push_reply_body'),
  179. 'desc' => stlang('row_class'),
  180. 'arr' => array(
  181. 'name' => 'push_reply_body',
  182. 'info' => $info,
  183. ),
  184. )
  185. ,'textarea');
  186. $show .= seoOutput::show_tr(
  187. array(
  188. 'name' => stlang('push_reply_footer'),
  189. 'desc' => stlang('row_class'),
  190. 'arr' => array(
  191. 'name' => 'push_reply_footer',
  192. 'info' => $info,
  193. ),
  194. )
  195. ,'textarea');
  196. $info['show'] = $show;
  197. $info['tpl'] = 'common_set';
  198. return $info;
  199. }
  200. }
  201. //ͬÒå´Ê
  202. function get_replace_words($page = 0, $perpage = 0, $s = ''){
  203. $words = array();
  204. $word_arr = get_seo_word_arr();
  205. $total_count = count($word_arr);
  206. if($page > 0 && $perpage > 0){
  207. if($s){
  208. $search_arr = array();
  209. foreach($word_arr as $k => $v){
  210. if(strexists($v, $s)) $search_arr[] = $v;
  211. }
  212. $word_arr = $search_arr;
  213. $total_count = count($word_arr);
  214. }
  215. $start = ($page-1)*$perpage;
  216. $word_arr = array_slice($word_arr, $start, $perpage);
  217. }
  218. $ext_str = get_seo_word_split();
  219. foreach((array)$word_arr as $k=>$v){
  220. if(!$v) continue;
  221. $str_arr = explode($ext_str, $v);//¹Ø¼ü´Ê·Ö¸î·û
  222. $words += array("$str_arr[0]" => "$str_arr[1]");
  223. }
  224. return array('list' => $words, 'total_count' => $total_count);
  225. }
  226. function replace_del_wrap($str){
  227. if($str == get_seo_word_split()) return;
  228. $str .= WRAP;
  229. return $str;
  230. }
  231. ?>