reporting->reports as $report ) { ?> title ); ?>

reporting->reports as $report ) { ?>
title ) ); ?>
name ); ?>
show_report(); @todo we don't need to init output them. ?>
__( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); } if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { define( 'WP_NETWORK_ADMIN', true ); } // Only for Pro users, require a license key to be entered first so we can link to things. if ( monsterinsights_is_pro_version() ) { if ( ! MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->is_network_licensed() ) { wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); } else if ( MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->site_license_has_error() ) { // good to go: site licensed } else if ( MonsterInsights()->license->is_network_licensed() && ! MonsterInsights()->license->network_license_has_error() ) { // good to go: network licensed } else { wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); } } // we do not have a current auth $site_auth = MonsterInsights()->auth->get_viewname(); $ms_auth = is_multisite() && MonsterInsights()->auth->get_network_viewname(); if ( ! $site_auth && ! $ms_auth ) { wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); } if ( empty( $name ) ) { wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); } $report = MonsterInsights()->reporting->get_report( $name ); if ( empty( $report ) ) { wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); } $args = array( 'start' => $start, 'end' => $end ); if ( $isnetwork ) { $args['network'] = true; } $data = $report->get_data( $args ); if ( ! empty( $data['success'] ) ) { $data = $report->show_report( array( 'start' => $start, 'end' => $end, 'data' => $data['data'], 'success' => true ) ); wp_send_json_success( array( 'html' => $data ) ); } else { wp_send_json_error( array( 'message' => $data['error'], 'data' => $data['data'] ) ); } } add_action( 'wp_ajax_monsterinsights_refresh_reports', 'monsterinsights_refresh_reports_data' );