Commit 1031bc3a authored by lucha's avatar lucha Committed by lechuck

disabeld unwanted features from Social plugin

parent 368087c8
......@@ -67,10 +67,10 @@ final class Social {
'broadcast_format' => '{title}: {content} {url}',
'comment_broadcast_format' => '{content} {url}',
'system_cron_api_key' => null,
'cron' => '1',
'cron' => '0',
'aggregate_comments' => '1',
'broadcast_by_default' => '0',
'use_standard_comments' => '0',
'use_standard_comments' => '1',
);
/**
......@@ -380,30 +380,8 @@ final class Social {
* @return void
*/
public function enqueue_assets() {
if (Social::option('use_standard_comments') == '1') {
return;
}
// JS/CSS
if (!defined('SOCIAL_COMMENTS_JS')) {
define('SOCIAL_COMMENTS_JS', Social::$plugins_url.'assets/social.js');
}
if (SOCIAL_COMMENTS_JS !== false) {
wp_enqueue_script('jquery');
wp_enqueue_script('social_js', SOCIAL_COMMENTS_JS, array('jquery'), Social::$version, true);
wp_localize_script('social_js', 'Sociali18n', array(
'commentReplyTitle' => __('Post a Reply', 'social'),
));
}
if (!is_admin()) {
if (!defined('SOCIAL_COMMENTS_CSS')) {
define('SOCIAL_COMMENTS_CSS', Social::$plugins_url.'assets/comments.css');
}
if (SOCIAL_COMMENTS_CSS !== false) {
wp_enqueue_style('social_comments', SOCIAL_COMMENTS_CSS, array(), Social::$version, 'screen');
}
}
/* we never want the comment section to be replaced */
return;
}
/**
......@@ -1334,21 +1312,8 @@ final class Social {
* @return string
*/
public function comments_template($path) {
global $post;
if (!(
is_singular() and
(have_comments() or $post->comment_status == 'open') and
Social::option('use_standard_comments') != '1'
)) {
return $path;
}
if (!defined('SOCIAL_COMMENTS_FILE')) {
define('SOCIAL_COMMENTS_FILE', trailingslashit(dirname(SOCIAL_FILE)).'views/comments.php');
}
return SOCIAL_COMMENTS_FILE;
/* we never want the comment form to be modified! */
return $path;
}
/**
......
......@@ -112,127 +112,6 @@ foreach (Social::comment_broadcast_tokens() as $token => $description) {
</td>
</tr>
</table>
<?php
$cron = Social::option('cron');
$toggle = (
(empty($cron)) or
Social::option('debug') == '1' or
Social::option('use_standard_comments') == 1 or
Social::option('disable_broadcasting') == 1
) ? ' social-open' : '';
?>
<div class="social-collapsible<?php echo $toggle; ?>">
<h3 class="social-title"><a href="#social-advanced"><?php _e('Advanced Options', 'social'); ?></a></h3>
<div class="social-content">
<table id="social-advanced" class="form-table">
<tr>
<th>
<?php _e('Misc.', 'social'); ?>
</th>
<td>
<ul>
<li>
<label for="social_use_standard_comments">
<input type="checkbox" name="social_use_standard_comments" id="social_use_standard_comments" value="1" <?php checked(Social::option('use_standard_comments'), '1'); ?> />
<?php _e("Disable Social's comment display (use standard theme output instead).", 'social'); ?>
</label>
</li>
<li>
<label for="social_disable_broadcasting">
<input type="checkbox" name="social_disable_broadcasting" id="social_disable_broadcasting" value="1" <?php checked(Social::option('disable_broadcasting'), '1'); ?> />
<?php _e("Disable Social's broadcasting feature.", 'social'); ?>
</label>
</li>
<li>&nbsp;</li>
<li>
<?php
$twitter_accounts = Social::instance()->service('twitter')->accounts();
$social_api_accounts = Social::option('social_api_accounts');
$selected_id = $social_api_accounts['twitter'];
?>
<div class="twitter-api-account">
<label><?php _e('Twitter Default API Account', 'social'); ?></label>
<select id="social_api_accounts-twitter" name="social_api_accounts[twitter]">
<?php foreach ($twitter_accounts as $account): $acct_id = $account->id() ?>
<?php if ($account->personal()) { continue; } ?>
<option value="<?php echo $acct_id ?>" <?php selected($acct_id, $selected_id) ?>><?php echo esc_html($account->name()) ?></option>
<?php endforeach; ?>
</select>
</div>
<p class="description social-description" style="max-width: 450px;"><?php _e('Account for general (non account specific) Twitter API interaction.', 'social'); ?></p>
</li>
</ul>
</td>
</tr>
<tr>
<th><?php _e('Cron settings', 'social'); ?></th>
<td>
<ul>
<li>
<label for="cron_auto">
<input type="radio" name="social_cron" value="1" id="cron_auto" style="position:relative;top:-1px"<?php echo Social::option('cron') == '1' ? ' checked="checked"' : ''; ?> />
<?php _e('Automatic (WP Cron)', 'social'); ?>
<span class="description social-description"><?php _e('(easiest)', 'social'); ?></span>
</label>
</li>
<li>
<label for="cron_manual">
<input type="radio" name="social_cron" value="0" id="cron_manual" style="position:relative;top:-1px"<?php echo Social::option('cron') == '0' ? ' checked="checked"' : ''; ?> />
<?php _e('Manual <span class="description">(advanced)</span>', 'social'); ?>
</label>
<p class="description social-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>
<?php
if (Social::option('cron') === '0') {
?>
<div class="social-callout">
<h3 class="social-title"><?php _e('CRON Setup', 'social'); ?></h3>
<dl class="social-kv">
<dt><?php _e('CRON API Key', 'social'); ?> <small>(<a href="<?php echo esc_url(Social::wp39_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>
<dd>
<code class="social_api_key"><?php echo esc_html(Social::option('system_cron_api_key')); ?></code>
</dd>
</dl>
<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>
<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>
<?php
}
?>
</div>
</li>
</ul>
</td>
</tr>
<tr>
<th>
<?php _e('Debug Mode', 'social'); ?>
<span class="description"><?php _e('(nerds only)', 'social'); ?></span>
</th>
<td>
<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>
<ul>
<li>
<label for="debug_mode_no">
<input type="radio" name="social_debug" id="debug_mode_no" value="0"<?php echo Social::option('debug') != '1' ? ' checked="checked"' : ''; ?> />
<?php _e('Off <span class="description">(recommended)</span>', 'social'); ?>
</label>
</li>
<li>
<label for="debug_mode_yes">
<input type="radio" name="social_debug" id="debug_mode_yes" value="1"<?php echo Social::option('debug') == '1' ? ' checked="checked"' : ''; ?> />
<?php _e('On <span class="description">(for troubleshooting)</span>', 'social'); ?>
</label>
</li>
</ul>
<strong><?php _e('Debug log location:', 'social'); ?></strong> <code><?php echo Social::$plugins_path.'debug_log.txt'; ?></code>
</td>
</tr>
</table>
</div>
<?php
do_action('social_advanced_options');
?>
</div>
<p class="submit" style="clear:both">
<input type="submit" name="submit" value="Save Settings" class="button-primary" />
</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment