/** * @param $method * * @return array */ private function get_log_count($method) { $args = array(); $args['select'] = 'COUNT(*)'; $args['method'] = $method; return $this->log->find($args); }
/** * Constructor */ private function __construct() { // init checkboxes $this->checkbox_manager = new MC4WP_Checkbox_Manager(); // forms add_action('init', array($this, 'init_form_listener')); add_action('init', array($this, 'init_form_manager')); // init logger, only if it's not disabled $disable_logging = apply_filters('mc4wp_disable_logging', false); if (false === $disable_logging) { // initialize logging class $this->log = new MC4WP_Logger(); $this->log->add_hooks(); } // init widget add_action('widgets_init', array($this, 'register_widget')); }
/** * Constructor */ private function __construct() { // store global `$_REQUEST` array locally, to prevent other plugins from messing with it (yes it happens....) // todo: fix this properly (move to more specific $_POST?) $this->untinkered_request_global = $_REQUEST; // init checkboxes $this->checkbox_manager = new MC4WP_Checkbox_Manager(); // forms add_action('init', array($this, 'init_form_listener')); add_action('init', array($this, 'init_form_manager')); // init logger, only if it's not disabled $disable_logging = apply_filters('mc4wp_disable_logging', false); if (false === $disable_logging) { // initialize logging class $this->log = new MC4WP_Logger(); $this->log->add_hooks(); } // init widget add_action('widgets_init', array($this, 'register_widget')); }
/** * Setup available views * * @access private * @since 1.0 * @return array */ public function get_views() { $views = array('all' => array('name' => esc_html__('All', 'mailchimp-for-wp'), 'count' => $this->log->count()), 'mc4wp-form' => array('name' => esc_html__('Form', 'mailchimp-for-wp'), 'count' => $this->log->count(array('type' => 'mc4wp-form'))), 'mc4wp-top-bar' => array('name' => 'MailChimp Top Bar', 'count' => $this->log->count(array('type' => 'mc4wp-top-bar')))); foreach ($this->integrations as $integration) { $views[$integration->slug] = array('name' => $integration->name, 'count' => $this->log->count(array('type' => $integration->slug))); } $links = array(); foreach ($views as $key => $view) { $links[$key] = $this->get_view_link($key, $view); } return $links; }
/** * @return array */ public function get_logs() { return $this->logger->find($this->log_filter); }
<?php defined('ABSPATH') or exit; $plugin = new MC4WP_Plugin(__FILE__, MC4WP_PREMIUM_VERSION); if (is_admin()) { $logging_admin = new MC4WP_Logging_Admin($plugin); $logging_admin->add_hooks(); } $logger = new MC4WP_Logger(); $logger->add_hooks();