settings.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <link rel="stylesheet" href="<?php echo $this->pluginDirUrl; ?>styles.css" type="text/css" />
  2. <div class="wrap">
  3. <?php screen_icon(); ?>
  4. <h2>多说评论框设置</h2>
  5. <h3>高级设定</h3>
  6. <form action="" method="post">
  7. <?php wp_nonce_field('duoshuo-local-options');?>
  8. <table class="form-table">
  9. <tbody>
  10. <tr valign="top">
  11. <th scope="row">多说域名</th>
  12. <td><strong><?php echo get_option('duoshuo_short_name');?></strong>.duoshuo.com</td>
  13. </tr>
  14. <tr valign="top">
  15. <th scope="row">密钥</th>
  16. <td><?php echo get_option('duoshuo_secret');?></td>
  17. </tr>
  18. <tr valign="top">
  19. <th scope="row">多说API服务器</th>
  20. <td><?php $duoshuo_api_hostname = get_option('duoshuo_api_hostname');?>
  21. <ul>
  22. <li><label><input type="radio" name="duoshuo_api_hostname" value="api.duoshuo.com" <?php if ($duoshuo_api_hostname === 'api.duoshuo.com') echo ' checked="checked"';?>/>api.duoshuo.com</label> <span class="description">(如果你的博客服务器在国内,推荐)</span></li>
  23. <li><label><input type="radio" name="duoshuo_api_hostname" value="api.duoshuo.org" <?php if ($duoshuo_api_hostname === 'api.duoshuo.org') echo ' checked="checked"';?>/>api.duoshuo.org</label> <span class="description">(如果你的博客服务器在国外,推荐)</span></li>
  24. <li><label><input type="radio" name="duoshuo_api_hostname" value="118.144.80.201" <?php if ($duoshuo_api_hostname === '118.144.80.201') echo ' checked="checked"';?>/>118.144.80.201</label> <span class="description">(除非你的博客服务器DNS出现故障,否则不推荐)</span></li>
  25. </ul>
  26. </td>
  27. </tr>
  28. <tr valign="top">
  29. <th scope="row">本地数据备份</th>
  30. <td>
  31. <input type="hidden" name="duoshuo_cron_sync_enabled" value="0">
  32. <label><input type="checkbox" name="duoshuo_cron_sync_enabled" value="1" <?php if (get_option('duoshuo_cron_sync_enabled')) echo ' checked="checked"';?>/>定时从多说备份评论到本地</label></td>
  33. </tr>
  34. <tr valign="top">
  35. <th scope="row">SEO优化</th>
  36. <td>
  37. <input type="hidden" name="duoshuo_seo_enabled" value="0">
  38. <label><input type="checkbox" name="duoshuo_seo_enabled" value="1" <?php if (get_option('duoshuo_seo_enabled')) echo ' checked="checked"';?>/>搜索引擎爬虫访问网页时,显示静态HTML评论</label></td>
  39. </tr>
  40. <tr valign="top">
  41. <th scope="row">Pingback和Trackback</th>
  42. <td>
  43. <input type="hidden" name="duoshuo_sync_pingback_and_trackback" value="0">
  44. <label><input type="checkbox" name="duoshuo_sync_pingback_and_trackback" value="1" <?php if (get_option('duoshuo_sync_pingback_and_trackback')) echo ' checked="checked"';?>/>将接收到的Pingback和Trackback同步到多说</label></td>
  45. </tr>
  46. <tr valign="top">
  47. <th scope="row">脚本后置</th>
  48. <td>
  49. <input type="hidden" name="duoshuo_postpone_print_scripts" value="0">
  50. <label><input type="checkbox" name="duoshuo_postpone_print_scripts" value="1" <?php if (get_option('duoshuo_postpone_print_scripts')) echo ' checked="checked"';?> />在网页底部才插入多说核心脚本embed.js</label></td>
  51. </tr>
  52. <tr valign="top">
  53. <th scope="row">主题适配</th>
  54. <td>
  55. <input type="hidden" name="duoshuo_style_patch" value="0">
  56. <label><input type="checkbox" name="duoshuo_style_patch" value="1" <?php if (get_option('duoshuo_style_patch')) echo ' checked="checked"';?> />自动适配当前WordPress主题</label>
  57. <p class="description"></p>
  58. </td>
  59. </tr>
  60. <tr valign="top">
  61. <th scope="row">评论数修正</th>
  62. <td>
  63. <input type="hidden" name="duoshuo_cc_fix" value="0">
  64. <label><input type="checkbox" name="duoshuo_cc_fix" value="1" <?php if (get_option('duoshuo_cc_fix')) echo ' checked="checked"';?> />AJAX加载文章的评论数</label>
  65. <p class="description">如果你的主题模板没有显示评论数,或者没有按照WordPress的标准,你可能需要修改模板。参见:<a href="http://dev.duoshuo.com/docs/50d7ecc6b2dcd51d2f0002e7">WordPress主题中的文章评论数</a></p>
  66. </td>
  67. </tr>
  68. <tr valign="top">
  69. <th scope="row">社交帐号登录</th>
  70. <td>
  71. <input type="hidden" name="duoshuo_social_login_enabled" value="0">
  72. <label><input type="checkbox" name="duoshuo_social_login_enabled" value="1" <?php if (get_option('duoshuo_social_login_enabled')) echo ' checked="checked"';?>/>允许用社交帐号登录WordPress</label></td>
  73. </tr>
  74. <tr valign="top">
  75. <th scope="row">评论框前缀</th>
  76. <td><label><input type="text" class="regular-text code" name="duoshuo_comments_wrapper_intro" value="<?php echo esc_attr(get_option('duoshuo_comments_wrapper_intro'));?>" /></label><br /><span class="description">仅在主题和评论框的div嵌套不正确的情况下使用</span></td>
  77. </tr>
  78. <tr valign="top">
  79. <th scope="row">评论框后缀</th>
  80. <td><label><input type="text" class="regular-text code" name="duoshuo_comments_wrapper_outro" value="<?php echo esc_attr(get_option('duoshuo_comments_wrapper_outro'));?>" /></label><br /><span class="description">仅在主题和评论框的div嵌套不正确的情况下使用</span></td>
  81. </tr>
  82. <tr valign="top">
  83. <th scope="row">调试开关</th>
  84. <td>
  85. <input type="hidden" name="duoshuo_debug" value="0">
  86. <label><input type="checkbox" name="duoshuo_debug" value="1" <?php if (get_option('duoshuo_debug')) echo ' checked="checked"';?>/>Debug调试开关</label><br /><span class="description">仅在出现故障向多说汇报错误信息时打开</span></td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <p class="submit"><input type="submit" name="duoshuo_local_options" id="submit" class="button-primary" value="保存"></p>
  91. </form>
  92. <h3>数据同步</h3>
  93. <div id="ds-export">
  94. <p class="message-start"><a href="javascript:void(0)" class="button" onclick="fireExport();return false;">同步本地数据库中的评论到多说</a></p>
  95. <p class="status"></p>
  96. <p class="message-complete">同步完成</p>
  97. </div>
  98. <div id="ds-sync">
  99. <p class="message-start"><a href="javascript:void(0)" class="button" onclick="fireSyncLog();return false;">备份多说中的评论到本地数据库</a></p>
  100. <p class="status"></p>
  101. </div>
  102. <?php include_once dirname(__FILE__) . '/common-script.html';?>
  103. <div>
  104. <h3>清空多说站点配置</h3>
  105. <form action="" method="post" onsubmit="return confirm('你确定要清空多说站点配置吗?');">
  106. <input type="hidden" name="action" value="duoshuo_reset" />
  107. <p>如果你希望本博客和其他多说站点进行绑定,或者创建新的多说站点,点此 <input type="submit" class="button" value="清空配置" name="duoshuo_reset" /></p>
  108. </form>
  109. </div>
  110. <div>
  111. <h3>环境依赖检查</h3>
  112. <table class="ds-dependencies">
  113. <thead>
  114. <tr>
  115. <th>依赖</th>
  116. <th>状态</th>
  117. <th>结果</th>
  118. </tr>
  119. </thead>
  120. <tbody>
  121. <?php
  122. $dependencies = array(
  123. 'php' => 'php版本',
  124. 'wordpress' => 'WordPress版本',
  125. 'json' => 'json扩展',
  126. 'curl' => 'curl扩展',
  127. 'fopen' => 'fopen()',
  128. 'fsockopen' => 'fsockopen()',
  129. 'hash_hmac' => 'hash_hmac()',
  130. );
  131. foreach($dependencies as $key => $name):
  132. list($status, $result) = $this->checkDependency($key);?>
  133. <tr>
  134. <th><?php echo $name;?></th>
  135. <td><?php echo $status === true ? '支持' : $status;?></td>
  136. <td><?php echo $result === true ? '<span class="ds-icon-yes">OK</span>' : $result;?></td>
  137. </tr>
  138. <?php endforeach;?>
  139. </tbody>
  140. </table>
  141. <p class="description">curl扩展、fopen()、fsockopen()只需支持一个即可,推荐使用curl扩展</p>
  142. </div>
  143. <h3>常见问题和参考链接</h3>
  144. <ul>
  145. <li><a href="http://dev.duoshuo.com/docs/513b65c57c33a8320d003335" target="_blank">我的主题模板是自己开发的,启用多说之后评论框没有被替换怎么办?</a></li>
  146. <li><a href="http://dev.duoshuo.com/docs/50d7ecc6b2dcd51d2f0002e7" target="_blank">多说WordPress插件常见问题</a></li>
  147. </ul>
  148. <h3>意见反馈</h3>
  149. <p>你的意见是多说成长的原动力,<a href="http://dev.duoshuo.com/wordpress-plugin" target="_blank">欢迎给我们留言</a>,或许你想要的功能下一个版本就会实现哦!</p>
  150. <p>多说正在招人!如果你相信改变世界不是资本而是技术;如果你不只是想完成任务,还希望你的巧妙构思实现意想不到的好处;如果你希望和跟你一样聪明的人一起工作。<a href="http://dev.duoshuo.com/threads/5138474ea7e92e7b60010bb9" target="_blank">那么你不妨加入我们!</a></p>
  151. <p>
  152. <iframe width="120" height="23" frameborder="0" allowtransparency="true" marginwidth="0" marginheight="0" scrolling="no" frameborder="No" border="0" src="http://widget.weibo.com/relationship/followbutton.php?language=zh_cn&width=120&height=24&uid=2468548203&style=2&btn=red&dpc=1"></iframe>
  153. <iframe id="previewmc" src="http://follow.v.t.qq.com/index.php?c=follow&a=quick&name=duo-shuo&style=3&t=1327999237149&f=1" allowtransparency="true" style="margin:0 auto;" frameborder="0" height="23" scrolling="no" width="100"></iframe>
  154. </p>
  155. <?php
  156. $services = array(
  157. 'qzone' => 'QQ空间',
  158. 'weibo' => '新浪微博',
  159. 'qqt' => '腾讯微博',
  160. 'renren'=> '人人网',
  161. 'kaixin'=> '开心网',
  162. 'douban'=> '豆瓣网',
  163. 'netease'=> '网易微博',
  164. 'sohu' => '搜狐微博',
  165. );
  166. ?>
  167. <h3>我们永远相信,分享是一种美德</h3>
  168. <p style="width:100%;overflow: hidden;">把多说分享给你的朋友:</p>
  169. <ul class="ds-share ds-service-icon">
  170. <?php foreach($services as $service => $serviceName):?>
  171. <li><a class="ds-<?php echo $service;?>" title="<?php echo $serviceName;?>"></a></li>
  172. <?php endforeach;?>
  173. </ul>
  174. <script>
  175. jQuery(function(){
  176. var $ = jQuery,
  177. duoshuoName = {
  178. weibo : '@多说网',
  179. qzone : '@多说网',
  180. qqt : '@多说网',
  181. renren : '多说',
  182. kaixin : '多说',
  183. douban : '多说',
  184. netease : '@多说网',
  185. sohu : '@多说网'
  186. },
  187. handler = function(e){
  188. var service = this.className.match(/ds\-(\w+)/)[1],
  189. message = <?php echo json_encode('我的' . get_option('blogname') . '(' .get_option('siteurl') . ')装了');?> + duoshuoName[service] + ' 评论插件,用微博、QQ、人人帐号就能登录评论了,很给力。来试试吧!',
  190. image = 'http://static.duoshuo.com/images/top.jpg',
  191. title = '多说评论插件',
  192. url = 'http://duoshuo.com';
  193. window.open('http://<?php echo $this->shortName . '.' . self::DOMAIN;?>/share-proxy/?service=' + service + '&url=' + encodeURIComponent(url) + '&message=' + encodeURIComponent(message) + '&title=' + encodeURIComponent(title) + '&images=' + image,
  194. '_blank',
  195. 'height=550,width=600,top=0,left=0,toolbar=no,menubar=no,resizable=yes,location=yes,status=no');
  196. return false;
  197. };
  198. $.fn.delegate
  199. ? $('.ds-share').delegate('a', 'click', handler)
  200. : $('.ds-share a').click(handler);
  201. });
  202. </script>
  203. </div>