@@ -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 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param string $starts_with |
179 | 179 | */ |
180 | 180 | public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
181 | - if ( empty($args) ) { |
|
181 | + if ( empty( $args ) ) { |
|
182 | 182 | // add an arg to prevent prepare from failing |
183 | 183 | $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) ); |
184 | 184 | return; |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
239 | 239 | $key = trim( $key ); |
240 | 240 | |
241 | - if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
242 | - $k = explode(' ', $key); |
|
241 | + if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
242 | + $k = explode( ' ', $key ); |
|
243 | 243 | $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
244 | 244 | $values[] = '%Y-%m-%d %H:%i:%s'; |
245 | 245 | } else { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | if ( is_array( $value ) ) { |
253 | 253 | // translate array of values to "in" |
254 | 254 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
255 | - $where = preg_replace('/' . $key . '$/', '', $where); |
|
255 | + $where = preg_replace( '/' . $key . '$/', '', $where ); |
|
256 | 256 | $where .= '('; |
257 | 257 | $start = true; |
258 | 258 | foreach ( $value as $v ) { |
@@ -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 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | $query = self::generate_query_string_from_pieces( $columns, $table, $where ); |
495 | 495 | |
496 | - $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A' , ' WHERE' ) ); |
|
496 | + $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) ); |
|
497 | 497 | $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_associative_results' ); |
498 | 498 | |
499 | 499 | return $results; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | public function uninstall() { |
533 | 533 | if ( ! current_user_can( 'administrator' ) ) { |
534 | 534 | $frm_settings = FrmAppHelper::get_settings(); |
535 | - wp_die($frm_settings->admin_permission); |
|
535 | + wp_die( $frm_settings->admin_permission ); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | global $wpdb, $wp_roles; |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); |
543 | 543 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); |
544 | 544 | |
545 | - delete_option('frm_options'); |
|
546 | - delete_option('frm_db_version'); |
|
545 | + delete_option( 'frm_options' ); |
|
546 | + delete_option( 'frm_db_version' ); |
|
547 | 547 | |
548 | 548 | //delete roles |
549 | 549 | $frm_roles = FrmAppHelper::frm_capabilities(); |
@@ -551,11 +551,11 @@ discard block |
||
551 | 551 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
552 | 552 | foreach ( $roles as $role => $details ) { |
553 | 553 | $wp_roles->remove_cap( $role, $frm_role ); |
554 | - unset($role, $details); |
|
554 | + unset( $role, $details ); |
|
555 | 555 | } |
556 | - unset($frm_role, $frm_role_description); |
|
556 | + unset( $frm_role, $frm_role_description ); |
|
557 | 557 | } |
558 | - unset($roles, $frm_roles); |
|
558 | + unset( $roles, $frm_roles ); |
|
559 | 559 | |
560 | 560 | // delete actions, views, and styles |
561 | 561 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | $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_%' ) ); |
579 | 579 | |
580 | - do_action('frm_after_uninstall'); |
|
580 | + do_action( 'frm_after_uninstall' ); |
|
581 | 581 | return true; |
582 | 582 | } |
583 | 583 | |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | |
635 | 635 | $updated = 0; |
636 | 636 | foreach ( $fields as $f ) { |
637 | - $f->field_options = maybe_unserialize($f->field_options); |
|
638 | - if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
637 | + $f->field_options = maybe_unserialize( $f->field_options ); |
|
638 | + if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) { |
|
639 | 639 | continue; |
640 | 640 | } |
641 | 641 | |
@@ -643,27 +643,27 @@ discard block |
||
643 | 643 | $f->field_options['size'] .= 'px'; |
644 | 644 | $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
645 | 645 | if ( $u ) { |
646 | - $updated++; |
|
646 | + $updated ++; |
|
647 | 647 | } |
648 | - unset($f); |
|
648 | + unset( $f ); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | // Change the characters in widgets to pixels |
652 | - $widgets = get_option('widget_frm_show_form'); |
|
653 | - if ( empty($widgets) ) { |
|
652 | + $widgets = get_option( 'widget_frm_show_form' ); |
|
653 | + if ( empty( $widgets ) ) { |
|
654 | 654 | return; |
655 | 655 | } |
656 | 656 | |
657 | - $widgets = maybe_unserialize($widgets); |
|
657 | + $widgets = maybe_unserialize( $widgets ); |
|
658 | 658 | foreach ( $widgets as $k => $widget ) { |
659 | - if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
659 | + if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
|
660 | 660 | continue; |
661 | 661 | } |
662 | 662 | $size = round( $pixel_conversion * (int) $widget['size'] ); |
663 | 663 | $size .= 'px'; |
664 | - $widgets[ $k ]['size'] = $size; |
|
664 | + $widgets[$k]['size'] = $size; |
|
665 | 665 | } |
666 | - update_option('widget_frm_show_form', $widgets); |
|
666 | + update_option( 'widget_frm_show_form', $widgets ); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } |
713 | 713 | |
714 | 714 | // Format form options |
715 | - $form_options = maybe_unserialize($form->options); |
|
715 | + $form_options = maybe_unserialize( $form->options ); |
|
716 | 716 | |
717 | 717 | // Migrate settings to actions |
718 | 718 | FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | private function migrate_to_11() { |
723 | 723 | global $wpdb; |
724 | 724 | |
725 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
725 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options' ); |
|
726 | 726 | |
727 | 727 | $sending = __( 'Sending', 'formidable' ); |
728 | 728 | $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif'; |
@@ -733,13 +733,13 @@ discard block |
||
733 | 733 | <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" /> |
734 | 734 | </div> |
735 | 735 | DEFAULT_HTML; |
736 | - unset($sending, $img); |
|
736 | + unset( $sending, $img ); |
|
737 | 737 | |
738 | - $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
738 | + $new_default_html = FrmFormsHelper::get_default_html( 'submit' ); |
|
739 | 739 | $draft_link = FrmFormsHelper::get_draft_link(); |
740 | 740 | foreach ( $forms as $form ) { |
741 | - $form->options = maybe_unserialize($form->options); |
|
742 | - if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
741 | + $form->options = maybe_unserialize( $form->options ); |
|
742 | + if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) { |
|
743 | 743 | continue; |
744 | 744 | } |
745 | 745 | |
@@ -750,9 +750,9 @@ discard block |
||
750 | 750 | $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] ); |
751 | 751 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
752 | 752 | } |
753 | - unset($form); |
|
753 | + unset( $form ); |
|
754 | 754 | } |
755 | - unset($forms); |
|
755 | + unset( $forms ); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | private function migrate_to_6() { |
@@ -781,16 +781,16 @@ discard block |
||
781 | 781 | </div> |
782 | 782 | DEFAULT_HTML; |
783 | 783 | |
784 | - $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
784 | + $new_default_html = FrmFieldsHelper::get_default_html( 'text' ); |
|
785 | 785 | foreach ( $fields as $field ) { |
786 | - $field->field_options = maybe_unserialize($field->field_options); |
|
786 | + $field->field_options = maybe_unserialize( $field->field_options ); |
|
787 | 787 | if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) { |
788 | 788 | $field->field_options['custom_html'] = $new_default_html; |
789 | 789 | $wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) ); |
790 | 790 | } |
791 | - unset($field); |
|
791 | + unset( $field ); |
|
792 | 792 | } |
793 | - unset($default_html, $old_default_html, $fields); |
|
793 | + unset( $default_html, $old_default_html, $fields ); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | private function migrate_to_4() { |
@@ -808,6 +808,6 @@ discard block |
||
808 | 808 | |
809 | 809 | public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) { |
810 | 810 | _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' ); |
811 | - return self::get_results( $table, $args, $fields, compact('order_by', 'limit') ); |
|
811 | + return self::get_results( $table, $args, $fields, compact( 'order_by', 'limit' ) ); |
|
812 | 812 | } |
813 | 813 | } |