예제 #1
0
 /**
  * Loads before all else
  */
 public static function admin_init()
 {
     ShareaholicUtilities::check_for_other_plugin();
     // workaround: http://codex.wordpress.org/Function_Reference/register_activation_hook
     if (is_admin() && get_option('Activated_Plugin_Shareaholic') == 'shareaholic') {
         delete_option('Activated_Plugin_Shareaholic');
         /* do stuff once right after activation */
         if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
             ShareaholicUtilities::share_counts_api_connectivity_check();
         }
     }
 }
예제 #2
0
파일: admin.php 프로젝트: reasonat/women
 /**
  * This function will run post install tasks
  * when a shareaholic flag is set
  */
 public static function post_install()
 {
     if (variable_get('Installed_Module_Shareaholic', '') == 'shareaholic') {
         // delete this so we do not check again
         variable_del('Installed_Module_Shareaholic');
         // Do share counts check
         ShareaholicUtilities::share_counts_api_connectivity_check();
     }
 }
예제 #3
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;
 }
예제 #4
0
 /**
  * Runs any update code if the version is different from what's
  * stored in the settings. This will only run if we are on the
  * shareaholic admin page to minimize any concurrency issues.
  */
 public static function update()
 {
     if (isset($_GET['page']) && preg_match('/shareaholic/', $_GET['page'])) {
         if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
             add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
         } else {
             if (ShareaholicUtilities::get_version() != self::VERSION) {
                 ShareaholicUtilities::log_event("Upgrade", array('previous_plugin_version' => ShareaholicUtilities::get_version()));
                 ShareaholicUtilities::perform_update();
                 ShareaholicUtilities::set_version(self::VERSION);
                 ShareaholicUtilities::notify_content_manager_sitemap();
                 ShareaholicUtilities::notify_content_manager_singledomain();
                 // Call the share counts api to check for connectivity on update
                 if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
                     ShareaholicUtilities::share_counts_api_connectivity_check();
                 }
                 // Activate the Shareaholic Cron job for existing plugin users
                 ShareaholicCron::activate();
             }
         }
     }
 }
예제 #5
0
</span> <a href="#" onClick="window.location.reload(); this.innerHTML='<?php 
    _e('Checking...', 'shareaholic');
    ?>
';"><?php 
    _e('Re-check', 'shareaholic');
    ?>
</a>
        <div class="key-description"><?php 
    echo sprintf(__('A network problem or firewall is blocking all connections from your web server to Shareaholic.com.  <strong>Shareaholic cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Shareaholic and firewalls</a>. Let us <a href="#" onclick="%s">know</a> too, so we can follow up!'), 'http://blog.shareaholic.com/shareaholic-hosting-faq/', 'SnapEngage.startLink();', '</a>');
    ?>
</div>
      <?php 
}
?>
      <?php 
if (ShareaholicUtilities::share_counts_api_connectivity_check() == 'SUCCESS') {
    ?>
        <span class="key-status passed"><?php 
    _e('Server-side Share Counts API is reachable', 'shareaholic');
    ?>
</span>
        <div class="key-description"><?php 
    _e('The server-side Share Counts API should be working correctly.', 'shareaholic');
    ?>
 <?php 
    _e('All servers and services needed by the API are accessible.', 'shareaholic');
    ?>
</div>
      <?php 
} else {
    // can't connect to any server