@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | var $entry_metas; |
8 | 8 | |
9 | 9 | public function __construct() { |
10 | - if ( ! defined('ABSPATH') ) { |
|
11 | - die('You are not allowed to call this page directly.'); |
|
10 | + if ( ! defined( 'ABSPATH' ) ) { |
|
11 | + die( 'You are not allowed to call this page directly.' ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | global $wpdb; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $frm_db_version = FrmAppHelper::$db_version; |
25 | 25 | $old_db_version = (float) $old_db_version; |
26 | 26 | if ( ! $old_db_version ) { |
27 | - $old_db_version = get_option('frm_db_version'); |
|
27 | + $old_db_version = get_option( 'frm_db_version' ); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( $frm_db_version != $old_db_version ) { |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
35 | 35 | |
36 | 36 | $this->create_tables(); |
37 | - $this->migrate_data($frm_db_version, $old_db_version); |
|
37 | + $this->migrate_data( $frm_db_version, $old_db_version ); |
|
38 | 38 | |
39 | 39 | /***** SAVE DB VERSION *****/ |
40 | - update_option('frm_db_version', $frm_db_version); |
|
40 | + update_option( 'frm_db_version', $frm_db_version ); |
|
41 | 41 | |
42 | 42 | /**** ADD/UPDATE DEFAULT TEMPLATES ****/ |
43 | 43 | FrmXMLController::add_default_templates(); |
44 | 44 | } |
45 | 45 | |
46 | - do_action('frm_after_install'); |
|
46 | + do_action( 'frm_after_install' ); |
|
47 | 47 | |
48 | 48 | /**** update the styling settings ****/ |
49 | 49 | if ( is_admin() && function_exists( 'get_filesystem_method' ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | global $wpdb; |
154 | 154 | $wpdb->query( $q . $charset_collate ); |
155 | 155 | } |
156 | - unset($q); |
|
156 | + unset( $q ); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Change array into format $wpdb->prepare can use |
175 | 175 | */ |
176 | 176 | public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
177 | - if ( empty($args) ) { |
|
177 | + if ( empty( $args ) ) { |
|
178 | 178 | // add an arg to prevent prepare from failing |
179 | 179 | $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) ); |
180 | 180 | return; |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
231 | 231 | $key = trim( $key ); |
232 | 232 | |
233 | - if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
234 | - $k = explode(' ', $key); |
|
233 | + if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
234 | + $k = explode( ' ', $key ); |
|
235 | 235 | $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
236 | 236 | $values[] = '%Y-%m-%d %H:%i:%s'; |
237 | 237 | } else { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if ( is_array( $value ) ) { |
245 | 245 | // translate array of values to "in" |
246 | 246 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
247 | - $where = preg_replace('/' . $key . '$/', '', $where); |
|
247 | + $where = preg_replace( '/' . $key . '$/', '', $where ); |
|
248 | 248 | $where .= '('; |
249 | 249 | $start = true; |
250 | 250 | foreach ( $value as $v ) { |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) { |
372 | 372 | _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' ); |
373 | - return self::get_results( $table, $args, $fields, compact('order_by', 'limit') ); |
|
373 | + return self::get_results( $table, $args, $fields, compact( 'order_by', 'limit' ) ); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | ); |
404 | 404 | |
405 | 405 | $where_is = strtolower( $where_is ); |
406 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
407 | - return ' ' . $switch_to[ $where_is ]; |
|
406 | + if ( isset( $switch_to[$where_is] ) ) { |
|
407 | + return ' ' . $switch_to[$where_is]; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | private static function get_group_and_table_name( &$table, &$group ) { |
427 | 427 | global $wpdb, $wpmuBaseTablePrefix; |
428 | 428 | |
429 | - $table_parts = explode(' ', $table); |
|
430 | - $group = reset($table_parts); |
|
429 | + $table_parts = explode( ' ', $table ); |
|
430 | + $group = reset( $table_parts ); |
|
431 | 431 | $group = str_replace( $wpdb->prefix, '', $group ); |
432 | 432 | |
433 | 433 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
445 | - if ( ! is_array($args) ) { |
|
445 | + if ( ! is_array( $args ) ) { |
|
446 | 446 | $args = array( 'order_by' => $args ); |
447 | 447 | } |
448 | 448 | |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | $temp_args = $args; |
458 | 458 | foreach ( $temp_args as $k => $v ) { |
459 | 459 | if ( $v == '' ) { |
460 | - unset( $args[ $k ] ); |
|
460 | + unset( $args[$k] ); |
|
461 | 461 | continue; |
462 | 462 | } |
463 | 463 | |
464 | 464 | if ( $k == 'limit' ) { |
465 | - $args[ $k ] = FrmAppHelper::esc_limit( $v ); |
|
465 | + $args[$k] = FrmAppHelper::esc_limit( $v ); |
|
466 | 466 | } |
467 | 467 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
468 | 468 | if ( strpos( $v, $db_name ) === false ) { |
469 | - $args[ $k ] = $db_name . ' ' . $v; |
|
469 | + $args[$k] = $db_name . ' ' . $v; |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $query = $wpdb->prepare( $query . $where['where'], $where['values'] ); |
499 | 499 | } |
500 | 500 | |
501 | - $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A' , ' WHERE' ) ); |
|
501 | + $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) ); |
|
502 | 502 | $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_associative_results' ); |
503 | 503 | |
504 | 504 | return $results; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | public function uninstall() { |
508 | 508 | if ( ! current_user_can( 'administrator' ) ) { |
509 | 509 | $frm_settings = FrmAppHelper::get_settings(); |
510 | - wp_die($frm_settings->admin_permission); |
|
510 | + wp_die( $frm_settings->admin_permission ); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | global $wpdb, $wp_roles; |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); |
518 | 518 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); |
519 | 519 | |
520 | - delete_option('frm_options'); |
|
521 | - delete_option('frm_db_version'); |
|
520 | + delete_option( 'frm_options' ); |
|
521 | + delete_option( 'frm_db_version' ); |
|
522 | 522 | |
523 | 523 | //delete roles |
524 | 524 | $frm_roles = FrmAppHelper::frm_capabilities(); |
@@ -526,11 +526,11 @@ discard block |
||
526 | 526 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
527 | 527 | foreach ( $roles as $role => $details ) { |
528 | 528 | $wp_roles->remove_cap( $role, $frm_role ); |
529 | - unset($role, $details); |
|
529 | + unset( $role, $details ); |
|
530 | 530 | } |
531 | - unset($frm_role, $frm_role_description); |
|
531 | + unset( $frm_role, $frm_role_description ); |
|
532 | 532 | } |
533 | - unset($roles, $frm_roles); |
|
533 | + unset( $roles, $frm_roles ); |
|
534 | 534 | |
535 | 535 | // delete actions, views, and styles |
536 | 536 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) ); |
554 | 554 | |
555 | - do_action('frm_after_uninstall'); |
|
555 | + do_action( 'frm_after_uninstall' ); |
|
556 | 556 | return true; |
557 | 557 | } |
558 | 558 | |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | |
610 | 610 | $updated = 0; |
611 | 611 | foreach ( $fields as $f ) { |
612 | - $f->field_options = maybe_unserialize($f->field_options); |
|
613 | - if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
612 | + $f->field_options = maybe_unserialize( $f->field_options ); |
|
613 | + if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) { |
|
614 | 614 | continue; |
615 | 615 | } |
616 | 616 | |
@@ -618,27 +618,27 @@ discard block |
||
618 | 618 | $f->field_options['size'] .= 'px'; |
619 | 619 | $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
620 | 620 | if ( $u ) { |
621 | - $updated++; |
|
621 | + $updated ++; |
|
622 | 622 | } |
623 | - unset($f); |
|
623 | + unset( $f ); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | // Change the characters in widgets to pixels |
627 | - $widgets = get_option('widget_frm_show_form'); |
|
628 | - if ( empty($widgets) ) { |
|
627 | + $widgets = get_option( 'widget_frm_show_form' ); |
|
628 | + if ( empty( $widgets ) ) { |
|
629 | 629 | return; |
630 | 630 | } |
631 | 631 | |
632 | - $widgets = maybe_unserialize($widgets); |
|
632 | + $widgets = maybe_unserialize( $widgets ); |
|
633 | 633 | foreach ( $widgets as $k => $widget ) { |
634 | - if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
634 | + if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
|
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | $size = round( $pixel_conversion * (int) $widget['size'] ); |
638 | 638 | $size .= 'px'; |
639 | - $widgets[ $k ]['size'] = $size; |
|
639 | + $widgets[$k]['size'] = $size; |
|
640 | 640 | } |
641 | - update_option('widget_frm_show_form', $widgets); |
|
641 | + update_option( 'widget_frm_show_form', $widgets ); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | // Format form options |
690 | - $form_options = maybe_unserialize($form->options); |
|
690 | + $form_options = maybe_unserialize( $form->options ); |
|
691 | 691 | |
692 | 692 | // Migrate settings to actions |
693 | 693 | FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | private function migrate_to_11() { |
698 | 698 | global $wpdb; |
699 | 699 | |
700 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
700 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options' ); |
|
701 | 701 | |
702 | 702 | $sending = __( 'Sending', 'formidable' ); |
703 | 703 | $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif'; |
@@ -708,13 +708,13 @@ discard block |
||
708 | 708 | <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" /> |
709 | 709 | </div> |
710 | 710 | DEFAULT_HTML; |
711 | - unset($sending, $img); |
|
711 | + unset( $sending, $img ); |
|
712 | 712 | |
713 | - $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
713 | + $new_default_html = FrmFormsHelper::get_default_html( 'submit' ); |
|
714 | 714 | $draft_link = FrmFormsHelper::get_draft_link(); |
715 | 715 | foreach ( $forms as $form ) { |
716 | - $form->options = maybe_unserialize($form->options); |
|
717 | - if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
716 | + $form->options = maybe_unserialize( $form->options ); |
|
717 | + if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) { |
|
718 | 718 | continue; |
719 | 719 | } |
720 | 720 | |
@@ -725,9 +725,9 @@ discard block |
||
725 | 725 | $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] ); |
726 | 726 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
727 | 727 | } |
728 | - unset($form); |
|
728 | + unset( $form ); |
|
729 | 729 | } |
730 | - unset($forms); |
|
730 | + unset( $forms ); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | private function migrate_to_6() { |
@@ -756,16 +756,16 @@ discard block |
||
756 | 756 | </div> |
757 | 757 | DEFAULT_HTML; |
758 | 758 | |
759 | - $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
759 | + $new_default_html = FrmFieldsHelper::get_default_html( 'text' ); |
|
760 | 760 | foreach ( $fields as $field ) { |
761 | - $field->field_options = maybe_unserialize($field->field_options); |
|
761 | + $field->field_options = maybe_unserialize( $field->field_options ); |
|
762 | 762 | if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) { |
763 | 763 | $field->field_options['custom_html'] = $new_default_html; |
764 | 764 | $wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) ); |
765 | 765 | } |
766 | - unset($field); |
|
766 | + unset( $field ); |
|
767 | 767 | } |
768 | - unset($default_html, $old_default_html, $fields); |
|
768 | + unset( $default_html, $old_default_html, $fields ); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | private function migrate_to_4() { |