Ejemplo n.º 1
0
 /**
  * wp_ajax_wpsd_load_clicks function.
  * 
  * @access public
  * @return void
  */
 function wp_ajax_wpsd_load_clicks()
 {
     $form = new WPSDAdminConfigForm();
     if ($form->getWpsdWidgetClicks()) {
         $result = wpsd_read_cache();
         echo '<!-- WP-Stats-Dashboard - START Clicks -->';
         // Parse Clicks.
         $pattern = '<div id="clicks".*?>(.*?)<\\/div>';
         preg_match_all('/' . $pattern . '/s', $result, $matches);
         $clicks = preg_replace('/<h4>(.*?)<\\/h4>/s', '<h5>$1</h5>', $matches[1][0]);
         $clicks = preg_replace('/<h3>(.*?)<\\/h3>/s', '<h4>Clicks</h4>', $clicks);
         $clicks = str_replace('<table', '<table style="width:100%;"', $clicks);
         if (defined('WPSD_PLUGIN_URL')) {
             $clicks = str_replace('/i/stats-icon.gif', WPSD_PLUGIN_URL . '/resources/images/stats-icon.gif', $clicks);
         }
         echo '<div style="overflow:hidden;">';
         echo str_replace('class="label"', 'class="label" width="350" style="word-break:break-all; width:350px;"', $clicks);
         echo '</div>';
         echo '<!-- WP-Stats-Dashboard - STOP Clicks -->';
     } else {
         _e('Widget disabled check', 'wpsd');
         echo ' <a href="' . wpsd_get_settings_url() . '" title="wp-stats-dashboard settings" target="_self">' . __('settings', 'wpsd') . '</a>';
     }
     exit;
 }