@@ -87,7 +87,8 @@ |
||
| 87 | 87 | wp_cache_flush(); |
| 88 | 88 | $cachec = true; |
| 89 | 89 | } |
| 90 | - } else { // if existing install |
|
| 90 | + } else { |
|
| 91 | +// if existing install |
|
| 91 | 92 | if ( version_compare( $version, '6.0.11', '<' ) ) { |
| 92 | 93 | if ( ! $cachec ) { |
| 93 | 94 | wp_cache_flush(); |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | 'track_internal_as_label', |
| 431 | 431 | ); |
| 432 | 432 | foreach ( $settings as $setting ) { |
| 433 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
| 434 | - unset( $this->new_settings[ $setting ] ); |
|
| 433 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
| 434 | + unset( $this->new_settings[$setting] ); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | ); |
| 476 | 476 | |
| 477 | 477 | foreach ( $settings as $setting ) { |
| 478 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
| 479 | - unset( $this->new_settings[ $setting ] ); |
|
| 478 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
| 479 | + unset( $this->new_settings[$setting] ); |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | ); |
| 516 | 516 | |
| 517 | 517 | foreach ( $settings as $setting ) { |
| 518 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
| 519 | - unset( $this->new_settings[ $setting ] ); |
|
| 518 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
| 519 | + unset( $this->new_settings[$setting] ); |
|
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | } |
| 608 | 608 | preg_match( $regex, $cross_domain['domain'], $matches ); |
| 609 | 609 | if ( count( $matches ) > 0 ) { |
| 610 | - unset( $this->new_settings['cross_domains'][ $key ] ); |
|
| 610 | + unset( $this->new_settings['cross_domains'][$key] ); |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | 'js', |
| 688 | 688 | 'tgz' |
| 689 | 689 | ); |
| 690 | - $extensions_to_add = array( |
|
| 690 | + $extensions_to_add = array( |
|
| 691 | 691 | 'docx', |
| 692 | 692 | 'pptx', |
| 693 | 693 | 'xlsx', |
@@ -789,8 +789,8 @@ discard block |
||
| 789 | 789 | ); |
| 790 | 790 | |
| 791 | 791 | foreach ( $popular_posts_defaults as $key => $value ) { |
| 792 | - if ( empty( $this->new_settings[ $key ] ) ) { |
|
| 793 | - $this->new_settings[ $key ] = $value; |
|
| 792 | + if ( empty( $this->new_settings[$key] ) ) { |
|
| 793 | + $this->new_settings[$key] = $value; |
|
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | $content = isset( $dismiss_notification['content'] ) ? $dismiss_notification['content'] : ''; |
| 806 | 806 | |
| 807 | 807 | if ( empty( $title ) || empty( $content ) ) { |
| 808 | - unset( $dismissed_notifications[ $key ] ); |
|
| 808 | + unset( $dismissed_notifications[$key] ); |
|
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | 811 | |
@@ -40,7 +40,8 @@ |
||
| 40 | 40 | // Load the MonsterInsights Connect class. |
| 41 | 41 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/connect.php'; |
| 42 | 42 | |
| 43 | - if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { // WPCS: CSRF ok, input var ok. |
|
| 43 | + if ( isset( $_GET['page'] ) && 'monsterinsights-onboarding' === $_GET['page'] ) { |
|
| 44 | +// WPCS: CSRF ok, input var ok. |
|
| 44 | 45 | // Only load the Onboarding wizard if the required parameter is present. |
| 45 | 46 | require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/onboarding-wizard.php'; |
| 46 | 47 | } |
@@ -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 | |
@@ -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 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if ( method_exists( $this, 'get_themes_' . $type ) ) { |
| 65 | 65 | $this->themes = call_user_func( array( $this, 'get_themes_' . $type ) ); |
| 66 | 66 | if ( ! empty( $theme ) ) { |
| 67 | - $this->theme = isset( $this->themes[ $theme ] ) ? $this->themes[ $theme ] : array(); |
|
| 67 | + $this->theme = isset( $this->themes[$theme] ) ? $this->themes[$theme] : array(); |
|
| 68 | 68 | |
| 69 | 69 | return $this->theme; |
| 70 | 70 | } else { |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $settings = $this->get_theme_stored_styles(); |
| 116 | 116 | |
| 117 | - if ( ! empty( $settings[ $type ] ) ) { |
|
| 117 | + if ( ! empty( $settings[$type] ) ) { |
|
| 118 | 118 | foreach ( $themes as $theme_key => $theme_values ) { |
| 119 | - if ( ! empty( $settings[ $type ][ $theme_key ] ) ) { |
|
| 120 | - foreach ( $themes[ $theme_key ]['styles'] as $object => $props ) { |
|
| 121 | - if ( ! empty( $settings[ $type ][ $theme_key ][ $object ] ) ) { |
|
| 119 | + if ( ! empty( $settings[$type][$theme_key] ) ) { |
|
| 120 | + foreach ( $themes[$theme_key]['styles'] as $object => $props ) { |
|
| 121 | + if ( ! empty( $settings[$type][$theme_key][$object] ) ) { |
|
| 122 | 122 | foreach ( $props as $style_key => $style_value ) { |
| 123 | - if ( ! empty( $settings[ $type ][ $theme_key ][ $object ][ $style_key ] ) ) { |
|
| 124 | - $themes[ $theme_key ]['styles'][ $object ][ $style_key ] = $settings[ $type ][ $theme_key ][ $object ][ $style_key ]; |
|
| 123 | + if ( ! empty( $settings[$type][$theme_key][$object][$style_key] ) ) { |
|
| 124 | + $themes[$theme_key]['styles'][$object][$style_key] = $settings[$type][$theme_key][$object][$style_key]; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->save_progress( $page, $this->more_pages ); |
| 156 | 156 | |
| 157 | 157 | if ( $this->more_pages ) { |
| 158 | - $page ++; |
|
| 158 | + $page++; |
|
| 159 | 159 | $this->schedule_next_page( $page ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function get_post_urls( $page = 1 ) { |
| 194 | 194 | |
| 195 | - $posts_args = array( |
|
| 195 | + $posts_args = array( |
|
| 196 | 196 | 'posts_per_page' => 100, // Don't try to load more than 500 posts at once. |
| 197 | 197 | 'fields' => 'ids', // Load just the ids. |
| 198 | 198 | 'paged' => $page, |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | while ( $posts_query->have_posts() ) { |
| 206 | 206 | $posts_query->the_post(); |
| 207 | 207 | |
| 208 | - $urls[ get_the_ID() ] = get_permalink( get_the_ID() ); |
|
| 208 | + $urls[get_the_ID()] = get_permalink( get_the_ID() ); |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $urls_as_keys = array(); |
| 233 | 233 | foreach ( $urls as $id => $url ) { |
| 234 | - $urls_as_keys[ $url ] = $id; |
|
| 234 | + $urls_as_keys[$url] = $id; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | return $urls_as_keys; |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | public function store_bulk_data( $bulk_data, $urls_as_keys ) { |
| 370 | 370 | if ( ! empty( $bulk_data['data'] ) && is_array( $bulk_data['data'] ) ) { |
| 371 | 371 | foreach ( $bulk_data['data'] as $url => $values ) { |
| 372 | - $post_id = array_key_exists( $url, $urls_as_keys ) ? $urls_as_keys[ $url ] : false; |
|
| 372 | + $post_id = array_key_exists( $url, $urls_as_keys ) ? $urls_as_keys[$url] : false; |
|
| 373 | 373 | |
| 374 | 374 | if ( $post_id ) { |
| 375 | 375 | $this->store_post_counts( $post_id, $values ); |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | public static function query_popular_posts( $count = 5 ) { |
| 608 | 608 | |
| 609 | - $popular_posts_args = array( |
|
| 609 | + $popular_posts_args = array( |
|
| 610 | 610 | 'posts_per_page' => $count, |
| 611 | 611 | 'meta_value' => 'monsterinsights_sharedcount_total', |
| 612 | 612 | 'orderby' => 'meta_value_num', |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | if ( $popular_posts_query->have_posts() ) { |
| 619 | 619 | while ( $popular_posts_query->have_posts() ) { |
| 620 | 620 | $popular_posts_query->the_post(); |
| 621 | - $popular_posts[ get_the_ID() ] = array( |
|
| 621 | + $popular_posts[get_the_ID()] = array( |
|
| 622 | 622 | 'post_title' => get_the_title(), |
| 623 | 623 | 'permalink' => get_permalink(), |
| 624 | 624 | 'thumbnail' => get_the_post_thumbnail_url( get_the_ID(), 'medium' ), |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | $cached_data = get_option( $this->get_cache_key(), array() ); |
| 64 | 64 | $args_key = $this->get_args_key( $args ); // Generate an unique key based on the instance settings. |
| 65 | 65 | |
| 66 | - if ( isset( $cached_data[ $args_key ] ) && isset( $cached_data[ $args_key ]['saved_at'] ) ) { |
|
| 67 | - $time_since = time() - $cached_data[ $args_key ]['saved_at']; |
|
| 66 | + if ( isset( $cached_data[$args_key] ) && isset( $cached_data[$args_key]['saved_at'] ) ) { |
|
| 67 | + $time_since = time() - $cached_data[$args_key]['saved_at']; |
|
| 68 | 68 | |
| 69 | 69 | if ( $time_since < intval( $cache_refresh_days ) * DAY_IN_SECONDS ) { |
| 70 | - return $cached_data[ $args_key ]['posts']; |
|
| 70 | + return $cached_data[$args_key]['posts']; |
|
| 71 | 71 | } else { |
| 72 | 72 | // It's expired so let's delete it. |
| 73 | - unset( $cached_data[ $args_key ] ); |
|
| 73 | + unset( $cached_data[$args_key] ); |
|
| 74 | 74 | update_option( $this->get_cache_key(), $cached_data ); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $args_key = md5( wp_json_encode( $args ) ); // Generate an unique key based on the instance settings. |
| 113 | 113 | $cached_data = get_option( $this->get_cache_key(), array() ); |
| 114 | 114 | |
| 115 | - $cached_data[ $args_key ] = array( |
|
| 115 | + $cached_data[$args_key] = array( |
|
| 116 | 116 | 'saved_at' => time(), |
| 117 | 117 | 'posts' => $posts, |
| 118 | 118 | ); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | register_rest_route( 'monsterinsights/v1', '/popular-posts/themes/(?P<type>[a-zA-Z0-9-]+)', array( |
| 37 | 37 | 'methods' => 'GET', |
| 38 | 38 | 'callback' => array( $this, 'get_gutenberg_themes' ), |
| 39 | - 'permission_callback' => function () { |
|
| 39 | + 'permission_callback' => function() { |
|
| 40 | 40 | return current_user_can( 'edit_posts' ); |
| 41 | 41 | }, |
| 42 | 42 | 'args' => array( |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | register_rest_route( 'monsterinsights/v1', '/terms/(?P<slug>[a-zA-Z0-9-_]+)', array( |
| 48 | 48 | 'methods' => 'GET', |
| 49 | 49 | 'callback' => array( $this, 'get_taxonomy_terms' ), |
| 50 | - 'permission_callback' => function () { |
|
| 50 | + 'permission_callback' => function() { |
|
| 51 | 51 | return current_user_can( 'edit_posts' ); |
| 52 | 52 | }, |
| 53 | 53 | 'args' => array( |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | register_rest_route( 'monsterinsights/v1', '/taxonomy/(?P<slug>[a-zA-Z0-9-_]+)', array( |
| 59 | 59 | 'methods' => 'GET', |
| 60 | 60 | 'callback' => array( $this, 'get_taxonomy' ), |
| 61 | - 'permission_callback' => function () { |
|
| 61 | + 'permission_callback' => function() { |
|
| 62 | 62 | return current_user_can( 'edit_posts' ); |
| 63 | 63 | }, |
| 64 | 64 | 'args' => array( |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $themes = $this->get_themes( $type, $theme ); |
| 115 | 115 | $themes_array = $themes->themes; |
| 116 | 116 | |
| 117 | - if ( isset( $themes_array[ $theme ] ) && $styled ) { |
|
| 118 | - $themes_array[ $theme ] = $themes->get_theme(); |
|
| 117 | + if ( isset( $themes_array[$theme] ) && $styled ) { |
|
| 118 | + $themes_array[$theme] = $themes->get_theme(); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $response = array( |
@@ -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 | |
@@ -462,7 +463,8 @@ discard block |
||
| 462 | 463 | // Remove notification and add in dismissed array. |
| 463 | 464 | if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
| 464 | 465 | foreach ( $option[ $type ] as $key => $notification ) { |
| 465 | - if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 466 | + if ( $notification['id'] == $id ) { |
|
| 467 | +// phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 466 | 468 | // Add notification to dismissed array. |
| 467 | 469 | array_unshift( $option['dismissed'], $notification ); |
| 468 | 470 | // Remove notification from feed or events. |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) || |
| 221 | 221 | ( ! empty( $notification['type'] ) && ! in_array( $license_type, $notification['type'] ) ) |
| 222 | 222 | ) { |
| 223 | - unset( $notifications[ $key ] ); |
|
| 223 | + unset( $notifications[$key] ); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | foreach ( $notifications as $key => $notification ) { |
| 279 | 279 | if ( ! empty( $notification['content'] ) ) { |
| 280 | - $notifications[ $key ]['content'] = wpautop( $notification['content'] ); |
|
| 281 | - $notifications[ $key ]['content'] = apply_filters( 'monsterinsights_notification_content_display', $notifications[ $key ]['content'] ); |
|
| 280 | + $notifications[$key]['content'] = wpautop( $notification['content'] ); |
|
| 281 | + $notifications[$key]['content'] = apply_filters( 'monsterinsights_notification_content_display', $notifications[$key]['content'] ); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | // Translators: Readable time to display |
| 306 | 306 | $modified_start_time = sprintf( __( '%1$s ago', 'google-analytics-for-wordpress' ), human_time_diff( strtotime( $notification['start'] ), current_time( 'timestamp' ) ) ); |
| 307 | - $notifications[ $key ]['start'] = $modified_start_time; |
|
| 307 | + $notifications[$key]['start'] = $modified_start_time; |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | return $notifications; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $notifications = array_merge( $notification, $current_notifications ); |
| 411 | 411 | |
| 412 | 412 | // Sort notifications by priority |
| 413 | - usort( $notifications, function ( $a, $b ) { |
|
| 413 | + usort( $notifications, function( $a, $b ) { |
|
| 414 | 414 | if ( ! isset( $a['priority'] ) || ! isset( $b['priority'] ) ) { |
| 415 | 415 | return 0; |
| 416 | 416 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | return 0; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - return $a['priority'] < $b['priority'] ? - 1 : 1; |
|
| 422 | + return $a['priority'] < $b['priority'] ? -1 : 1; |
|
| 423 | 423 | } ); |
| 424 | 424 | |
| 425 | 425 | update_option( |
@@ -482,13 +482,13 @@ discard block |
||
| 482 | 482 | if ( is_array( $option['feed'] ) && ! empty( $option['feed'] ) ) { |
| 483 | 483 | foreach ( $option['feed'] as $key => $notification ) { |
| 484 | 484 | array_unshift( $option['dismissed'], $notification ); |
| 485 | - unset( $option['feed'][ $key ] ); |
|
| 485 | + unset( $option['feed'][$key] ); |
|
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | if ( is_array( $option['events'] ) && ! empty( $option['events'] ) ) { |
| 489 | 489 | foreach ( $option['events'] as $key => $notification ) { |
| 490 | 490 | array_unshift( $option['dismissed'], $notification ); |
| 491 | - unset( $option['events'][ $key ] ); |
|
| 491 | + unset( $option['events'][$key] ); |
|
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | } |
@@ -496,13 +496,13 @@ discard block |
||
| 496 | 496 | $type = is_numeric( $id ) ? 'feed' : 'events'; |
| 497 | 497 | |
| 498 | 498 | // Remove notification and add in dismissed array. |
| 499 | - if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
|
| 500 | - foreach ( $option[ $type ] as $key => $notification ) { |
|
| 499 | + if ( is_array( $option[$type] ) && ! empty( $option[$type] ) ) { |
|
| 500 | + foreach ( $option[$type] as $key => $notification ) { |
|
| 501 | 501 | if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
| 502 | 502 | // Add notification to dismissed array. |
| 503 | 503 | array_unshift( $option['dismissed'], $notification ); |
| 504 | 504 | // Remove notification from feed or events. |
| 505 | - unset( $option[ $type ][ $key ] ); |
|
| 505 | + unset( $option[$type][$key] ); |
|
| 506 | 506 | break; |
| 507 | 507 | } |
| 508 | 508 | } |