示例#1
0
文件: public.php 项目: antoninab/t2c
 /**
  * Function to return relevant plugin debug info
  *
  * @return debug info in JSON
  */
 public static function debug_info()
 {
     global $wpdb;
     if (ShareaholicUtilities::get_option('disable_debug_info') == "on") {
         exit;
     }
     if (ShareaholicUtilities::get_option('disable_internal_share_counts_api') == NULL || ShareaholicUtilities::get_option('disable_internal_share_counts_api') == "off") {
         $server_side_share_count_status = "on";
     } else {
         $server_side_share_count_status = "off";
     }
     if (ShareaholicUtilities::has_accepted_terms_of_service() == 1) {
         $tos_status = "accepted";
     } else {
         $tos_status = "pending";
     }
     if (function_exists('curl_version')) {
         $curl_version = curl_version();
     }
     $info = array('plugin_version' => Shareaholic::VERSION, 'site_id' => ShareaholicUtilities::get_option('api_key'), 'domain' => get_bloginfo('url'), 'language' => get_bloginfo('language'), 'tos_status' => $tos_status, 'stats' => array('posts_total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts} where post_type = 'post' AND post_status = 'publish'"), 'pages_total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts} where post_type = 'page' AND post_status = 'publish'"), 'comments_total' => wp_count_comments()->approved, 'users_total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->users}")), 'diagnostics' => array('theme' => get_option('template'), 'multisite' => is_multisite(), 'shareaholic_server_reachable' => ShareaholicUtilities::connectivity_check(), 'server_side_share_count_api_reachable' => ShareaholicUtilities::share_counts_api_connectivity_check(), 'php_version' => phpversion(), 'wp_version' => get_bloginfo('version'), 'curl' => array('status' => ShareaholicPublic::has_curl(), 'version' => $curl_version), 'plugins' => array('active' => get_option('active_plugins', array()), 'sitewide' => get_site_option('active_sitewide_plugins', array()))), 'app_locations' => array('share_buttons' => ShareaholicUtilities::get_option('share_buttons'), 'recommendations' => ShareaholicUtilities::get_option('recommendations')), 'advanced_settings' => array('server_side_share_count_api' => $server_side_share_count_status));
     header('Content-Type: application/json');
     echo json_encode($info);
     exit;
 }
示例#2
0
echo sprintf(__('Save Changes', 'shareaholic'));
?>
'>
        </fieldset>
      </div> 
    </form>
    
    <div class='clear'></div>  
    
    <fieldset class="app">
      <legend><h2><?php 
_e('Server Connectivity', 'shareaholic');
?>
</h2></legend>
      <?php 
if (ShareaholicUtilities::connectivity_check() == "SUCCESS") {
    ?>
        <span class="key-status passed"><?php 
    _e('All Shareaholic servers are reachable', 'shareaholic');
    ?>
</span>
        <div class="key-description"><?php 
    _e('Shareaholic should be working correctly.', 'shareaholic');
    ?>
 <?php 
    _e('All Shareaholic servers are accessible.', 'shareaholic');
    ?>
</div>  
      <?php 
} else {
    // can't connect to any server