@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( !defined( 'ABSPATH' ) ) { |
|
| 14 | + exit; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Get the settings for a section |
@@ -153,7 +155,7 @@ discard block |
||
| 153 | 155 | } |
| 154 | 156 | add_action( 'current_screen', 'monsterinsights_save_settings' ); |
| 155 | 157 | |
| 156 | -function monsterinsights_is_settings_tab( $tab = '' ){ |
|
| 158 | +function monsterinsights_is_settings_tab( $tab = '' ) { |
|
| 157 | 159 | $tabs = monsterinsights_get_settings_tabs(); |
| 158 | 160 | if ( empty( $tab ) || empty( $tabs ) || ! is_string( $tab ) || ! is_array( $tabs ) ) { |
| 159 | 161 | return false; |
@@ -317,7 +319,7 @@ discard block |
||
| 317 | 319 | function monsterinsights_sanitize_multicheck_field( $value, $id, $setting, $previous_value ) { |
| 318 | 320 | $save_value = array(); |
| 319 | 321 | if ( ! empty( $value ) && is_array( $value ) ) { |
| 320 | - foreach( $setting['options'] as $key => $option ){ |
|
| 322 | + foreach( $setting['options'] as $key => $option ) { |
|
| 321 | 323 | if ( in_array( $key, $value ) ) { |
| 322 | 324 | $save_value[] = $key; |
| 323 | 325 | } |
@@ -342,7 +344,7 @@ discard block |
||
| 342 | 344 | if ( ! empty( $value ) && is_array( $value ) ) { |
| 343 | 345 | if ( $setting['multiple'] ) { |
| 344 | 346 | foreach ( $value as $vid => $vname ) { |
| 345 | - foreach( $setting['options'] as $key => $option ){ |
|
| 347 | + foreach( $setting['options'] as $key => $option ) { |
|
| 346 | 348 | if ( $key === $vname ) { |
| 347 | 349 | $save_value[] = $key; |
| 348 | 350 | break; |
@@ -350,11 +352,11 @@ discard block |
||
| 350 | 352 | } |
| 351 | 353 | } |
| 352 | 354 | } else { |
| 353 | - foreach( $setting['options'] as $key => $option ){ |
|
| 355 | + foreach( $setting['options'] as $key => $option ) { |
|
| 354 | 356 | if ( is_array( $value ) && in_array( $key, $value ) ) { |
| 355 | 357 | $save_value = $key; |
| 356 | 358 | break; |
| 357 | - } else if ( is_string( $value ) && $key === $value ){ |
|
| 359 | + } else if ( is_string( $value ) && $key === $value ) { |
|
| 358 | 360 | $save_value = $key; |
| 359 | 361 | break; |
| 360 | 362 | } |
@@ -375,7 +377,7 @@ discard block |
||
| 375 | 377 | function monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ) { |
| 376 | 378 | $save_value = ''; |
| 377 | 379 | if ( ! empty( $value ) ) { |
| 378 | - foreach( $setting['options'] as $key => $option ){ |
|
| 380 | + foreach( $setting['options'] as $key => $option ) { |
|
| 379 | 381 | if ( $key === $value ) { |
| 380 | 382 | $save_value = $key; |
| 381 | 383 | } |
@@ -995,7 +997,8 @@ discard block |
||
| 995 | 997 | /** |
| 996 | 998 | * @todo docbloc |
| 997 | 999 | */ |
| 998 | -function monsterinsights_add_setting_tooltip( $html, $args ) { // @todo: enqueue tooltips |
|
| 1000 | +function monsterinsights_add_setting_tooltip( $html, $args ) { |
|
| 1001 | +// @todo: enqueue tooltips |
|
| 999 | 1002 | |
| 1000 | 1003 | if ( ! empty( $args['tooltip_title'] ) && ! empty( $args['tooltip_desc'] ) ) { |
| 1001 | 1004 | $tooltip = '<span alt="f223" class="monsterinsights-help-tip dashicons dashicons-editor-help" title="<strong>' . $args['tooltip_title'] . '</strong>: ' . $args['tooltip_desc'] . '"></span>'; |
@@ -1052,6 +1055,6 @@ discard block |
||
| 1052 | 1055 | /** |
| 1053 | 1056 | * @todo docbloc |
| 1054 | 1057 | */ |
| 1055 | -function monsterinsights_get_non_setting_types(){ |
|
| 1058 | +function monsterinsights_get_non_setting_types() { |
|
| 1056 | 1059 | return apply_filters( 'monsterinsights_non_setting_types', array( 'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) ); |
| 1057 | 1060 | } |
| 1058 | 1061 | \ No newline at end of file |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | |
| 167 | 167 | // Deactivate the addon. |
| 168 | 168 | if ( isset( $_POST['plugin'] ) ) { |
| 169 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
| 169 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
| 170 | 170 | $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
| 171 | 171 | } else { |
| 172 | 172 | $deactivate = deactivate_plugins( $_POST['plugin'] ); |
@@ -390,7 +390,7 @@ |
||
| 390 | 390 | return $shareasale_id; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | -function monsterinsights_settings_ublock_error_js(){ |
|
| 393 | +function monsterinsights_settings_ublock_error_js() { |
|
| 394 | 394 | echo "<script type='text/javascript'>\n"; |
| 395 | 395 | echo "jQuery( document ).ready( function( $ ) { |
| 396 | 396 | if ( window.uorigindetected == null){ |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | <?php |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function monsterinsights_tools_url_builder_tab(){ |
|
| 54 | +function monsterinsights_tools_url_builder_tab() { |
|
| 55 | 55 | do_action( 'monsterinsights_tools_url_builder_tab' ); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | </th> |
| 71 | 71 | <td> |
| 72 | 72 | <?php |
| 73 | - if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){ |
|
| 73 | + if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) { |
|
| 74 | 74 | echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() ); |
| 75 | 75 | } |
| 76 | 76 | ?> |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){ |
|
| 136 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){ |
|
| 167 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) { |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | function monsterinsights_rss_link_tagger( $guid ) { |
| 127 | 127 | global $post; |
| 128 | 128 | |
| 129 | - if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
|
| 129 | + if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ) { |
|
| 130 | 130 | if ( is_feed() ) { |
| 131 | 131 | if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
| 132 | 132 | $delimiter = '#'; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -72,7 +72,8 @@ discard block |
||
| 72 | 72 | // This is the version used for MI upgrade routines. |
| 73 | 73 | update_option( 'monsterinsights_db_version', '6.2.0' ); |
| 74 | 74 | |
| 75 | - } else if ( ! $version && $yoast ) { // if new install and has used Yoast previously |
|
| 75 | + } else if ( ! $version && $yoast ) { |
|
| 76 | +// if new install and has used Yoast previously |
|
| 76 | 77 | |
| 77 | 78 | $this->upgrade_from_yoast(); |
| 78 | 79 | // This is the version used for MI upgrade routines. |
@@ -83,7 +84,8 @@ discard block |
||
| 83 | 84 | $cachec = true; |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - } else { // if existing install |
|
| 87 | + } else { |
|
| 88 | +// if existing install |
|
| 87 | 89 | if ( version_compare( $version, '6.0.2', '<' ) ) { |
| 88 | 90 | $this->v602_upgrades(); |
| 89 | 91 | } |
@@ -328,7 +330,7 @@ discard block |
||
| 328 | 330 | $network = false; |
| 329 | 331 | // Try network active Premium |
| 330 | 332 | $is_key = get_site_option( 'google-analytics-by-yoast-premium_license', array() ); |
| 331 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
| 333 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
| 332 | 334 | $key = $is_key['key']; |
| 333 | 335 | $found = true; |
| 334 | 336 | $network = true; |
@@ -337,7 +339,7 @@ discard block |
||
| 337 | 339 | // Try single site Premium |
| 338 | 340 | if ( ! $found ) { |
| 339 | 341 | $is_key = get_option( 'google-analytics-by-yoast-premium_license', array() ); |
| 340 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
| 342 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
| 341 | 343 | $key = $is_key['key']; |
| 342 | 344 | $found = true; |
| 343 | 345 | } |
@@ -346,7 +348,7 @@ discard block |
||
| 346 | 348 | // Try network active Premium |
| 347 | 349 | if ( ! $found ) { |
| 348 | 350 | $is_key = get_site_option( 'monsterinsights-pro_license', array() ); |
| 349 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
| 351 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
| 350 | 352 | $key = $is_key['key']; |
| 351 | 353 | $found = true; |
| 352 | 354 | $network = true; |
@@ -356,7 +358,7 @@ discard block |
||
| 356 | 358 | // Try single site Premium |
| 357 | 359 | if ( ! $found ) { |
| 358 | 360 | $is_key = get_option( 'monsterinsights-pro_license', array() ); |
| 359 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
| 361 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
| 360 | 362 | $key = $is_key['key']; |
| 361 | 363 | $found = true; |
| 362 | 364 | } |
@@ -365,7 +367,7 @@ discard block |
||
| 365 | 367 | // Try network active ecommmerce |
| 366 | 368 | if ( ! $found ) { |
| 367 | 369 | $is_key = get_site_option( 'ecommerce-addon_license', array() ); |
| 368 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ){ |
|
| 370 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) && is_multisite() ) { |
|
| 369 | 371 | $key = $is_key['key']; |
| 370 | 372 | $found = true; |
| 371 | 373 | $network = true; |
@@ -374,7 +376,7 @@ discard block |
||
| 374 | 376 | // Try single site ecommerce |
| 375 | 377 | if ( ! $found ) { |
| 376 | 378 | $is_key = get_option( 'ecommerce-addon_license', array() ); |
| 377 | - if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ){ |
|
| 379 | + if ( $is_key && ! empty( $is_key ) && is_array( $is_key ) && ! empty( $is_key['key'] ) ) { |
|
| 378 | 380 | $key = $is_key['key']; |
| 379 | 381 | $found = true; |
| 380 | 382 | } |
@@ -516,7 +518,7 @@ discard block |
||
| 516 | 518 | delete_option( 'yoast-ga-access_token' ); |
| 517 | 519 | delete_option( 'yoast-ga-refresh_token' ); |
| 518 | 520 | delete_option( 'yst_ga_api' ); |
| 519 | - } else { |
|
| 521 | + } else { |
|
| 520 | 522 | // if UA in profile profiles, remove others and use that |
| 521 | 523 | if ( ! empty( $options['analytics_profile' ] ) && ! empty( $profiles['ga_api_response_accounts'] ) && is_array( $profiles['ga_api_response_accounts'] ) ) { |
| 522 | 524 | foreach ( $profiles as $account ) { |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | + exit; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Callback for displaying the UI for support tab. |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -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', 'www.monsterinsights.com/v1/' ); |
| 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 |