示例#1
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     // Get all sections from the database
     self::$sections = WP_Stream_Reports_Settings::get_user_options('sections');
     // Load records
     add_filter('wp_stream_reports_load_records', array($this, 'sort_coordinates_by_count'), 10, 2);
     add_filter('wp_stream_reports_load_records', array($this, 'limit_coordinates'), 10, 2);
     // Make charts
     add_filter('wp_stream_reports_make_chart', array($this, 'pie_chart_coordinates'), 10, 2);
     add_filter('wp_stream_reports_make_chart', array($this, 'bar_chart_coordinates'), 10, 2);
     add_filter('wp_stream_reports_make_chart', array($this, 'line_chart_coordinates'), 10, 2);
     // Finalize charts
     add_filter('wp_stream_reports_finalize_chart', array($this, 'translate_labels'), 10, 2);
     add_filter('wp_stream_reports_finalize_chart', array($this, 'apply_chart_settings'), 10, 2);
     // Get chart labels
     add_filter('wp_stream_reports_get_label', array($this, 'translate_data_type_labels'), 10, 2);
     // Specific data for multisite
     if (is_multisite() && is_network_admin()) {
         add_filter('wp_stream_reports_data_types', array($this, 'mutlisite_data_types'), 10);
         add_filter('wp_stream_reports_selector_types', array($this, 'mutlisite_selector_types'), 10);
         add_filter('wp_stream_reports_get_label', array($this, 'multisite_labels'), 10, 2);
         add_filter('wp_stream_reports_query_args', array($this, 'multisite_query_args'), 10, 2);
     }
     $ajax_hooks = array('wp_stream_reports_add_metabox' => 'add_metabox', 'wp_stream_reports_delete_metabox' => 'delete_metabox', 'wp_stream_reports_default_reports' => 'setup_user', 'wp_stream_reports_save_metabox_config' => 'save_metabox_config', 'wp_stream_reports_save_chart_height' => 'save_chart_height', 'wp_stream_reports_save_chart_options' => 'save_chart_options', 'wp_stream_reports_update_metabox_display' => 'update_metabox_display');
     // Register all ajax action and check referer for this class
     WP_Stream_Reports::handle_ajax_request($ajax_hooks, $this);
 }
 public function __construct()
 {
     // Call parent constructor
     parent::__construct();
     // Ajax declaration to save time interval
     $ajax_hooks = array('wp_stream_reports_save_interval' => 'save_interval');
     // Register all ajax action and check referer for this class
     WP_Stream_Reports::handle_ajax_request($ajax_hooks, $this);
 }
 /**
  * Public constructor
  */
 public function __construct()
 {
     // Get all sections from the database
     self::$sections = WP_Stream_Reports_Settings::get_user_options('sections');
     $this->charts = new WP_Stream_Reports_Charts();
     if (isset(self::$sections[0]) && isset(self::$sections[0]['data_type'])) {
         $this->migrate_settings();
     }
     // Finalize charts
     add_filter('wp_stream_reports_finalize_chart', array($this, 'translate_labels'), 10, 2);
     // Get chart labels
     add_filter('wp_stream_reports_get_label', array($this, 'translate_data_type_labels'), 10, 2);
     $ajax_hooks = array('wp_stream_reports_add_metabox' => 'add_metabox', 'wp_stream_reports_delete_metabox' => 'delete_metabox', 'wp_stream_reports_default_reports' => 'setup_user', 'wp_stream_reports_save_metabox_config' => 'save_metabox_config', 'wp_stream_reports_save_chart_height' => 'save_chart_height', 'wp_stream_reports_save_chart_options' => 'save_chart_options', 'wp_stream_reports_update_metabox_display' => 'update_metabox_display');
     // Register all ajax action and check referer for this class
     WP_Stream_Reports::handle_ajax_request($ajax_hooks, $this);
 }
 /**
  * Return active instance of WP_Stream_Reports, create one if it doesn't exist
  *
  * @return WP_Stream_Reports
  */
 public static function get_instance()
 {
     if (empty(self::$instance)) {
         $class = __CLASS__;
         self::$instance = new $class();
     }
     return self::$instance;
 }