首页 > Other > wp站群批量设置:all in one seo插件title和Description

wp站群批量设置:all in one seo插件title和Description

SEO推广少不了wordpress,少量的wp肯定效果不怎么好,在资金容许的情况下搭建wp站群才是上上之选。

wp的插件all in one seo是必须安装的,如果人工一个个的去登陆后台,修改wp的默认标题,描述等等,那是非常麻烦的事情,下面的php脚本用于批量修改,前提只需要在把所有的站群的标题,描述,按格式添加就OK 了

  1. <?php
  2. /*
  3. 此程序用于批量修改博客标题与描述,调用的是gg文件,文件格式为
  4. $domain $title $des $keyword
  5. */
  6. $fp=fopen(“gg”,”r”);
  7. while(!feof($fp)){
  8. $txt=fgets($fp,4096);
  9. $line=preg_split(“=\s+=”,$txt);
  10. $domain=$line[0];
  11. $title=$line[1];
  12. $titlen= strlen($title);
  13. $des=$line[2];
  14. $deslen=strlen($des);
  15. $keyword=$line[3];
  16. $keylen=strlen($keyword);
  17. if(!empty($domain)){
  18. $file=”/usr/local/webserver/nginx/conf/vhost/$domain.conf”;
  19. if(file_exists($file)){
  20. $files=file_get_contents($file);
  21. preg_match(‘/root\s+(.*);/’,$files,$path);
  22. $path=$path[1];
  23. $conf=”$path/wp-config.php”;
  24. $file_conf=file_get_contents($conf);
  25. preg_match(“=’DB_USER’,\s+'(\S+)’=”,$file_conf,$mysqluser);
  26. $mysqluser=$mysqluser[1];
  27. preg_match(“=’DB_NAME’,\s+'(\S+)’=”,$file_conf,$mysqldata);
  28. $mysqldata=$mysqldata[1];
  29. preg_match(“=’DB_PASSWORD’,\s+'(\S+)’=”,$file_conf,$mysqlpwd);
  30. $mysqlpwd=$mysqlpwd[1];
  31. $conn = new mysqli(“$ip”,”$mysqluser”,”$mysqlpwd”,”$mysqldata”) or die (“error”);
  32. /*修改All in one SEO */
  33. $sql=”INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES (‘aioseop_options’, ‘a:34:{s:9:\”aiosp_can\”;i:1;s:12:\”aiosp_donate\”;i:0;s:16:\”aiosp_home_title\”;N;s:22:\”aiosp_home_description\”;s:0:\”\”;s:19:\”aiosp_home_keywords\”;N;s:23:\”aiosp_max_words_excerpt\”;s:9:\”something\”;s:20:\”aiosp_rewrite_titles\”;i:1;s:23:\”aiosp_post_title_format\”;s:27:\”%post_title% | %blog_title%\”;s:23:\”aiosp_page_title_format\”;s:27:\”%page_title% | %blog_title%\”;s:27:\”aiosp_category_title_format\”;s:31:\”%category_title% | %blog_title%\”;s:26:\”aiosp_archive_title_format\”;s:21:\”%date% | %blog_title%\”;s:22:\”aiosp_tag_title_format\”;s:20:\”%tag% | %blog_title%\”;s:25:\”aiosp_search_title_format\”;s:23:\”%search% | %blog_title%\”;s:24:\”aiosp_description_format\”;s:13:\”%description%\”;s:22:\”aiosp_404_title_format\”;s:33:\”Nothing found for %request_words%\”;s:18:\”aiosp_paged_format\”;s:14:\” – Part %page%\”;s:20:\”aiosp_use_categories\”;i:0;s:32:\”aiosp_dynamic_postspage_keywords\”;i:1;s:22:\”aiosp_category_noindex\”;i:1;s:21:\”aiosp_archive_noindex\”;i:1;s:18:\”aiosp_tags_noindex\”;i:0;s:14:\”aiosp_cap_cats\”;i:1;s:27:\”aiosp_generate_descriptions\”;i:0;s:16:\”aiosp_debug_info\”;N;s:20:\”aiosp_post_meta_tags\”;s:0:\”\”;s:20:\”aiosp_page_meta_tags\”;s:0:\”\”;s:20:\”aiosp_home_meta_tags\”;s:0:\”\”;s:13:\”aiosp_enabled\”;i:0;s:17:\”aiosp_enablecpost\”;i:0;s:26:\”aiosp_use_tags_as_keywords\”;i:1;s:16:\”aiosp_seopostcol\”;i:1;s:18:\”aiosp_seocustptcol\”;i:0;s:21:\”aiosp_posttypecolumns\”;a:2:{i:0;s:4:\”post\”;i:1;s:4:\”page\”;}s:12:\”aiosp_do_log\”;N;}’, ‘yes’) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`);”;
  34. $sql.=”UPDATE `wp_options` SET `option_value` = ‘a:2:{i:0;s:43:\”all-in-one-seo-pack/all_in_one_seo_pack.php\”;i:1;s:36:\”google-sitemap-generator/sitemap.php\”;}’ WHERE `option_name` = ‘active_plugins’;”;
  35. $sql.=”UPDATE `wp_options` SET `option_value` = ‘a:35:{s:9:\”aiosp_can\”;s:2:\”on\”;s:12:\”aiosp_donate\”;N;s:16:\”aiosp_home_title\”;s:$titlen:\”$title\”;s:22:\”aiosp_home_description\”;s:$deslen:\”$des\”;s:19:\”aiosp_home_keywords\”;s:$keylen:\”$keyword\”;s:23:\”aiosp_max_words_excerpt\”;N;s:20:\”aiosp_rewrite_titles\”;s:2:\”on\”;s:23:\”aiosp_post_title_format\”;s:27:\”%post_title% | %blog_title%\”;s:23:\”aiosp_page_title_format\”;s:27:\”%page_title% | %blog_title%\”;s:27:\”aiosp_category_title_format\”;s:31:\”%category_title% | %blog_title%\”;s:26:\”aiosp_archive_title_format\”;s:21:\”%date% | %blog_title%\”;s:22:\”aiosp_tag_title_format\”;s:20:\”%tag% | %blog_title%\”;s:25:\”aiosp_search_title_format\”;s:23:\”%search% | %blog_title%\”;s:24:\”aiosp_description_format\”;s:13:\”%description%\”;s:22:\”aiosp_404_title_format\”;s:33:\”Nothing found for %request_words%\”;s:18:\”aiosp_paged_format\”;s:14:\” – Part %page%\”;s:20:\”aiosp_use_categories\”;N;s:32:\”aiosp_dynamic_postspage_keywords\”;s:2:\”on\”;s:22:\”aiosp_category_noindex\”;s:2:\”on\”;s:21:\”aiosp_archive_noindex\”;s:2:\”on\”;s:18:\”aiosp_tags_noindex\”;N;s:14:\”aiosp_cap_cats\”;s:2:\”on\”;s:27:\”aiosp_generate_descriptions\”;N;s:16:\”aiosp_debug_info\”;N;s:20:\”aiosp_post_meta_tags\”;s:0:\”\”;s:20:\”aiosp_page_meta_tags\”;s:0:\”\”;s:20:\”aiosp_home_meta_tags\”;s:0:\”\”;s:13:\”aiosp_enabled\”;s:1:\”1\”;s:17:\”aiosp_enablecpost\”;N;s:26:\”aiosp_use_tags_as_keywords\”;s:2:\”on\”;s:16:\”aiosp_seopostcol\”;N;s:18:\”aiosp_seocustptcol\”;N;s:21:\”aiosp_posttypecolumns\”;a:2:{i:0;s:4:\”post\”;i:1;s:4:\”page\”;}s:12:\”aiosp_do_log\”;N;s:14:\”aiosp_ex_pages\”;s:0:\”\”;}’ WHERE `option_name` = ‘aioseop_options’;”;
  36. /*修改blog默认长标题和短标题*/
  37. $sql.=”UPDATE `wp_options` SET `option_value` = \”$title\” WHERE `option_name` = ‘blogname’;”;
  38. $sql.=”UPDATE `wp_options` SET `option_value` = \”$title\” WHERE `option_name` = ‘blogdescription’;”;
  39. // $query=mysql_query($sql,$conn);
  40. if($conn->multi_query($sql)){
  41. echo “$domain SQL文件修改成功\n”;
  42. }
  43. }
  44. }
  45. }
  46. ?>
分类:Other
  1. 还没有评论。
  1. No trackbacks yet.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: