Пример #1
0
/**
* Disable internal Wordpress commenting if Disqus is enabled - this prevents spam bots from
* commenting using POST requests to /wp-comments-post.php.
*
* @param int $comment_post_ID
* @return int
*/
function dsq_pre_comment_on_post($comment_post_ID)
{
    if (dsq_can_replace()) {
        wp_die(dsq_i('Sorry, the built-in commenting system is disabled because Disqus is active.'));
    }
    return $comment_post_ID;
}
						<input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('<?php 
echo dsq_i('Are you sure you want to uninstall Disqus?');
?>
')" class="button" />
					</form>
				</td>
			</tr>
			
		</table>
		<br/>
		<h3><?php 
echo dsq_i('Debug Information');
?>
</h3>
		<p><?php 
echo dsq_i('Having problems with the plugin? <a href="%s">Drop us a line</a> and include the following details and we\'ll do what we can.', 'mailto:help+wp@disqus.com');
?>
</p>
		<textarea style="width:90%; height:200px;">URL: <?php 
echo get_option('siteurl');
?>
 
Version: <?php 
echo esc_html($wp_version);
?>

Plugin Version: <?php 
echo esc_html($dsq_version);
?>
Forum Shortname: <?php 
echo esc_html(get_option('disqus_forum_url'));
Пример #3
0
</h3>
        <p>
            <?php 
echo dsq_i('Having problems with the plugin? Check out our troubleshooting documentation.');
?>
&nbsp;
            <a href="https://help.disqus.com/customer/portal/articles/472005" target="_blank"><?php 
echo dsq_i('WordPress troubleshooting ocumentation');
?>
</a>
            <?php 
echo dsq_i('You can also email us and include the debug info below.');
?>
&nbsp;
            <a href="mailto:help+wp@disqus.com"><?php 
echo dsq_i('Contact support');
?>
</a>
        </p>
        <textarea style="width:90%; height:200px;">
URL: <?php 
echo esc_url(get_option('siteurl'));
?>

PHP Version: <?php 
echo esc_html(phpversion());
?>

Version: <?php 
echo esc_html($wp_version);
?>
Пример #4
0
                        <p><input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('<?php 
echo dsq_i('Are you sure you want to uninstall Disqus?');
?>
')" class="button" /> This will remove all Disqus specific settings, but it will leave your comments unaffected.</p>
                        NOTE: If you have problems with uninstallation taking too long you may wish to manually drop the <code>disqus_dupecheck</code> index from your <code>commentmeta</code> table.
                    </form>
                </td>
            </tr>
        </table>
        <br/>
        <h3><?php 
echo dsq_i('Debug Information');
?>
</h3>
        <p><?php 
echo dsq_i('Having problems with the plugin? Check out our <a href="%s" onclick="window.open(this.href); return false">WordPress Troubleshooting</a> documentation. You can also <a href="%s">drop us a line</a> including the following details and we\'ll do what we can.', 'http://docs.disqus.com/help/87/', 'mailto:help+wp@disqus.com');
?>
</p>
        <textarea style="width:90%; height:200px;">URL: <?php 
echo get_option('siteurl');
?>
PHP Version: <?php 
echo phpversion();
?>
Version: <?php 
echo $wp_version;
?>
Active Theme: <?php 
$theme = get_theme(get_current_theme());
echo $theme['Name'] . ' ' . $theme['Version'];
?>
Пример #5
0
<?php

require ABSPATH . 'wp-includes/version.php';
if (!current_user_can('manage_options')) {
    die;
}
$step = isset($_GET['step']) ? $_GET['step'] : null;
?>
<div class="wrap">
    <h2><?php 
echo dsq_i('Upgrade Disqus Comments');
?>
</h2>
    <form method="POST" action="?page=disqus&amp;step=<?php 
echo $step;
?>
">
        <p><?php 
echo dsq_i('You need to upgrade your database to continue.');
?>
</p>

        <p class="submit" style="text-align: left">
            <input type="submit" name="upgrade" value="Upgrade &raquo;" />
        </p>
    </form>
</div>
Пример #6
0
function dsq_request_handler()
{
    global $dsq_response;
    global $dsq_api;
    global $post;
    global $wpdb;
    if (!empty($_GET['cf_action'])) {
        switch ($_GET['cf_action']) {
            case 'sync_comments':
                if (!($post_id = $_GET['post_id'])) {
                    header("HTTP/1.0 400 Bad Request");
                    die;
                }
                // schedule the event for 5 minutes from now in case they
                // happen to make a quick post
                $post_ids = dsq_get_pending_post_ids();
                if (!in_array($post_id, $post_ids)) {
                    $post_ids[] = $post_id;
                    update_option('_disqus_sync_post_ids', $post_ids);
                }
                if (DISQUS_DEBUG) {
                    dsq_sync_post($post_id);
                    $response = dsq_sync_forum();
                    if (!$response) {
                        die('// error: ' . $dsq_api->get_last_error());
                    } else {
                        list($last_comment_id, $comments) = $response;
                        die('// synced ' . $comments . ' comments');
                    }
                } else {
                    $ts = time() + 300;
                    wp_schedule_single_event($ts, 'dsq_sync_forum');
                    die('// sync scheduled');
                }
                break;
            case 'export_comments':
                if (current_user_can('manage_options') && DISQUS_CAN_EXPORT) {
                    $timestamp = intval($_GET['timestamp']);
                    $post_id = intval($_GET['post_id']);
                    global $wpdb, $dsq_api;
                    $post = $wpdb->get_results($wpdb->prepare("\n                        SELECT *\n                        FROM {$wpdb->posts}\n                        WHERE post_type != 'revision'\n                        AND post_status = 'publish'\n                        AND comment_count > 0\n                        AND ID > %d\n                        ORDER BY ID ASC\n                        LIMIT 1\n                    ", $post_id));
                    $post = $post[0];
                    $post_id = $post->ID;
                    $max_post_id = $wpdb->get_var($wpdb->prepare("\n                        SELECT MAX(ID)\n                        FROM {$wpdb->posts}\n                        WHERE post_type != 'revision'\n                        AND post_status = 'publish'\n                        AND comment_count > 0\n                    ", $post_id));
                    $eof = (int) ($post_id == $max_post_id);
                    if ($eof) {
                        $status = 'complete';
                        $msg = 'Your comments have been sent to Disqus and queued for import!<br/><a href="' . DISQUS_IMPORTER_URL . '" target="_blank">See the status of your import at Disqus</a>';
                    } else {
                        $status = 'partial';
                        $msg = dsq_i('Processed comments on post #%s&hellip;', $post_id);
                    }
                    $result = 'fail';
                    $response = null;
                    if ($post) {
                        require_once dirname(__FILE__) . '/export.php';
                        $wxr = dsq_export_wp($post);
                        $response = $dsq_api->import_wordpress_comments($wxr, $timestamp, $eof);
                        if (!($response['group_id'] > 0)) {
                            $result = 'fail';
                            $msg = '<p class="status dsq-export-fail">' . dsq_i('Sorry, something unexpected happened with the export. Please <a href="#" id="dsq_export_retry">try again</a></p><p>If your API key has changed, you may need to reinstall Disqus (deactivate the plugin and then reactivate it). If you are still having issues, refer to the <a href="%s" onclick="window.open(this.href); return false">WordPress help page</a>.', 'http://disqus.com/help/wordpress') . '</p>';
                            $response = $dsq_api->get_last_error();
                        } else {
                            if ($eof) {
                                $msg = dsq_i('Your comments have been sent to Disqus and queued for import!<br/><a href="%s" target="_blank">See the status of your import at Disqus</a>', $response['link']);
                            }
                            $result = 'success';
                        }
                    }
                    // send AJAX response
                    $response = compact('result', 'timestamp', 'status', 'post_id', 'msg', 'eof', 'response');
                    header('Content-type: text/javascript');
                    echo cf_json_encode($response);
                    die;
                }
                break;
            case 'import_comments':
                if (current_user_can('manage_options')) {
                    if (!isset($_GET['last_comment_id'])) {
                        $last_comment_id = false;
                    } else {
                        $last_comment_id = $_GET['last_comment_id'];
                    }
                    $force = $_GET['force'] == '1';
                    if ($_GET['wipe'] == '1') {
                        $wpdb->query("DELETE FROM `" . $wpdb->prefix . "commentmeta` WHERE meta_key IN ('dsq_post_id', 'dsq_parent_post_id')");
                        $wpdb->query("DELETE FROM `" . $wpdb->prefix . "comments` WHERE comment_agent LIKE 'Disqus/%%'");
                    }
                    ob_start();
                    $response = dsq_sync_forum($last_comment_id, $force);
                    $debug = ob_get_clean();
                    if (!$response) {
                        $status = 'error';
                        $result = 'fail';
                        $error = $dsq_api->get_last_error();
                        $msg = '<p class="status dsq-export-fail">' . dsq_i('There was an error downloading your comments from Disqus.') . '<br/>' . htmlspecialchars($error) . '</p>';
                    } else {
                        list($comments, $last_comment_id) = $response;
                        if (!$comments) {
                            $status = 'complete';
                            $msg = dsq_i('Your comments have been downloaded from Disqus and saved in your local database.');
                        } else {
                            $status = 'partial';
                            $msg = dsq_i('Import in progress (last post id: %s) &hellip;', $last_comment_id);
                        }
                        $result = 'success';
                    }
                    $debug = explode("\n", $debug);
                    $response = compact('result', 'status', 'comments', 'msg', 'last_comment_id', 'debug');
                    header('Content-type: text/javascript');
                    echo cf_json_encode($response);
                    die;
                }
                break;
        }
    }
}
Пример #7
0
<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // Are there comments to navigate through?
        ?>

            <div class="navigation">
                <div class="nav-previous">
                    <span class="meta-nav">&larr;</span>
                    &nbsp;<?php 
        previous_comments_link(dsq_i('Older Comments'));
        ?>

                </div>
                <div class="nav-next">
                    <?php 
        next_comments_link(dsq_i('Newer Comments'));
        ?>

                    &nbsp;<span class="meta-nav">&rarr;</span>
                </div>
            </div><!-- .navigation -->
<?php 
    }
    // check for comment navigation
    ?>


        </div>

    <?php 
}
Пример #8
0
 /**
  * Custom Plugin Action Link.
  *
  * Function to add a quick link to DCL, when being listed on your
  * plugins list view.
  *
  * @since    1.0.0
  * @return	$links		Links to display.
  * @author	Joel James
  */
 public function dcl_plugin_action_links($links, $file)
 {
     $plugin_file = basename('disqus-conditional-load.php');
     if (basename($file) == $plugin_file) {
         if (!dsq_is_installed()) {
             $settings_link = '<a href="edit-comments.php?page=disqus">' . dsq_i('Configure') . '</a>';
         } else {
             $settings_link = '<a href="admin.php?page=dcl-settings">' . dsq_i('Settings') . '</a>';
         }
         array_unshift($links, $settings_link);
     }
     return $links;
 }
Пример #9
0
     */
    wp_list_comments(array('callback' => 'dsq_comment'));
    ?>
            </ul>

<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // Are there comments to navigate through?
        ?>
            <div class="navigation">
                <div class="nav-previous"><?php 
        previous_comments_link(dsq_i('<span class="meta-nav">&larr;</span> Older Comments'));
        ?>
</div>
                <div class="nav-next"><?php 
        next_comments_link(dsq_i('Newer Comments <span class="meta-nav">&rarr;</span>'));
        ?>
</div>
            </div><!-- .navigation -->
<?php 
    }
    // check for comment navigation
    ?>

        </div>

    <?php 
}
?>
</div>
Пример #10
0
function dsq_plugin_action_links($links, $file)
{
    $plugin_file = basename(__FILE__);
    if (basename($file) == $plugin_file) {
        $settings_link = '<a href="edit-comments.php?page=disqus#adv">' . dsq_i('Settings') . '</a>';
        array_unshift($links, $settings_link);
    }
    return $links;
}
Пример #11
0
</p>
                        <?php 
echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the <code>disqus_dupecheck</code> index from your <code>commentmeta</code> table.');
?>
                    </form>
                </td>
            </tr>
        </table>
        <br/>

        <h3><?php 
echo dsq_i('Debug Information');
?>
</h3>
        <p><?php 
echo dsq_i('Having problems with the plugin? Check out our <a href="%s" onclick="window.open(this.href); return false">WordPress Troubleshooting</a> documentation. You can also <a href="%s">drop us a line</a> including the following details and we\'ll do what we can.', 'https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting', 'mailto:help+wp@disqus.com');
?>
</p>
        <textarea style="width:90%; height:200px;">
URL: <?php 
echo esc_attr(get_option('siteurl'));
?>

PHP Version: <?php 
echo phpversion();
?>

Version: <?php 
echo $wp_version;
?>
Пример #12
0
        <?php wp_nonce_field('dsq-wpnonce_upgrade', 'dsq-form_nonce_upgrade'); ?>
        <p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>

        <p class="submit" style="text-align: left">
            <input type="submit" name="upgrade" class="button-primary button" value="Upgrade &raquo;" />
        </p>
    </form>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
<?php
require(ABSPATH . 'wp-includes/version.php');

if ( !current_user_can('manage_options') ) {
    die();
}

$step = (isset($_GET['step']) ? $_GET['step'] : null);

?>
<div class="wrap">
    <h2><?php echo dsq_i('Upgrade Disqus Comments'); ?></h2>
    <form method="POST" action="?page=disqus&amp;step=<?php echo esc_attr($step); ?>">
        <?php wp_nonce_field('dsq-wpnonce_upgrade', 'dsq-form_nonce_upgrade'); ?>
        <p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>

        <p class="submit" style="text-align: left">
            <input type="submit" name="upgrade" class="button-primary button" value="Upgrade &raquo;" />
        </p>
    </form>
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
</div>
Пример #13
0
                            <input type="submit" value="Reset" name="reset" onclick="return confirm('<?php echo dsq_i('Are you sure you want to reset the Disqus plugin?'); ?>')" class="button" /> 
                            <?php echo dsq_i('This removes all Disqus-specific settings. Comments will remain unaffected.') ?>
                        </p>
                        <?php echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the \'disqus_dupecheck\' index from your \'commentmeta\' table.') ?>
                    </form>
                </td>
            </tr>
        </table>
        <br/>

        <h3><?php echo dsq_i('Debug Information'); ?></h3>
        <p>
            <?php echo dsq_i('Having problems with the plugin? Check out our troubleshooting documentation.'); ?>&nbsp;
            <a href="https://help.disqus.com/customer/portal/articles/472005" target="_blank"><?php echo dsq_i('WordPress troubleshooting ocumentation'); ?></a>
            <?php echo dsq_i('You can also email us and include the debug info below.'); ?>&nbsp;
            <a href="mailto:help+wp@disqus.com"><?php echo dsq_i('Contact support'); ?></a>
        </p>
        <textarea style="width:90%; height:200px;">
URL: <?php echo esc_url( get_option('siteurl') ); ?>

PHP Version: <?php echo esc_html( phpversion() ); ?>

Version: <?php echo esc_html( $wp_version ); ?>

Active Theme: 
<?php
if ( !function_exists('wp_get_theme') ) {
    $theme = get_theme(get_current_theme());
    echo esc_html( $theme['Name'] . ' ' . $theme['Version'] );
} else {
    $theme = wp_get_theme();
Пример #14
0
<?php

require ABSPATH . 'wp-includes/version.php';
if (!current_user_can('manage_options')) {
    die;
}
?>
<div class="wrap">
	<h2><?php 
echo dsq_i('Upgrade Disqus Comments');
?>
</h2>
	<form method="POST" action="?page=disqus&amp;step=<?php 
echo $_GET['step'];
?>
">
		<p>You need to upgrade your database to continue.</p>

		<p class="submit" style="text-align: left">
			<input type="submit" name="upgrade" value="Upgrade &raquo;" />
		</p>
	</form>
</div>