Skip to content

Commit

Permalink
MI 7.6 & 7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscct7 committed Jun 19, 2019
1 parent 843c92d commit 29aa472
Show file tree
Hide file tree
Showing 66 changed files with 4,274 additions and 3,141 deletions.
Binary file modified assets/css/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/css/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/css/images/mascot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/css/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/down-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/plugin-om.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/plugin-smtp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/plugin-wpforms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/question-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/up-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/woo-edd-upsell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ var MonsterInsights = function(){
valuesArray.extension = extension; /* What extension is this link */
valuesArray.type = type; /* What type of link is this */
valuesArray.target = target; /* Is a new tab/window being opened? */
valuesArray.title = el.title || el.textContent || el.innerText; /* Try link title, then text content */
valuesArray.title = el.title || el.innerText || el.getAttribute('aria-label') || el.textContent; /* Try link title, then text content */

/* Let's track everything but internals (that aren't internal-as-externals) and javascript */
if ( type !== 'internal' && type !== 'javascript' ) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 21 additions & 6 deletions assets/lib/pandora/class-am-notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,24 @@ public function get_remote_notifications() {
return;
}

$last_checked = get_option( '_amn_' . $this->plugin . '_last_checked', strtotime( '-1 week' ) );
$to_check = get_option( '_amn_' . $this->plugin . '_to_check', false );

if ( $to_check == false ) {
// Non load balanced. Start checking in in 7 days + 2-4 days.
$checktime = array();
$checktime['day'] = rand( 0, 6 );
$checktime['hour'] = rand( 0, 23 );
$checktime['minute'] = rand( 0, 59 );
$checktime['second'] = rand( 0, 59 );
$checktime['offset'] = ( $checktime['day'] * DAY_IN_SECONDS ) +
( $checktime['hour'] * HOUR_IN_SECONDS ) +
( $checktime['minute'] * MINUTE_IN_SECONDS ) +
$checktime['second'];
$to_check = strtotime("next sunday") + $checktime['offset'];
update_option( '_amn_' . $this->plugin . '_to_check', $to_check );
}

if ( $last_checked < strtotime( 'today midnight' ) ) {
if ( $to_check < time() ) {
$plugin_notifications = $this->get_plugin_notifications( 1 );
$notification_id = null;

Expand Down Expand Up @@ -158,7 +173,7 @@ public function get_remote_notifications() {
}

// Set the option now so we can't run this again until after 24 hours.
update_option( '_amn_' . $this->plugin . '_last_checked', strtotime( 'today midnight' ) );
update_option( '_amn_' . $this->plugin . '_to_check', time() + 3 * DAY_IN_SECONDS );
}
}

Expand Down Expand Up @@ -355,7 +370,7 @@ public function get_plan_level() {
$type = MonsterInsights()->license->get_network_license_type();
}

// Check key fallbacks
// Check key fallbacks.
if ( empty( $key ) ) {
$key = MonsterInsights()->license->get_license_key();
}
Expand Down Expand Up @@ -394,7 +409,7 @@ public function get_plan_level() {
// Possibly set the level to 'unknown' if a key is entered, but no level can be determined (such as manually entered key)
if ( ! empty( $key ) && empty( $level ) ) {
$level = 'unknown';
}
}

// Normalize the level.
switch ( $level ) {
Expand Down Expand Up @@ -454,4 +469,4 @@ public function revoke_notifications( $ids ) {
}
}
}
}
}
18 changes: 15 additions & 3 deletions googleanalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: MonsterInsights
* Author URI: https://www.monsterinsights.com/?utm_source=liteplugin&utm_medium=pluginheader&utm_campaign=authoruri&utm_content=7%2E0%2E0
*
* Version: 7.5.0
* Version: 7.7.0
* Requires at least: 3.8.0
* Tested up to: 5.1.1
*
Expand Down Expand Up @@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
* @access public
* @var string $version Plugin version.
*/
public $version = '7.5.0';
public $version = '7.7.0';

/**
* Plugin file.
Expand Down Expand Up @@ -216,7 +216,7 @@ public static function get_instance() {

// This does the version to version background upgrade routines and initial install
$mi_version = get_option( 'monsterinsights_current_version', '5.5.3' );
if ( version_compare( $mi_version, '7.4.0', '<' ) ) {
if ( version_compare( $mi_version, '7.6.0', '<' ) ) {
monsterinsights_lite_call_install_and_upgrade();
}

Expand Down Expand Up @@ -633,6 +633,18 @@ function monsterinsights_lite_uninstall_hook() {
// has that method.
$instance = MonsterInsights();

// If uninstalling via wp-cli load admin-specific files only here.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
define( 'WP_ADMIN', true );
$instance->require_files();
$instance->load_auth();
$instance->load_licensing();
$instance->notices = new MonsterInsights_Notice_Admin();
$instance->license_actions = new MonsterInsights_License_Actions();
$instance->reporting = new MonsterInsights_Reporting();
$instance->api_auth = new MonsterInsights_API_Auth();
}

// Don't delete any data if the PRO version is already active.
if ( monsterinsights_is_pro_version() ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function monsterinsights_admin_menu() {
}

// Add About us page.
// add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' );
add_submenu_page( $hook, __( 'About Us:', 'google-analytics-for-wordpress' ), __( 'About Us', 'google-analytics-for-wordpress' ), 'manage_options', $submenu_base . '#/about' );
}
add_action( 'admin_menu', 'monsterinsights_admin_menu' );

Expand Down
13 changes: 9 additions & 4 deletions includes/admin/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,17 @@ function monsterinsights_admin_scripts() {
// Used to add notices for future deprecations.
'versions' => array(
'php_version' => phpversion(),
'php_version_below_54' => version_compare( phpversion(), '5.4', '<' ),
'php_version_below_56' => version_compare( phpversion(), '5.6', '<' ),
'php_version_below_54' => apply_filters( 'monsterinsights_temporarily_hide_php_52_and_53_upgrade_warnings', version_compare( phpversion(), '5.4', '<' ) ),
'php_version_below_56' => apply_filters( 'monsterinsights_temporarily_hide_php_54_and_55_upgrade_warnings', version_compare( phpversion(), '5.6', '<' ) ),
'php_update_link' => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ),
'wp_version' => $wp_version,
'wp_version_below_46' => version_compare( $wp_version, '4.6', '<' ),
'wp_version_below_49' => version_compare( $wp_version, '4.9', '<' ),
'wp_update_link' => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ),
),
'plugin_version' => MONSTERINSIGHTS_VERSION,
'is_admin' => true,
'reports_url' => add_query_arg( 'page', 'monsterinsights_reports', admin_url( 'admin.php' ) ),
)
);

Expand Down Expand Up @@ -304,15 +306,16 @@ function monsterinsights_admin_scripts() {
// Used to add notices for future deprecations.
'versions' => array(
'php_version' => phpversion(),
'php_version_below_54' => version_compare( phpversion(), '5.4', '<' ),
'php_version_below_56' => version_compare( phpversion(), '5.6', '<' ),
'php_version_below_54' => apply_filters( 'monsterinsights_temporarily_hide_php_52_and_53_upgrade_warnings', version_compare( phpversion(), '5.4', '<' ) ),
'php_version_below_56' => apply_filters( 'monsterinsights_temporarily_hide_php_54_and_55_upgrade_warnings', version_compare( phpversion(), '5.6', '<' ) ),
'php_update_link' => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' ),
'wp_version' => $wp_version,
'wp_version_below_46' => version_compare( $wp_version, '4.6', '<' ),
'wp_version_below_49' => version_compare( $wp_version, '4.9', '<' ),
'wp_update_link' => monsterinsights_get_url( 'settings-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' ),
),
'plugin_version' => MONSTERINSIGHTS_VERSION,
'is_admin' => true,
)
);
return;
Expand Down Expand Up @@ -470,6 +473,8 @@ function monsterinsights_remove_conflicting_asset_files() {
'repuso_js_admin', // Social testimonials and reviews by Repuso
'chart', // Video Mate Pro Theme
'reuse_vendor', // RedQ Reuse Form
'jetpack-onboarding-vendor', // Jetpack Onboarding Bluehost
'date-js', // Google Analytics by Web Dorado
);

if ( ! empty( $styles ) ) {
Expand Down
70 changes: 0 additions & 70 deletions includes/admin/pages/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,73 +62,3 @@ function monsterinsights_reports_page() {
echo monsterinsights_ublock_notice();
monsterinsights_settings_error_page( 'monsterinsights-reports');
}

function monsterinsights_refresh_reports_data() {
check_ajax_referer( 'mi-admin-nonce', 'security' );

// Get variables
$start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : '';
$end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : '';
$name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : '';
$isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : '';


// Current user can authenticate
if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
wp_send_json_error( array( 'message' => __( "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' );
6 changes: 3 additions & 3 deletions includes/admin/pages/settings.php

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions includes/admin/partials/header.php

This file was deleted.

4 changes: 0 additions & 4 deletions includes/admin/partials/index.php

This file was deleted.

4 changes: 4 additions & 0 deletions includes/admin/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ public function get_addons() {
$parsed_addons['memberpress'] = array(
'active' => defined( 'MEPR_VERSION' ) && version_compare( MEPR_VERSION, '1.3.43', '>' ),
);
// LifterLMS.
$parsed_addons['lifterlms'] = array(
'active' => function_exists( 'LLMS' ) && version_compare( LLMS()->version, '3.32.0', '>=' ),
);
// Cookiebot.
$parsed_addons['cookiebot'] = array(
'active' => function_exists( 'cookiebot_active' ) && cookiebot_active(),
Expand Down
Loading

0 comments on commit 29aa472

Please sign in to comment.