@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function monsterinsights_track_user() { |
33 | 33 | $user = wp_get_current_user(); |
34 | 34 | $track_user = true; |
35 | - $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
35 | + $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
36 | 36 | |
37 | 37 | if ( ! empty( $roles ) && is_array( $roles ) ) { |
38 | 38 | foreach ( $roles as $role ) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | |
100 | 100 | $ga_cookie = $_COOKIE['_ga']; |
101 | - $cookie_parts = explode('.', $ga_cookie ); |
|
101 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
102 | 102 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
103 | 103 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
104 | 104 | if ( is_string( $uuid ) ) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | $ga_cookie = $_COOKIE['_ga']; |
160 | - $cookie_parts = explode('.', $ga_cookie ); |
|
160 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
161 | 161 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
162 | 162 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
163 | 163 | if ( is_string( $uuid ) ) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | function monsterinsights_generate_ga_client_id() { |
175 | - return rand(100000000,999999999) . '.' . time(); |
|
175 | + return rand( 100000000, 999999999 ) . '.' . time(); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $stop = time(); |
193 | 193 | } |
194 | 194 | |
195 | - $diff = (int) abs( $stop - $start ); |
|
195 | + $diff = (int) abs( $stop - $start ); |
|
196 | 196 | $hours = round( $diff / HOUR_IN_SECONDS ); |
197 | 197 | return $hours; |
198 | 198 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
251 | 251 | |
252 | 252 | foreach ( $editable_roles as $id => $name ) { |
253 | - $roles[ $id ] = translate_user_role( $name['name'] ); |
|
253 | + $roles[$id] = translate_user_role( $name['name'] ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $roles; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | } |
297 | 297 | if ( substr_count( $host, '.' ) > 1 ) { |
298 | - $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
298 | + $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
299 | 299 | foreach ( $subdomains_to_check as $subdomain ) { |
300 | 300 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
301 | 301 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
@@ -311,16 +311,16 @@ discard block |
||
311 | 311 | |
312 | 312 | // Set cookie to expire in 2 years |
313 | 313 | function monsterinsights_get_cookie_expiration_date( $time ) { |
314 | - return date('D, j F Y H:i:s', time() + $time ); |
|
314 | + return date( 'D, j F Y H:i:s', time() + $time ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | function monsterinsights_string_ends_with( $string, $ending ) { |
318 | - $strlen = strlen($string); |
|
319 | - $endinglen = strlen($ending); |
|
318 | + $strlen = strlen( $string ); |
|
319 | + $endinglen = strlen( $ending ); |
|
320 | 320 | if ( $endinglen > $strlen ) { |
321 | 321 | return false; |
322 | 322 | } |
323 | - return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0; |
|
323 | + return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | function monsterinsights_string_starts_with( $string, $start ) { |
@@ -844,11 +844,11 @@ discard block |
||
844 | 844 | return $countries; |
845 | 845 | } |
846 | 846 | |
847 | -function monsterinsights_get_api_url(){ |
|
847 | +function monsterinsights_get_api_url() { |
|
848 | 848 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
849 | 849 | } |
850 | 850 | |
851 | -function monsterinsights_get_licensing_url(){ |
|
851 | +function monsterinsights_get_licensing_url() { |
|
852 | 852 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
853 | 853 | } |
854 | 854 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | -if ( ! function_exists ( 'remove_class_filter' ) ) { |
|
899 | +if ( ! function_exists( 'remove_class_filter' ) ) { |
|
900 | 900 | /** |
901 | 901 | * Remove Class Filter Without Access to Class Object |
902 | 902 | * |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
918 | 918 | global $wp_filter; |
919 | 919 | // Check that filter actually exists first |
920 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
920 | + if ( ! isset( $wp_filter[$tag] ) ) return FALSE; |
|
921 | 921 | /** |
922 | 922 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
923 | 923 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -926,33 +926,33 @@ discard block |
||
926 | 926 | * |
927 | 927 | * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ |
928 | 928 | */ |
929 | - if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) { |
|
930 | - $callbacks = &$wp_filter[ $tag ]->callbacks; |
|
929 | + if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) { |
|
930 | + $callbacks = &$wp_filter[$tag]->callbacks; |
|
931 | 931 | } else { |
932 | - $callbacks = &$wp_filter[ $tag ]; |
|
932 | + $callbacks = &$wp_filter[$tag]; |
|
933 | 933 | } |
934 | 934 | // Exit if there aren't any callbacks for specified priority |
935 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
935 | + if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE; |
|
936 | 936 | // Loop through each filter for the specified priority, looking for our class & method |
937 | - foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
|
937 | + foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) { |
|
938 | 938 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
939 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
939 | + if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue; |
|
940 | 940 | // If first value in array is not an object, it can't be a class |
941 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
941 | + if ( ! is_object( $filter['function'][0] ) ) continue; |
|
942 | 942 | // Method doesn't match the one we're looking for, goto next |
943 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
943 | + if ( $filter['function'][1] !== $method_name ) continue; |
|
944 | 944 | // Method matched, now let's check the Class |
945 | - if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
|
945 | + if ( get_class( $filter['function'][0] ) === $class_name ) { |
|
946 | 946 | // Now let's remove it from the array |
947 | - unset( $callbacks[ $priority ][ $filter_id ] ); |
|
947 | + unset( $callbacks[$priority][$filter_id] ); |
|
948 | 948 | // and if it was the only filter in that priority, unset that priority |
949 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
949 | + if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] ); |
|
950 | 950 | // and if the only filter for that tag, set the tag to an empty array |
951 | 951 | if ( empty( $callbacks ) ) $callbacks = array(); |
952 | 952 | // If using WordPress older than 4.7 |
953 | - if ( ! is_object( $wp_filter[ $tag ] ) ) { |
|
953 | + if ( ! is_object( $wp_filter[$tag] ) ) { |
|
954 | 954 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
955 | - unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
|
955 | + unset( $GLOBALS['merged_filters'][$tag] ); |
|
956 | 956 | } |
957 | 957 | return TRUE; |
958 | 958 | } |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | } |
962 | 962 | } // End function exists |
963 | 963 | |
964 | -if ( ! function_exists ( 'remove_class_action' ) ) { |
|
964 | +if ( ! function_exists( 'remove_class_action' ) ) { |
|
965 | 965 | /** |
966 | 966 | * Remove Class Action Without Access to Class Object |
967 | 967 | * |
@@ -844,11 +844,11 @@ discard block |
||
844 | 844 | return $countries; |
845 | 845 | } |
846 | 846 | |
847 | -function monsterinsights_get_api_url(){ |
|
847 | +function monsterinsights_get_api_url() { |
|
848 | 848 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
849 | 849 | } |
850 | 850 | |
851 | -function monsterinsights_get_licensing_url(){ |
|
851 | +function monsterinsights_get_licensing_url() { |
|
852 | 852 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
853 | 853 | } |
854 | 854 | |
@@ -917,7 +917,9 @@ discard block |
||
917 | 917 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
918 | 918 | global $wp_filter; |
919 | 919 | // Check that filter actually exists first |
920 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
920 | + if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
921 | + return FALSE; |
|
922 | + } |
|
921 | 923 | /** |
922 | 924 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
923 | 925 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -932,23 +934,35 @@ discard block |
||
932 | 934 | $callbacks = &$wp_filter[ $tag ]; |
933 | 935 | } |
934 | 936 | // Exit if there aren't any callbacks for specified priority |
935 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
937 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
938 | + return FALSE; |
|
939 | + } |
|
936 | 940 | // Loop through each filter for the specified priority, looking for our class & method |
937 | 941 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
938 | 942 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
939 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
943 | + if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) { |
|
944 | + continue; |
|
945 | + } |
|
940 | 946 | // If first value in array is not an object, it can't be a class |
941 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
947 | + if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) { |
|
948 | + continue; |
|
949 | + } |
|
942 | 950 | // Method doesn't match the one we're looking for, goto next |
943 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
951 | + if ( $filter[ 'function' ][ 1 ] !== $method_name ) { |
|
952 | + continue; |
|
953 | + } |
|
944 | 954 | // Method matched, now let's check the Class |
945 | 955 | if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
946 | 956 | // Now let's remove it from the array |
947 | 957 | unset( $callbacks[ $priority ][ $filter_id ] ); |
948 | 958 | // and if it was the only filter in that priority, unset that priority |
949 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
959 | + if ( empty( $callbacks[ $priority ] ) ) { |
|
960 | + unset( $callbacks[ $priority ] ); |
|
961 | + } |
|
950 | 962 | // and if the only filter for that tag, set the tag to an empty array |
951 | - if ( empty( $callbacks ) ) $callbacks = array(); |
|
963 | + if ( empty( $callbacks ) ) { |
|
964 | + $callbacks = array(); |
|
965 | + } |
|
952 | 966 | // If using WordPress older than 4.7 |
953 | 967 | if ( ! is_object( $wp_filter[ $tag ] ) ) { |
954 | 968 | // Remove this filter from merged_filters, which specifies if filters have been sorted |