@@ -44,37 +44,37 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // Get addons data from transient or perform API query if no transient. |
| 46 | 46 | if ( false === ( $addons = get_transient( '_monsterinsights_addons' ) ) ) { |
| 47 | - $addons = monsterinsights_get_addons_data( $key ); |
|
| 47 | + $addons = monsterinsights_get_addons_data( $key ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // If no Addons exist, return false |
| 51 | 51 | if ( ! $addons ) { |
| 52 | - return false; |
|
| 52 | + return false; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Iterate through Addons, to build two arrays: |
| 56 | 56 | // - Addons the user is licensed to use, |
| 57 | 57 | // - Addons the user isn't licensed to use. |
| 58 | 58 | $results = array( |
| 59 | - 'licensed' => array(), |
|
| 60 | - 'unlicensed'=> array(), |
|
| 59 | + 'licensed' => array(), |
|
| 60 | + 'unlicensed'=> array(), |
|
| 61 | 61 | ); |
| 62 | 62 | foreach ( (array) $addons as $i => $addon ) { |
| 63 | 63 | |
| 64 | - // Determine whether the user is licensed to use this Addon or not. |
|
| 65 | - if ( |
|
| 66 | - empty( $type ) || |
|
| 67 | - ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
| 68 | - ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
| 69 | - ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
| 70 | - ) { |
|
| 71 | - // Unlicensed |
|
| 72 | - $results['unlicensed'][] = $addon; |
|
| 73 | - continue; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - // Licensed |
|
| 77 | - $results['licensed'][] = $addon; |
|
| 64 | + // Determine whether the user is licensed to use this Addon or not. |
|
| 65 | + if ( |
|
| 66 | + empty( $type ) || |
|
| 67 | + ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
| 68 | + ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
| 69 | + ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
| 70 | + ) { |
|
| 71 | + // Unlicensed |
|
| 72 | + $results['unlicensed'][] = $addon; |
|
| 73 | + continue; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + // Licensed |
|
| 77 | + $results['licensed'][] = $addon; |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -95,21 +95,21 @@ discard block |
||
| 95 | 95 | // Get Addons |
| 96 | 96 | // If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information. |
| 97 | 97 | if ( monsterinsights_is_pro_version() && $key ) { |
| 98 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
| 98 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
| 99 | 99 | } else { |
| 100 | - $addons = monsterinsights_get_all_addons_data(); |
|
| 100 | + $addons = monsterinsights_get_all_addons_data(); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // If there was an API error, set transient for only 10 minutes. |
| 104 | 104 | if ( ! $addons ) { |
| 105 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
| 106 | - return false; |
|
| 105 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
| 106 | + return false; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // If there was an error retrieving the addons, set the error. |
| 110 | 110 | if ( isset( $addons->error ) ) { |
| 111 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
| 112 | - return false; |
|
| 111 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
| 112 | + return false; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Otherwise, our request worked. Save the data and return it. |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | $keys = array_keys( get_plugins() ); |
| 174 | 174 | |
| 175 | 175 | foreach ( $keys as $key ) { |
| 176 | - if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
| 177 | - return $key; |
|
| 178 | - } |
|
| 176 | + if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
| 177 | + return $key; |
|
| 178 | + } |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $slug; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $site_license = array( |
|
| 45 | + $site_license = array( |
|
| 46 | 46 | 'key' => MonsterInsights()->license->get_site_license_key(), |
| 47 | 47 | 'type' => MonsterInsights()->license->get_site_license_type(), |
| 48 | 48 | 'is_disabled' => MonsterInsights()->license->site_license_disabled(), |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | // Array fields are needed even if empty. |
| 103 | 103 | $array_fields = array( 'view_reports', 'save_settings', 'ignore_users' ); |
| 104 | 104 | foreach ( $array_fields as $array_field ) { |
| 105 | - if ( ! isset( $options[ $array_field ] ) ) { |
|
| 106 | - $options[ $array_field ] = array(); |
|
| 105 | + if ( ! isset( $options[$array_field] ) ) { |
|
| 106 | + $options[$array_field] = array(); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | if ( isset( $options['custom_code'] ) ) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | if ( $empty ) { |
| 180 | - unset( $value[ $key ] ); |
|
| 180 | + unset( $value[$key] ); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | } else { |
| 228 | 228 | $addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug ); |
| 229 | 229 | } |
| 230 | - $parsed_addons[ $addon->slug ] = $addon; |
|
| 230 | + $parsed_addons[$addon->slug] = $addon; |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $installed = false; |
| 317 | 317 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
| 318 | 318 | |
| 319 | - if ( isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
| 319 | + if ( isset( $installed_plugins[$plugin_basename] ) ) { |
|
| 320 | 320 | $installed = true; |
| 321 | 321 | |
| 322 | 322 | if ( is_multisite() && is_network_admin() ) { |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | ); |
| 460 | 460 | |
| 461 | 461 | foreach ( $exclude as $e ) { |
| 462 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
| 463 | - unset( $new_settings[ $e ] ); |
|
| 462 | + if ( ! empty( $new_settings[$e] ) ) { |
|
| 463 | + unset( $new_settings[$e] ); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | foreach ( $exclude as $e ) { |
| 474 | - if ( ! empty( $settings[ $e ] ) ) { |
|
| 475 | - $new_settings = $settings[ $e ]; |
|
| 474 | + if ( ! empty( $settings[$e] ) ) { |
|
| 475 | + $new_settings = $settings[$e]; |
|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | ), |
| 631 | 631 | admin_url( 'admin.php' ) |
| 632 | 632 | ); |
| 633 | - $url = esc_url( $url ); |
|
| 633 | + $url = esc_url( $url ); |
|
| 634 | 634 | |
| 635 | 635 | ob_start(); |
| 636 | 636 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |