@@ -878,11 +878,11 @@ discard block |
||
| 878 | 878 | return $countries; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | -function monsterinsights_get_api_url(){ |
|
| 881 | +function monsterinsights_get_api_url() { |
|
| 882 | 882 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
| 883 | 883 | } |
| 884 | 884 | |
| 885 | -function monsterinsights_get_licensing_url(){ |
|
| 885 | +function monsterinsights_get_licensing_url() { |
|
| 886 | 886 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
| 887 | 887 | } |
| 888 | 888 | |
@@ -947,7 +947,9 @@ discard block |
||
| 947 | 947 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
| 948 | 948 | global $wp_filter; |
| 949 | 949 | // Check that filter actually exists first |
| 950 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
| 950 | + if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
| 951 | + return FALSE; |
|
| 952 | + } |
|
| 951 | 953 | /** |
| 952 | 954 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
| 953 | 955 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -962,23 +964,35 @@ discard block |
||
| 962 | 964 | $callbacks = &$wp_filter[ $tag ]; |
| 963 | 965 | } |
| 964 | 966 | // Exit if there aren't any callbacks for specified priority |
| 965 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
| 967 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
| 968 | + return FALSE; |
|
| 969 | + } |
|
| 966 | 970 | // Loop through each filter for the specified priority, looking for our class & method |
| 967 | 971 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
| 968 | 972 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
| 969 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
| 973 | + if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) { |
|
| 974 | + continue; |
|
| 975 | + } |
|
| 970 | 976 | // If first value in array is not an object, it can't be a class |
| 971 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
| 977 | + if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) { |
|
| 978 | + continue; |
|
| 979 | + } |
|
| 972 | 980 | // Method doesn't match the one we're looking for, goto next |
| 973 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
| 981 | + if ( $filter[ 'function' ][ 1 ] !== $method_name ) { |
|
| 982 | + continue; |
|
| 983 | + } |
|
| 974 | 984 | // Method matched, now let's check the Class |
| 975 | 985 | if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
| 976 | 986 | // Now let's remove it from the array |
| 977 | 987 | unset( $callbacks[ $priority ][ $filter_id ] ); |
| 978 | 988 | // and if it was the only filter in that priority, unset that priority |
| 979 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
| 989 | + if ( empty( $callbacks[ $priority ] ) ) { |
|
| 990 | + unset( $callbacks[ $priority ] ); |
|
| 991 | + } |
|
| 980 | 992 | // and if the only filter for that tag, set the tag to an empty array |
| 981 | - if ( empty( $callbacks ) ) $callbacks = array(); |
|
| 993 | + if ( empty( $callbacks ) ) { |
|
| 994 | + $callbacks = array(); |
|
| 995 | + } |
|
| 982 | 996 | // If using WordPress older than 4.7 |
| 983 | 997 | if ( ! is_object( $wp_filter[ $tag ] ) ) { |
| 984 | 998 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
@@ -1378,7 +1392,7 @@ discard block |
||
| 1378 | 1392 | * |
| 1379 | 1393 | * @return trimed sentence |
| 1380 | 1394 | */ |
| 1381 | -function monsterinsights_trim_text( $text, $count ){ |
|
| 1395 | +function monsterinsights_trim_text( $text, $count ) { |
|
| 1382 | 1396 | $text = str_replace(" ", " ", $text); |
| 1383 | 1397 | $string = explode(" ", $text); |
| 1384 | 1398 | $trimed = ""; |
@@ -1386,7 +1400,7 @@ discard block |
||
| 1386 | 1400 | for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter++ ) { |
| 1387 | 1401 | $trimed .= isset( $string[$wordCounter] ) ? $string[$wordCounter] : ''; |
| 1388 | 1402 | |
| 1389 | - if ( $wordCounter < $count ){ |
|
| 1403 | + if ( $wordCounter < $count ) { |
|
| 1390 | 1404 | $trimed .= " "; |
| 1391 | 1405 | } else { |
| 1392 | 1406 | $trimed .= "..."; |
@@ -303,7 +303,7 @@ |
||
| 303 | 303 | // 3. License key not valid/okay for pro |
| 304 | 304 | if ( monsterinsights_is_pro_version() ) { |
| 305 | 305 | $message = ''; |
| 306 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
| 306 | + if ( MonsterInsights()->license->get_site_license_key() ) { |
|
| 307 | 307 | if ( MonsterInsights()->license->site_license_expired() ) { |
| 308 | 308 | // Translators: Adds a link to the license renewal. |
| 309 | 309 | $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'admin-notices', 'expired-license', "https://www.monsterinsights.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
@@ -97,7 +97,8 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | $options = apply_filters( 'upgrader_package_options', $options ); |
| 99 | 99 | |
| 100 | - if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times |
|
| 100 | + if ( ! $options['is_multi'] ) { |
|
| 101 | +// call $this->header separately if running multiple times |
|
| 101 | 102 | $this->skin->header(); |
| 102 | 103 | } |
| 103 | 104 | |
@@ -288,7 +289,8 @@ discard block |
||
| 288 | 289 | return $reply; |
| 289 | 290 | } |
| 290 | 291 | |
| 291 | - if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote? |
|
| 292 | + if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { |
|
| 293 | +//Local file or remote? |
|
| 292 | 294 | return $package; //must be a local file.. |
| 293 | 295 | } |
| 294 | 296 | |
@@ -443,11 +445,13 @@ discard block |
||
| 443 | 445 | $remote_destination = $wp_filesystem->find_folder( $local_destination ); |
| 444 | 446 | |
| 445 | 447 | //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. |
| 446 | - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents. |
|
| 448 | + if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { |
|
| 449 | +//Only one folder? Then we want its contents. |
|
| 447 | 450 | $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); |
| 448 | 451 | } elseif ( count( $source_files ) == 0 ) { |
| 449 | 452 | return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? |
| 450 | - } else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
| 453 | + } else { |
|
| 454 | +// It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
| 451 | 455 | $source = trailingslashit( $args['source'] ); |
| 452 | 456 | } |
| 453 | 457 | |
@@ -141,7 +141,8 @@ discard block |
||
| 141 | 141 | * @since {VERSION} |
| 142 | 142 | * |
| 143 | 143 | */ |
| 144 | - public function verify( $notifications ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh |
|
| 144 | + public function verify( $notifications ) { |
|
| 145 | +// phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh |
|
| 145 | 146 | |
| 146 | 147 | $data = array(); |
| 147 | 148 | |
@@ -169,7 +170,8 @@ discard block |
||
| 169 | 170 | } |
| 170 | 171 | |
| 171 | 172 | // Ignore if notification has already been dismissed. |
| 172 | - if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 173 | + if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { |
|
| 174 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 173 | 175 | continue; |
| 174 | 176 | } |
| 175 | 177 | |
@@ -275,7 +277,8 @@ discard block |
||
| 275 | 277 | |
| 276 | 278 | $option = $this->get_option(); |
| 277 | 279 | |
| 278 | - if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 280 | + if ( in_array( $notification['id'], $option['dismissed'] ) ) { |
|
| 281 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 279 | 282 | return; |
| 280 | 283 | } |
| 281 | 284 | |
@@ -344,7 +347,8 @@ discard block |
||
| 344 | 347 | // Remove notification. |
| 345 | 348 | if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
| 346 | 349 | foreach ( $option[ $type ] as $key => $notification ) { |
| 347 | - if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 350 | + if ( $notification['id'] == $id ) { |
|
| 351 | +// phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 348 | 352 | unset( $option[ $type ][ $key ] ); |
| 349 | 353 | break; |
| 350 | 354 | } |
@@ -87,7 +87,8 @@ |
||
| 87 | 87 | delete_transient( '_monsterinsights_activation_redirect' ); |
| 88 | 88 | |
| 89 | 89 | // Bail if activating from network, or bulk. |
| 90 | - if ( isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok. |
|
| 90 | + if ( isset( $_GET['activate-multi'] ) ) { |
|
| 91 | +// WPCS: CSRF ok, input var ok. |
|
| 91 | 92 | return; |
| 92 | 93 | } |
| 93 | 94 | |