@@ -50,7 +50,7 @@ |
||
| 50 | 50 | // Remove 'Styling Template' from titles. |
| 51 | 51 | foreach ( $api_info as $id => $template ) { |
| 52 | 52 | if ( isset( $template['name'] ) ) { |
| 53 | - $api_info[ $id ]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] ); |
|
| 53 | + $api_info[$id]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] ); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'text-color' => $style->post_content['text_color'], |
| 41 | 41 | 'submit-bg-color' => $style->post_content['submit_bg_color'], |
| 42 | 42 | ); |
| 43 | - $index = 0; |
|
| 43 | + $index = 0; |
|
| 44 | 44 | foreach ( $colors as $css_var_name => $color ) { |
| 45 | 45 | if ( 0 !== strpos( $color, 'rgb' ) ) { |
| 46 | 46 | $color = '#' . $color; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'style' => 'background-color: var(--' . $css_var_name . ')', |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - ++$index; |
|
| 54 | + ++ $index; |
|
| 55 | 55 | ?> |
| 56 | 56 | <div <?php FrmAppHelper::array_to_html_params( $circle_params, true ); ?>></div> |
| 57 | 57 | <?php |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | if ( isset( $addon['categories'] ) ) { |
| 106 | 106 | $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); |
| 107 | 107 | if ( ! empty( $cats ) ) { |
| 108 | - unset( $addons[ $k ] ); |
|
| 108 | + unset( $addons[$k] ); |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) { |
| 114 | - $addons[ $k ]['is_new'] = $this->is_new( $addon ); |
|
| 114 | + $addons[$k]['is_new'] = $this->is_new( $addon ); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | return $addon; |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 157 | - $plugin = $addons[ $download_id ]; |
|
| 156 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 157 | + $plugin = $addons[$download_id]; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return $plugin; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $page = $this->get_pagenum(); |
| 21 | 21 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 22 | 22 | |
| 23 | - $mode = self::get_param( |
|
| 23 | + $mode = self::get_param( |
|
| 24 | 24 | array( |
| 25 | 25 | 'param' => 'mode', |
| 26 | 26 | 'default' => 'list', |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | 'default' => 'name', |
| 33 | 33 | ) |
| 34 | 34 | ); |
| 35 | - $order = self::get_param( |
|
| 35 | + $order = self::get_param( |
|
| 36 | 36 | array( |
| 37 | 37 | 'param' => 'order', |
| 38 | 38 | 'default' => 'ASC', |
| 39 | 39 | ) |
| 40 | 40 | ); |
| 41 | - $start = self::get_param( |
|
| 41 | + $start = self::get_param( |
|
| 42 | 42 | array( |
| 43 | 43 | 'param' => 'start', |
| 44 | 44 | 'default' => ( $page - 1 ) * $per_page, |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $counts = FrmForm::get_count(); |
| 163 | 163 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
| 164 | 164 | |
| 165 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
| 165 | + if ( isset( $statuses[$form_type] ) ) { |
|
| 166 | 166 | $counts->$form_type = $this->total_items; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | if ( $counts->{$status} || 'draft' !== $status ) { |
| 185 | 185 | /* translators: %1$s: Status, %2$s: Number of items */ |
| 186 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 186 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | unset( $status, $name ); |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | private function get_actions( &$actions, $item, $edit_link ) { |
| 349 | 349 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 350 | 350 | foreach ( $new_actions as $link => $action ) { |
| 351 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 351 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | if ( 'trash' == $this->status ) { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
| 166 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
| 167 | 167 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
| 168 | 168 | return; |
| 169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * @param array $form |
| 179 | 179 | */ |
| 180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
| 181 | - if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
|
| 182 | - return $form[ $value ]; |
|
| 181 | + if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) { |
|
| 182 | + return $form[$value]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return ''; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if ( $for === 'view' ) { |
| 211 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
| 211 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
| 212 | 212 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
| 213 | 213 | } elseif ( $for === 'form' ) { |
| 214 | 214 | $item_key = $form_key; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $page_ids[ $for ] = wp_insert_post( |
|
| 226 | + $page_ids[$for] = wp_insert_post( |
|
| 227 | 227 | array( |
| 228 | 228 | 'post_title' => $name, |
| 229 | 229 | 'post_type' => 'page', |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
| 378 | 378 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
| 379 | 379 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
| 380 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
| 380 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
| 381 | 381 | // allow other file types to be imported |
| 382 | 382 | do_action( 'frm_before_import_' . $file_type ); |
| 383 | 383 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | foreach ( $type as $tb_type ) { |
| 471 | 471 | $where = array(); |
| 472 | 472 | $join = ''; |
| 473 | - $table = $tables[ $tb_type ]; |
|
| 473 | + $table = $tables[$tb_type]; |
|
| 474 | 474 | |
| 475 | 475 | $select = $table . '.id'; |
| 476 | 476 | $query_vars = array(); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $table . '.parent_form_id' => $args['ids'], |
| 486 | 486 | ); |
| 487 | 487 | } else { |
| 488 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 488 | + $where[$table . '.status !'] = 'draft'; |
|
| 489 | 489 | } |
| 490 | 490 | break; |
| 491 | 491 | case 'actions': |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | case 'items': |
| 499 | 499 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 500 | 500 | if ( $args['ids'] ) { |
| 501 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 501 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 502 | 502 | } |
| 503 | 503 | break; |
| 504 | 504 | case 'styles': |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 542 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 543 | 543 | unset( $tb_type ); |
| 544 | 544 | } |
| 545 | 545 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | $no_export_fields = FrmField::no_save_fields(); |
| 711 | 711 | foreach ( $csv_fields as $k => $f ) { |
| 712 | 712 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
| 713 | - unset( $csv_fields[ $k ] ); |
|
| 713 | + unset( $csv_fields[$k] ); |
|
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | //validate the number format |
| 65 | 65 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 66 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 66 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // validate number settings |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
| 76 | 76 | $value = (float) $args['value']; |
| 77 | 77 | if ( $value < $minnum ) { |
| 78 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
| 78 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
| 79 | 79 | } elseif ( $value > $maxnum ) { |
| 80 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
| 80 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | 100 | private function validate_step( &$errors, $args ) { |
| 101 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
| 101 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
| 102 | 102 | return; // Don't need to check if value is invalid before. |
| 103 | 103 | } |
| 104 | 104 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
| 115 | + $errors['field' . $args['id']] = sprintf( |
|
| 116 | 116 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
| 117 | 117 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
| 118 | 118 | floatval( $result[0] ), |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | * @return array |
| 182 | 182 | */ |
| 183 | 183 | private function prepare_array_property( $index, $atts ) { |
| 184 | - if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { |
|
| 184 | + if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) { |
|
| 185 | 185 | |
| 186 | - if ( is_array( $atts[ $index ] ) ) { |
|
| 187 | - $property = $atts[ $index ]; |
|
| 186 | + if ( is_array( $atts[$index] ) ) { |
|
| 187 | + $property = $atts[$index]; |
|
| 188 | 188 | } else { |
| 189 | - $property = explode( ',', $atts[ $index ] ); |
|
| 189 | + $property = explode( ',', $atts[$index] ); |
|
| 190 | 190 | } |
| 191 | 191 | } else { |
| 192 | 192 | $property = array(); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | ); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - $ip = array( |
|
| 269 | + $ip = array( |
|
| 270 | 270 | 'label' => __( 'IP Address', 'formidable' ), |
| 271 | 271 | 'value' => $this->entry->ip, |
| 272 | 272 | ); |
@@ -356,6 +356,6 @@ discard block |
||
| 356 | 356 | * @return void |
| 357 | 357 | */ |
| 358 | 358 | protected function add_field_values( $field ) { |
| 359 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 359 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 360 | 360 | } |
| 361 | 361 | } |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $show_intervals = array( 50, 200, 500 ); |
| 81 | 81 | $asked = $this->review_status['asked']; |
| 82 | 82 | |
| 83 | - if ( ! isset( $show_intervals[ $asked ] ) ) { |
|
| 83 | + if ( ! isset( $show_intervals[$asked] ) ) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $entries = FrmEntry::getRecordCount(); |
| 88 | - $count = $show_intervals[ $asked ]; |
|
| 88 | + $count = $show_intervals[$asked]; |
|
| 89 | 89 | $user = wp_get_current_user(); |
| 90 | 90 | |
| 91 | 91 | // Only show review request if the site has collected enough entries |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $requests = $message->get_messages(); |
| 135 | 135 | $key = $this->inbox_key . ( $asked ? $asked : '' ); |
| 136 | 136 | |
| 137 | - if ( isset( $requests[ $key ] ) ) { |
|
| 137 | + if ( isset( $requests[$key] ) ) { |
|
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @return bool |
| 174 | 174 | */ |
| 175 | 175 | private function has_later_request( $requests, $asked ) { |
| 176 | - return isset( $requests[ $this->inbox_key . ( $asked + 1 ) ] ) || isset( $requests[ $this->inbox_key . ( $asked + 2 ) ] ); |
|
| 176 | + return isset( $requests[$this->inbox_key . ( $asked + 1 )] ) || isset( $requests[$this->inbox_key . ( $asked + 2 )] ); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 108 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 109 | 109 | // Don't replace messages unless required. |
| 110 | 110 | return; |
| 111 | 111 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 117 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 118 | 118 | // Move up and mark as new. |
| 119 | - unset( self::$messages[ $message['key'] ] ); |
|
| 119 | + unset( self::$messages[$message['key']] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $this->fill_message( $message ); |
| 123 | - self::$messages[ $message['key'] ] = $message; |
|
| 123 | + self::$messages[$message['key']] = $message; |
|
| 124 | 124 | |
| 125 | 125 | $this->update_list(); |
| 126 | 126 | |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | private function clean_messages() { |
| 157 | 157 | $removed = false; |
| 158 | 158 | foreach ( self::$messages as $t => $message ) { |
| 159 | - $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 160 | - $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 159 | + $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 160 | + $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 161 | 161 | $expired = $this->is_expired( $message ); |
| 162 | 162 | if ( $read || $expired || $dismissed ) { |
| 163 | - unset( self::$messages[ $t ] ); |
|
| 163 | + unset( self::$messages[$t] ); |
|
| 164 | 164 | $removed = true; |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | private function filter_messages( &$messages ) { |
| 177 | 177 | $user_id = get_current_user_id(); |
| 178 | 178 | foreach ( $messages as $k => $message ) { |
| 179 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 179 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 180 | 180 | if ( empty( $k ) || $this->is_expired( $message ) || $dismissed ) { |
| 181 | - unset( $messages[ $k ] ); |
|
| 181 | + unset( $messages[$k] ); |
|
| 182 | 182 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 183 | - unset( $messages[ $k ] ); |
|
| 183 | + unset( $messages[$k] ); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | * @return void |
| 227 | 227 | */ |
| 228 | 228 | public function mark_read( $key ) { |
| 229 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 229 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 234 | - self::$messages[ $key ]['read'] = array(); |
|
| 233 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 234 | + self::$messages[$key]['read'] = array(); |
|
| 235 | 235 | } |
| 236 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 236 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 237 | 237 | |
| 238 | 238 | $this->update_list(); |
| 239 | 239 | } |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | * @return void |
| 247 | 247 | */ |
| 248 | 248 | public function mark_unread( $key ) { |
| 249 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 249 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 250 | 250 | if ( $is_read ) { |
| 251 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 251 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 252 | 252 | $this->update_list(); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 267 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 268 | 268 | return; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 272 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 271 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 272 | + self::$messages[$key]['dismissed'] = array(); |
|
| 273 | 273 | } |
| 274 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 274 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 275 | 275 | |
| 276 | 276 | $this->update_list(); |
| 277 | 277 | } |
@@ -285,11 +285,11 @@ discard block |
||
| 285 | 285 | $user_id = get_current_user_id(); |
| 286 | 286 | foreach ( self::$messages as $key => $message ) { |
| 287 | 287 | if ( ! isset( $message['dismissed'] ) ) { |
| 288 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 288 | + self::$messages[$key]['dismissed'] = array(); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 292 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 291 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 292 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | $this->update_list(); |
@@ -299,8 +299,8 @@ discard block |
||
| 299 | 299 | $messages = $this->get_messages( 'filter' ); |
| 300 | 300 | $user_id = get_current_user_id(); |
| 301 | 301 | foreach ( $messages as $t => $message ) { |
| 302 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 303 | - unset( $messages[ $t ] ); |
|
| 302 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 303 | + unset( $messages[$t] ); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | return $messages; |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * @return void |
| 329 | 329 | */ |
| 330 | 330 | public function remove( $key ) { |
| 331 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 332 | - unset( self::$messages[ $key ] ); |
|
| 331 | + if ( isset( self::$messages[$key] ) ) { |
|
| 332 | + unset( self::$messages[$key] ); |
|
| 333 | 333 | $this->update_list(); |
| 334 | 334 | } |
| 335 | 335 | } |