web/wp-content/plugins/social/views/wp-admin/options.php
changeset 196 5e8dcbe22c24
equal deleted inserted replaced
195:c7c0fbc09788 196:5e8dcbe22c24
       
     1 <form id="setup" method="post" action="<?php echo esc_url(admin_url('options-general.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 
       
    36 					<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); ?>
       
    37 					<label for="social-broadcast-by-default-no"><?php _e('No', 'social'); ?></label>
       
    38 				</td>
       
    39 			</tr>
       
    40 			<tr>
       
    41 				<th>
       
    42 					<label for="social_broadcast_format"><?php _e('Post broadcast format', 'social'); ?></label>
       
    43 				</th>
       
    44 				<td>
       
    45 					<input type="text" class="regular-text" name="social_broadcast_format" id="social_broadcast_format" value="<?php echo esc_attr(Social::option('broadcast_format')); ?>" />
       
    46 					<p class="description"><?php _e('How you would like posts to be formatted when broadcasting to Twitter or Facebook?', 'social'); ?></p>
       
    47 
       
    48 					<div class="description">
       
    49 						<?php _e('Tokens:', 'social'); ?>
       
    50 						<ul>
       
    51 <?php 
       
    52 foreach (Social::broadcast_tokens() as $token => $description) {
       
    53 	if (!empty($description)) {
       
    54 		$description = ' - '.$description;
       
    55 	}
       
    56 ?>
       
    57 							<li><b><?php echo esc_html($token); ?></b><?php echo esc_html($description); ?></li>
       
    58 <?php
       
    59 }
       
    60 ?>
       
    61 						</ul>
       
    62 					</div>
       
    63 				</td>
       
    64 			</tr>
       
    65 			<tr>
       
    66 				<th>
       
    67 					<label for="social_comment_broadcast_format"><?php _e('Comment broadcast format', 'social'); ?></label>
       
    68 				</th>
       
    69 				<td>
       
    70 					<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')); ?>" />
       
    71 					<p class="description"><?php _e('How you would like comments to be formatted when broadcasting to Twitter or Facebook.', 'social'); ?></p>
       
    72 
       
    73 					<div class="description">
       
    74 						<?php _e('Tokens:', 'social'); ?>
       
    75 						<ul>
       
    76 <?php 
       
    77 foreach (Social::comment_broadcast_tokens() as $token => $description) {
       
    78 	if (!empty($description)) {
       
    79 		$description = ' - '.$description;
       
    80 	}
       
    81 ?>
       
    82 							<li><b><?php echo esc_html($token); ?></b><?php echo esc_html($description); ?></li>
       
    83 <?php
       
    84 }
       
    85 ?>
       
    86 						</ul>
       
    87 					</div>
       
    88 				</td>
       
    89 			</tr>
       
    90 			<tr>
       
    91 				<th><?php _e('Twitter @anywhere', 'social'); ?></th>
       
    92 				<td>
       
    93 					<p>Social Version 2.6 has removed @anywhere support to comply with <a href="https://dev.twitter.com/blog/sunsetting-anywhere">Twitter's decision to sunset the service</a>.</p>
       
    94 					<p>If you would like to continue to use @anywhere, <a href="https://www.google.com/search?q=WordPress+@anywhere+plugin" target="_blank">there are many plugins available to accomodate</a>.</p>
       
    95 				</td>
       
    96 			</tr>
       
    97 		</table>
       
    98 <?php
       
    99 $fetch = Social::option('fetch_comments');
       
   100 $toggle = (
       
   101 	(!empty($fetch) and $fetch != '1') or
       
   102 	Social::option('debug') == '1' or
       
   103 	Social::option('use_standard_comments') == 1 or
       
   104 	Social::option('disable_broadcasting') == 1
       
   105 ) ? ' social-open' : '';
       
   106 ?>
       
   107 		<div class="social-collapsible<?php echo $toggle; ?>">
       
   108 			<h3 class="social-title"><a href="#social-advanced"><?php _e('Advanced Options', 'social'); ?></a></h3>
       
   109 			<div class="social-content">
       
   110 				<table id="social-advanced" class="form-table">
       
   111 					<tr>
       
   112 						<th>
       
   113 							<?php _e('Misc.', 'social'); ?>
       
   114 						</th>
       
   115 						<td>
       
   116 							<ul>
       
   117 								<li>
       
   118 									<label for="social_use_standard_comments">
       
   119 										<input type="checkbox" name="social_use_standard_comments" id="social_use_standard_comments" value="1" <?php checked(Social::option('use_standard_comments'), '1'); ?> />
       
   120 										<?php _e("Disable Social's comment display (use standard theme output instead).", 'social'); ?>
       
   121 									</label>
       
   122 								</li>
       
   123 								<li>
       
   124 									<label for="social_disable_broadcasting">
       
   125 										<input type="checkbox" name="social_disable_broadcasting" id="social_disable_broadcasting" value="1" <?php checked(Social::option('disable_broadcasting'), '1'); ?> />
       
   126 										<?php _e("Disable Social's broadcasting feature.", 'social'); ?>
       
   127 									</label>
       
   128 								</li>
       
   129 								<li>&nbsp;</li>
       
   130 								<li>
       
   131 									<?php
       
   132 										$twitter_accounts = Social::instance()->service('twitter')->accounts();
       
   133 										$social_api_accounts = Social::option('social_api_accounts');
       
   134 										$selected_id = $social_api_accounts['twitter'];
       
   135 									?>
       
   136 									<div class="twitter-api-account">
       
   137 										<label>Twitter Default API Account</label>
       
   138 										<select id="social_api_accounts-twitter" name="social_api_accounts[twitter]">
       
   139 											<?php foreach ($twitter_accounts as $account): $acct_id = $account->id() ?>
       
   140 												<?php if ($account->personal()) { continue; } ?>
       
   141 												<option value="<?php echo $acct_id ?>" <?php selected($acct_id, $selected_id) ?>><?php echo esc_html($account->name()) ?></option>
       
   142 											<?php endforeach; ?>
       
   143 										</select>
       
   144 									</div>
       
   145 									<p class="description" style="max-width: 450px;"><?php _e('Account for general (non account specific) Twitter API interaction.', 'social'); ?></p>
       
   146 								</li>
       
   147 							</ul>
       
   148 						</td>
       
   149 					</tr>
       
   150 					<tr>
       
   151 						<th><?php _e('Fetch new comments', 'social'); ?></th>
       
   152 						<td>
       
   153 							<ul>
       
   154 								<li>
       
   155 									<label for="fetch_comments_auto">
       
   156 										<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"' : ''; ?> />
       
   157 										<?php _e('Automatically', 'social'); ?>
       
   158 										<span class="description"><?php _e('(easiest)', 'social'); ?></span>
       
   159 									</label>
       
   160 								</li>
       
   161 								<li>
       
   162 									<label for="fetch_comments_never">
       
   163 										<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"' : ''; ?> />
       
   164 										<?php _e('Never', 'social'); ?>
       
   165 										<span class="description"><?php _e('(disables fetching of comments)', 'social'); ?></span>
       
   166 									</label>
       
   167 								</li>
       
   168 								<li>
       
   169 									<label for="fetch_comments_cron">
       
   170 										<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"' : ''; ?> />
       
   171 										<?php _e('Using a custom CRON job <span class="description">(advanced)</span>', 'social'); ?>
       
   172 									</label>
       
   173 									<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>
       
   174 									<?php if (Social::option('fetch_comments') == '2'): ?>
       
   175 									<div class="social-callout">
       
   176 										<h3 class="social-title"><?php _e('CRON Setup', 'social'); ?></h3>
       
   177 										<dl class="social-kv">
       
   178 											<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>
       
   179 											<dd>
       
   180 												<code class="social_api_key"><?php echo esc_html(Social::option('system_cron_api_key')); ?></code>
       
   181 											</dd>
       
   182 										</dl>
       
   183 										<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>
       
   184 										<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>
       
   185 										<?php endif; ?>
       
   186 									</div>
       
   187 								</li>
       
   188 							</ul>
       
   189 						</td>
       
   190 					</tr>
       
   191 					<tr>
       
   192 						<th>
       
   193 							<?php _e('Debug Mode', 'social'); ?>
       
   194 							<span class="description"><?php _e('(nerds only)', 'social'); ?></span>
       
   195 						</th>
       
   196 						<td>
       
   197 							<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>
       
   198 							<ul>
       
   199 								<li>
       
   200 									<label for="debug_mode_no">
       
   201 										<input type="radio" name="social_debug" id="debug_mode_no" value="0"<?php echo Social::option('debug') != '1' ? ' checked="checked"' : ''; ?> />
       
   202 										<?php _e('Off <span class="description">(recommended)</span>', 'social'); ?>
       
   203 									</label>
       
   204 								</li>
       
   205 								<li>
       
   206 									<label for="debug_mode_yes">
       
   207 										<input type="radio" name="social_debug" id="debug_mode_yes" value="1"<?php echo Social::option('debug') == '1' ? ' checked="checked"' : ''; ?> />
       
   208 										<?php _e('On <span class="description">(for troubleshooting)</span>', 'social'); ?>
       
   209 									</label>
       
   210 								</li>
       
   211 							</ul>
       
   212 
       
   213 							<strong><?php _e('Debug log location:', 'social'); ?></strong> <code><?php echo Social::$plugins_path.'debug_log.txt'; ?></code>
       
   214 						</td>
       
   215 					</tr>
       
   216 				</table>
       
   217 			</div>
       
   218 <?php
       
   219 do_action('social_advanced_options');
       
   220 ?>
       
   221 		</div>
       
   222 		<p class="submit" style="clear:both">
       
   223 			<input type="submit" name="submit" value="Save Settings" class="button-primary" />
       
   224 		</p>
       
   225 	</div>
       
   226 </div>
       
   227 </form>