@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public static function get_direct_link( $key, $form = false ) { |
| 16 | 16 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
| 17 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
| 17 | + $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form ); |
|
| 18 | 18 | |
| 19 | 19 | return $target_url; |
| 20 | 20 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $query['id !'] = $args['exclude']; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
| 42 | + $where = apply_filters( 'frm_forms_dropdown', $query, $field_name ); |
|
| 43 | 43 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
| 44 | 44 | $add_html = array(); |
| 45 | 45 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 70 | 70 | if ( ! empty( $class ) ) { |
| 71 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 71 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ); |
| 83 | 83 | if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) { |
| 84 | 84 | unset( $args['form'] ); |
| 85 | - } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
|
| 85 | + } else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) { |
|
| 86 | 86 | unset( $args['id'] ); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
| 91 | 91 | $args['frm_action'] = 'list'; |
| 92 | 92 | $args['form'] = 0; |
| 93 | - } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
| 93 | + } else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
| 94 | 94 | $args['frm_action'] = 'edit'; |
| 95 | 95 | } else if ( isset( $_GET['post'] ) ) { |
| 96 | 96 | $args['form'] = 0; |
| 97 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
| 97 | + $base = admin_url( 'edit.php?post_type=frm_display' ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | ?> |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $post_values = $values; |
| 182 | 182 | } else { |
| 183 | 183 | $values = array(); |
| 184 | - $post_values = isset($_POST) ? $_POST : array(); |
|
| 184 | + $post_values = isset( $_POST ) ? $_POST : array(); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $defaults = array( |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | 'description' => '', |
| 190 | 190 | ); |
| 191 | 191 | foreach ( $defaults as $var => $default ) { |
| 192 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 193 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 192 | + if ( ! isset( $values[$var] ) ) { |
|
| 193 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
| 197 | + $values['description'] = FrmAppHelper::use_wpautop( $values['description'] ); |
|
| 198 | 198 | |
| 199 | 199 | $defaults = array( |
| 200 | 200 | 'form_id' => '', |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | 'parent_form_id' => 0, |
| 207 | 207 | ); |
| 208 | 208 | foreach ( $defaults as $var => $default ) { |
| 209 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 210 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 209 | + if ( ! isset( $values[$var] ) ) { |
|
| 210 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | unset( $defaults ); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $values = self::fill_default_opts( $values, false, $post_values ); |
| 220 | 220 | $values['custom_style'] = FrmAppHelper::custom_style_value( $post_values ); |
| 221 | 221 | |
| 222 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
| 222 | + return apply_filters( 'frm_setup_new_form_vars', $values ); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -230,42 +230,42 @@ discard block |
||
| 230 | 230 | $post_values = stripslashes_deep( $_POST ); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
| 234 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
| 235 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
| 233 | + $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key; |
|
| 234 | + $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template; |
|
| 235 | + $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template; |
|
| 236 | 236 | $values['status'] = $record->status; |
| 237 | 237 | |
| 238 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
| 238 | + $values = self::fill_default_opts( $values, $record, $post_values ); |
|
| 239 | 239 | |
| 240 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
| 240 | + return apply_filters( 'frm_setup_edit_form_vars', $values ); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | public static function fill_default_opts( $values, $record, $post_values ) { |
| 244 | 244 | |
| 245 | 245 | $defaults = self::get_default_opts(); |
| 246 | 246 | foreach ( $defaults as $var => $default ) { |
| 247 | - if ( is_array($default) ) { |
|
| 248 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 249 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
| 247 | + if ( is_array( $default ) ) { |
|
| 248 | + if ( ! isset( $values[$var] ) ) { |
|
| 249 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | foreach ( $default as $k => $v ) { |
| 253 | - $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 ); |
|
| 253 | + $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 ); |
|
| 254 | 254 | |
| 255 | 255 | if ( is_array( $v ) ) { |
| 256 | 256 | foreach ( $v as $k1 => $v1 ) { |
| 257 | - $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 ); |
|
| 257 | + $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 ); |
|
| 258 | 258 | unset( $k1, $v1 ); |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - unset($k, $v); |
|
| 262 | + unset( $k, $v ); |
|
| 263 | 263 | } |
| 264 | 264 | } else { |
| 265 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
| 265 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - unset($var, $default); |
|
| 268 | + unset( $var, $default ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $values; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | public static function fill_form_options( &$options, $values ) { |
| 300 | 300 | $defaults = self::get_default_opts(); |
| 301 | 301 | foreach ( $defaults as $var => $default ) { |
| 302 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
| 302 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
| 303 | 303 | unset( $var, $default ); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $last_field = false; |
| 379 | 379 | foreach ( $fields as $field ) { |
| 380 | 380 | if ( $prev_order === $field->field_order ) { |
| 381 | - $add_order++; |
|
| 381 | + $add_order ++; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ( $add_order ) { |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | if ( $code == 'form_name' ) { |
| 451 | 451 | $replace_with = $form->name; |
| 452 | 452 | } else if ( $code == 'form_description' ) { |
| 453 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
| 454 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
| 453 | + $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
|
| 454 | + } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { |
|
| 455 | 455 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
| 456 | 456 | } else { |
| 457 | 457 | $replace_with = ''; |
@@ -461,10 +461,10 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | //replace [form_key] |
| 464 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
| 464 | + $html = str_replace( '[form_key]', $form->form_key, $html ); |
|
| 465 | 465 | |
| 466 | 466 | //replace [frmurl] |
| 467 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
| 467 | + $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
|
| 468 | 468 | |
| 469 | 469 | if ( strpos( $html, '[button_label]' ) ) { |
| 470 | 470 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $html = str_replace( '[button_label]', $submit_label, $html ); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
| 476 | + $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values ); |
|
| 477 | 477 | |
| 478 | 478 | if ( strpos( $html, '[if back_button]' ) ) { |
| 479 | 479 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | public static function submit_button_label( $submit ) { |
| 494 | - if ( ! $submit || empty($submit) ) { |
|
| 494 | + if ( ! $submit || empty( $submit ) ) { |
|
| 495 | 495 | $frm_settings = FrmAppHelper::get_settings(); |
| 496 | 496 | $submit = $frm_settings->submit_value; |
| 497 | 497 | } |
@@ -514,11 +514,11 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | public static function get_form_style_class( $form = false ) { |
| 517 | - $style = self::get_form_style($form); |
|
| 517 | + $style = self::get_form_style( $form ); |
|
| 518 | 518 | $class = ' with_frm_style'; |
| 519 | 519 | |
| 520 | - if ( empty($style) ) { |
|
| 521 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
| 520 | + if ( empty( $style ) ) { |
|
| 521 | + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { |
|
| 522 | 522 | return $class; |
| 523 | 523 | } else { |
| 524 | 524 | return; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | //If submit button needs to be inline or centered |
| 529 | - if ( is_object($form) ) { |
|
| 529 | + if ( is_object( $form ) ) { |
|
| 530 | 530 | $form = $form->options; |
| 531 | 531 | } |
| 532 | 532 | |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | $class .= ' frm_center_submit'; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
| 542 | + $class = apply_filters( 'frm_add_form_style_class', $class, $style ); |
|
| 543 | 543 | |
| 544 | 544 | return $class; |
| 545 | 545 | } |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | * @since 3.0 |
| 695 | 695 | */ |
| 696 | 696 | public static function actions_dropdown( $atts ) { |
| 697 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 697 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 698 | 698 | $status = $atts['status']; |
| 699 | 699 | $form_id = isset( $atts['id'] ) ? $atts['id'] : FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
| 700 | 700 | $trash_link = self::delete_trash_info( $form_id, $status ); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | if ( 'trash' == $form->status ) { |
| 717 | 717 | $actions['restore'] = $trash_links['restore']; |
| 718 | 718 | |
| 719 | - if ( current_user_can('frm_delete_forms') ) { |
|
| 719 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 720 | 720 | $actions['trash'] = $trash_links['delete']; |
| 721 | 721 | } |
| 722 | 722 | } elseif ( current_user_can( 'frm_edit_forms' ) ) { |
@@ -742,12 +742,12 @@ discard block |
||
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | public static function edit_form_link( $form_id ) { |
| 745 | - if ( is_object($form_id) ) { |
|
| 745 | + if ( is_object( $form_id ) ) { |
|
| 746 | 746 | $form = $form_id; |
| 747 | 747 | $name = $form->name; |
| 748 | 748 | $form_id = $form->id; |
| 749 | 749 | } else { |
| 750 | - $name = FrmForm::getName($form_id); |
|
| 750 | + $name = FrmForm::getName( $form_id ); |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ( $form_id ) { |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | } elseif ( isset( $link_details['confirm'] ) ) { |
| 780 | 780 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 781 | 781 | } |
| 782 | - $label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] ); |
|
| 782 | + $label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] ); |
|
| 783 | 783 | $link .= '>' . $label . '</a>'; |
| 784 | 784 | } |
| 785 | 785 | return $link; |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | |
| 794 | 794 | if ( 'trash' == $status ) { |
| 795 | 795 | $info = $labels['restore']; |
| 796 | - } elseif ( current_user_can('frm_delete_forms') ) { |
|
| 796 | + } elseif ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 797 | 797 | if ( EMPTY_TRASH_DAYS ) { |
| 798 | 798 | $info = $labels['trash']; |
| 799 | 799 | } else { |
@@ -943,11 +943,11 @@ discard block |
||
| 943 | 943 | 'publish' => __( 'Published', 'formidable' ), |
| 944 | 944 | ); |
| 945 | 945 | |
| 946 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
| 946 | + if ( ! in_array( $status, array_keys( $nice_names ) ) ) { |
|
| 947 | 947 | $status = 'publish'; |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - $name = $nice_names[ $status ]; |
|
| 950 | + $name = $nice_names[$status]; |
|
| 951 | 951 | |
| 952 | 952 | return $name; |
| 953 | 953 | } |