PageRenderTime 54ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/views/wp-admin/options.php

https://github.com/kkalvaa/wp-social
PHP | 210 lines | 206 code | 4 blank | 0 comment | 13 complexity | 58be001ba2dde16c2263686886b28a1d MD5 | raw file
  1. <form id="setup" method="post" action="<?php echo esc_url(admin_url('index.php?social_controller=settings&social_action=index')); ?>">
  2. <?php wp_nonce_field(); ?>
  3. <input type="hidden" name="social_action" value="settings" />
  4. <?php if (isset($_GET['saved'])): ?>
  5. <div id="message" class="updated">
  6. <p><strong><?php _e('Social settings have been updated.', 'social'); ?></strong></p>
  7. </div>
  8. <?php endif; ?>
  9. <div class="wrap" id="social_options_page">
  10. <div class="social-view-header cf-clearfix">
  11. <h2><?php _e('Social', 'social'); ?></h2>
  12. <div class="social-view-subtitle"><?php printf(__('Compliments of <a class="social-mailchimp-link" href="%s">MailChimp</a>', 'social'), 'http://mailchimp.com/'); ?></div>
  13. </div>
  14. <div class="social-view">
  15. <table class="form-table">
  16. <tr id="social-accounts">
  17. <th>
  18. <?php _e('Accounts', 'social'); ?>
  19. <p class="description" style="padding-top: 40px;"><?php printf(__('Available to all blog authors. Add accounts that only you can use in <a href="%s">your profile</a>.', 'social'), esc_url(admin_url('profile.php#social-accounts'))); ?></p>
  20. </th>
  21. <td>
  22. <?php
  23. echo Social_View::factory(
  24. 'wp-admin/parts/accounts',
  25. compact('services', 'accounts', 'defaults')
  26. );
  27. ?>
  28. </td>
  29. </tr>
  30. <tr>
  31. <th><?php _e('Broadcasting is on by default', 'social'); ?></th>
  32. <td>
  33. <input type="radio" name="social_broadcast_by_default" id="social-broadcast-by-default-yes" value="1"<?php checked('1', Social::option('broadcast_by_default'), true); ?>
  34. <label for="social-broadcast-by-default-yes"><?php _e('Yes', 'social'); ?></label>
  35. <input type="radio" name="social_broadcast_by_default" id="social-broadcast-by-default-no" value="0"<?php checked('0', Social::option('broadcast_by_default'), true); ?>
  36. <label for="social-broadcast-by-default-no"><?php _e('No', 'social'); ?></label>
  37. </td>
  38. </tr>
  39. <tr>
  40. <th>
  41. <label for="social_broadcast_format"><?php _e('Post broadcast format', 'social'); ?></label>
  42. </th>
  43. <td>
  44. <input type="text" class="regular-text" name="social_broadcast_format" id="social_broadcast_format" value="<?php echo esc_attr(Social::option('broadcast_format')); ?>" />
  45. <p class="description"><?php _e('How you would like posts to be formatted when broadcasting to Twitter or Facebook?', 'social'); ?></p>
  46. <div class="description">
  47. <?php _e('Tokens:', 'social'); ?>
  48. <ul>
  49. <?php
  50. foreach (Social::broadcast_tokens() as $token => $description) {
  51. if (!empty($description)) {
  52. $description = ' - '.$description;
  53. }
  54. ?>
  55. <li><b><?php echo esc_html($token); ?></b><?php echo esc_html($description); ?></li>
  56. <?php
  57. }
  58. ?>
  59. </ul>
  60. </div>
  61. </td>
  62. </tr>
  63. <tr>
  64. <th>
  65. <label for="social_comment_broadcast_format"><?php _e('Comment broadcast format', 'social'); ?></label>
  66. </th>
  67. <td>
  68. <input type="text" class="regular-text" name="social_comment_broadcast_format" id="social_comment_broadcast_format" value="<?php echo esc_attr(Social::option('comment_broadcast_format')); ?>" />
  69. <p class="description"><?php _e('How you would like comments to be formatted when broadcasting to Twitter or Facebook.', 'social'); ?></p>
  70. <div class="description">
  71. <?php _e('Tokens:', 'social'); ?>
  72. <ul>
  73. <?php
  74. foreach (Social::comment_broadcast_tokens() as $token => $description) {
  75. if (!empty($description)) {
  76. $description = ' - '.$description;
  77. }
  78. ?>
  79. <li><b><?php echo esc_html($token); ?></b><?php echo esc_html($description); ?></li>
  80. <?php
  81. }
  82. ?>
  83. </ul>
  84. </div>
  85. </td>
  86. </tr>
  87. <tr>
  88. <th><?php _e('Twitter @anywhere', 'social'); ?></th>
  89. <td>
  90. <label for="social_twitter_anywhere_api_key"><?php _e('Consumer API Key', 'social'); ?></label><br />
  91. <input type="text" class="regular-text" name="social_twitter_anywhere_api_key" id="social_twitter_anywhere_api_key" value="<?php echo esc_attr(Social::option('twitter_anywhere_api_key')); ?>" />
  92. <p class="description"><?php printf(__('To enable Twitter\'s @anywhere hovercards for Twitter usernames, enter your application\'s Consumer API key here. (<a href="%1$s" target="_blank">Click here to get an API key</a>)', 'social'), 'https://dev.twitter.com/docs/anywhere'); ?></p>
  93. </td>
  94. </tr>
  95. </table>
  96. <?php
  97. $fetch = Social::option('fetch_comments');
  98. $toggle = (
  99. (!empty($fetch) and $fetch != '1') or
  100. Social::option('debug') == '1' or
  101. Social::option('use_standard_comments') == 1 or
  102. Social::option('disable_broadcasting') == 1
  103. ) ? ' social-open' : '';
  104. ?>
  105. <div class="social-collapsible<?php echo $toggle; ?>">
  106. <h3 class="social-title"><a href="#social-advanced"><?php _e('Advanced Options', 'social'); ?></a></h3>
  107. <div class="social-content">
  108. <table id="social-advanced" class="form-table">
  109. <tr>
  110. <th>
  111. <?php _e('Misc.', 'social'); ?>
  112. </th>
  113. <td>
  114. <ul>
  115. <li>
  116. <label for="social_use_standard_comments">
  117. <input type="checkbox" name="social_use_standard_comments" id="social_use_standard_comments" value="1" <?php checked(Social::option('use_standard_comments'), '1'); ?> />
  118. <?php _e("Disable Social's comment display (use standard theme output instead).", 'social'); ?>
  119. </label>
  120. </li>
  121. <li>
  122. <label for="social_disable_broadcasting">
  123. <input type="checkbox" name="social_disable_broadcasting" id="social_disable_broadcasting" value="1" <?php checked(Social::option('disable_broadcasting'), '1'); ?> />
  124. <?php _e("Disable Social's broadcasting feature.", 'social'); ?>
  125. </label>
  126. </li>
  127. </ul>
  128. </td>
  129. </tr>
  130. <tr>
  131. <th><?php _e('Fetch new comments', 'social'); ?></th>
  132. <td>
  133. <ul>
  134. <li>
  135. <label for="fetch_comments_auto">
  136. <input type="radio" name="social_fetch_comments" value="1" id="fetch_comments_auto" style="position:relative;top:-1px"<?php echo Social::option('fetch_comments') == '1' ? ' checked="checked"' : ''; ?> />
  137. <?php _e('Automatically', 'social'); ?>
  138. <span class="description"><?php _e('(easiest)', 'social'); ?></span>
  139. </label>
  140. </li>
  141. <li>
  142. <label for="fetch_comments_never">
  143. <input type="radio" name="social_fetch_comments" value="0" id="fetch_comments_never" style="position:relative;top:-1px"<?php echo !in_array(Social::option('fetch_comments'), array('1', '2')) ? ' checked="checked"' : ''; ?> />
  144. <?php _e('Never', 'social'); ?>
  145. <span class="description"><?php _e('(disables fetching of comments)', 'social'); ?></span>
  146. </label>
  147. </li>
  148. <li>
  149. <label for="fetch_comments_cron">
  150. <input type="radio" name="social_fetch_comments" value="2" id="fetch_comments_cron" style="position:relative;top:-1px"<?php echo Social::option('fetch_comments') == '2' ? ' checked="checked"' : ''; ?> />
  151. <?php _e('Using a custom CRON job <span class="description">(advanced)</span>', 'social'); ?>
  152. </label>
  153. <p class="description"><?php _e('If you select this option, new tweets and Facebook posts will not be fetched unless you set up a system CRON job or fetch new items manually from the post edit screen. More help is also available in&nbsp;<code>README.txt</code>.', 'social'); ?></p>
  154. <?php if (Social::option('fetch_comments') == '2'): ?>
  155. <div class="social-callout">
  156. <h3 class="social-title"><?php _e('CRON Setup', 'social'); ?></h3>
  157. <dl class="social-kv">
  158. <dt><?php _e('CRON API Key', 'social'); ?> <small>(<a href="<?php echo esc_url(wp_nonce_url(admin_url('options-general.php?page=social.php&social_controller=settings&social_action=regenerate_api_key'), 'regenerate_api_key')); ?>" rel="social_api_key" id="social_regenerate_api_key"><?php _e('regenerate', 'social'); ?></a>)</small></dt>
  159. <dd>
  160. <code class="social_api_key"><?php echo esc_html(Social::option('system_cron_api_key')); ?></code>
  161. </dd>
  162. </dl>
  163. <p><?php _e('For your system CRON to run correctly, make sure it is pointing towards a URL that looks something like the following:', 'social'); ?></p>
  164. <code><?php echo esc_url(home_url('index.php?social_controller=cron&social_action=cron_15&api_key='.Social::option('system_cron_api_key'))); ?></code>
  165. <?php endif; ?>
  166. </div>
  167. </li>
  168. </ul>
  169. </td>
  170. </tr>
  171. <tr>
  172. <th>
  173. <?php _e('Debug Mode', 'social'); ?>
  174. <span class="description"><?php _e('(nerds only)', 'social'); ?></span>
  175. </th>
  176. <td>
  177. <p style="margin-top:0"><?php _e('If you turn debug on, Social will save additional information in <code>debug_log.txt</code> file. Not recommended for production environments.', 'social'); ?></p>
  178. <ul>
  179. <li>
  180. <label for="debug_mode_no">
  181. <input type="radio" name="social_debug" id="debug_mode_no" value="0"<?php echo Social::option('debug') != '1' ? ' checked="checked"' : ''; ?> />
  182. <?php _e('Off <span class="description">(recommended)</span>', 'social'); ?>
  183. </label>
  184. </li>
  185. <li>
  186. <label for="debug_mode_yes">
  187. <input type="radio" name="social_debug" id="debug_mode_yes" value="1"<?php echo Social::option('debug') == '1' ? ' checked="checked"' : ''; ?> />
  188. <?php _e('On <span class="description">(for troubleshooting)</span>', 'social'); ?>
  189. </label>
  190. </li>
  191. </ul>
  192. <strong><?php _e('Debug log location:', 'social'); ?></strong> <code><?php echo Social::$plugins_path.'debug_log.txt'; ?></code>
  193. </td>
  194. </tr>
  195. </table>
  196. </div>
  197. <?php
  198. do_action('social_advanced_options');
  199. ?>
  200. </div>
  201. <p class="submit" style="clear:both">
  202. <input type="submit" name="submit" value="Save Settings" class="button-primary" />
  203. </p>
  204. </div>
  205. </div>
  206. </form>