@@ -299,6 +299,9 @@ discard block |
||
| 299 | 299 | return $this->alter_builder_classes( $classes ); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | + /** |
|
| 303 | + * @param string $classes |
|
| 304 | + */ |
|
| 302 | 305 | protected function alter_builder_classes( $classes ) { |
| 303 | 306 | return $classes; |
| 304 | 307 | } |
@@ -493,6 +496,11 @@ discard block |
||
| 493 | 496 | return $html; |
| 494 | 497 | } |
| 495 | 498 | |
| 499 | + /** |
|
| 500 | + * @param string $html |
|
| 501 | + * |
|
| 502 | + * @return string |
|
| 503 | + */ |
|
| 496 | 504 | protected function after_replace_html_shortcodes( $args, $html ) { |
| 497 | 505 | return $html; |
| 498 | 506 | } |
@@ -788,6 +796,7 @@ discard block |
||
| 788 | 796 | * Link input to field description for screen readers |
| 789 | 797 | * |
| 790 | 798 | * @since 3.0 |
| 799 | + * @param string $input_html |
|
| 791 | 800 | */ |
| 792 | 801 | protected function add_aria_description( $args, &$input_html ) { |
| 793 | 802 | $describedby = ''; |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | $field_val = ''; |
| 106 | 106 | if ( is_object( $this->field ) ) { |
| 107 | 107 | $field_val = $this->field->{$column}; |
| 108 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 109 | - $field_val = $this->field[ $column ]; |
|
| 108 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 109 | + $field_val = $this->field[$column]; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return $field_val; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ( is_object( $this->field ) ) { |
| 121 | 121 | $this->field->{$column} = $value; |
| 122 | 122 | } elseif ( is_array( $this->field ) ) { |
| 123 | - $this->field[ $column ] = $value; |
|
| 123 | + $this->field[$column] = $value; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | $fields = FrmField::field_selection(); |
| 431 | 431 | $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
| 432 | 432 | |
| 433 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 434 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 433 | + if ( isset( $fields[$this->type] ) ) { |
|
| 434 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | return $name; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | public function get_default_field_options() { |
| 445 | - $opts = array( |
|
| 445 | + $opts = array( |
|
| 446 | 446 | 'size' => '', |
| 447 | 447 | 'max' => '', |
| 448 | 448 | 'label' => '', |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | } else { |
| 768 | 768 | $args['save_array'] = $this->is_readonly_array(); |
| 769 | - $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
| 769 | + $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | return $hidden; |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | protected function show_single_hidden( $selected, $args ) { |
| 776 | 776 | if ( $args['save_array'] ) { |
| 777 | 777 | $args['field_name'] .= '[]'; |
| 778 | - $id = ''; |
|
| 778 | + $id = ''; |
|
| 779 | 779 | } else { |
| 780 | 780 | $id = ' id="' . esc_attr( $args['html_id'] ) . '"'; |
| 781 | 781 | } |
@@ -791,8 +791,8 @@ discard block |
||
| 791 | 791 | $selected = $values['field_value']; |
| 792 | 792 | |
| 793 | 793 | if ( isset( $values['combo_name'] ) ) { |
| 794 | - $options = $options[ $values['combo_name'] ]; |
|
| 795 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 794 | + $options = $options[$values['combo_name']]; |
|
| 795 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | $input = $this->select_tag( $values ); |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | protected function fill_display_field_values( $args = array() ) { |
| 849 | - $defaults = array( |
|
| 849 | + $defaults = array( |
|
| 850 | 850 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 851 | 851 | 'field_id' => $this->get_field_column( 'id' ), |
| 852 | 852 | 'field_plus_id' => '', |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | $describedby = 'frm_desc_' . $args['html_id']; |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) ) { |
|
| 887 | + if ( isset( $args['errors']['field' . $args['field_id']] ) ) { |
|
| 888 | 888 | $describedby .= ' frm_error_' . $args['html_id']; |
| 889 | 889 | } |
| 890 | 890 | |
@@ -940,8 +940,8 @@ discard block |
||
| 940 | 940 | $value = $this->prepare_display_value( $value, $atts ); |
| 941 | 941 | |
| 942 | 942 | if ( is_array( $value ) ) { |
| 943 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 944 | - $value = $value[ $atts['show'] ]; |
|
| 943 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 944 | + $value = $value[$atts['show']]; |
|
| 945 | 945 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 946 | 946 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 947 | 947 | $value = implode( $sep, $value ); |
@@ -1010,8 +1010,8 @@ discard block |
||
| 1010 | 1010 | $saved_entries = $atts['ids']; |
| 1011 | 1011 | $new_value = array(); |
| 1012 | 1012 | foreach ( (array) $value as $old_child_id ) { |
| 1013 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1014 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1013 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1014 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | } |
| 1017 | 1017 | |
@@ -300,7 +300,6 @@ discard block |
||
| 300 | 300 | * Get the action link for an addon that isn't active. |
| 301 | 301 | * |
| 302 | 302 | * @since 3.06.03 |
| 303 | - * @param string $addon The plugin slug |
|
| 304 | 303 | * @return array |
| 305 | 304 | */ |
| 306 | 305 | public static function install_link( $plugin ) { |
@@ -403,6 +402,7 @@ discard block |
||
| 403 | 402 | |
| 404 | 403 | /** |
| 405 | 404 | * @since 3.04.02 |
| 405 | + * @param string $link |
|
| 406 | 406 | */ |
| 407 | 407 | private static function prepare_addon_link( &$link ) { |
| 408 | 408 | $site_url = 'https://formidableforms.com/'; |
@@ -736,6 +736,7 @@ discard block |
||
| 736 | 736 | * so let's install the plugin. |
| 737 | 737 | * |
| 738 | 738 | * @since 3.04.02 |
| 739 | + * @return string |
|
| 739 | 740 | */ |
| 740 | 741 | private static function install_addon() { |
| 741 | 742 | require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } else { |
| 64 | 64 | foreach ( $addons as $k => $addon ) { |
| 65 | 65 | if ( empty( $addon['excerpt'] ) && $k !== 'error' ) { |
| 66 | - unset( $addons[ $k ] ); |
|
| 66 | + unset( $addons[$k] ); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -222,16 +222,16 @@ discard block |
||
| 222 | 222 | continue; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array(); |
|
| 225 | + $wp_plugin = isset( $wp_plugins[$folder] ) ? $wp_plugins[$folder] : array(); |
|
| 226 | 226 | $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0'; |
| 227 | 227 | |
| 228 | 228 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 229 | 229 | $slug = explode( '/', $folder ); |
| 230 | 230 | $plugin->slug = $slug[0]; |
| 231 | - $transient->response[ $folder ] = $plugin; |
|
| 231 | + $transient->response[$folder] = $plugin; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $transient->checked[ $folder ] = $wp_version; |
|
| 234 | + $transient->checked[$folder] = $wp_version; |
|
| 235 | 235 | |
| 236 | 236 | } |
| 237 | 237 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | $all_plugins = get_plugins(); |
| 256 | 256 | |
| 257 | - return isset( $all_plugins[ $plugin ] ); |
|
| 257 | + return isset( $all_plugins[$plugin] ); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -293,13 +293,13 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0; |
| 296 | - if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 296 | + if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 297 | 297 | // if this addon is using its own license, get the update url |
| 298 | 298 | $addon_info = $api->get_api_info(); |
| 299 | 299 | |
| 300 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 300 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 301 | 301 | if ( isset( $addon_info['error'] ) ) { |
| 302 | - $version_info[ $download_id ]['error'] = array( |
|
| 302 | + $version_info[$download_id]['error'] = array( |
|
| 303 | 303 | 'message' => $addon_info['error']['message'], |
| 304 | 304 | 'code' => $addon_info['error']['code'], |
| 305 | 305 | ); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @return array |
| 319 | 319 | */ |
| 320 | 320 | public static function install_link( $plugin ) { |
| 321 | - $link = array(); |
|
| 321 | + $link = array(); |
|
| 322 | 322 | $addons = self::get_api_addons(); |
| 323 | 323 | self::prepare_addons( $addons ); |
| 324 | 324 | |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | return $addon; |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 369 | - $plugin = $addons[ $download_id ]; |
|
| 368 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 369 | + $plugin = $addons[$download_id]; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | return $plugin; |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | self::prepare_addon_link( $addon['link'] ); |
| 418 | 418 | |
| 419 | 419 | self::set_addon_status( $addon ); |
| 420 | - $addons[ $id ] = $addon; |
|
| 420 | + $addons[$id] = $addon; |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | 'utm_medium' => 'addons', |
| 436 | 436 | 'utm_campaign' => 'liteplugin', |
| 437 | 437 | ); |
| 438 | - $link = add_query_arg( $query_args, $link ); |
|
| 438 | + $link = add_query_arg( $query_args, $link ); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -147,6 +147,7 @@ discard block |
||
| 147 | 147 | * Include the permissions settings for each capability. |
| 148 | 148 | * |
| 149 | 149 | * @since 3.06.04 |
| 150 | + * @param FrmSettings $settings_list |
|
| 150 | 151 | * @return array |
| 151 | 152 | */ |
| 152 | 153 | private function messages( $settings_list ) { |
@@ -173,6 +174,7 @@ discard block |
||
| 173 | 174 | * Include the permissions settings for each capability. |
| 174 | 175 | * |
| 175 | 176 | * @since 3.06.04 |
| 177 | + * @param FrmSettings $settings_list |
|
| 176 | 178 | * @return array |
| 177 | 179 | */ |
| 178 | 180 | private function permissions( $settings_list ) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | foreach ( $pass_settings as $setting ) { |
| 141 | 141 | if ( isset( $settings_list->$setting ) ) { |
| 142 | - $settings[ $setting ] = $this->maybe_json( $settings_list->$setting ); |
|
| 142 | + $settings[$setting] = $this->maybe_json( $settings_list->$setting ); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $message_settings = array(); |
| 173 | 173 | foreach ( $messages as $message ) { |
| 174 | - $message_settings[ $message ] = $settings_list->$message; |
|
| 174 | + $message_settings[$message] = $settings_list->$message; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $message_settings; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 191 | 191 | if ( isset( $settings_list->$frm_role ) ) { |
| 192 | - $permissions[ $frm_role ] = $settings_list->$frm_role; |
|
| 192 | + $permissions[$frm_role] = $settings_list->$frm_role; |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | 258 | foreach ( $settings as $setting ) { |
| 259 | - if ( isset( $form->options[ $setting ] ) ) { |
|
| 260 | - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); |
|
| 259 | + if ( isset( $form->options[$setting] ) ) { |
|
| 260 | + $new_form[$setting] = $this->maybe_json( $form->options[$setting] ); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | * @return array |
| 309 | 309 | */ |
| 310 | 310 | private function fields() { |
| 311 | - $args = array( |
|
| 311 | + $args = array( |
|
| 312 | 312 | 'limit' => 100, |
| 313 | 313 | 'order_by' => 'id DESC', |
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | $fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args ); |
| 317 | 317 | foreach ( $fields as $k => $field ) { |
| 318 | - $fields[ $k ]->field_options = json_encode( maybe_unserialize( $field->field_options ) ); |
|
| 318 | + $fields[$k]->field_options = json_encode( maybe_unserialize( $field->field_options ) ); |
|
| 319 | 319 | } |
| 320 | 320 | return $fields; |
| 321 | 321 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * |
| 81 | 81 | * @since 3.06 |
| 82 | 82 | * |
| 83 | - * @param object $xml The values included in the XML. |
|
| 83 | + * @param SimpleXMLElement $xml The values included in the XML. |
|
| 84 | 84 | */ |
| 85 | 85 | private static function set_new_form_name( &$xml ) { |
| 86 | 86 | if ( ! isset( $xml->form ) ) { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $export_format = apply_filters( 'frm_export_formats', $export_format ); |
| 194 | 194 | |
| 195 | 195 | $file_type = strtolower( pathinfo( wp_unslash( $_FILES['frm_import_file']['name'] ), PATHINFO_EXTENSION ) ); |
| 196 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
| 196 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
| 197 | 197 | // allow other file types to be imported |
| 198 | 198 | do_action( 'frm_before_import_' . $file_type ); |
| 199 | 199 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | foreach ( $type as $tb_type ) { |
| 277 | 277 | $where = array(); |
| 278 | 278 | $join = ''; |
| 279 | - $table = $tables[ $tb_type ]; |
|
| 279 | + $table = $tables[$tb_type]; |
|
| 280 | 280 | |
| 281 | 281 | $select = $table . '.id'; |
| 282 | 282 | $query_vars = array(); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $table . '.parent_form_id' => $args['ids'], |
| 292 | 292 | ); |
| 293 | 293 | } else { |
| 294 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 294 | + $where[$table . '.status !'] = 'draft'; |
|
| 295 | 295 | } |
| 296 | 296 | break; |
| 297 | 297 | case 'actions': |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | case 'items': |
| 305 | 305 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 306 | 306 | if ( $args['ids'] ) { |
| 307 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 307 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 308 | 308 | } |
| 309 | 309 | break; |
| 310 | 310 | case 'styles': |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 348 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 349 | 349 | unset( $tb_type ); |
| 350 | 350 | } |
| 351 | 351 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $no_export_fields = FrmField::no_save_fields(); |
| 491 | 491 | foreach ( $csv_fields as $k => $f ) { |
| 492 | 492 | if ( in_array( $f->type, $no_export_fields ) ) { |
| 493 | - unset( $csv_fields[ $k ] ); |
|
| 493 | + unset( $csv_fields[$k] ); |
|
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param string $type |
| 111 | 111 | * |
| 112 | - * @return array |
|
| 112 | + * @return string |
|
| 113 | 113 | */ |
| 114 | 114 | public static function get_default_field_options( $type ) { |
| 115 | 115 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @param object $field |
| 214 | 214 | * |
| 215 | - * @return array |
|
| 215 | + * @return stdClass |
|
| 216 | 216 | */ |
| 217 | 217 | private static function get_original_field( $field ) { |
| 218 | 218 | $original_type = FrmField::get_option( $field, 'original_type' ); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @param string $type |
| 242 | 242 | * |
| 243 | - * @return array |
|
| 243 | + * @return string |
|
| 244 | 244 | */ |
| 245 | 245 | public static function get_default_field( $type ) { |
| 246 | 246 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @since 2.0 |
| 266 | 266 | * |
| 267 | 267 | * @param $field |
| 268 | - * @param $error |
|
| 268 | + * @param string $error |
|
| 269 | 269 | * |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 27 | 27 | $values['field_options']['data_type'] = $setting; |
| 28 | 28 | } else { |
| 29 | - $values['field_options'][ $setting ] = 1; |
|
| 29 | + $values['field_options'][$setting] = 1; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | foreach ( $defaults as $opt => $default ) { |
| 136 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 136 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 137 | 137 | |
| 138 | 138 | if ( $check_post ) { |
| 139 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 139 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | unset( $opt, $default ); |
@@ -180,16 +180,16 @@ discard block |
||
| 180 | 180 | * @param mixed $value |
| 181 | 181 | */ |
| 182 | 182 | private static function get_posted_field_setting( $setting, &$value ) { |
| 183 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 183 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { |
|
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if ( strpos( $setting, 'html' ) !== false ) { |
| 188 | 188 | // Strip slashes from HTML but not regex. |
| 189 | - $value = maybe_unserialize( wp_unslash( $_POST['field_options'][ $setting ] ) ); |
|
| 189 | + $value = maybe_unserialize( wp_unslash( $_POST['field_options'][$setting] ) ); |
|
| 190 | 190 | } else { |
| 191 | 191 | // TODO: Remove stripslashes on output, and use on input only. |
| 192 | - $value = maybe_unserialize( $_POST['field_options'][ $setting ] ); // WPCS: sanitization ok. |
|
| 192 | + $value = maybe_unserialize( $_POST['field_options'][$setting] ); // WPCS: sanitization ok. |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $values['default_value'] = maybe_serialize( $field->default_value ); |
| 262 | 262 | |
| 263 | 263 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 264 | - $values[ $col ] = $field->{$col}; |
|
| 264 | + $values[$col] = $field->{$col}; |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | ); |
| 302 | 302 | |
| 303 | 303 | $msg = FrmField::get_option( $field, $error ); |
| 304 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 304 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 305 | 305 | $msg = do_shortcode( $msg ); |
| 306 | 306 | |
| 307 | 307 | return $msg; |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $base_name = 'default_value_' . $field['id']; |
| 412 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
| 412 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
| 413 | 413 | |
| 414 | 414 | $default_type = self::get_default_value_type( $field ); |
| 415 | 415 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | continue; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 708 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 709 | 709 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 710 | 710 | |
| 711 | 711 | $atts['entry'] = $entry; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | if ( $replace_with !== null ) { |
| 716 | 716 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 717 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 717 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | unset( $atts, $replace_with ); |
@@ -757,8 +757,8 @@ discard block |
||
| 757 | 757 | |
| 758 | 758 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
| 759 | 759 | |
| 760 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 761 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 760 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 761 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 762 | 762 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 763 | 763 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 764 | 764 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -967,8 +967,8 @@ discard block |
||
| 967 | 967 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 968 | 968 | } elseif ( in_array( $type, $multiple_input ) ) { |
| 969 | 969 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 970 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 971 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 970 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 971 | + $field_types[$type] = $field_selection[$type]; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | |
| 1002 | 1002 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 1003 | 1003 | foreach ( $inputs as $input ) { |
| 1004 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1004 | + $field_types[$input] = $fields[$input]; |
|
| 1005 | 1005 | unset( $input ); |
| 1006 | 1006 | } |
| 1007 | 1007 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | 'parent' => false, |
| 1034 | 1034 | 'pointer' => false, |
| 1035 | 1035 | ); |
| 1036 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1036 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1037 | 1037 | |
| 1038 | 1038 | $opt_key = $args['opt_key']; |
| 1039 | 1039 | $field = $args['field']; |
@@ -1050,22 +1050,22 @@ discard block |
||
| 1050 | 1050 | // Check posted vals before checking saved values |
| 1051 | 1051 | |
| 1052 | 1052 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1053 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 1053 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 1054 | 1054 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1055 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1055 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1056 | 1056 | } else { |
| 1057 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
| 1057 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | return $other_val; |
| 1061 | 1061 | |
| 1062 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 1062 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 1063 | 1063 | // For normal fields |
| 1064 | 1064 | |
| 1065 | 1065 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1066 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1066 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1067 | 1067 | } else { |
| 1068 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
| 1068 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | return $other_val; |
@@ -1075,8 +1075,8 @@ discard block |
||
| 1075 | 1075 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 1076 | 1076 | // Check if there is an "other" val in saved value and make sure the |
| 1077 | 1077 | // "other" val is not equal to the Other checkbox option |
| 1078 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1079 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1078 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1079 | + $other_val = $field['value'][$opt_key]; |
|
| 1080 | 1080 | } |
| 1081 | 1081 | } else { |
| 1082 | 1082 | /** |
@@ -1088,8 +1088,8 @@ discard block |
||
| 1088 | 1088 | // Multi-select dropdowns - key is not preserved |
| 1089 | 1089 | if ( is_array( $field['value'] ) ) { |
| 1090 | 1090 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1091 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1092 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1091 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1092 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1093 | 1093 | } |
| 1094 | 1094 | } elseif ( $temp_val == $field['value'] ) { |
| 1095 | 1095 | // For radio and regular dropdowns |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | } |
| 1277 | 1277 | if ( is_array( $val ) ) { |
| 1278 | 1278 | foreach ( $val as $k => $v ) { |
| 1279 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1279 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1280 | 1280 | unset( $k, $v ); |
| 1281 | 1281 | } |
| 1282 | 1282 | } else { |
@@ -1574,19 +1574,19 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1577 | - $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries(); |
|
| 1577 | + $prepop[__( 'Countries', 'formidable' )] = self::get_countries(); |
|
| 1578 | 1578 | |
| 1579 | 1579 | $states = self::get_us_states(); |
| 1580 | 1580 | $state_abv = array_keys( $states ); |
| 1581 | 1581 | sort( $state_abv ); |
| 1582 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1582 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1583 | 1583 | |
| 1584 | 1584 | $states = array_values( $states ); |
| 1585 | 1585 | sort( $states ); |
| 1586 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1586 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1587 | 1587 | unset( $state_abv, $states ); |
| 1588 | 1588 | |
| 1589 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1589 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1590 | 1590 | __( 'Under 18', 'formidable' ), |
| 1591 | 1591 | __( '18-24', 'formidable' ), |
| 1592 | 1592 | __( '25-34', 'formidable' ), |
@@ -1597,7 +1597,7 @@ discard block |
||
| 1597 | 1597 | __( 'Prefer Not to Answer', 'formidable' ), |
| 1598 | 1598 | ); |
| 1599 | 1599 | |
| 1600 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1600 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1601 | 1601 | __( 'Very Satisfied', 'formidable' ), |
| 1602 | 1602 | __( 'Satisfied', 'formidable' ), |
| 1603 | 1603 | __( 'Neutral', 'formidable' ), |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | __( 'N/A', 'formidable' ), |
| 1607 | 1607 | ); |
| 1608 | 1608 | |
| 1609 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1609 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1610 | 1610 | __( 'Very Important', 'formidable' ), |
| 1611 | 1611 | __( 'Important', 'formidable' ), |
| 1612 | 1612 | __( 'Neutral', 'formidable' ), |
@@ -1615,7 +1615,7 @@ discard block |
||
| 1615 | 1615 | __( 'N/A', 'formidable' ), |
| 1616 | 1616 | ); |
| 1617 | 1617 | |
| 1618 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1618 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1619 | 1619 | __( 'Strongly Agree', 'formidable' ), |
| 1620 | 1620 | __( 'Agree', 'formidable' ), |
| 1621 | 1621 | __( 'Neutral', 'formidable' ), |
@@ -658,6 +658,9 @@ discard block |
||
| 658 | 658 | $reset_fields = true; |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | + /** |
|
| 662 | + * @return string |
|
| 663 | + */ |
|
| 661 | 664 | public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
| 662 | 665 | $codes = array( |
| 663 | 666 | 'form_name' => $title, |
@@ -818,7 +821,7 @@ discard block |
||
| 818 | 821 | } |
| 819 | 822 | |
| 820 | 823 | /** |
| 821 | - * @param object|string|boolean $form |
|
| 824 | + * @param string|boolean $form |
|
| 822 | 825 | * |
| 823 | 826 | * @return string |
| 824 | 827 | */ |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'class' => '', |
| 29 | 29 | 'inc_children' => 'exclude', |
| 30 | 30 | ); |
| 31 | - $args = wp_parse_args( $args, $defaults ); |
|
| 31 | + $args = wp_parse_args( $args, $defaults ); |
|
| 32 | 32 | |
| 33 | 33 | if ( ! $args['field_id'] ) { |
| 34 | 34 | $args['field_id'] = $field_name; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 72 | 72 | if ( ! empty( $class ) ) { |
| 73 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 73 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | 'description' => '', |
| 237 | 237 | ); |
| 238 | 238 | foreach ( $defaults as $var => $default ) { |
| 239 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 240 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 239 | + if ( ! isset( $values[$var] ) ) { |
|
| 240 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | 'parent_form_id' => 0, |
| 253 | 253 | ); |
| 254 | 254 | foreach ( $defaults as $var => $default ) { |
| 255 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 256 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 255 | + if ( ! isset( $values[$var] ) ) { |
|
| 256 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | unset( $defaults ); |
@@ -290,16 +290,16 @@ discard block |
||
| 290 | 290 | $defaults = self::get_default_opts(); |
| 291 | 291 | foreach ( $defaults as $var => $default ) { |
| 292 | 292 | if ( is_array( $default ) ) { |
| 293 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 294 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
| 293 | + if ( ! isset( $values[$var] ) ) { |
|
| 294 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | foreach ( $default as $k => $v ) { |
| 298 | - $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v ); |
|
| 298 | + $values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v ); |
|
| 299 | 299 | |
| 300 | 300 | if ( is_array( $v ) ) { |
| 301 | 301 | foreach ( $v as $k1 => $v1 ) { |
| 302 | - $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 302 | + $values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 303 | 303 | unset( $k1, $v1 ); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | unset( $k, $v ); |
| 308 | 308 | } |
| 309 | 309 | } else { |
| 310 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
| 310 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | unset( $var, $default ); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | public static function fill_form_options( &$options, $values ) { |
| 346 | 346 | $defaults = self::get_default_opts(); |
| 347 | 347 | foreach ( $defaults as $var => $default ) { |
| 348 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
| 348 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
| 349 | 349 | unset( $var, $default ); |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | public static function insert_opt_html( $args ) { |
| 502 | 502 | $class = isset( $args['class'] ) ? $args['class'] : ''; |
| 503 | 503 | $fields = FrmField::all_field_selection(); |
| 504 | - $field = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array(); |
|
| 504 | + $field = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array(); |
|
| 505 | 505 | |
| 506 | 506 | self::prepare_field_type( $field ); |
| 507 | 507 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | FrmField::update( $field->id, array( 'field_order' => $field->field_order + 2 ) ); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - $add_order += 2; |
|
| 656 | + $add_order += 2; |
|
| 657 | 657 | $open = false; |
| 658 | 658 | $reset_fields = true; |
| 659 | 659 | } |
@@ -1005,10 +1005,10 @@ discard block |
||
| 1005 | 1005 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | - $label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] ); |
|
| 1009 | - if ( $length == 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1008 | + $label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] ); |
|
| 1009 | + if ( $length == 'icon' && isset( $link_details[$length] ) ) { |
|
| 1010 | 1010 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1011 | - $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
|
| 1011 | + $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $link .= '>' . $label . '</a>'; |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | $status = 'publish'; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | - $name = $nice_names[ $status ]; |
|
| 1159 | + $name = $nice_names[$status]; |
|
| 1160 | 1160 | |
| 1161 | 1161 | return $name; |
| 1162 | 1162 | } |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | |
| 1195 | 1195 | foreach ( $item['categories'] as $k => $category ) { |
| 1196 | 1196 | if ( in_array( $category, $plans ) ) { |
| 1197 | - unset( $item['categories'][ $k ] ); |
|
| 1197 | + unset( $item['categories'][$k] ); |
|
| 1198 | 1198 | return $category; |
| 1199 | 1199 | } |
| 1200 | 1200 | } |
@@ -278,6 +278,9 @@ discard block |
||
| 278 | 278 | FrmAppHelper::show_search_box( compact( 'text', 'input_id' ) ); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | + /** |
|
| 282 | + * @param string $param_name |
|
| 283 | + */ |
|
| 281 | 284 | private function hidden_search_inputs( $param_name ) { |
| 282 | 285 | if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
| 283 | 286 | $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
@@ -418,6 +421,9 @@ discard block |
||
| 418 | 421 | return $action; |
| 419 | 422 | } |
| 420 | 423 | |
| 424 | + /** |
|
| 425 | + * @param string $action_name |
|
| 426 | + */ |
|
| 421 | 427 | private static function get_bulk_action( $action_name ) { |
| 422 | 428 | $action = false; |
| 423 | 429 | $action_param = self::get_param( |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | return $this->get_pagenum(); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 234 | - return $this->_pagination_args[ $key ]; |
|
| 233 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 234 | + return $this->_pagination_args[$key]; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | private function hidden_search_inputs( $param_name ) { |
| 282 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 283 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 282 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 283 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 284 | 284 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | echo "<ul class='subsubsub'>\n"; |
| 326 | 326 | foreach ( $views as $class => $view ) { |
| 327 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 327 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 328 | 328 | } |
| 329 | 329 | echo implode( " |</li>\n", $views ) . "</li>\n"; // WPCS: XSS ok. |
| 330 | 330 | echo '</ul>'; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | 'next' => __( 'Next page', 'formidable' ), |
| 683 | 683 | ); |
| 684 | 684 | |
| 685 | - return $labels[ $link ]; |
|
| 685 | + return $labels[$link]; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | private function current_url() { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | // If the primary column doesn't exist fall back to the |
| 777 | 777 | // first non-checkbox column. |
| 778 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 778 | + if ( ! isset( $columns[$default] ) ) { |
|
| 779 | 779 | $default = self::get_default_primary_column_name(); |
| 780 | 780 | } |
| 781 | 781 | |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 791 | 791 | |
| 792 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 792 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 793 | 793 | $column = $default; |
| 794 | 794 | } |
| 795 | 795 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | // In 4.3, we added a fourth argument for primary column. |
| 812 | 812 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 813 | 813 | foreach ( $this->_column_headers as $key => $value ) { |
| 814 | - $column_headers[ $key ] = $value; |
|
| 814 | + $column_headers[$key] = $value; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | return $column_headers; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $data[1] = false; |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $sortable[ $id ] = $data; |
|
| 847 | + $sortable[$id] = $data; |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | $primary = $this->get_primary_column_name(); |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | $class[] = 'column-primary'; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 925 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 924 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 925 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 926 | 926 | |
| 927 | 927 | if ( $current_orderby == $orderby ) { |
| 928 | 928 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @since 2.0 |
| 185 | - * @return The class for this icon |
|
| 185 | + * @return string class for this icon |
|
| 186 | 186 | */ |
| 187 | 187 | public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) { |
| 188 | 188 | if ( 'arrow' == $type && is_numeric( $key ) ) { |
@@ -379,6 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | 381 | * @since 2.3 |
| 382 | + * @param string $default |
|
| 382 | 383 | */ |
| 383 | 384 | private static function get_color_output( $default, &$color ) { |
| 384 | 385 | $color = trim( $color ); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | '-' => 'down', |
| 192 | 192 | '+' => 'up', |
| 193 | 193 | ); |
| 194 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 194 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 195 | 195 | } else { |
| 196 | 196 | //frm_minus1_icon |
| 197 | 197 | $key = str_replace( 'p', '', $key ); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | '-' => 'minus', |
| 200 | 200 | '+' => 'plus', |
| 201 | 201 | ); |
| 202 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 202 | + $class = 'frm_' . $plus[$icon]; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if ( $key ) { |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | ?> |
| 220 | 220 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 221 | 221 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 222 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 223 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 222 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 223 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 224 | 224 | <b class="caret"></b> |
| 225 | 225 | </button> |
| 226 | 226 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
| 229 | 229 | <a href="javascript:void(0);"> |
| 230 | 230 | <label> |
| 231 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?>/> |
|
| 231 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?>/> |
|
| 232 | 232 | <span> |
| 233 | 233 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); ?> |
| 234 | 234 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '-', $type ) ); ?> |
@@ -313,14 +313,14 @@ discard block |
||
| 313 | 313 | $settings['style_class'] = 'frm_style_' . $style->post_name . '.'; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $settings['style_class'] .= 'with_frm_style'; |
|
| 316 | + $settings['style_class'] .= 'with_frm_style'; |
|
| 317 | 317 | $settings['font'] = stripslashes( $settings['font'] ); |
| 318 | 318 | $settings['change_margin'] = self::description_margin_for_screensize( $settings['width'] ); |
| 319 | 319 | |
| 320 | 320 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 321 | 321 | foreach ( $checkbox_opts as $opt ) { |
| 322 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 323 | - $settings[ $opt ] = 0; |
|
| 322 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 323 | + $settings[$opt] = 0; |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $css = ''; |
| 340 | 340 | } |
| 341 | 341 | foreach ( $opts as $opt ) { |
| 342 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 342 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | * @since 2.02.05 |
| 167 | 167 | * |
| 168 | 168 | * @param string $key |
| 169 | - * @param int|string $value |
|
| 169 | + * @param string $value |
|
| 170 | 170 | * @param string $where |
| 171 | 171 | */ |
| 172 | 172 | private static function add_query_placeholder( $key, $value, &$where ) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | foreach ( $args as $key => $value ) { |
| 64 | - $where .= empty( $where ) ? $base_where : $condition; |
|
| 64 | + $where .= empty( $where ) ? $base_where : $condition; |
|
| 65 | 65 | $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) ); |
| 66 | 66 | if ( is_numeric( $key ) || $array_inc_null ) { |
| 67 | 67 | $where .= ' ( '; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
| 98 | 98 | $k = explode( ' ', $key ); |
| 99 | - $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 99 | + $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 100 | 100 | $values[] = '%Y-%m-%d %H:%i:%s'; |
| 101 | 101 | } else { |
| 102 | 102 | $where .= ' ' . $key; |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | $where .= ' OR '; |
| 117 | 117 | } |
| 118 | 118 | $start = false; |
| 119 | - $where .= $key . ' %s'; |
|
| 119 | + $where .= $key . ' %s'; |
|
| 120 | 120 | $values[] = '%' . self::esc_like( $v ) . '%'; |
| 121 | 121 | } |
| 122 | 122 | $where .= ')'; |
| 123 | 123 | } elseif ( ! empty( $value ) ) { |
| 124 | - $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')'; |
|
| 124 | + $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')'; |
|
| 125 | 125 | $values = array_merge( $values, $value ); |
| 126 | 126 | } |
| 127 | 127 | } elseif ( strpos( $lowercase_key, 'like' ) !== false ) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $where .= 'like'; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $where .= ' %s'; |
|
| 144 | + $where .= ' %s'; |
|
| 145 | 145 | $values[] = $start . self::esc_like( $value ) . $end; |
| 146 | 146 | |
| 147 | 147 | } elseif ( $value === null ) { |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | $where_is = strtolower( $where_is ); |
| 309 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
| 310 | - return ' ' . $switch_to[ $where_is ]; |
|
| 309 | + if ( isset( $switch_to[$where_is] ) ) { |
|
| 310 | + return ' ' . $switch_to[$where_is]; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | $temp_args = $args; |
| 361 | 361 | foreach ( $temp_args as $k => $v ) { |
| 362 | 362 | if ( $v == '' ) { |
| 363 | - unset( $args[ $k ] ); |
|
| 363 | + unset( $args[$k] ); |
|
| 364 | 364 | continue; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
| 368 | 368 | if ( strpos( $v, $db_name ) === false ) { |
| 369 | - $args[ $k ] = $db_name . ' ' . $v; |
|
| 369 | + $args[$k] = $db_name . ' ' . $v; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
@@ -440,13 +440,13 @@ discard block |
||
| 440 | 440 | private static function esc_query_args( &$args ) { |
| 441 | 441 | foreach ( $args as $param => $value ) { |
| 442 | 442 | if ( $param == 'order_by' ) { |
| 443 | - $args[ $param ] = self::esc_order( $value ); |
|
| 443 | + $args[$param] = self::esc_order( $value ); |
|
| 444 | 444 | } elseif ( $param == 'limit' ) { |
| 445 | - $args[ $param ] = self::esc_limit( $value ); |
|
| 445 | + $args[$param] = self::esc_limit( $value ); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( $args[ $param ] == '' ) { |
|
| 449 | - unset( $args[ $param ] ); |
|
| 448 | + if ( $args[$param] == '' ) { |
|
| 449 | + unset( $args[$param] ); |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $limit = explode( ',', trim( $limit ) ); |
| 530 | 530 | foreach ( $limit as $k => $l ) { |
| 531 | 531 | if ( is_numeric( $l ) ) { |
| 532 | - $limit[ $k ] = $l; |
|
| 532 | + $limit[$k] = $l; |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | */ |
| 666 | 666 | public static function add_key_to_group_cache( $key, $group ) { |
| 667 | 667 | $cached = self::get_group_cached_keys( $group ); |
| 668 | - $cached[ $key ] = $key; |
|
| 668 | + $cached[$key] = $key; |
|
| 669 | 669 | wp_cache_set( 'cached_keys', $cached, $group, 300 ); |
| 670 | 670 | } |
| 671 | 671 | |