Allow third party tools to manipulate (add, remove, edit) the list of reports available. Please use unique report IDs that don't interfere with built-in ones, if you add your own custom report.
self::$reports_info = apply_filters( 'slimstat_reports_info', self::$reports_info );
The array passed to this function looks like:
self::$reports_info = array( 'slim_getsocial' => array( 'title' => __( 'Social Sharing Analytics <a href="http://getsocial.io/?utm_source=slimstat">powered by GetSocial</a>', 'wp-slimstat' ), 'callback' => array( __CLASS__, 'show_getsocial' ), 'classes' => array( 'full-width' ), 'screens' => array( 'wp-slim-view-4' ) ), 'slim_p7_02' => array( 'title' => __( 'Activity', 'wp-slimstat' ), 'callback' => array( __CLASS__, 'show_activity_log' ), 'callback_args' => array( 'type' => 'recent', 'columns' => 'id', 'raw' => array( 'wp_slimstat_db', 'get_recent' ) ), 'classes' => array( 'full-width', 'tall' ), 'screens' => array( 'wp-slim-view-1', 'dashboard' ), 'tooltip' => __( 'Color codes', 'wp-slimstat' ).'</strong><p><span class="little-color-box is-search-engine"></span> '.__( 'From search result page', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-visitor"></span> '.__( 'Known Visitor', 'wp-slimstat' ).'</p><p><span class="little-color-box is-known-user"></span> '.__( 'Known Users', 'wp-slimstat' ).'</p><p><span class="little-color-box is-direct"></span> '.__( 'Other Humans', 'wp-slimstat' ).'</p><p><span class="little-color-box"></span> '.__( 'Bot or Crawler', 'wp-slimstat' ).'</p>' ), 'slim_p1_01' => array( 'title' => __( 'Pageviews', 'wp-slimstat' ), 'callback' => array( __CLASS__, 'show_chart' ), 'callback_args' => array( 'type' => 'p1_01' ), 'classes' => array( 'wide', 'chart' ), 'screens' => array( 'wp-slim-view-2', 'dashboard' ), 'tooltip' => $chart_tooltip ), 'slim_p1_02' => array( 'title' => __( 'About Slimstat', 'wp-slimstat' ), //'callback' => array( __CLASS__, 'show_about_wpslimstat' ), 'callback' => array( __CLASS__, 'raw_results_to_html' ), 'callback_args' => array( 'raw' => array( __CLASS__, 'get_about_wpslimstat' ) ), 'classes' => array( 'normal', 'hidden' ), 'screens' => array( 'wp-slim-view-2' ) ), etc
To define a new report, use the following code:
add_filter( 'slimstat_reports_info', 'add_report_info' ); function add_report_info( $_reports_info = array() ) { $_reports_info[ 'slim_super_duper' ] = array( // Report Title 'title' => 'Super Duper', // Callback that renders the data retrieved from the DB 'callback' => 'raw_results_to_html', // Arguments for the callback 'callback_args' => array( // The 'raw' param is the name of the function that retrieves the data from the DB // Please note: if you specify this paramenter, Slimstat will attempt to use it // for the Excel generator and Email functionality 'raw' => 'get_raw_results' ), // Report layout: normal, wide, full-width, tall // You can mix and match class names (normal tall) 'classes' => array( 'full-width' ), // On what screen should this report appear? // wp-slim-view-1: Access Log // wp-slim-view-2: Overview // wp-slim-view-3: Audience // wp-slim-view-4: Site Analysis // wp-slim-view-5: Traffic Sources // wp-slim-view-6: Map Overlay // dashboard: WordPress Dashboard 'screens' => array( 'wp-slim-view-3' ) ); return $_reports_info; }