themes.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <link rel="stylesheet" href="<?php echo $this->pluginDirUrl; ?>styles.css" type="text/css" />
  2. <div class="wrap">
  3. <a href="https://github.com/duoshuo/duoshuo-embed.css" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
  4. <?php screen_icon(); ?>
  5. <h2>多说主题设置</h2>
  6. <form action="" method="post">
  7. <?php wp_nonce_field('duoshuo-local-options');?>
  8. <ul class="ds-themes"></ul>
  9. <p>多说的CSS样式已经开源啦! <a href="https://github.com/duoshuo/duoshuo-embed.css" target="_blank">github:duoshuo/duoshuo-embed.css</a></p>
  10. <p>你可以打造属于自己的主题,在<a href="http://dev.duoshuo.com/discussion" target="_blank">开发者中心</a>分享你的主题,还有可能被官方推荐哟!</p>
  11. </form>
  12. <style>
  13. .ds-themes li{
  14. display: inline-block;
  15. margin-right: 10px;
  16. overflow: hidden;
  17. padding: 20px 20px 20px 0;
  18. vertical-align: top;
  19. width: 300px;
  20. }
  21. </style>
  22. <script>
  23. function loadDuoshuoThemes(json){
  24. var $ = jQuery;
  25. $(function(){
  26. var html = '';
  27. $.each(json.response, function(key, theme){
  28. html += '<li>'
  29. + '<img src="' + theme.screenshot + '" width="300" height="225" style="border:1px #CCC solid;" />'
  30. + '<h3>' + theme.name + '</h3>'
  31. + '<p>作者:<a href="' + theme.author_url + '" target="_blank">' + theme.author_name + '</a></p>'
  32. + '<div class="action-links">'
  33. + ( key == <?php echo json_encode($this->getOption('theme'));?>
  34. ? '<span class="">当前主题</span>'
  35. : '<a href="admin.php?page=duoshuo-themes&amp;duoshuo_theme=' + key + '&amp;_wpnonce=<?php echo wp_create_nonce('set-duoshuo-theme'); ?>" class="activatelink" title="启用 “' + theme.name + '”">启用</a>')
  36. + '</div>'
  37. + '</li>';
  38. });
  39. $('.ds-themes').html(html);
  40. });
  41. }
  42. </script>
  43. <?php
  44. $adminUrl = is_ssl() ? 'https://' : 'http://';
  45. $adminUrl .= $this->shortName .".duoshuo.com/api/sites/themes.jsonp?callback=loadDuoshuoThemes";
  46. ?>
  47. <script src="<?php echo $adminUrl;?>"></script>
  48. </div>