@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | public function widget( $args, $instance ) { |
| 11 | - if ( empty($instance['title']) ) { |
|
| 12 | - $title = FrmForm::getName( $instance['form'] ); |
|
| 13 | - } else { |
|
| 14 | - $title = $instance['title']; |
|
| 15 | - } |
|
| 16 | - $title = apply_filters('widget_title', $title); |
|
| 11 | + if ( empty($instance['title']) ) { |
|
| 12 | + $title = FrmForm::getName( $instance['form'] ); |
|
| 13 | + } else { |
|
| 14 | + $title = $instance['title']; |
|
| 15 | + } |
|
| 16 | + $title = apply_filters('widget_title', $title); |
|
| 17 | 17 | |
| 18 | - $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
| 18 | + $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
| 19 | 19 | |
| 20 | 20 | echo $args['before_widget']; |
| 21 | 21 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function form( $instance ) { |
| 38 | - //Defaults |
|
| 38 | + //Defaults |
|
| 39 | 39 | $instance = wp_parse_args( (array) $instance, array( |
| 40 | - 'title' => false, 'form' => false, 'description' => false, |
|
| 40 | + 'title' => false, 'form' => false, 'description' => false, |
|
| 41 | 41 | ) ); |
| 42 | 42 | ?> |
| 43 | 43 | <p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | <p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
| 47 | 47 | <?php |
| 48 | - FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
| 49 | - 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
| 50 | - 'class' => 'widefat', |
|
| 51 | - ) ); |
|
| 48 | + FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
| 49 | + 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
| 50 | + 'class' => 'widefat', |
|
| 51 | + ) ); |
|
| 52 | 52 | ?> |
| 53 | 53 | </p> |
| 54 | 54 | |
@@ -4,27 +4,27 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | public function __construct() { |
| 6 | 6 | $widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) ); |
| 7 | - parent::__construct('frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops); |
|
| 7 | + parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops ); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | public function widget( $args, $instance ) { |
| 11 | - if ( empty($instance['title']) ) { |
|
| 11 | + if ( empty( $instance['title'] ) ) { |
|
| 12 | 12 | $title = FrmForm::getName( $instance['form'] ); |
| 13 | 13 | } else { |
| 14 | 14 | $title = $instance['title']; |
| 15 | 15 | } |
| 16 | - $title = apply_filters('widget_title', $title); |
|
| 16 | + $title = apply_filters( 'widget_title', $title ); |
|
| 17 | 17 | |
| 18 | - $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
| 18 | + $instance['description'] = isset( $instance['description'] ) ? $instance['description'] : false; |
|
| 19 | 19 | |
| 20 | 20 | echo $args['before_widget']; |
| 21 | 21 | |
| 22 | 22 | echo '<div class="frm_form_widget">'; |
| 23 | 23 | if ( $title ) { |
| 24 | - echo $args['before_title'] . stripslashes($title) . $args['after_title']; |
|
| 24 | + echo $args['before_title'] . stripslashes( $title ) . $args['after_title']; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']); |
|
| 27 | + echo FrmFormsController::show_form( $instance['form'], '', false, $instance['description'] ); |
|
| 28 | 28 | |
| 29 | 29 | echo '</div>'; |
| 30 | 30 | echo $args['after_widget']; |
@@ -40,19 +40,19 @@ discard block |
||
| 40 | 40 | 'title' => false, 'form' => false, 'description' => false, |
| 41 | 41 | ) ); |
| 42 | 42 | ?> |
| 43 | - <p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
|
| 44 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" value="<?php echo esc_attr( stripslashes($instance['title']) ); ?>" /></p> |
|
| 43 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
|
| 44 | + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>" /></p> |
|
| 45 | 45 | |
| 46 | - <p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
|
| 46 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
|
| 47 | 47 | <?php |
| 48 | - FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
| 49 | - 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
| 48 | + FrmFormsHelper::forms_dropdown( $this->get_field_name( 'form' ), $instance['form'], array( |
|
| 49 | + 'blank' => false, 'field_id' => $this->get_field_id( 'form' ), |
|
| 50 | 50 | 'class' => 'widefat', |
| 51 | 51 | ) ); |
| 52 | 52 | ?> |
| 53 | 53 | </p> |
| 54 | 54 | |
| 55 | - <p><label for="<?php echo esc_attr( $this->get_field_id('description') ); ?>"><input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo esc_attr( $this->get_field_id('description') ); ?>" name="<?php echo esc_attr( $this->get_field_name('description') ); ?>" value="1" /> |
|
| 55 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" /> |
|
| 56 | 56 | <?php _e( 'Show Description', 'formidable' ) ?></label></p> |
| 57 | 57 | <?php |
| 58 | 58 | } |
@@ -3,23 +3,23 @@ discard block |
||
| 3 | 3 | if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) { |
| 4 | 4 | if ( isset( $_GET['frm_style_setting'] ) ) { |
| 5 | 5 | extract( $_GET['frm_style_setting']['post_content'] ); |
| 6 | - } else { |
|
| 7 | - extract($_GET); |
|
| 8 | - } |
|
| 6 | + } else { |
|
| 7 | + extract($_GET); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - $important_style = isset($important_style) ? $important_style : 0; |
|
| 11 | - $auto_width = isset($auto_width) ? $auto_width : 0; |
|
| 12 | - $submit_style = isset($submit_style) ? $submit_style : 0; |
|
| 10 | + $important_style = isset($important_style) ? $important_style : 0; |
|
| 11 | + $auto_width = isset($auto_width) ? $auto_width : 0; |
|
| 12 | + $submit_style = isset($submit_style) ? $submit_style : 0; |
|
| 13 | 13 | |
| 14 | 14 | $style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' ); |
| 15 | 15 | if ( ! empty( $style_name ) ) { |
| 16 | 16 | $style_class = $style_name . '.with_frm_style'; |
| 17 | - } else { |
|
| 18 | - $style_class = 'with_frm_style'; |
|
| 19 | - } |
|
| 17 | + } else { |
|
| 18 | + $style_class = 'with_frm_style'; |
|
| 19 | + } |
|
| 20 | 20 | } else { |
| 21 | - $style_class = 'frm_style_'. $style->post_name .'.with_frm_style'; |
|
| 22 | - extract($style->post_content); |
|
| 21 | + $style_class = 'frm_style_'. $style->post_name .'.with_frm_style'; |
|
| 22 | + extract($style->post_content); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $important = empty($important_style) ? '' : ' !important'; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ( ! isset($collapse_icon) ) { |
| 43 | - $collapse_icon = 0; |
|
| 43 | + $collapse_icon = 0; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if ( ! isset( $center_form ) ) { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | color:#<?php echo esc_html( $text_color . $important ) ?>; |
| 324 | 324 | background-color:#<?php echo esc_html( $bg_color . $important ); ?>; |
| 325 | 325 | <?php if ( ! empty($important) ) { |
| 326 | - echo esc_html( 'background-image:none' . $important . ';' ); |
|
| 326 | + echo esc_html( 'background-image:none' . $important . ';' ); |
|
| 327 | 327 | } |
| 328 | 328 | ?> |
| 329 | 329 | border-color:#<?php echo esc_html( $border_color . $important ) ?>; |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | color:#<?php echo esc_html( $submit_active_color . $important ) ?>; |
| 531 | 531 | } |
| 532 | 532 | <?php |
| 533 | - } |
|
| 533 | + } |
|
| 534 | 534 | } |
| 535 | 535 | ?> |
| 536 | 536 | |
@@ -832,11 +832,11 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{ |
| 834 | 834 | <?php |
| 835 | - // calculate the top position based on field padding |
|
| 836 | - $top_pad = explode(' ', $field_pad); |
|
| 837 | - $top_pad = reset($top_pad); // the top padding is listed first |
|
| 838 | - $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
| 839 | - $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
| 835 | + // calculate the top position based on field padding |
|
| 836 | + $top_pad = explode(' ', $field_pad); |
|
| 837 | + $top_pad = reset($top_pad); // the top padding is listed first |
|
| 838 | + $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
| 839 | + $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
| 840 | 840 | ?> |
| 841 | 841 | top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>; |
| 842 | 842 | } |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) { |
|
| 3 | +if ( isset( $_GET['frm_style_setting'] ) || isset( $_GET['flat'] ) ) { |
|
| 4 | 4 | if ( isset( $_GET['frm_style_setting'] ) ) { |
| 5 | 5 | extract( $_GET['frm_style_setting']['post_content'] ); |
| 6 | 6 | } else { |
| 7 | - extract($_GET); |
|
| 7 | + extract( $_GET ); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - $important_style = isset($important_style) ? $important_style : 0; |
|
| 11 | - $auto_width = isset($auto_width) ? $auto_width : 0; |
|
| 12 | - $submit_style = isset($submit_style) ? $submit_style : 0; |
|
| 10 | + $important_style = isset( $important_style ) ? $important_style : 0; |
|
| 11 | + $auto_width = isset( $auto_width ) ? $auto_width : 0; |
|
| 12 | + $submit_style = isset( $submit_style ) ? $submit_style : 0; |
|
| 13 | 13 | |
| 14 | 14 | $style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' ); |
| 15 | 15 | if ( ! empty( $style_name ) ) { |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | $style_class = 'with_frm_style'; |
| 19 | 19 | } |
| 20 | 20 | } else { |
| 21 | - $style_class = 'frm_style_'. $style->post_name .'.with_frm_style'; |
|
| 22 | - extract($style->post_content); |
|
| 21 | + $style_class = 'frm_style_' . $style->post_name . '.with_frm_style'; |
|
| 22 | + extract( $style->post_content ); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -$important = empty($important_style) ? '' : ' !important'; |
|
| 25 | +$important = empty( $important_style ) ? '' : ' !important'; |
|
| 26 | 26 | $label_margin = (int) $width + 10; |
| 27 | 27 | |
| 28 | 28 | $minus_icons = FrmStylesHelper::minus_icons(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $change_margin = 650 . 'px'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if ( ! isset($collapse_icon) ) { |
|
| 42 | +if ( ! isset( $collapse_icon ) ) { |
|
| 43 | 43 | $collapse_icon = 0; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | border:<?php echo esc_html( $fieldset ) ?> solid #<?php echo esc_html( $fieldset_color . $important ) ?>; |
| 76 | 76 | margin:0; |
| 77 | 77 | padding:<?php echo esc_html( $fieldset_padding . $important ) ?>; |
| 78 | - background-color:<?php echo esc_html( empty($fieldset_bg_color) ? 'transparent' : '#'. $fieldset_bg_color ); ?>; |
|
| 78 | + background-color:<?php echo esc_html( empty( $fieldset_bg_color ) ? 'transparent' : '#' . $fieldset_bg_color ); ?>; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | .<?php echo esc_html( $style_class ) ?> .frm-show-form > h3{ |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | .<?php echo esc_html( $style_class ) ?> .frm_repeat_sec{ |
| 118 | - margin-bottom:<?php echo esc_html( $field_margin. $important ) ?>; |
|
| 119 | - margin-top:<?php echo esc_html( $field_margin. $important ) ?>; |
|
| 118 | + margin-bottom:<?php echo esc_html( $field_margin . $important ) ?>; |
|
| 119 | + margin-top:<?php echo esc_html( $field_margin . $important ) ?>; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | .<?php echo esc_html( $style_class ) ?> label.frm_primary_label, |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before{ |
| 140 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
| 140 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_plus_icon:before{ |
| 144 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
| 144 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before, |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
| 153 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
| 153 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
| 157 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
| 157 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | .<?php echo esc_html( $style_class ) ?> .form-field{ |
| 161 | - margin-bottom:<?php echo esc_html( $field_margin. $important ) ?>; |
|
| 161 | + margin-bottom:<?php echo esc_html( $field_margin . $important ) ?>; |
|
| 162 | 162 | } |
| 163 | 163 | .<?php echo esc_html( $style_class ) ?> .frm_grid, |
| 164 | 164 | .<?php echo esc_html( $style_class ) ?> .frm_grid_first, |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | .<?php echo esc_html( $style_class ) ?> .frm_error{ |
| 177 | 177 | margin:0; |
| 178 | 178 | padding:0; |
| 179 | - font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>; |
|
| 179 | + font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>; |
|
| 180 | 180 | font-size:<?php echo esc_html( $description_font_size . $important ) ?>; |
| 181 | 181 | color:#<?php echo esc_html( $description_color . $important ) ?>; |
| 182 | 182 | font-weight:<?php echo esc_html( $description_weight . $important ) ?>; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | .<?php echo esc_html( $style_class ) ?> .form-field.frm_col_field div.frm_description{ |
| 257 | - width:<?php echo esc_html( ( $field_width == '' ? 'auto' : $field_width ) . $important ) ?>; |
|
| 257 | + width:<?php echo esc_html( ( $field_width == '' ? 'auto' : $field_width ) . $important ) ?>; |
|
| 258 | 258 | max-width:100%; |
| 259 | 259 | } |
| 260 | 260 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | .<?php echo esc_html( $style_class ) ?> .frm_scale label{ |
| 281 | 281 | font-weight:<?php echo esc_html( $check_weight . $important ) ?>; |
| 282 | - font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>; |
|
| 282 | + font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>; |
|
| 283 | 283 | font-size:<?php echo esc_html( $check_font_size . $important ) ?>; |
| 284 | 284 | color:#<?php echo esc_html( $check_label_color . $important ) ?>; |
| 285 | 285 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | .<?php echo esc_html( $style_class ) ?> select, |
| 300 | 300 | .<?php echo esc_html( $style_class ) ?> textarea, |
| 301 | 301 | .<?php echo esc_html( $style_class ) ?> .chosen-container{ |
| 302 | - font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>; |
|
| 302 | + font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>; |
|
| 303 | 303 | font-size:<?php echo esc_html( $field_font_size ) ?>; |
| 304 | 304 | margin-bottom:0<?php echo esc_html( $important ) ?>; |
| 305 | 305 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single{ |
| 323 | 323 | color:#<?php echo esc_html( $text_color . $important ) ?>; |
| 324 | 324 | background-color:#<?php echo esc_html( $bg_color . $important ); ?>; |
| 325 | -<?php if ( ! empty($important) ) { |
|
| 325 | +<?php if ( ! empty( $important ) ) { |
|
| 326 | 326 | echo esc_html( 'background-image:none' . $important . ';' ); |
| 327 | 327 | } |
| 328 | 328 | ?> |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | line-height:normal<?php echo esc_html( $important ) ?>; |
| 477 | 477 | text-align:center; |
| 478 | 478 | background:#<?php echo esc_html( $submit_bg_color ); |
| 479 | - if ( ! empty($submit_bg_img) ) { |
|
| 480 | - echo esc_html( ' url('. $submit_bg_img .')' ); |
|
| 479 | + if ( ! empty( $submit_bg_img ) ) { |
|
| 480 | + echo esc_html( ' url(' . $submit_bg_img . ')' ); |
|
| 481 | 481 | } |
| 482 | 482 | echo esc_html( $important ); ?>; |
| 483 | 483 | border-width:<?php echo esc_html( $submit_border_width ) ?>; |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | .<?php echo esc_html( $style_class ) ?> .frm_radio label, |
| 576 | 576 | .<?php echo esc_html( $style_class ) ?> .frm_checkbox label{ |
| 577 | - font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>; |
|
| 577 | + font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>; |
|
| 578 | 578 | font-size:<?php echo esc_html( $check_font_size . $important ) ?>; |
| 579 | 579 | color:#<?php echo esc_html( $check_label_color . $important ) ?>; |
| 580 | 580 | font-weight:<?php echo esc_html( $check_weight . $important ) ?>; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | -webkit-border-radius:<?php echo esc_html( $border_radius . $important ) ?>; |
| 715 | 715 | border-radius:<?php echo esc_html( $border_radius . $important ) ?>; |
| 716 | 716 | font-size:<?php echo esc_html( $submit_font_size . $important ) ?>; |
| 717 | - font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>; |
|
| 717 | + font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>; |
|
| 718 | 718 | font-weight:<?php echo esc_html( $submit_weight . $important ) ?>; |
| 719 | 719 | color:#<?php echo esc_html( $submit_text_color . $important ) ?>; |
| 720 | 720 | background:#<?php echo esc_html( $submit_bg_color . $important ) ?>; |
@@ -833,10 +833,10 @@ discard block |
||
| 833 | 833 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{ |
| 834 | 834 | <?php |
| 835 | 835 | // calculate the top position based on field padding |
| 836 | - $top_pad = explode(' ', $field_pad); |
|
| 837 | - $top_pad = reset($top_pad); // the top padding is listed first |
|
| 838 | - $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
| 839 | - $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
| 836 | + $top_pad = explode( ' ', $field_pad ); |
|
| 837 | + $top_pad = reset( $top_pad ); // the top padding is listed first |
|
| 838 | + $pad_unit = preg_replace( '/[0-9]+/', '', $top_pad ); //px, em, rem... |
|
| 839 | + $top_margin = (int) str_replace( $pad_unit, '', $top_pad ) / 2; |
|
| 840 | 840 | ?> |
| 841 | 841 | top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>; |
| 842 | 842 | } |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! isset($saving) ) { |
| 3 | - header( 'Content-type: text/css' ); |
|
| 3 | + header( 'Content-type: text/css' ); |
|
| 4 | 4 | |
| 5 | - if ( isset($css) && $css ) { |
|
| 6 | - echo $css; |
|
| 7 | - die(); |
|
| 8 | - } |
|
| 5 | + if ( isset($css) && $css ) { |
|
| 6 | + echo $css; |
|
| 7 | + die(); |
|
| 8 | + } |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | if ( ! isset($frm_style) ) { |
| 12 | - $frm_style = new FrmStyle(); |
|
| 12 | + $frm_style = new FrmStyle(); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $styles = $frm_style->get_all(); |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | <?php |
| 180 | 180 | foreach ( $styles as $style ) { |
| 181 | - include(dirname(__FILE__) .'/_single_theme.css.php'); |
|
| 182 | - unset($style); |
|
| 181 | + include(dirname(__FILE__) .'/_single_theme.css.php'); |
|
| 182 | + unset($style); |
|
| 183 | 183 | } |
| 184 | 184 | ?> |
| 185 | 185 | |
@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! isset($saving) ) { |
|
| 2 | +if ( ! isset( $saving ) ) { |
|
| 3 | 3 | header( 'Content-type: text/css' ); |
| 4 | 4 | |
| 5 | - if ( isset($css) && $css ) { |
|
| 5 | + if ( isset( $css ) && $css ) { |
|
| 6 | 6 | echo $css; |
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -if ( ! isset($frm_style) ) { |
|
| 11 | +if ( ! isset( $frm_style ) ) { |
|
| 12 | 12 | $frm_style = new FrmStyle(); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $styles = $frm_style->get_all(); |
| 16 | -$default_style = $frm_style->get_default_style($styles); |
|
| 16 | +$default_style = $frm_style->get_default_style( $styles ); |
|
| 17 | 17 | $defaults = $default_style->post_content; |
| 18 | 18 | ?> |
| 19 | 19 | |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | <?php |
| 180 | 180 | foreach ( $styles as $style ) { |
| 181 | - include(dirname(__FILE__) .'/_single_theme.css.php'); |
|
| 182 | - unset($style); |
|
| 181 | + include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
|
| 182 | + unset( $style ); |
|
| 183 | 183 | } |
| 184 | 184 | ?> |
| 185 | 185 | |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | -moz-border-radius:<?php echo $defaults['border_radius'] ?>; |
| 1163 | 1163 | -webkit-border-radius:<?php echo $defaults['border_radius'] ?>; |
| 1164 | 1164 | border-radius:<?php echo $defaults['border_radius'] ?>; |
| 1165 | - width:<?php echo ($defaults['field_width'] == '' ? 'auto' : $defaults['field_width']) ?>; |
|
| 1165 | + width:<?php echo ( $defaults['field_width'] == '' ? 'auto' : $defaults['field_width'] ) ?>; |
|
| 1166 | 1166 | max-width:100%; |
| 1167 | 1167 | font-size:<?php echo $defaults['field_font_size'] ?>; |
| 1168 | 1168 | padding:<?php echo $defaults['field_pad'] ?>; |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | font-style:normal; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | -<?php include(FrmAppHelper::plugin_path() .'/css/font_icons.css'); ?> |
|
| 1738 | +<?php include( FrmAppHelper::plugin_path() . '/css/font_icons.css' ); ?> |
|
| 1739 | 1739 | |
| 1740 | 1740 | /* Responsive */ |
| 1741 | 1741 | @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi){ |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | // 2.0 |
| 4 | 4 | if ( ! isset($frm_vars['pro_is_installed']) ) { |
| 5 | - $frm_vars['pro_is_installed'] = false; |
|
| 5 | + $frm_vars['pro_is_installed'] = false; |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | // Instansiate Models |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // 2.0 |
| 4 | -if ( ! isset($frm_vars['pro_is_installed']) ) { |
|
| 4 | +if ( ! isset( $frm_vars['pro_is_installed'] ) ) { |
|
| 5 | 5 | $frm_vars['pro_is_installed'] = false; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -23,41 +23,41 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | global $frm_vars; |
| 25 | 25 | $frm_vars = array( |
| 26 | - 'load_css' => false, 'forms_loaded' => array(), |
|
| 27 | - 'created_entries' => array(), |
|
| 28 | - 'pro_is_authorized' => false, |
|
| 26 | + 'load_css' => false, 'forms_loaded' => array(), |
|
| 27 | + 'created_entries' => array(), |
|
| 28 | + 'pro_is_authorized' => false, |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | function frm_forms_autoloader( $class_name ) { |
| 32 | - // Only load Frm classes here |
|
| 32 | + // Only load Frm classes here |
|
| 33 | 33 | if ( ! preg_match( '/^Frm.+$/', $class_name ) ) { |
| 34 | - return; |
|
| 35 | - } |
|
| 34 | + return; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - $filepath = dirname(__FILE__); |
|
| 37 | + $filepath = dirname(__FILE__); |
|
| 38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) { |
| 39 | - $filepath .= '/pro'; |
|
| 40 | - } |
|
| 41 | - $filepath .= '/classes'; |
|
| 39 | + $filepath .= '/pro'; |
|
| 40 | + } |
|
| 41 | + $filepath .= '/classes'; |
|
| 42 | 42 | |
| 43 | 43 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
| 44 | - $filepath .= '/helpers/'; |
|
| 44 | + $filepath .= '/helpers/'; |
|
| 45 | 45 | } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { |
| 46 | - $filepath .= '/controllers/'; |
|
| 47 | - } else { |
|
| 48 | - $filepath .= '/models/'; |
|
| 49 | - } |
|
| 46 | + $filepath .= '/controllers/'; |
|
| 47 | + } else { |
|
| 48 | + $filepath .= '/models/'; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $filepath .= $class_name .'.php'; |
|
| 51 | + $filepath .= $class_name .'.php'; |
|
| 52 | 52 | |
| 53 | - if ( file_exists($filepath) ) { |
|
| 54 | - include($filepath); |
|
| 55 | - } |
|
| 53 | + if ( file_exists($filepath) ) { |
|
| 54 | + include($filepath); |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
| 59 | 59 | if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
| 60 | - spl_autoload_register('__autoload'); |
|
| 60 | + spl_autoload_register('__autoload'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Add the autoloader |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $frm_path = dirname(__FILE__); |
| 67 | 67 | if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
| 68 | - include($frm_path .'/pro/formidable-pro.php'); |
|
| 68 | + include($frm_path .'/pro/formidable-pro.php'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | FrmHooksController::trigger_load_hook(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $filepath = dirname(__FILE__); |
|
| 37 | + $filepath = dirname( __FILE__ ); |
|
| 38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) { |
| 39 | 39 | $filepath .= '/pro'; |
| 40 | 40 | } |
@@ -48,27 +48,27 @@ discard block |
||
| 48 | 48 | $filepath .= '/models/'; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $filepath .= $class_name .'.php'; |
|
| 51 | + $filepath .= $class_name . '.php'; |
|
| 52 | 52 | |
| 53 | - if ( file_exists($filepath) ) { |
|
| 54 | - include($filepath); |
|
| 53 | + if ( file_exists( $filepath ) ) { |
|
| 54 | + include( $filepath ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
| 59 | -if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
|
| 60 | - spl_autoload_register('__autoload'); |
|
| 59 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
|
| 60 | + spl_autoload_register( '__autoload' ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Add the autoloader |
| 64 | -spl_autoload_register('frm_forms_autoloader'); |
|
| 64 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
| 65 | 65 | |
| 66 | -$frm_path = dirname(__FILE__); |
|
| 67 | -if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
| 68 | - include($frm_path .'/pro/formidable-pro.php'); |
|
| 66 | +$frm_path = dirname( __FILE__ ); |
|
| 67 | +if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
| 68 | + include( $frm_path . '/pro/formidable-pro.php' ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | FrmHooksController::trigger_load_hook(); |
| 72 | 72 | |
| 73 | -include_once($frm_path .'/deprecated.php'); |
|
| 74 | -unset($frm_path); |
|
| 73 | +include_once( $frm_path . '/deprecated.php' ); |
|
| 74 | +unset( $frm_path ); |
|
@@ -1,5 +1,5 @@ |
||
| 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 | |
@@ -2,136 +2,136 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFormsController { |
| 4 | 4 | |
| 5 | - public static function menu() { |
|
| 6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 5 | + public static function menu() { |
|
| 6 | + add_submenu_page('formidable', 'Formidable | '. __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 7 | 7 | |
| 8 | - add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 8 | + add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 9 | 9 | |
| 10 | - add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 10 | + add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 11 | 11 | add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public static function head() { |
|
| 15 | - wp_enqueue_script('formidable-editinplace'); |
|
| 14 | + public static function head() { |
|
| 15 | + wp_enqueue_script('formidable-editinplace'); |
|
| 16 | 16 | |
| 17 | - if ( wp_is_mobile() ) { |
|
| 18 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
| 19 | - } |
|
| 20 | - } |
|
| 17 | + if ( wp_is_mobile() ) { |
|
| 18 | + wp_enqueue_script( 'jquery-touch-punch' ); |
|
| 19 | + } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public static function register_widgets() { |
|
| 23 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 24 | - register_widget('FrmShowForm'); |
|
| 25 | - } |
|
| 22 | + public static function register_widgets() { |
|
| 23 | + require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 24 | + register_widget('FrmShowForm'); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public static function list_form() { |
|
| 28 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
| 27 | + public static function list_form() { |
|
| 28 | + FrmAppHelper::permission_check('frm_view_forms'); |
|
| 29 | 29 | |
| 30 | 30 | $params = FrmForm::list_page_params(); |
| 31 | - $errors = self::process_bulk_form_actions( array()); |
|
| 32 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 31 | + $errors = self::process_bulk_form_actions( array()); |
|
| 32 | + $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 33 | 33 | |
| 34 | 34 | return self::display_forms_list( $params, '', $errors ); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | public static function new_form( $values = array() ) { |
| 38 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 38 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 39 | 39 | |
| 40 | - global $frm_vars; |
|
| 40 | + global $frm_vars; |
|
| 41 | 41 | |
| 42 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 42 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 43 | 43 | $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
| 44 | 44 | |
| 45 | 45 | if ( $action == 'create' ) { |
| 46 | - return self::create($values); |
|
| 46 | + return self::create($values); |
|
| 47 | 47 | } else if ( $action == 'new' ) { |
| 48 | 48 | $frm_field_selection = FrmField::field_selection(); |
| 49 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
| 50 | - $id = FrmForm::create( $values ); |
|
| 51 | - $form = FrmForm::getOne($id); |
|
| 49 | + $values = FrmFormsHelper::setup_new_vars($values); |
|
| 50 | + $id = FrmForm::create( $values ); |
|
| 51 | + $form = FrmForm::getOne($id); |
|
| 52 | 52 | |
| 53 | - // add default email notification |
|
| 54 | - $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
| 55 | - $action_control->create($form->id); |
|
| 53 | + // add default email notification |
|
| 54 | + $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
| 55 | + $action_control->create($form->id); |
|
| 56 | 56 | |
| 57 | 57 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 58 | 58 | |
| 59 | - $values['id'] = $id; |
|
| 60 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 61 | - } |
|
| 62 | - } |
|
| 59 | + $values['id'] = $id; |
|
| 60 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | public static function create( $values = array() ) { |
| 65 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 65 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 66 | 66 | |
| 67 | - global $frm_vars; |
|
| 68 | - if ( empty( $values ) ) { |
|
| 69 | - $values = $_POST; |
|
| 70 | - } |
|
| 67 | + global $frm_vars; |
|
| 68 | + if ( empty( $values ) ) { |
|
| 69 | + $values = $_POST; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - //Set radio button and checkbox meta equal to "other" value |
|
| 73 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 74 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 75 | - } |
|
| 72 | + //Set radio button and checkbox meta equal to "other" value |
|
| 73 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 74 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 78 | 78 | |
| 79 | - if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
| 80 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 81 | - $errors = array( 'form' => $frm_settings->admin_permission ); |
|
| 82 | - } else { |
|
| 83 | - $errors = FrmForm::validate($values); |
|
| 84 | - } |
|
| 79 | + if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
| 80 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 81 | + $errors = array( 'form' => $frm_settings->admin_permission ); |
|
| 82 | + } else { |
|
| 83 | + $errors = FrmForm::validate($values); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if ( count($errors) > 0 ) { |
|
| 87 | - $hide_preview = true; |
|
| 86 | + if ( count($errors) > 0 ) { |
|
| 87 | + $hide_preview = true; |
|
| 88 | 88 | $frm_field_selection = FrmField::field_selection(); |
| 89 | - $form = FrmForm::getOne( $id ); |
|
| 90 | - $fields = FrmField::get_all_for_form($id); |
|
| 89 | + $form = FrmForm::getOne( $id ); |
|
| 90 | + $fields = FrmField::get_all_for_form($id); |
|
| 91 | 91 | |
| 92 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 92 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 93 | 93 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 94 | 94 | |
| 95 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 96 | - } else { |
|
| 97 | - FrmForm::update( $id, $values, true ); |
|
| 98 | - die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 99 | - } |
|
| 100 | - } |
|
| 95 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 96 | + } else { |
|
| 97 | + FrmForm::update( $id, $values, true ); |
|
| 98 | + die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - public static function edit( $values = false ) { |
|
| 103 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 102 | + public static function edit( $values = false ) { |
|
| 103 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 104 | 104 | |
| 105 | 105 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 106 | - return self::get_edit_vars($id); |
|
| 107 | - } |
|
| 106 | + return self::get_edit_vars($id); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - public static function settings( $id = false, $message = '' ) { |
|
| 110 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 109 | + public static function settings( $id = false, $message = '' ) { |
|
| 110 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 111 | 111 | |
| 112 | - if ( ! $id || ! is_numeric($id) ) { |
|
| 112 | + if ( ! $id || ! is_numeric($id) ) { |
|
| 113 | 113 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | return self::get_settings_vars( $id, array(), $message ); |
| 116 | - } |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - public static function update_settings() { |
|
| 119 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 118 | + public static function update_settings() { |
|
| 119 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 120 | 120 | |
| 121 | 121 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 122 | 122 | |
| 123 | - $errors = FrmForm::validate($_POST); |
|
| 124 | - if ( count($errors) > 0 ) { |
|
| 125 | - return self::get_settings_vars($id, $errors); |
|
| 126 | - } |
|
| 123 | + $errors = FrmForm::validate($_POST); |
|
| 124 | + if ( count($errors) > 0 ) { |
|
| 125 | + return self::get_settings_vars($id, $errors); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - do_action('frm_before_update_form_settings', $id); |
|
| 128 | + do_action('frm_before_update_form_settings', $id); |
|
| 129 | 129 | |
| 130 | 130 | FrmForm::update( $id, $_POST ); |
| 131 | 131 | |
| 132 | - $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
| 132 | + $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
| 133 | 133 | return self::get_settings_vars( $id, array(), $message ); |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | public static function edit_key() { |
| 137 | 137 | $values = self::edit_in_place_value( 'form_key' ); |
@@ -161,43 +161,43 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | public static function update( $values = array() ) { |
| 163 | 163 | if ( empty( $values ) ) { |
| 164 | - $values = $_POST; |
|
| 165 | - } |
|
| 164 | + $values = $_POST; |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - //Set radio button and checkbox meta equal to "other" value |
|
| 168 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 169 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 170 | - } |
|
| 167 | + //Set radio button and checkbox meta equal to "other" value |
|
| 168 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 169 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $errors = FrmForm::validate( $values ); |
|
| 173 | - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
| 174 | - if ( $permission_error !== false ) { |
|
| 175 | - $errors['form'] = $permission_error; |
|
| 176 | - } |
|
| 172 | + $errors = FrmForm::validate( $values ); |
|
| 173 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
| 174 | + if ( $permission_error !== false ) { |
|
| 175 | + $errors['form'] = $permission_error; |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | 178 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 179 | 179 | |
| 180 | 180 | if ( count( $errors ) > 0 ) { |
| 181 | - return self::get_edit_vars( $id, $errors ); |
|
| 181 | + return self::get_edit_vars( $id, $errors ); |
|
| 182 | 182 | } else { |
| 183 | - FrmForm::update( $id, $values ); |
|
| 184 | - $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 185 | - if ( defined( 'DOING_AJAX' ) ) { |
|
| 183 | + FrmForm::update( $id, $values ); |
|
| 184 | + $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 185 | + if ( defined( 'DOING_AJAX' ) ) { |
|
| 186 | 186 | wp_die( $message ); |
| 187 | - } |
|
| 187 | + } |
|
| 188 | 188 | return self::get_edit_vars( $id, array(), $message ); |
| 189 | - } |
|
| 190 | - } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | - public static function bulk_create_template( $ids ) { |
|
| 193 | - FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 192 | + public static function bulk_create_template( $ids ) { |
|
| 193 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 194 | 194 | |
| 195 | - foreach ( $ids as $id ) { |
|
| 196 | - FrmForm::duplicate( $id, true, true ); |
|
| 197 | - } |
|
| 195 | + foreach ( $ids as $id ) { |
|
| 196 | + FrmForm::duplicate( $id, true, true ); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - return __( 'Form template was Successfully Created', 'formidable' ); |
|
| 200 | - } |
|
| 199 | + return __( 'Form template was Successfully Created', 'formidable' ); |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Redirect to the url for creating from a template |
@@ -218,45 +218,45 @@ discard block |
||
| 218 | 218 | wp_die(); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - public static function duplicate() { |
|
| 222 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 221 | + public static function duplicate() { |
|
| 222 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 223 | 223 | |
| 224 | 224 | $params = FrmForm::list_page_params(); |
| 225 | - $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
| 226 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 227 | - if ( $form ) { |
|
| 225 | + $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
| 226 | + $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 227 | + if ( $form ) { |
|
| 228 | 228 | return self::get_edit_vars( $form, array(), $message, true ); |
| 229 | - } else { |
|
| 230 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 231 | - } |
|
| 232 | - } |
|
| 229 | + } else { |
|
| 230 | + return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - public static function page_preview() { |
|
| 234 | + public static function page_preview() { |
|
| 235 | 235 | $params = FrmForm::list_page_params(); |
| 236 | - if ( ! $params['form'] ) { |
|
| 237 | - return; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - $form = FrmForm::getOne( $params['form'] ); |
|
| 241 | - if ( ! $form ) { |
|
| 242 | - return; |
|
| 243 | - } |
|
| 244 | - return self::show_form( $form->id, '', true, true ); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - public static function preview() { |
|
| 248 | - do_action( 'frm_wp' ); |
|
| 249 | - |
|
| 250 | - global $frm_vars; |
|
| 251 | - $frm_vars['preview'] = true; |
|
| 252 | - |
|
| 253 | - if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
| 254 | - global $wp; |
|
| 255 | - $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 256 | - include_once( $root.'/wp-config.php' ); |
|
| 257 | - $wp->init(); |
|
| 258 | - $wp->register_globals(); |
|
| 259 | - } |
|
| 236 | + if ( ! $params['form'] ) { |
|
| 237 | + return; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + $form = FrmForm::getOne( $params['form'] ); |
|
| 241 | + if ( ! $form ) { |
|
| 242 | + return; |
|
| 243 | + } |
|
| 244 | + return self::show_form( $form->id, '', true, true ); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + public static function preview() { |
|
| 248 | + do_action( 'frm_wp' ); |
|
| 249 | + |
|
| 250 | + global $frm_vars; |
|
| 251 | + $frm_vars['preview'] = true; |
|
| 252 | + |
|
| 253 | + if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
| 254 | + global $wp; |
|
| 255 | + $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 256 | + include_once( $root.'/wp-config.php' ); |
|
| 257 | + $wp->init(); |
|
| 258 | + $wp->register_globals(); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | 261 | self::register_pro_scripts(); |
| 262 | 262 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 ); |
| 271 | 271 | if ( empty( $form ) ) { |
| 272 | 272 | $form = FrmForm::getAll( array(), '', 1 ); |
| 273 | - } |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 276 | - wp_die(); |
|
| 277 | - } |
|
| 275 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 276 | + wp_die(); |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | 279 | public static function register_pro_scripts() { |
| 280 | 280 | if ( FrmAppHelper::pro_is_installed() ) { |
@@ -284,22 +284,22 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - public static function untrash() { |
|
| 287 | + public static function untrash() { |
|
| 288 | 288 | self::change_form_status( 'untrash' ); |
| 289 | - } |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | 291 | public static function bulk_untrash( $ids ) { |
| 292 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 292 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 293 | 293 | |
| 294 | - $count = FrmForm::set_status( $ids, 'published' ); |
|
| 294 | + $count = FrmForm::set_status( $ids, 'published' ); |
|
| 295 | 295 | |
| 296 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 297 | - return $message; |
|
| 298 | - } |
|
| 296 | + $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 297 | + return $message; |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | - public static function trash() { |
|
| 300 | + public static function trash() { |
|
| 301 | 301 | self::change_form_status( 'trash' ); |
| 302 | - } |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * @param string $status |
@@ -337,68 +337,68 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | public static function bulk_trash( $ids ) { |
| 340 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 340 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 341 | 341 | |
| 342 | - $count = 0; |
|
| 343 | - foreach ( $ids as $id ) { |
|
| 344 | - if ( FrmForm::trash( $id ) ) { |
|
| 345 | - $count++; |
|
| 346 | - } |
|
| 347 | - } |
|
| 342 | + $count = 0; |
|
| 343 | + foreach ( $ids as $id ) { |
|
| 344 | + if ( FrmForm::trash( $id ) ) { |
|
| 345 | + $count++; |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | 348 | |
| 349 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 350 | - $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' ); |
|
| 349 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 350 | + $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' ); |
|
| 351 | 351 | |
| 352 | - return $message; |
|
| 353 | - } |
|
| 352 | + return $message; |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | - public static function destroy() { |
|
| 356 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 355 | + public static function destroy() { |
|
| 356 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 357 | 357 | |
| 358 | 358 | $params = FrmForm::list_page_params(); |
| 359 | 359 | |
| 360 | - //check nonce url |
|
| 361 | - check_admin_referer('destroy_form_' . $params['id']); |
|
| 360 | + //check nonce url |
|
| 361 | + check_admin_referer('destroy_form_' . $params['id']); |
|
| 362 | 362 | |
| 363 | - $count = 0; |
|
| 364 | - if ( FrmForm::destroy( $params['id'] ) ) { |
|
| 365 | - $count++; |
|
| 366 | - } |
|
| 363 | + $count = 0; |
|
| 364 | + if ( FrmForm::destroy( $params['id'] ) ) { |
|
| 365 | + $count++; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 368 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 369 | 369 | |
| 370 | 370 | self::display_forms_list( $params, $message ); |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | public static function bulk_destroy( $ids ) { |
| 374 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 374 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 375 | 375 | |
| 376 | - $count = 0; |
|
| 377 | - foreach ( $ids as $id ) { |
|
| 378 | - $d = FrmForm::destroy( $id ); |
|
| 379 | - if ( $d ) { |
|
| 380 | - $count++; |
|
| 381 | - } |
|
| 382 | - } |
|
| 376 | + $count = 0; |
|
| 377 | + foreach ( $ids as $id ) { |
|
| 378 | + $d = FrmForm::destroy( $id ); |
|
| 379 | + if ( $d ) { |
|
| 380 | + $count++; |
|
| 381 | + } |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 384 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 385 | 385 | |
| 386 | - return $message; |
|
| 387 | - } |
|
| 386 | + return $message; |
|
| 387 | + } |
|
| 388 | 388 | |
| 389 | - private static function delete_all() { |
|
| 390 | - //check nonce url |
|
| 391 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 392 | - if ( $permission_error !== false ) { |
|
| 389 | + private static function delete_all() { |
|
| 390 | + //check nonce url |
|
| 391 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 392 | + if ( $permission_error !== false ) { |
|
| 393 | 393 | self::display_forms_list( array(), '', array( $permission_error ) ); |
| 394 | - return; |
|
| 395 | - } |
|
| 394 | + return; |
|
| 395 | + } |
|
| 396 | 396 | |
| 397 | 397 | $count = FrmForm::scheduled_delete( time() ); |
| 398 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 398 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 399 | 399 | |
| 400 | 400 | self::display_forms_list( array(), $message ); |
| 401 | - } |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | 403 | public static function scheduled_delete( $delete_timestamp = '' ) { |
| 404 | 404 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' ); |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | - * Inserts Formidable button |
|
| 410 | - * Hook exists since 2.5.0 |
|
| 411 | - * |
|
| 412 | - * @since 2.0.15 |
|
| 413 | - */ |
|
| 409 | + * Inserts Formidable button |
|
| 410 | + * Hook exists since 2.5.0 |
|
| 411 | + * |
|
| 412 | + * @since 2.0.15 |
|
| 413 | + */ |
|
| 414 | 414 | public static function insert_form_button() { |
| 415 | 415 | if ( current_user_can('frm_view_forms') ) { |
| 416 | 416 | $content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> Formidable</a>'; |
@@ -418,48 +418,48 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - public static function insert_form_popup() { |
|
| 421 | + public static function insert_form_popup() { |
|
| 422 | 422 | $page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) ); |
| 423 | 423 | if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) { |
| 424 | - return; |
|
| 425 | - } |
|
| 424 | + return; |
|
| 425 | + } |
|
| 426 | 426 | |
| 427 | - FrmAppHelper::load_admin_wide_js(); |
|
| 427 | + FrmAppHelper::load_admin_wide_js(); |
|
| 428 | 428 | |
| 429 | - $shortcodes = array( |
|
| 429 | + $shortcodes = array( |
|
| 430 | 430 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
| 431 | - ); |
|
| 431 | + ); |
|
| 432 | 432 | |
| 433 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 433 | + $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 434 | 434 | |
| 435 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 436 | - } |
|
| 435 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - public static function get_shortcode_opts() { |
|
| 439 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 438 | + public static function get_shortcode_opts() { |
|
| 439 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 440 | 440 | |
| 441 | 441 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
| 442 | - if ( empty($shortcode) ) { |
|
| 443 | - wp_die(); |
|
| 444 | - } |
|
| 442 | + if ( empty($shortcode) ) { |
|
| 443 | + wp_die(); |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 447 | - echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 446 | + echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 447 | + echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 448 | 448 | |
| 449 | - $form_id = ''; |
|
| 450 | - $opts = array(); |
|
| 449 | + $form_id = ''; |
|
| 450 | + $opts = array(); |
|
| 451 | 451 | switch ( $shortcode ) { |
| 452 | - case 'formidable': |
|
| 453 | - $opts = array( |
|
| 452 | + case 'formidable': |
|
| 453 | + $opts = array( |
|
| 454 | 454 | 'form_id' => 'id', |
| 455 | - //'key' => ', |
|
| 455 | + //'key' => ', |
|
| 456 | 456 | 'title' => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ), |
| 457 | 457 | 'description' => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ), |
| 458 | 458 | 'minimize' => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ), |
| 459 | - ); |
|
| 460 | - break; |
|
| 461 | - } |
|
| 462 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 459 | + ); |
|
| 460 | + break; |
|
| 461 | + } |
|
| 462 | + $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 463 | 463 | |
| 464 | 464 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
| 465 | 465 | // allow other shortcodes to use the required form id option |
@@ -467,63 +467,63 @@ discard block |
||
| 467 | 467 | unset( $opts['form_id'] ); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 470 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 471 | 471 | |
| 472 | - echo '</div>'; |
|
| 472 | + echo '</div>'; |
|
| 473 | 473 | |
| 474 | - wp_die(); |
|
| 475 | - } |
|
| 474 | + wp_die(); |
|
| 475 | + } |
|
| 476 | 476 | |
| 477 | 477 | public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) { |
| 478 | - FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 478 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 479 | 479 | if ( ! empty( $deprecated_errors ) ) { |
| 480 | 480 | $errors = $deprecated_errors; |
| 481 | 481 | _deprecated_argument( 'errors', '2.0.8' ); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - global $wpdb, $frm_vars; |
|
| 484 | + global $wpdb, $frm_vars; |
|
| 485 | 485 | |
| 486 | 486 | if ( empty( $params ) ) { |
| 487 | 487 | $params = FrmForm::list_page_params(); |
| 488 | - } |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
| 490 | + $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
| 491 | 491 | |
| 492 | - $pagenum = $wp_list_table->get_pagenum(); |
|
| 492 | + $pagenum = $wp_list_table->get_pagenum(); |
|
| 493 | 493 | |
| 494 | - $wp_list_table->prepare_items(); |
|
| 494 | + $wp_list_table->prepare_items(); |
|
| 495 | 495 | |
| 496 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 497 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 496 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 497 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 498 | 498 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
| 499 | - die(); |
|
| 500 | - } |
|
| 499 | + die(); |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 503 | - } |
|
| 502 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | 505 | public static function get_columns( $columns ) { |
| 506 | - $columns['cb'] = '<input type="checkbox" />'; |
|
| 507 | - $columns['id'] = 'ID'; |
|
| 506 | + $columns['cb'] = '<input type="checkbox" />'; |
|
| 507 | + $columns['id'] = 'ID'; |
|
| 508 | 508 | |
| 509 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
| 509 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
| 510 | 510 | |
| 511 | - if ( 'template' == $type ) { |
|
| 512 | - $columns['name'] = __( 'Template Name', 'formidable' ); |
|
| 513 | - $columns['type'] = __( 'Type', 'formidable' ); |
|
| 514 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 515 | - } else { |
|
| 516 | - $columns['name'] = __( 'Form Title', 'formidable' ); |
|
| 517 | - $columns['entries'] = __( 'Entries', 'formidable' ); |
|
| 518 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 519 | - $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
| 520 | - } |
|
| 511 | + if ( 'template' == $type ) { |
|
| 512 | + $columns['name'] = __( 'Template Name', 'formidable' ); |
|
| 513 | + $columns['type'] = __( 'Type', 'formidable' ); |
|
| 514 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 515 | + } else { |
|
| 516 | + $columns['name'] = __( 'Form Title', 'formidable' ); |
|
| 517 | + $columns['entries'] = __( 'Entries', 'formidable' ); |
|
| 518 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 519 | + $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
| 520 | + } |
|
| 521 | 521 | |
| 522 | - $columns['created_at'] = __( 'Date', 'formidable' ); |
|
| 522 | + $columns['created_at'] = __( 'Date', 'formidable' ); |
|
| 523 | 523 | |
| 524 | 524 | add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) ); |
| 525 | 525 | |
| 526 | - return $columns; |
|
| 526 | + return $columns; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | public static function get_sortable_columns() { |
@@ -537,110 +537,110 @@ discard block |
||
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | public static function hidden_columns( $result ) { |
| 540 | - $return = false; |
|
| 541 | - foreach ( (array) $result as $r ) { |
|
| 542 | - if ( ! empty( $r ) ) { |
|
| 543 | - $return = true; |
|
| 544 | - break; |
|
| 545 | - } |
|
| 546 | - } |
|
| 540 | + $return = false; |
|
| 541 | + foreach ( (array) $result as $r ) { |
|
| 542 | + if ( ! empty( $r ) ) { |
|
| 543 | + $return = true; |
|
| 544 | + break; |
|
| 545 | + } |
|
| 546 | + } |
|
| 547 | 547 | |
| 548 | - if ( $return ) { |
|
| 549 | - return $result; |
|
| 548 | + if ( $return ) { |
|
| 549 | + return $result; |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 552 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 553 | 553 | |
| 554 | - $result[] = 'created_at'; |
|
| 555 | - if ( $type == 'template' ) { |
|
| 556 | - $result[] = 'id'; |
|
| 557 | - $result[] = 'form_key'; |
|
| 558 | - } |
|
| 554 | + $result[] = 'created_at'; |
|
| 555 | + if ( $type == 'template' ) { |
|
| 556 | + $result[] = 'id'; |
|
| 557 | + $result[] = 'form_key'; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - return $result; |
|
| 561 | - } |
|
| 560 | + return $result; |
|
| 561 | + } |
|
| 562 | 562 | |
| 563 | 563 | public static function save_per_page( $save, $option, $value ) { |
| 564 | - if ( $option == 'formidable_page_formidable_per_page' ) { |
|
| 565 | - $save = (int) $value; |
|
| 566 | - } |
|
| 567 | - return $save; |
|
| 568 | - } |
|
| 564 | + if ( $option == 'formidable_page_formidable_per_page' ) { |
|
| 565 | + $save = (int) $value; |
|
| 566 | + } |
|
| 567 | + return $save; |
|
| 568 | + } |
|
| 569 | 569 | |
| 570 | 570 | private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) { |
| 571 | - global $frm_vars; |
|
| 571 | + global $frm_vars; |
|
| 572 | 572 | |
| 573 | - $form = FrmForm::getOne( $id ); |
|
| 574 | - if ( ! $form ) { |
|
| 575 | - wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
| 576 | - } |
|
| 573 | + $form = FrmForm::getOne( $id ); |
|
| 574 | + if ( ! $form ) { |
|
| 575 | + wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
| 576 | + } |
|
| 577 | 577 | |
| 578 | - if ( $form->parent_form_id ) { |
|
| 579 | - wp_die( sprintf(__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url(admin_url('admin.php') .'?page=formidable&frm_action=edit&id='. $form->parent_form_id) .'">', '</a>' )); |
|
| 580 | - } |
|
| 578 | + if ( $form->parent_form_id ) { |
|
| 579 | + wp_die( sprintf(__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url(admin_url('admin.php') .'?page=formidable&frm_action=edit&id='. $form->parent_form_id) .'">', '</a>' )); |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | 582 | $frm_field_selection = FrmField::field_selection(); |
| 583 | - $fields = FrmField::get_all_for_form($form->id); |
|
| 583 | + $fields = FrmField::get_all_for_form($form->id); |
|
| 584 | 584 | |
| 585 | - // Automatically add end section fields if they don't exist (2.0 migration) |
|
| 586 | - $reset_fields = false; |
|
| 587 | - FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
| 585 | + // Automatically add end section fields if they don't exist (2.0 migration) |
|
| 586 | + $reset_fields = false; |
|
| 587 | + FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
| 588 | 588 | |
| 589 | - if ( $reset_fields ) { |
|
| 590 | - $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
| 591 | - } |
|
| 589 | + if ( $reset_fields ) { |
|
| 590 | + $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
| 591 | + } |
|
| 592 | 592 | |
| 593 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 593 | + unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 594 | 594 | |
| 595 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 595 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 596 | 596 | |
| 597 | - $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 598 | - if ( $form->is_template && $message == $edit_message ) { |
|
| 599 | - $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
| 600 | - } |
|
| 597 | + $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 598 | + if ( $form->is_template && $message == $edit_message ) { |
|
| 599 | + $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
| 600 | + } |
|
| 601 | 601 | |
| 602 | 602 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 603 | 603 | |
| 604 | - if ( $form->default_template ) { |
|
| 605 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 606 | - } else if ( defined('DOING_AJAX') ) { |
|
| 607 | - wp_die(); |
|
| 608 | - } else if ( $create_link ) { |
|
| 609 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 610 | - } else { |
|
| 611 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 612 | - } |
|
| 613 | - } |
|
| 604 | + if ( $form->default_template ) { |
|
| 605 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 606 | + } else if ( defined('DOING_AJAX') ) { |
|
| 607 | + wp_die(); |
|
| 608 | + } else if ( $create_link ) { |
|
| 609 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 610 | + } else { |
|
| 611 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 612 | + } |
|
| 613 | + } |
|
| 614 | 614 | |
| 615 | 615 | public static function get_settings_vars( $id, $errors = array(), $message = '' ) { |
| 616 | 616 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 617 | 617 | |
| 618 | - global $frm_vars; |
|
| 618 | + global $frm_vars; |
|
| 619 | 619 | |
| 620 | - $form = FrmForm::getOne( $id ); |
|
| 620 | + $form = FrmForm::getOne( $id ); |
|
| 621 | 621 | |
| 622 | - $fields = FrmField::get_all_for_form($id); |
|
| 623 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 622 | + $fields = FrmField::get_all_for_form($id); |
|
| 623 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 624 | 624 | |
| 625 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 626 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 627 | - } |
|
| 625 | + if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 626 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 627 | + } |
|
| 628 | 628 | |
| 629 | - $action_controls = FrmFormActionsController::get_form_actions(); |
|
| 629 | + $action_controls = FrmFormActionsController::get_form_actions(); |
|
| 630 | 630 | |
| 631 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 632 | - $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
| 631 | + $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 632 | + $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
| 633 | 633 | |
| 634 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
| 634 | + $styles = apply_filters('frm_get_style_opts', array()); |
|
| 635 | 635 | |
| 636 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 637 | - } |
|
| 636 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | - public static function mb_tags_box( $form_id, $class = '' ) { |
|
| 640 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 641 | - $linked_forms = array(); |
|
| 642 | - $col = 'one'; |
|
| 643 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 639 | + public static function mb_tags_box( $form_id, $class = '' ) { |
|
| 640 | + $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 641 | + $linked_forms = array(); |
|
| 642 | + $col = 'one'; |
|
| 643 | + $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 644 | 644 | |
| 645 | 645 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
| 646 | 646 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $entry_shortcodes = self::get_shortcode_helpers( $settings_tab ); |
| 649 | 649 | |
| 650 | 650 | include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' ); |
| 651 | - } |
|
| 651 | + } |
|
| 652 | 652 | |
| 653 | 653 | /** |
| 654 | 654 | * Get an array of the options to display in the advanced tab |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | '' => '', |
| 690 | 690 | 'siteurl' => __( 'Site URL', 'formidable' ), |
| 691 | 691 | 'sitename' => __( 'Site Name', 'formidable' ), |
| 692 | - ); |
|
| 692 | + ); |
|
| 693 | 693 | |
| 694 | 694 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 695 | 695 | unset( $entry_shortcodes['post_id'] ); |
@@ -716,38 +716,38 @@ discard block |
||
| 716 | 716 | return $entry_shortcodes; |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - // Insert the form class setting into the form |
|
| 719 | + // Insert the form class setting into the form |
|
| 720 | 720 | public static function form_classes( $form ) { |
| 721 | - if ( isset($form->options['form_class']) ) { |
|
| 721 | + if ( isset($form->options['form_class']) ) { |
|
| 722 | 722 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
| 723 | - } |
|
| 724 | - } |
|
| 723 | + } |
|
| 724 | + } |
|
| 725 | 725 | |
| 726 | - public static function get_email_html() { |
|
| 727 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 726 | + public static function get_email_html() { |
|
| 727 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 728 | 728 | echo FrmEntryFormat::show_entry( array( |
| 729 | 729 | 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 730 | - 'default_email' => true, |
|
| 730 | + 'default_email' => true, |
|
| 731 | 731 | 'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ), |
| 732 | - ) ); |
|
| 733 | - wp_die(); |
|
| 732 | + ) ); |
|
| 733 | + wp_die(); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - public static function filter_content( $content, $form, $entry = false ) { |
|
| 736 | + public static function filter_content( $content, $form, $entry = false ) { |
|
| 737 | 737 | self::get_entry_by_param( $entry ); |
| 738 | - if ( ! $entry ) { |
|
| 739 | - return $content; |
|
| 740 | - } |
|
| 738 | + if ( ! $entry ) { |
|
| 739 | + return $content; |
|
| 740 | + } |
|
| 741 | 741 | |
| 742 | - if ( is_object( $form ) ) { |
|
| 743 | - $form = $form->id; |
|
| 744 | - } |
|
| 742 | + if ( is_object( $form ) ) { |
|
| 743 | + $form = $form->id; |
|
| 744 | + } |
|
| 745 | 745 | |
| 746 | - $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
| 747 | - $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
| 746 | + $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
| 747 | + $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
| 748 | 748 | |
| 749 | - return $content; |
|
| 750 | - } |
|
| 749 | + return $content; |
|
| 750 | + } |
|
| 751 | 751 | |
| 752 | 752 | private static function get_entry_by_param( &$entry ) { |
| 753 | 753 | if ( ! $entry || ! is_object( $entry ) ) { |
@@ -759,287 +759,287 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | - public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
| 763 | - return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
| 764 | - } |
|
| 762 | + public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
| 763 | + return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
| 764 | + } |
|
| 765 | 765 | |
| 766 | - public static function process_bulk_form_actions( $errors ) { |
|
| 767 | - if ( ! $_REQUEST ) { |
|
| 768 | - return $errors; |
|
| 769 | - } |
|
| 766 | + public static function process_bulk_form_actions( $errors ) { |
|
| 767 | + if ( ! $_REQUEST ) { |
|
| 768 | + return $errors; |
|
| 769 | + } |
|
| 770 | 770 | |
| 771 | 771 | $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
| 772 | - if ( $bulkaction == -1 ) { |
|
| 772 | + if ( $bulkaction == -1 ) { |
|
| 773 | 773 | $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 774 | - } |
|
| 775 | - |
|
| 776 | - if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
| 777 | - FrmAppHelper::remove_get_action(); |
|
| 778 | - |
|
| 779 | - $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
| 780 | - } |
|
| 781 | - |
|
| 782 | - $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
| 783 | - if ( empty( $ids ) ) { |
|
| 784 | - $errors[] = __( 'No forms were specified', 'formidable' ); |
|
| 785 | - return $errors; |
|
| 786 | - } |
|
| 787 | - |
|
| 788 | - $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 789 | - if ( $permission_error !== false ) { |
|
| 790 | - $errors[] = $permission_error; |
|
| 791 | - return $errors; |
|
| 792 | - } |
|
| 793 | - |
|
| 794 | - if ( ! is_array( $ids ) ) { |
|
| 795 | - $ids = explode( ',', $ids ); |
|
| 796 | - } |
|
| 797 | - |
|
| 798 | - switch ( $bulkaction ) { |
|
| 799 | - case 'delete': |
|
| 800 | - $message = self::bulk_destroy( $ids ); |
|
| 801 | - break; |
|
| 802 | - case 'trash': |
|
| 803 | - $message = self::bulk_trash( $ids ); |
|
| 804 | - break; |
|
| 805 | - case 'untrash': |
|
| 806 | - $message = self::bulk_untrash( $ids ); |
|
| 807 | - break; |
|
| 808 | - case 'create_template': |
|
| 809 | - $message = self::bulk_create_template( $ids ); |
|
| 810 | - break; |
|
| 811 | - } |
|
| 812 | - |
|
| 813 | - if ( isset( $message ) && ! empty( $message ) ) { |
|
| 774 | + } |
|
| 775 | + |
|
| 776 | + if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
| 777 | + FrmAppHelper::remove_get_action(); |
|
| 778 | + |
|
| 779 | + $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
| 780 | + } |
|
| 781 | + |
|
| 782 | + $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
| 783 | + if ( empty( $ids ) ) { |
|
| 784 | + $errors[] = __( 'No forms were specified', 'formidable' ); |
|
| 785 | + return $errors; |
|
| 786 | + } |
|
| 787 | + |
|
| 788 | + $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 789 | + if ( $permission_error !== false ) { |
|
| 790 | + $errors[] = $permission_error; |
|
| 791 | + return $errors; |
|
| 792 | + } |
|
| 793 | + |
|
| 794 | + if ( ! is_array( $ids ) ) { |
|
| 795 | + $ids = explode( ',', $ids ); |
|
| 796 | + } |
|
| 797 | + |
|
| 798 | + switch ( $bulkaction ) { |
|
| 799 | + case 'delete': |
|
| 800 | + $message = self::bulk_destroy( $ids ); |
|
| 801 | + break; |
|
| 802 | + case 'trash': |
|
| 803 | + $message = self::bulk_trash( $ids ); |
|
| 804 | + break; |
|
| 805 | + case 'untrash': |
|
| 806 | + $message = self::bulk_untrash( $ids ); |
|
| 807 | + break; |
|
| 808 | + case 'create_template': |
|
| 809 | + $message = self::bulk_create_template( $ids ); |
|
| 810 | + break; |
|
| 811 | + } |
|
| 812 | + |
|
| 813 | + if ( isset( $message ) && ! empty( $message ) ) { |
|
| 814 | 814 | echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>'; |
| 815 | - } |
|
| 815 | + } |
|
| 816 | 816 | |
| 817 | - return $errors; |
|
| 818 | - } |
|
| 817 | + return $errors; |
|
| 818 | + } |
|
| 819 | 819 | |
| 820 | - public static function add_default_templates( $path, $default = true, $template = true ) { |
|
| 821 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
| 820 | + public static function add_default_templates( $path, $default = true, $template = true ) { |
|
| 821 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
| 822 | 822 | |
| 823 | - $path = untrailingslashit(trim($path)); |
|
| 824 | - $templates = glob( $path .'/*.php' ); |
|
| 823 | + $path = untrailingslashit(trim($path)); |
|
| 824 | + $templates = glob( $path .'/*.php' ); |
|
| 825 | 825 | |
| 826 | 826 | for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
| 827 | - $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 827 | + $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 828 | 828 | $template_query = array( 'form_key' => $filename ); |
| 829 | - if ( $template ) { |
|
| 830 | - $template_query['is_template'] = 1; |
|
| 831 | - } |
|
| 832 | - if ( $default ) { |
|
| 833 | - $template_query['default_template'] = 1; |
|
| 834 | - } |
|
| 829 | + if ( $template ) { |
|
| 830 | + $template_query['is_template'] = 1; |
|
| 831 | + } |
|
| 832 | + if ( $default ) { |
|
| 833 | + $template_query['default_template'] = 1; |
|
| 834 | + } |
|
| 835 | 835 | $form = FrmForm::getAll( $template_query, '', 1 ); |
| 836 | 836 | |
| 837 | - $values = FrmFormsHelper::setup_new_vars(); |
|
| 838 | - $values['form_key'] = $filename; |
|
| 839 | - $values['is_template'] = $template; |
|
| 840 | - $values['status'] = 'published'; |
|
| 841 | - if ( $default ) { |
|
| 842 | - $values['default_template'] = 1; |
|
| 843 | - } |
|
| 844 | - |
|
| 845 | - include( $templates[ $i ] ); |
|
| 846 | - |
|
| 847 | - //get updated form |
|
| 848 | - if ( isset($form) && ! empty($form) ) { |
|
| 849 | - $old_id = $form->id; |
|
| 850 | - $form = FrmForm::getOne($form->id); |
|
| 851 | - } else { |
|
| 852 | - $old_id = false; |
|
| 837 | + $values = FrmFormsHelper::setup_new_vars(); |
|
| 838 | + $values['form_key'] = $filename; |
|
| 839 | + $values['is_template'] = $template; |
|
| 840 | + $values['status'] = 'published'; |
|
| 841 | + if ( $default ) { |
|
| 842 | + $values['default_template'] = 1; |
|
| 843 | + } |
|
| 844 | + |
|
| 845 | + include( $templates[ $i ] ); |
|
| 846 | + |
|
| 847 | + //get updated form |
|
| 848 | + if ( isset($form) && ! empty($form) ) { |
|
| 849 | + $old_id = $form->id; |
|
| 850 | + $form = FrmForm::getOne($form->id); |
|
| 851 | + } else { |
|
| 852 | + $old_id = false; |
|
| 853 | 853 | $form = FrmForm::getAll( $template_query, '', 1 ); |
| 854 | - } |
|
| 854 | + } |
|
| 855 | 855 | |
| 856 | - if ( $form ) { |
|
| 856 | + if ( $form ) { |
|
| 857 | 857 | do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) ); |
| 858 | - } |
|
| 859 | - } |
|
| 860 | - } |
|
| 858 | + } |
|
| 859 | + } |
|
| 860 | + } |
|
| 861 | 861 | |
| 862 | - public static function route() { |
|
| 863 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 864 | - $vars = array(); |
|
| 862 | + public static function route() { |
|
| 863 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 864 | + $vars = array(); |
|
| 865 | 865 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
| 866 | 866 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 867 | 867 | |
| 868 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 869 | - $json_vars = json_decode($json_vars, true); |
|
| 870 | - if ( empty($json_vars) ) { |
|
| 871 | - // json decoding failed so we should return an error message |
|
| 868 | + $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 869 | + $json_vars = json_decode($json_vars, true); |
|
| 870 | + if ( empty($json_vars) ) { |
|
| 871 | + // json decoding failed so we should return an error message |
|
| 872 | 872 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 873 | - if ( 'edit' == $action ) { |
|
| 874 | - $action = 'update'; |
|
| 875 | - } |
|
| 876 | - |
|
| 877 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 878 | - } else { |
|
| 879 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 880 | - $action = $vars[ $action ]; |
|
| 873 | + if ( 'edit' == $action ) { |
|
| 874 | + $action = 'update'; |
|
| 875 | + } |
|
| 876 | + |
|
| 877 | + add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 878 | + } else { |
|
| 879 | + $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 880 | + $action = $vars[ $action ]; |
|
| 881 | 881 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
| 882 | 882 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
| 883 | 883 | $_POST = array_merge( $_POST, $_REQUEST ); |
| 884 | - } |
|
| 885 | - } else { |
|
| 884 | + } |
|
| 885 | + } else { |
|
| 886 | 886 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 887 | - if ( isset( $_REQUEST['delete_all'] ) ) { |
|
| 888 | - // override the action for this page |
|
| 889 | - $action = 'delete_all'; |
|
| 890 | - } |
|
| 891 | - } |
|
| 887 | + if ( isset( $_REQUEST['delete_all'] ) ) { |
|
| 888 | + // override the action for this page |
|
| 889 | + $action = 'delete_all'; |
|
| 890 | + } |
|
| 891 | + } |
|
| 892 | 892 | |
| 893 | 893 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
| 894 | - FrmAppHelper::trigger_hook_load( 'form' ); |
|
| 895 | - |
|
| 896 | - switch ( $action ) { |
|
| 897 | - case 'new': |
|
| 898 | - return self::new_form($vars); |
|
| 899 | - case 'create': |
|
| 900 | - case 'edit': |
|
| 901 | - case 'update': |
|
| 902 | - case 'duplicate': |
|
| 903 | - case 'trash': |
|
| 904 | - case 'untrash': |
|
| 905 | - case 'destroy': |
|
| 906 | - case 'delete_all': |
|
| 907 | - case 'settings': |
|
| 908 | - case 'update_settings': |
|
| 894 | + FrmAppHelper::trigger_hook_load( 'form' ); |
|
| 895 | + |
|
| 896 | + switch ( $action ) { |
|
| 897 | + case 'new': |
|
| 898 | + return self::new_form($vars); |
|
| 899 | + case 'create': |
|
| 900 | + case 'edit': |
|
| 901 | + case 'update': |
|
| 902 | + case 'duplicate': |
|
| 903 | + case 'trash': |
|
| 904 | + case 'untrash': |
|
| 905 | + case 'destroy': |
|
| 906 | + case 'delete_all': |
|
| 907 | + case 'settings': |
|
| 908 | + case 'update_settings': |
|
| 909 | 909 | return self::$action( $vars ); |
| 910 | - default: |
|
| 911 | - do_action('frm_form_action_'. $action); |
|
| 912 | - if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 913 | - return; |
|
| 914 | - } |
|
| 910 | + default: |
|
| 911 | + do_action('frm_form_action_'. $action); |
|
| 912 | + if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 913 | + return; |
|
| 914 | + } |
|
| 915 | 915 | |
| 916 | 916 | $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
| 917 | - if ( $action == -1 ) { |
|
| 917 | + if ( $action == -1 ) { |
|
| 918 | 918 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 919 | - } |
|
| 919 | + } |
|
| 920 | 920 | |
| 921 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
| 922 | - FrmAppHelper::remove_get_action(); |
|
| 923 | - return self::list_form(); |
|
| 924 | - } |
|
| 921 | + if ( strpos($action, 'bulk_') === 0 ) { |
|
| 922 | + FrmAppHelper::remove_get_action(); |
|
| 923 | + return self::list_form(); |
|
| 924 | + } |
|
| 925 | 925 | |
| 926 | - return self::display_forms_list(); |
|
| 927 | - } |
|
| 928 | - } |
|
| 926 | + return self::display_forms_list(); |
|
| 927 | + } |
|
| 928 | + } |
|
| 929 | 929 | |
| 930 | - public static function json_error( $errors ) { |
|
| 931 | - $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
| 932 | - return $errors; |
|
| 933 | - } |
|
| 930 | + public static function json_error( $errors ) { |
|
| 931 | + $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
| 932 | + return $errors; |
|
| 933 | + } |
|
| 934 | 934 | |
| 935 | 935 | |
| 936 | - /* FRONT-END FORMS */ |
|
| 937 | - public static function admin_bar_css() { |
|
| 936 | + /* FRONT-END FORMS */ |
|
| 937 | + public static function admin_bar_css() { |
|
| 938 | 938 | if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
| 939 | - return; |
|
| 940 | - } |
|
| 939 | + return; |
|
| 940 | + } |
|
| 941 | 941 | |
| 942 | 942 | add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' ); |
| 943 | 943 | FrmAppHelper::load_font_style(); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | public static function admin_bar_configure() { |
| 947 | - global $frm_vars; |
|
| 948 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
| 949 | - return; |
|
| 950 | - } |
|
| 951 | - |
|
| 952 | - $actions = array(); |
|
| 953 | - foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
| 954 | - if ( is_object($form) ) { |
|
| 955 | - $actions[ $form->id ] = $form->name; |
|
| 956 | - } |
|
| 957 | - unset($form); |
|
| 958 | - } |
|
| 959 | - |
|
| 960 | - if ( empty($actions) ) { |
|
| 961 | - return; |
|
| 962 | - } |
|
| 963 | - |
|
| 964 | - asort($actions); |
|
| 965 | - |
|
| 966 | - global $wp_admin_bar; |
|
| 967 | - |
|
| 968 | - if ( count($actions) == 1 ) { |
|
| 969 | - $wp_admin_bar->add_menu( array( |
|
| 970 | - 'title' => 'Edit Form', |
|
| 971 | - 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 972 | - 'id' => 'frm-forms', |
|
| 973 | - ) ); |
|
| 974 | - } else { |
|
| 975 | - $wp_admin_bar->add_menu( array( |
|
| 976 | - 'id' => 'frm-forms', |
|
| 977 | - 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
| 978 | - 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 979 | - 'meta' => array( |
|
| 947 | + global $frm_vars; |
|
| 948 | + if ( empty($frm_vars['forms_loaded']) ) { |
|
| 949 | + return; |
|
| 950 | + } |
|
| 951 | + |
|
| 952 | + $actions = array(); |
|
| 953 | + foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
| 954 | + if ( is_object($form) ) { |
|
| 955 | + $actions[ $form->id ] = $form->name; |
|
| 956 | + } |
|
| 957 | + unset($form); |
|
| 958 | + } |
|
| 959 | + |
|
| 960 | + if ( empty($actions) ) { |
|
| 961 | + return; |
|
| 962 | + } |
|
| 963 | + |
|
| 964 | + asort($actions); |
|
| 965 | + |
|
| 966 | + global $wp_admin_bar; |
|
| 967 | + |
|
| 968 | + if ( count($actions) == 1 ) { |
|
| 969 | + $wp_admin_bar->add_menu( array( |
|
| 970 | + 'title' => 'Edit Form', |
|
| 971 | + 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 972 | + 'id' => 'frm-forms', |
|
| 973 | + ) ); |
|
| 974 | + } else { |
|
| 975 | + $wp_admin_bar->add_menu( array( |
|
| 976 | + 'id' => 'frm-forms', |
|
| 977 | + 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
| 978 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 979 | + 'meta' => array( |
|
| 980 | 980 | 'title' => __( 'Edit Forms', 'formidable' ), |
| 981 | - ), |
|
| 982 | - ) ); |
|
| 981 | + ), |
|
| 982 | + ) ); |
|
| 983 | 983 | |
| 984 | - foreach ( $actions as $form_id => $name ) { |
|
| 984 | + foreach ( $actions as $form_id => $name ) { |
|
| 985 | 985 | |
| 986 | - $wp_admin_bar->add_menu( array( |
|
| 987 | - 'parent' => 'frm-forms', |
|
| 988 | - 'id' => 'edit_form_'. $form_id, |
|
| 989 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 986 | + $wp_admin_bar->add_menu( array( |
|
| 987 | + 'parent' => 'frm-forms', |
|
| 988 | + 'id' => 'edit_form_'. $form_id, |
|
| 989 | + 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 990 | 990 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
| 991 | - ) ); |
|
| 992 | - } |
|
| 993 | - } |
|
| 994 | - } |
|
| 991 | + ) ); |
|
| 992 | + } |
|
| 993 | + } |
|
| 994 | + } |
|
| 995 | 995 | |
| 996 | - //formidable shortcode |
|
| 996 | + //formidable shortcode |
|
| 997 | 997 | public static function get_form_shortcode( $atts ) { |
| 998 | - global $frm_vars; |
|
| 999 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 1000 | - $sc = '[formidable'; |
|
| 998 | + global $frm_vars; |
|
| 999 | + if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 1000 | + $sc = '[formidable'; |
|
| 1001 | 1001 | if ( ! empty( $atts ) ) { |
| 1002 | 1002 | foreach ( $atts as $k => $v ) { |
| 1003 | 1003 | $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | - return $sc .']'; |
|
| 1007 | - } |
|
| 1008 | - |
|
| 1009 | - $shortcode_atts = shortcode_atts( array( |
|
| 1010 | - 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
| 1011 | - 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
| 1012 | - 'exclude_fields' => array(), 'minimize' => false, |
|
| 1013 | - ), $atts); |
|
| 1014 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1015 | - |
|
| 1016 | - return self::show_form( |
|
| 1017 | - $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
| 1018 | - $shortcode_atts['description'], $atts |
|
| 1019 | - ); |
|
| 1020 | - } |
|
| 1021 | - |
|
| 1022 | - public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
| 1023 | - if ( empty( $id ) ) { |
|
| 1024 | - $id = $key; |
|
| 1025 | - } |
|
| 1026 | - |
|
| 1027 | - // no form id or key set |
|
| 1028 | - if ( empty( $id ) ) { |
|
| 1029 | - return __( 'Please select a valid form', 'formidable' ); |
|
| 1030 | - } |
|
| 1031 | - |
|
| 1032 | - $form = FrmForm::getOne( $id ); |
|
| 1033 | - if ( ! $form || $form->parent_form_id ) { |
|
| 1034 | - return __( 'Please select a valid form', 'formidable' ); |
|
| 1035 | - } |
|
| 1006 | + return $sc .']'; |
|
| 1007 | + } |
|
| 1008 | + |
|
| 1009 | + $shortcode_atts = shortcode_atts( array( |
|
| 1010 | + 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
| 1011 | + 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
| 1012 | + 'exclude_fields' => array(), 'minimize' => false, |
|
| 1013 | + ), $atts); |
|
| 1014 | + do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1015 | + |
|
| 1016 | + return self::show_form( |
|
| 1017 | + $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
| 1018 | + $shortcode_atts['description'], $atts |
|
| 1019 | + ); |
|
| 1020 | + } |
|
| 1021 | + |
|
| 1022 | + public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
| 1023 | + if ( empty( $id ) ) { |
|
| 1024 | + $id = $key; |
|
| 1025 | + } |
|
| 1026 | + |
|
| 1027 | + // no form id or key set |
|
| 1028 | + if ( empty( $id ) ) { |
|
| 1029 | + return __( 'Please select a valid form', 'formidable' ); |
|
| 1030 | + } |
|
| 1031 | + |
|
| 1032 | + $form = FrmForm::getOne( $id ); |
|
| 1033 | + if ( ! $form || $form->parent_form_id ) { |
|
| 1034 | + return __( 'Please select a valid form', 'formidable' ); |
|
| 1035 | + } |
|
| 1036 | 1036 | |
| 1037 | 1037 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
| 1038 | - FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
| 1038 | + FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
| 1039 | 1039 | |
| 1040 | - $form = apply_filters( 'frm_pre_display_form', $form ); |
|
| 1040 | + $form = apply_filters( 'frm_pre_display_form', $form ); |
|
| 1041 | 1041 | |
| 1042 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 1042 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 1043 | 1043 | |
| 1044 | 1044 | if ( self::is_viewable_draft_form( $form ) ) { |
| 1045 | 1045 | // don't show a draft form on a page |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | return $form; |
| 1063 | - } |
|
| 1063 | + } |
|
| 1064 | 1064 | |
| 1065 | 1065 | private static function is_viewable_draft_form( $form ) { |
| 1066 | 1066 | global $post; |
@@ -1076,98 +1076,98 @@ discard block |
||
| 1076 | 1076 | return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] ); |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | - public static function get_form( $form, $title, $description, $atts = array() ) { |
|
| 1080 | - ob_start(); |
|
| 1079 | + public static function get_form( $form, $title, $description, $atts = array() ) { |
|
| 1080 | + ob_start(); |
|
| 1081 | 1081 | |
| 1082 | - self::get_form_contents( $form, $title, $description, $atts ); |
|
| 1082 | + self::get_form_contents( $form, $title, $description, $atts ); |
|
| 1083 | 1083 | self::enqueue_scripts( FrmForm::get_params( $form ) ); |
| 1084 | 1084 | |
| 1085 | - $contents = ob_get_contents(); |
|
| 1086 | - ob_end_clean(); |
|
| 1085 | + $contents = ob_get_contents(); |
|
| 1086 | + ob_end_clean(); |
|
| 1087 | 1087 | |
| 1088 | 1088 | self::maybe_minimize_form( $atts, $contents ); |
| 1089 | 1089 | |
| 1090 | - return $contents; |
|
| 1091 | - } |
|
| 1090 | + return $contents; |
|
| 1091 | + } |
|
| 1092 | 1092 | |
| 1093 | 1093 | public static function enqueue_scripts( $params ) { |
| 1094 | 1094 | do_action( 'frm_enqueue_form_scripts', $params ); |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | public static function get_form_contents( $form, $title, $description, $atts ) { |
| 1098 | - global $frm_vars; |
|
| 1098 | + global $frm_vars; |
|
| 1099 | 1099 | |
| 1100 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 1100 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 1101 | 1101 | |
| 1102 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1102 | + $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1103 | 1103 | |
| 1104 | - $user_ID = get_current_user_id(); |
|
| 1104 | + $user_ID = get_current_user_id(); |
|
| 1105 | 1105 | $params = FrmForm::get_params( $form ); |
| 1106 | - $message = $errors = ''; |
|
| 1106 | + $message = $errors = ''; |
|
| 1107 | 1107 | |
| 1108 | - if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
| 1109 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1110 | - } |
|
| 1108 | + if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
| 1109 | + $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1110 | + } |
|
| 1111 | 1111 | |
| 1112 | 1112 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 1113 | - $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
| 1114 | - |
|
| 1115 | - if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
| 1116 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1117 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1118 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1119 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1120 | - } |
|
| 1121 | - return; |
|
| 1122 | - } |
|
| 1123 | - |
|
| 1124 | - if ( ! empty($errors) ) { |
|
| 1125 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1126 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1127 | - return; |
|
| 1128 | - } |
|
| 1129 | - |
|
| 1130 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1131 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1132 | - return; |
|
| 1133 | - } |
|
| 1134 | - |
|
| 1135 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1136 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1137 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1138 | - |
|
| 1139 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1140 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1113 | + $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
| 1114 | + |
|
| 1115 | + if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
| 1116 | + do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1117 | + if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1118 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1119 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1120 | + } |
|
| 1121 | + return; |
|
| 1122 | + } |
|
| 1123 | + |
|
| 1124 | + if ( ! empty($errors) ) { |
|
| 1125 | + $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1126 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1127 | + return; |
|
| 1128 | + } |
|
| 1129 | + |
|
| 1130 | + do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1131 | + if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1132 | + return; |
|
| 1133 | + } |
|
| 1134 | + |
|
| 1135 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1136 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1137 | + $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1138 | + |
|
| 1139 | + if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1140 | + do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1141 | 1141 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1142 | - return; |
|
| 1143 | - } |
|
| 1142 | + return; |
|
| 1143 | + } |
|
| 1144 | 1144 | |
| 1145 | - if ( $created && is_numeric($created) ) { |
|
| 1146 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1147 | - $class = 'frm_message'; |
|
| 1148 | - } else { |
|
| 1149 | - $message = $frm_settings->failed_msg; |
|
| 1150 | - $class = 'frm_error_style'; |
|
| 1151 | - } |
|
| 1145 | + if ( $created && is_numeric($created) ) { |
|
| 1146 | + $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1147 | + $class = 'frm_message'; |
|
| 1148 | + } else { |
|
| 1149 | + $message = $frm_settings->failed_msg; |
|
| 1150 | + $class = 'frm_error_style'; |
|
| 1151 | + } |
|
| 1152 | 1152 | |
| 1153 | 1153 | $message = FrmFormsHelper::get_success_message( array( |
| 1154 | 1154 | 'message' => $message, 'form' => $form, |
| 1155 | 1155 | 'entry_id' => $created, 'class' => $class, |
| 1156 | 1156 | ) ); |
| 1157 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1157 | + $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1158 | 1158 | |
| 1159 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1160 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1161 | - } else { |
|
| 1162 | - global $frm_vars; |
|
| 1159 | + if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1160 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1161 | + } else { |
|
| 1162 | + global $frm_vars; |
|
| 1163 | 1163 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 1164 | 1164 | |
| 1165 | - $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1166 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1167 | - } |
|
| 1165 | + $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1166 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1167 | + } |
|
| 1168 | 1168 | |
| 1169 | 1169 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1170 | - } |
|
| 1170 | + } |
|
| 1171 | 1171 | |
| 1172 | 1172 | public static function front_head() { |
| 1173 | 1173 | $version = FrmAppHelper::plugin_version(); |
@@ -3,16 +3,16 @@ discard block |
||
| 3 | 3 | class FrmFormsController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Forms', 'formidable' ), __( 'Forms', 'formidable' ), 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 7 | 7 | |
| 8 | - add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 8 | + add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 9 | 9 | |
| 10 | - add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 11 | - add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
| 10 | + add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 11 | + add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public static function head() { |
| 15 | - wp_enqueue_script('formidable-editinplace'); |
|
| 15 | + wp_enqueue_script( 'formidable-editinplace' ); |
|
| 16 | 16 | |
| 17 | 17 | if ( wp_is_mobile() ) { |
| 18 | 18 | wp_enqueue_script( 'jquery-touch-punch' ); |
@@ -20,49 +20,49 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public static function register_widgets() { |
| 23 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 24 | - register_widget('FrmShowForm'); |
|
| 23 | + require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' ); |
|
| 24 | + register_widget( 'FrmShowForm' ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public static function list_form() { |
| 28 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
| 28 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 29 | 29 | |
| 30 | 30 | $params = FrmForm::list_page_params(); |
| 31 | - $errors = self::process_bulk_form_actions( array()); |
|
| 32 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 31 | + $errors = self::process_bulk_form_actions( array() ); |
|
| 32 | + $errors = apply_filters( 'frm_admin_list_form_action', $errors ); |
|
| 33 | 33 | |
| 34 | 34 | return self::display_forms_list( $params, '', $errors ); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public static function new_form( $values = array() ) { |
| 38 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 38 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 39 | 39 | |
| 40 | 40 | global $frm_vars; |
| 41 | 41 | |
| 42 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 43 | - $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
|
| 42 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 43 | + $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action]; |
|
| 44 | 44 | |
| 45 | 45 | if ( $action == 'create' ) { |
| 46 | - return self::create($values); |
|
| 46 | + return self::create( $values ); |
|
| 47 | 47 | } else if ( $action == 'new' ) { |
| 48 | 48 | $frm_field_selection = FrmField::field_selection(); |
| 49 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
| 49 | + $values = FrmFormsHelper::setup_new_vars( $values ); |
|
| 50 | 50 | $id = FrmForm::create( $values ); |
| 51 | - $form = FrmForm::getOne($id); |
|
| 51 | + $form = FrmForm::getOne( $id ); |
|
| 52 | 52 | |
| 53 | 53 | // add default email notification |
| 54 | 54 | $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
| 55 | - $action_control->create($form->id); |
|
| 55 | + $action_control->create( $form->id ); |
|
| 56 | 56 | |
| 57 | 57 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 58 | 58 | |
| 59 | 59 | $values['id'] = $id; |
| 60 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 60 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public static function create( $values = array() ) { |
| 65 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 65 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 66 | 66 | |
| 67 | 67 | global $frm_vars; |
| 68 | 68 | if ( empty( $values ) ) { |
@@ -74,58 +74,58 @@ discard block |
||
| 74 | 74 | $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
| 77 | + $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
| 78 | 78 | |
| 79 | 79 | if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
| 80 | 80 | $frm_settings = FrmAppHelper::get_settings(); |
| 81 | 81 | $errors = array( 'form' => $frm_settings->admin_permission ); |
| 82 | 82 | } else { |
| 83 | - $errors = FrmForm::validate($values); |
|
| 83 | + $errors = FrmForm::validate( $values ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( count($errors) > 0 ) { |
|
| 86 | + if ( count( $errors ) > 0 ) { |
|
| 87 | 87 | $hide_preview = true; |
| 88 | 88 | $frm_field_selection = FrmField::field_selection(); |
| 89 | 89 | $form = FrmForm::getOne( $id ); |
| 90 | - $fields = FrmField::get_all_for_form($id); |
|
| 90 | + $fields = FrmField::get_all_for_form( $id ); |
|
| 91 | 91 | |
| 92 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 92 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 93 | 93 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 94 | 94 | |
| 95 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 95 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 96 | 96 | } else { |
| 97 | 97 | FrmForm::update( $id, $values, true ); |
| 98 | - die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 98 | + die( FrmAppHelper::js_redirect( admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ) ) ); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | public static function edit( $values = false ) { |
| 103 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 103 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 104 | 104 | |
| 105 | 105 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 106 | - return self::get_edit_vars($id); |
|
| 106 | + return self::get_edit_vars( $id ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public static function settings( $id = false, $message = '' ) { |
| 110 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 110 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 111 | 111 | |
| 112 | - if ( ! $id || ! is_numeric($id) ) { |
|
| 112 | + if ( ! $id || ! is_numeric( $id ) ) { |
|
| 113 | 113 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 114 | 114 | } |
| 115 | 115 | return self::get_settings_vars( $id, array(), $message ); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public static function update_settings() { |
| 119 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 119 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 120 | 120 | |
| 121 | 121 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 122 | 122 | |
| 123 | - $errors = FrmForm::validate($_POST); |
|
| 124 | - if ( count($errors) > 0 ) { |
|
| 125 | - return self::get_settings_vars($id, $errors); |
|
| 123 | + $errors = FrmForm::validate( $_POST ); |
|
| 124 | + if ( count( $errors ) > 0 ) { |
|
| 125 | + return self::get_settings_vars( $id, $errors ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - do_action('frm_before_update_form_settings', $id); |
|
| 128 | + do_action( 'frm_before_update_form_settings', $id ); |
|
| 129 | 129 | |
| 130 | 130 | FrmForm::update( $id, $_POST ); |
| 131 | 131 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | private static function edit_in_place_value( $field ) { |
| 149 | 149 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 150 | - FrmAppHelper::permission_check('frm_edit_forms', 'hide'); |
|
| 150 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 151 | 151 | |
| 152 | 152 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 153 | 153 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' ); |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | public static function duplicate() { |
| 222 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 222 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 223 | 223 | |
| 224 | 224 | $params = FrmForm::list_page_params(); |
| 225 | 225 | $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
| 226 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 226 | + $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 227 | 227 | if ( $form ) { |
| 228 | 228 | return self::get_edit_vars( $form, array(), $message, true ); |
| 229 | 229 | } else { |
| 230 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 230 | + return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) ); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
| 254 | 254 | global $wp; |
| 255 | 255 | $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
| 256 | - include_once( $root.'/wp-config.php' ); |
|
| 256 | + include_once( $root . '/wp-config.php' ); |
|
| 257 | 257 | $wp->init(); |
| 258 | 258 | $wp->register_globals(); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | self::register_pro_scripts(); |
| 262 | 262 | |
| 263 | - header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) ); |
|
| 263 | + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
| 264 | 264 | |
| 265 | 265 | $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' ); |
| 266 | 266 | if ( $key == '' ) { |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $form = FrmForm::getAll( array(), '', 1 ); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 275 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' ); |
|
| 276 | 276 | wp_die(); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | if ( FrmAppHelper::pro_is_installed() ) { |
| 281 | 281 | wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true ); |
| 282 | 282 | wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true ); |
| 283 | - wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true ); |
|
| 283 | + wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true ); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | public static function bulk_untrash( $ids ) { |
| 292 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 292 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 293 | 293 | |
| 294 | 294 | $count = FrmForm::set_status( $ids, 'published' ); |
| 295 | 295 | |
| 296 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 296 | + $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 297 | 297 | return $message; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -312,90 +312,90 @@ discard block |
||
| 312 | 312 | 'trash' => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ), |
| 313 | 313 | ); |
| 314 | 314 | |
| 315 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 315 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 316 | 316 | return; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 319 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 320 | 320 | |
| 321 | 321 | $params = FrmForm::list_page_params(); |
| 322 | 322 | |
| 323 | 323 | //check nonce url |
| 324 | - check_admin_referer($status .'_form_' . $params['id']); |
|
| 324 | + check_admin_referer( $status . '_form_' . $params['id'] ); |
|
| 325 | 325 | |
| 326 | 326 | $count = 0; |
| 327 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 328 | - $count++; |
|
| 327 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 328 | + $count ++; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
| 332 | - $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type='. ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); |
|
| 331 | + $available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
| 332 | + $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); |
|
| 333 | 333 | |
| 334 | - $message = $available_status[ $status ]['message']; |
|
| 334 | + $message = $available_status[$status]['message']; |
|
| 335 | 335 | |
| 336 | 336 | self::display_forms_list( $params, $message ); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | public static function bulk_trash( $ids ) { |
| 340 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 340 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 341 | 341 | |
| 342 | 342 | $count = 0; |
| 343 | 343 | foreach ( $ids as $id ) { |
| 344 | 344 | if ( FrmForm::trash( $id ) ) { |
| 345 | - $count++; |
|
| 345 | + $count ++; |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
| 350 | - $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' ); |
|
| 350 | + $message = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type=' . $current_page . '&item-action[]=' . implode( 'item-action[]=', $ids ), 'bulk-toplevel_page_formidable' ) ) . '">', '</a>' ); |
|
| 351 | 351 | |
| 352 | 352 | return $message; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | public static function destroy() { |
| 356 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 356 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 357 | 357 | |
| 358 | 358 | $params = FrmForm::list_page_params(); |
| 359 | 359 | |
| 360 | 360 | //check nonce url |
| 361 | - check_admin_referer('destroy_form_' . $params['id']); |
|
| 361 | + check_admin_referer( 'destroy_form_' . $params['id'] ); |
|
| 362 | 362 | |
| 363 | 363 | $count = 0; |
| 364 | 364 | if ( FrmForm::destroy( $params['id'] ) ) { |
| 365 | - $count++; |
|
| 365 | + $count ++; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 368 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 369 | 369 | |
| 370 | 370 | self::display_forms_list( $params, $message ); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | public static function bulk_destroy( $ids ) { |
| 374 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 374 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 375 | 375 | |
| 376 | 376 | $count = 0; |
| 377 | 377 | foreach ( $ids as $id ) { |
| 378 | 378 | $d = FrmForm::destroy( $id ); |
| 379 | 379 | if ( $d ) { |
| 380 | - $count++; |
|
| 380 | + $count ++; |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 384 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 385 | 385 | |
| 386 | 386 | return $message; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | private static function delete_all() { |
| 390 | 390 | //check nonce url |
| 391 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 391 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 392 | 392 | if ( $permission_error !== false ) { |
| 393 | 393 | self::display_forms_list( array(), '', array( $permission_error ) ); |
| 394 | 394 | return; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $count = FrmForm::scheduled_delete( time() ); |
| 398 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 398 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 399 | 399 | |
| 400 | 400 | self::display_forms_list( array(), $message ); |
| 401 | 401 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @since 2.0.15 |
| 413 | 413 | */ |
| 414 | 414 | public static function insert_form_button() { |
| 415 | - if ( current_user_can('frm_view_forms') ) { |
|
| 415 | + if ( current_user_can( 'frm_view_forms' ) ) { |
|
| 416 | 416 | $content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> Formidable</a>'; |
| 417 | 417 | echo wp_kses_post( $content ); |
| 418 | 418 | } |
@@ -430,21 +430,21 @@ discard block |
||
| 430 | 430 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
| 431 | 431 | ); |
| 432 | 432 | |
| 433 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 433 | + $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes ); |
|
| 434 | 434 | |
| 435 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 435 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' ); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | public static function get_shortcode_opts() { |
| 439 | 439 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 440 | 440 | |
| 441 | 441 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
| 442 | - if ( empty($shortcode) ) { |
|
| 442 | + if ( empty( $shortcode ) ) { |
|
| 443 | 443 | wp_die(); |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 447 | - echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 446 | + echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">'; |
|
| 447 | + echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />'; |
|
| 448 | 448 | |
| 449 | 449 | $form_id = ''; |
| 450 | 450 | $opts = array(); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | ); |
| 460 | 460 | break; |
| 461 | 461 | } |
| 462 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 462 | + $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode ); |
|
| 463 | 463 | |
| 464 | 464 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
| 465 | 465 | // allow other shortcodes to use the required form id option |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | unset( $opts['form_id'] ); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 470 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' ); |
|
| 471 | 471 | |
| 472 | 472 | echo '</div>'; |
| 473 | 473 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | die(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 502 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | public static function get_columns( $columns ) { |
@@ -576,11 +576,11 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | if ( $form->parent_form_id ) { |
| 579 | - wp_die( sprintf(__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url(admin_url('admin.php') .'?page=formidable&frm_action=edit&id='. $form->parent_form_id) .'">', '</a>' )); |
|
| 579 | + wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php' ) . '?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) . '">', '</a>' ) ); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $frm_field_selection = FrmField::field_selection(); |
| 583 | - $fields = FrmField::get_all_for_form($form->id); |
|
| 583 | + $fields = FrmField::get_all_for_form( $form->id ); |
|
| 584 | 584 | |
| 585 | 585 | // Automatically add end section fields if they don't exist (2.0 migration) |
| 586 | 586 | $reset_fields = false; |
@@ -590,9 +590,9 @@ discard block |
||
| 590 | 590 | $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 593 | + unset( $end_section_values, $last_order, $open, $reset_fields ); |
|
| 594 | 594 | |
| 595 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 595 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 596 | 596 | |
| 597 | 597 | $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
| 598 | 598 | if ( $form->is_template && $message == $edit_message ) { |
@@ -602,13 +602,13 @@ discard block |
||
| 602 | 602 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 603 | 603 | |
| 604 | 604 | if ( $form->default_template ) { |
| 605 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 606 | - } else if ( defined('DOING_AJAX') ) { |
|
| 605 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
| 606 | + } else if ( defined( 'DOING_AJAX' ) ) { |
|
| 607 | 607 | wp_die(); |
| 608 | 608 | } else if ( $create_link ) { |
| 609 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 609 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 610 | 610 | } else { |
| 611 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 611 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' ); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
@@ -619,28 +619,28 @@ discard block |
||
| 619 | 619 | |
| 620 | 620 | $form = FrmForm::getOne( $id ); |
| 621 | 621 | |
| 622 | - $fields = FrmField::get_all_for_form($id); |
|
| 623 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 622 | + $fields = FrmField::get_all_for_form( $id ); |
|
| 623 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 624 | 624 | |
| 625 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 626 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 625 | + if ( isset( $values['default_template'] ) && $values['default_template'] ) { |
|
| 626 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | $action_controls = FrmFormActionsController::get_form_actions(); |
| 630 | 630 | |
| 631 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 631 | + $sections = apply_filters( 'frm_add_form_settings_section', array(), $values ); |
|
| 632 | 632 | $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
| 633 | 633 | |
| 634 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
| 634 | + $styles = apply_filters( 'frm_get_style_opts', array() ); |
|
| 635 | 635 | |
| 636 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 636 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' ); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | public static function mb_tags_box( $form_id, $class = '' ) { |
| 640 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 640 | + $fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
| 641 | 641 | $linked_forms = array(); |
| 642 | 642 | $col = 'one'; |
| 643 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 643 | + $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false; |
|
| 644 | 644 | |
| 645 | 645 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
| 646 | 646 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | // Insert the form class setting into the form |
| 720 | 720 | public static function form_classes( $form ) { |
| 721 | - if ( isset($form->options['form_class']) ) { |
|
| 721 | + if ( isset( $form->options['form_class'] ) ) { |
|
| 722 | 722 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
| 723 | 723 | } |
| 724 | 724 | } |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | public static function add_default_templates( $path, $default = true, $template = true ) { |
| 821 | 821 | _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
| 822 | 822 | |
| 823 | - $path = untrailingslashit(trim($path)); |
|
| 824 | - $templates = glob( $path .'/*.php' ); |
|
| 823 | + $path = untrailingslashit( trim( $path ) ); |
|
| 824 | + $templates = glob( $path . '/*.php' ); |
|
| 825 | 825 | |
| 826 | - for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
|
| 827 | - $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 826 | + for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) { |
|
| 827 | + $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) ); |
|
| 828 | 828 | $template_query = array( 'form_key' => $filename ); |
| 829 | 829 | if ( $template ) { |
| 830 | 830 | $template_query['is_template'] = 1; |
@@ -842,12 +842,12 @@ discard block |
||
| 842 | 842 | $values['default_template'] = 1; |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - include( $templates[ $i ] ); |
|
| 845 | + include( $templates[$i] ); |
|
| 846 | 846 | |
| 847 | 847 | //get updated form |
| 848 | - if ( isset($form) && ! empty($form) ) { |
|
| 848 | + if ( isset( $form ) && ! empty( $form ) ) { |
|
| 849 | 849 | $old_id = $form->id; |
| 850 | - $form = FrmForm::getOne($form->id); |
|
| 850 | + $form = FrmForm::getOne( $form->id ); |
|
| 851 | 851 | } else { |
| 852 | 852 | $old_id = false; |
| 853 | 853 | $form = FrmForm::getAll( $template_query, '', 1 ); |
@@ -860,24 +860,24 @@ discard block |
||
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | public static function route() { |
| 863 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 863 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 864 | 864 | $vars = array(); |
| 865 | 865 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
| 866 | 866 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 867 | 867 | |
| 868 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 869 | - $json_vars = json_decode($json_vars, true); |
|
| 870 | - if ( empty($json_vars) ) { |
|
| 868 | + $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '"', '\\\"', $_POST['frm_compact_fields'] ) ) ) ); |
|
| 869 | + $json_vars = json_decode( $json_vars, true ); |
|
| 870 | + if ( empty( $json_vars ) ) { |
|
| 871 | 871 | // json decoding failed so we should return an error message |
| 872 | 872 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 873 | 873 | if ( 'edit' == $action ) { |
| 874 | 874 | $action = 'update'; |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 877 | + add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
|
| 878 | 878 | } else { |
| 879 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 880 | - $action = $vars[ $action ]; |
|
| 879 | + $vars = FrmAppHelper::json_to_array( $json_vars ); |
|
| 880 | + $action = $vars[$action]; |
|
| 881 | 881 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
| 882 | 882 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
| 883 | 883 | $_POST = array_merge( $_POST, $_REQUEST ); |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | switch ( $action ) { |
| 897 | 897 | case 'new': |
| 898 | - return self::new_form($vars); |
|
| 898 | + return self::new_form( $vars ); |
|
| 899 | 899 | case 'create': |
| 900 | 900 | case 'edit': |
| 901 | 901 | case 'update': |
@@ -908,8 +908,8 @@ discard block |
||
| 908 | 908 | case 'update_settings': |
| 909 | 909 | return self::$action( $vars ); |
| 910 | 910 | default: |
| 911 | - do_action('frm_form_action_'. $action); |
|
| 912 | - if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 911 | + do_action( 'frm_form_action_' . $action ); |
|
| 912 | + if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) { |
|
| 913 | 913 | return; |
| 914 | 914 | } |
| 915 | 915 | |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
| 921 | + if ( strpos( $action, 'bulk_' ) === 0 ) { |
|
| 922 | 922 | FrmAppHelper::remove_get_action(); |
| 923 | 923 | return self::list_form(); |
| 924 | 924 | } |
@@ -945,37 +945,37 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | public static function admin_bar_configure() { |
| 947 | 947 | global $frm_vars; |
| 948 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
| 948 | + if ( empty( $frm_vars['forms_loaded'] ) ) { |
|
| 949 | 949 | return; |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | $actions = array(); |
| 953 | 953 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 954 | - if ( is_object($form) ) { |
|
| 955 | - $actions[ $form->id ] = $form->name; |
|
| 954 | + if ( is_object( $form ) ) { |
|
| 955 | + $actions[$form->id] = $form->name; |
|
| 956 | 956 | } |
| 957 | - unset($form); |
|
| 957 | + unset( $form ); |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | - if ( empty($actions) ) { |
|
| 960 | + if ( empty( $actions ) ) { |
|
| 961 | 961 | return; |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | - asort($actions); |
|
| 964 | + asort( $actions ); |
|
| 965 | 965 | |
| 966 | 966 | global $wp_admin_bar; |
| 967 | 967 | |
| 968 | - if ( count($actions) == 1 ) { |
|
| 968 | + if ( count( $actions ) == 1 ) { |
|
| 969 | 969 | $wp_admin_bar->add_menu( array( |
| 970 | 970 | 'title' => 'Edit Form', |
| 971 | - 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 971 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
|
| 972 | 972 | 'id' => 'frm-forms', |
| 973 | 973 | ) ); |
| 974 | 974 | } else { |
| 975 | 975 | $wp_admin_bar->add_menu( array( |
| 976 | 976 | 'id' => 'frm-forms', |
| 977 | 977 | 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
| 978 | - 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 978 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
|
| 979 | 979 | 'meta' => array( |
| 980 | 980 | 'title' => __( 'Edit Forms', 'formidable' ), |
| 981 | 981 | ), |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | |
| 986 | 986 | $wp_admin_bar->add_menu( array( |
| 987 | 987 | 'parent' => 'frm-forms', |
| 988 | - 'id' => 'edit_form_'. $form_id, |
|
| 989 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 988 | + 'id' => 'edit_form_' . $form_id, |
|
| 989 | + 'title' => empty( $name ) ? __( '(no title)' ) : $name, |
|
| 990 | 990 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
| 991 | 991 | ) ); |
| 992 | 992 | } |
@@ -996,22 +996,22 @@ discard block |
||
| 996 | 996 | //formidable shortcode |
| 997 | 997 | public static function get_form_shortcode( $atts ) { |
| 998 | 998 | global $frm_vars; |
| 999 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 999 | + if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) { |
|
| 1000 | 1000 | $sc = '[formidable'; |
| 1001 | 1001 | if ( ! empty( $atts ) ) { |
| 1002 | 1002 | foreach ( $atts as $k => $v ) { |
| 1003 | 1003 | $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | - return $sc .']'; |
|
| 1006 | + return $sc . ']'; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | $shortcode_atts = shortcode_atts( array( |
| 1010 | 1010 | 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
| 1011 | 1011 | 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
| 1012 | 1012 | 'exclude_fields' => array(), 'minimize' => false, |
| 1013 | - ), $atts); |
|
| 1014 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1013 | + ), $atts ); |
|
| 1014 | + do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts ); |
|
| 1015 | 1015 | |
| 1016 | 1016 | return self::show_form( |
| 1017 | 1017 | $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
@@ -1099,51 +1099,51 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | $frm_settings = FrmAppHelper::get_settings(); |
| 1101 | 1101 | |
| 1102 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1102 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1103 | 1103 | |
| 1104 | 1104 | $user_ID = get_current_user_id(); |
| 1105 | 1105 | $params = FrmForm::get_params( $form ); |
| 1106 | 1106 | $message = $errors = ''; |
| 1107 | 1107 | |
| 1108 | 1108 | if ( $params['posted_form_id'] == $form->id && $_POST ) { |
| 1109 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1109 | + $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array(); |
|
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 1113 | 1113 | $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
| 1114 | 1114 | |
| 1115 | 1115 | if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
| 1116 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1117 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1118 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1119 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1116 | + do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description ); |
|
| 1117 | + if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) { |
|
| 1118 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form ); |
|
| 1119 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1120 | 1120 | } |
| 1121 | 1121 | return; |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | - if ( ! empty($errors) ) { |
|
| 1125 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1126 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1124 | + if ( ! empty( $errors ) ) { |
|
| 1125 | + $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array(); |
|
| 1126 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1127 | 1127 | return; |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1131 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1130 | + do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description ); |
|
| 1131 | + if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) { |
|
| 1132 | 1132 | return; |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1136 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1137 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1135 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true ); |
|
| 1136 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0; |
|
| 1137 | + $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' ); |
|
| 1138 | 1138 | |
| 1139 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1140 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1139 | + if ( $created && is_numeric( $created ) && $conf_method != 'message' ) { |
|
| 1140 | + do_action( 'frm_success_action', $conf_method, $form, $form->options, $created ); |
|
| 1141 | 1141 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1142 | 1142 | return; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - if ( $created && is_numeric($created) ) { |
|
| 1146 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1145 | + if ( $created && is_numeric( $created ) ) { |
|
| 1146 | + $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1147 | 1147 | $class = 'frm_message'; |
| 1148 | 1148 | } else { |
| 1149 | 1149 | $message = $frm_settings->failed_msg; |
@@ -1154,16 +1154,16 @@ discard block |
||
| 1154 | 1154 | 'message' => $message, 'form' => $form, |
| 1155 | 1155 | 'entry_id' => $created, 'class' => $class, |
| 1156 | 1156 | ) ); |
| 1157 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1157 | + $message = apply_filters( 'frm_main_feedback', $message, $form, $created ); |
|
| 1158 | 1158 | |
| 1159 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1160 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1159 | + if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) { |
|
| 1160 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1161 | 1161 | } else { |
| 1162 | 1162 | global $frm_vars; |
| 1163 | 1163 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 1164 | 1164 | |
| 1165 | - $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1166 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1165 | + $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values ); |
|
| 1166 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' ); |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
@@ -7,71 +7,71 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
| 9 | 9 | |
| 10 | - if ( strpos($type, '|') ) { |
|
| 11 | - list($type, $setting) = explode('|', $type); |
|
| 12 | - } |
|
| 13 | - |
|
| 14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 16 | - |
|
| 17 | - $values = array(); |
|
| 18 | - |
|
| 19 | - foreach ( $defaults as $var => $default ) { |
|
| 20 | - if ( $var == 'field_options' ) { |
|
| 21 | - $values['field_options'] = array(); |
|
| 22 | - foreach ( $default as $opt_var => $opt_default ) { |
|
| 23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | - unset($opt_var, $opt_default); |
|
| 25 | - } |
|
| 26 | - } else { |
|
| 27 | - $values[ $var ] = $default; |
|
| 28 | - } |
|
| 29 | - unset($var, $default); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - if ( isset( $setting ) && ! empty( $setting ) ) { |
|
| 33 | - if ( 'data' == $type ) { |
|
| 34 | - $values['field_options']['data_type'] = $setting; |
|
| 35 | - } else { |
|
| 36 | - $values['field_options'][ $setting ] = 1; |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - if ( $type == 'radio' || $type == 'checkbox' ) { |
|
| 41 | - $values['options'] = serialize( array( |
|
| 42 | - __( 'Option 1', 'formidable' ), |
|
| 43 | - __( 'Option 2', 'formidable' ), |
|
| 44 | - ) ); |
|
| 45 | - } else if ( $type == 'select' ) { |
|
| 46 | - $values['options'] = serialize( array( |
|
| 47 | - '', __( 'Option 1', 'formidable' ), |
|
| 48 | - ) ); |
|
| 49 | - } else if ( $type == 'textarea' ) { |
|
| 50 | - $values['field_options']['max'] = '5'; |
|
| 51 | - } else if ( $type == 'captcha' ) { |
|
| 52 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 53 | - $values['invalid'] = $frm_settings->re_msg; |
|
| 54 | - } else if ( 'url' == $type ) { |
|
| 55 | - $values['name'] = __( 'Website', 'formidable' ); |
|
| 56 | - } |
|
| 10 | + if ( strpos($type, '|') ) { |
|
| 11 | + list($type, $setting) = explode('|', $type); |
|
| 12 | + } |
|
| 13 | + |
|
| 14 | + $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | + $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 16 | + |
|
| 17 | + $values = array(); |
|
| 18 | + |
|
| 19 | + foreach ( $defaults as $var => $default ) { |
|
| 20 | + if ( $var == 'field_options' ) { |
|
| 21 | + $values['field_options'] = array(); |
|
| 22 | + foreach ( $default as $opt_var => $opt_default ) { |
|
| 23 | + $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | + unset($opt_var, $opt_default); |
|
| 25 | + } |
|
| 26 | + } else { |
|
| 27 | + $values[ $var ] = $default; |
|
| 28 | + } |
|
| 29 | + unset($var, $default); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + if ( isset( $setting ) && ! empty( $setting ) ) { |
|
| 33 | + if ( 'data' == $type ) { |
|
| 34 | + $values['field_options']['data_type'] = $setting; |
|
| 35 | + } else { |
|
| 36 | + $values['field_options'][ $setting ] = 1; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + if ( $type == 'radio' || $type == 'checkbox' ) { |
|
| 41 | + $values['options'] = serialize( array( |
|
| 42 | + __( 'Option 1', 'formidable' ), |
|
| 43 | + __( 'Option 2', 'formidable' ), |
|
| 44 | + ) ); |
|
| 45 | + } else if ( $type == 'select' ) { |
|
| 46 | + $values['options'] = serialize( array( |
|
| 47 | + '', __( 'Option 1', 'formidable' ), |
|
| 48 | + ) ); |
|
| 49 | + } else if ( $type == 'textarea' ) { |
|
| 50 | + $values['field_options']['max'] = '5'; |
|
| 51 | + } else if ( $type == 'captcha' ) { |
|
| 52 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 53 | + $values['invalid'] = $frm_settings->re_msg; |
|
| 54 | + } else if ( 'url' == $type ) { |
|
| 55 | + $values['name'] = __( 'Website', 'formidable' ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | $fields = FrmField::field_selection(); |
| 59 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 59 | + $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 60 | 60 | |
| 61 | - if ( isset( $fields[ $type ] ) ) { |
|
| 62 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 63 | - } |
|
| 61 | + if ( isset( $fields[ $type ] ) ) { |
|
| 62 | + $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - unset($fields); |
|
| 65 | + unset($fields); |
|
| 66 | 66 | |
| 67 | - return $values; |
|
| 68 | - } |
|
| 67 | + return $values; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | public static function get_html_id( $field, $plus = '' ) { |
| 71 | - return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field); |
|
| 72 | - } |
|
| 71 | + return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public static function setup_edit_vars( $record, $doing_ajax = false ) { |
|
| 74 | + public static function setup_edit_vars( $record, $doing_ajax = false ) { |
|
| 75 | 75 | $values = array( 'id' => $record->id, 'form_id' => $record->form_id ); |
| 76 | 76 | $defaults = array( |
| 77 | 77 | 'name' => $record->name, |
@@ -84,86 +84,86 @@ discard block |
||
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | if ( $doing_ajax ) { |
| 87 | - $values = $values + $defaults; |
|
| 88 | - $values['form_name'] = ''; |
|
| 87 | + $values = $values + $defaults; |
|
| 88 | + $values['form_name'] = ''; |
|
| 89 | 89 | } else { |
| 90 | 90 | foreach ( $defaults as $var => $default ) { |
| 91 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 92 | - unset($var, $default); |
|
| 93 | - } |
|
| 91 | + $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 92 | + unset($var, $default); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | unset( $defaults ); |
| 99 | 99 | |
| 100 | - $values['options'] = $record->options; |
|
| 101 | - $values['field_options'] = $record->field_options; |
|
| 100 | + $values['options'] = $record->options; |
|
| 101 | + $values['field_options'] = $record->field_options; |
|
| 102 | 102 | |
| 103 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 103 | + $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 104 | 104 | |
| 105 | 105 | if ( $values['type'] == 'captcha' ) { |
| 106 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 107 | - $defaults['invalid'] = $frm_settings->re_msg; |
|
| 108 | - } |
|
| 106 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 107 | + $defaults['invalid'] = $frm_settings->re_msg; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | foreach ( $defaults as $opt => $default ) { |
| 111 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 112 | - unset($opt, $default); |
|
| 113 | - } |
|
| 111 | + $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 112 | + unset($opt, $default); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 115 | + $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 116 | 116 | |
| 117 | 117 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
| 121 | - $field_options = array( |
|
| 122 | - 'size' => '', 'max' => '', 'label' => '', 'blank' => '', |
|
| 123 | - 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, |
|
| 124 | - 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', |
|
| 120 | + public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
| 121 | + $field_options = array( |
|
| 122 | + 'size' => '', 'max' => '', 'label' => '', 'blank' => '', |
|
| 123 | + 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, |
|
| 124 | + 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', |
|
| 125 | 125 | 'custom_html' => '', 'captcha_size' => 'default', |
| 126 | - ); |
|
| 126 | + ); |
|
| 127 | 127 | |
| 128 | 128 | if ( $limit ) { |
| 129 | - return $field_options; |
|
| 129 | + return $field_options; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - global $wpdb; |
|
| 132 | + global $wpdb; |
|
| 133 | 133 | |
| 134 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 134 | + $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 135 | 135 | |
| 136 | - $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key; |
|
| 136 | + $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key; |
|
| 137 | 137 | |
| 138 | - $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); |
|
| 138 | + $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); |
|
| 139 | 139 | |
| 140 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 141 | - return array( |
|
| 142 | - 'name' => __( 'Untitled', 'formidable' ), 'description' => '', |
|
| 140 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 141 | + return array( |
|
| 142 | + 'name' => __( 'Untitled', 'formidable' ), 'description' => '', |
|
| 143 | 143 | 'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '', |
| 144 | 144 | 'field_order' => $field_count + 1, 'required' => false, |
| 145 | - 'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg, |
|
| 146 | - 'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id, |
|
| 145 | + 'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg, |
|
| 146 | + 'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id, |
|
| 147 | 147 | 'field_options' => $field_options, |
| 148 | - ); |
|
| 149 | - } |
|
| 148 | + ); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 152 | - global $wpdb; |
|
| 151 | + public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 152 | + global $wpdb; |
|
| 153 | 153 | |
| 154 | - $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key'); |
|
| 155 | - $values['form_id'] = $form_id; |
|
| 156 | - $values['options'] = maybe_serialize($field->options); |
|
| 157 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 154 | + $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key'); |
|
| 155 | + $values['form_id'] = $form_id; |
|
| 156 | + $values['options'] = maybe_serialize($field->options); |
|
| 157 | + $values['default_value'] = maybe_serialize($field->default_value); |
|
| 158 | 158 | |
| 159 | - foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 160 | - $values[ $col ] = $field->{$col}; |
|
| 161 | - } |
|
| 162 | - } |
|
| 159 | + foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 160 | + $values[ $col ] = $field->{$col}; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * @since 2.0 |
|
| 166 | - */ |
|
| 164 | + /** |
|
| 165 | + * @since 2.0 |
|
| 166 | + */ |
|
| 167 | 167 | public static function get_error_msg( $field, $error ) { |
| 168 | 168 | $frm_settings = FrmAppHelper::get_settings(); |
| 169 | 169 | $default_settings = $frm_settings->default_options(); |
@@ -180,21 +180,21 @@ discard block |
||
| 180 | 180 | return $msg; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - public static function get_form_fields( $form_id, $error = false ) { |
|
| 184 | - $fields = FrmField::get_all_for_form($form_id); |
|
| 185 | - $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error); |
|
| 186 | - return $fields; |
|
| 187 | - } |
|
| 183 | + public static function get_form_fields( $form_id, $error = false ) { |
|
| 184 | + $fields = FrmField::get_all_for_form($form_id); |
|
| 185 | + $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error); |
|
| 186 | + return $fields; |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | public static function get_default_html( $type = 'text' ) { |
| 190 | 190 | if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) { |
| 191 | 191 | $input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]'; |
| 192 | - $for = ''; |
|
| 192 | + $for = ''; |
|
| 193 | 193 | if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) { |
| 194 | - $for = 'for="field_[key]"'; |
|
| 195 | - } |
|
| 194 | + $for = 'for="field_[key]"'; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - $default_html = <<<DEFAULT_HTML |
|
| 197 | + $default_html = <<<DEFAULT_HTML |
|
| 198 | 198 | <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]"> |
| 199 | 199 | <label $for class="frm_primary_label">[field_name] |
| 200 | 200 | <span class="frm_required">[required_label]</span> |
@@ -204,145 +204,145 @@ discard block |
||
| 204 | 204 | [if error]<div class="frm_error">[error]</div>[/if error] |
| 205 | 205 | </div> |
| 206 | 206 | DEFAULT_HTML; |
| 207 | - } else { |
|
| 207 | + } else { |
|
| 208 | 208 | $default_html = apply_filters('frm_other_custom_html', '', $type); |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 212 | - } |
|
| 211 | + return apply_filters('frm_custom_html', $default_html, $type); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | 214 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 215 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 216 | - |
|
| 217 | - $defaults = array( |
|
| 218 | - 'field_name' => 'item_meta['. $field['id'] .']', |
|
| 219 | - 'field_id' => $field['id'], |
|
| 220 | - 'field_plus_id' => '', |
|
| 221 | - 'section_id' => '', |
|
| 222 | - ); |
|
| 223 | - $args = wp_parse_args($args, $defaults); |
|
| 224 | - $field_name = $args['field_name']; |
|
| 225 | - $field_id = $args['field_id']; |
|
| 226 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 227 | - |
|
| 228 | - if ( FrmField::is_multiple_select($field) ) { |
|
| 229 | - $field_name .= '[]'; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - //replace [id] |
|
| 233 | - $html = str_replace('[id]', $field_id, $html); |
|
| 234 | - |
|
| 235 | - // Remove the for attribute for captcha |
|
| 236 | - if ( $field['type'] == 'captcha' ) { |
|
| 237 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - // set the label for |
|
| 241 | - $html = str_replace('field_[key]', $html_id, $html); |
|
| 242 | - |
|
| 243 | - //replace [key] |
|
| 244 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
| 245 | - |
|
| 246 | - //replace [description] and [required_label] and [error] |
|
| 215 | + $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 216 | + |
|
| 217 | + $defaults = array( |
|
| 218 | + 'field_name' => 'item_meta['. $field['id'] .']', |
|
| 219 | + 'field_id' => $field['id'], |
|
| 220 | + 'field_plus_id' => '', |
|
| 221 | + 'section_id' => '', |
|
| 222 | + ); |
|
| 223 | + $args = wp_parse_args($args, $defaults); |
|
| 224 | + $field_name = $args['field_name']; |
|
| 225 | + $field_id = $args['field_id']; |
|
| 226 | + $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 227 | + |
|
| 228 | + if ( FrmField::is_multiple_select($field) ) { |
|
| 229 | + $field_name .= '[]'; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + //replace [id] |
|
| 233 | + $html = str_replace('[id]', $field_id, $html); |
|
| 234 | + |
|
| 235 | + // Remove the for attribute for captcha |
|
| 236 | + if ( $field['type'] == 'captcha' ) { |
|
| 237 | + $html = str_replace(' for="field_[key]"', '', $html); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + // set the label for |
|
| 241 | + $html = str_replace('field_[key]', $html_id, $html); |
|
| 242 | + |
|
| 243 | + //replace [key] |
|
| 244 | + $html = str_replace('[key]', $field['field_key'], $html); |
|
| 245 | + |
|
| 246 | + //replace [description] and [required_label] and [error] |
|
| 247 | 247 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
| 248 | - if ( ! is_array( $errors ) ) { |
|
| 249 | - $errors = array(); |
|
| 250 | - } |
|
| 248 | + if ( ! is_array( $errors ) ) { |
|
| 249 | + $errors = array(); |
|
| 250 | + } |
|
| 251 | 251 | $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
| 252 | 252 | |
| 253 | - //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
|
| 254 | - if ( $field['type'] == 'divider' ) { |
|
| 255 | - if ( FrmField::is_option_true( $field, 'description' ) ) { |
|
| 256 | - $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
|
| 257 | - } else { |
|
| 258 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 259 | - } |
|
| 260 | - } |
|
| 253 | + //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
|
| 254 | + if ( $field['type'] == 'divider' ) { |
|
| 255 | + if ( FrmField::is_option_true( $field, 'description' ) ) { |
|
| 256 | + $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
|
| 257 | + } else { |
|
| 258 | + $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | 262 | foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) { |
| 263 | - self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html ); |
|
| 264 | - } |
|
| 263 | + self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html ); |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | - //replace [required_class] |
|
| 266 | + //replace [required_class] |
|
| 267 | 267 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
| 268 | - $html = str_replace('[required_class]', $required_class, $html); |
|
| 268 | + $html = str_replace('[required_class]', $required_class, $html); |
|
| 269 | 269 | |
| 270 | - //replace [label_position] |
|
| 271 | - $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 272 | - $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
|
| 270 | + //replace [label_position] |
|
| 271 | + $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 272 | + $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
|
| 273 | 273 | $html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html ); |
| 274 | 274 | |
| 275 | - //replace [field_name] |
|
| 276 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
| 275 | + //replace [field_name] |
|
| 276 | + $html = str_replace('[field_name]', $field['name'], $html); |
|
| 277 | 277 | |
| 278 | - //replace [error_class] |
|
| 278 | + //replace [error_class] |
|
| 279 | 279 | $error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
| 280 | 280 | self::get_more_field_classes( $error_class, $field, $field_id, $html ); |
| 281 | 281 | if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) { |
| 282 | 282 | // there is no error_class shortcode to use for addign fields |
| 283 | 283 | $html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html ); |
| 284 | 284 | } |
| 285 | - $html = str_replace('[error_class]', $error_class, $html); |
|
| 285 | + $html = str_replace('[error_class]', $error_class, $html); |
|
| 286 | 286 | |
| 287 | - //replace [entry_key] |
|
| 288 | - $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
|
| 289 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 287 | + //replace [entry_key] |
|
| 288 | + $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
|
| 289 | + $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 290 | 290 | |
| 291 | - //replace [input] |
|
| 292 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 293 | - global $frm_vars; |
|
| 294 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 291 | + //replace [input] |
|
| 292 | + preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 293 | + global $frm_vars; |
|
| 294 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 295 | 295 | |
| 296 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 297 | - $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
| 296 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 297 | + $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
| 298 | 298 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
| 299 | 299 | |
| 300 | - $replace_with = ''; |
|
| 300 | + $replace_with = ''; |
|
| 301 | 301 | |
| 302 | - if ( $tag == 'input' ) { |
|
| 303 | - if ( isset($atts['opt']) ) { |
|
| 304 | - $atts['opt']--; |
|
| 305 | - } |
|
| 302 | + if ( $tag == 'input' ) { |
|
| 303 | + if ( isset($atts['opt']) ) { |
|
| 304 | + $atts['opt']--; |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 308 | - if ( isset($atts['class']) ) { |
|
| 309 | - unset($atts['class']); |
|
| 310 | - } |
|
| 307 | + $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 308 | + if ( isset($atts['class']) ) { |
|
| 309 | + unset($atts['class']); |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - $field['shortcodes'] = $atts; |
|
| 313 | - ob_start(); |
|
| 314 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php'); |
|
| 315 | - $replace_with = ob_get_contents(); |
|
| 316 | - ob_end_clean(); |
|
| 317 | - } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
|
| 318 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 319 | - } |
|
| 312 | + $field['shortcodes'] = $atts; |
|
| 313 | + ob_start(); |
|
| 314 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php'); |
|
| 315 | + $replace_with = ob_get_contents(); |
|
| 316 | + ob_end_clean(); |
|
| 317 | + } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
|
| 318 | + $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 322 | - } |
|
| 321 | + $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | if ( $form ) { |
| 325 | - $form = (array) $form; |
|
| 325 | + $form = (array) $form; |
|
| 326 | 326 | |
| 327 | - //replace [form_key] |
|
| 328 | - $html = str_replace('[form_key]', $form['form_key'], $html); |
|
| 327 | + //replace [form_key] |
|
| 328 | + $html = str_replace('[form_key]', $form['form_key'], $html); |
|
| 329 | 329 | |
| 330 | - //replace [form_name] |
|
| 331 | - $html = str_replace('[form_name]', $form['name'], $html); |
|
| 332 | - } |
|
| 333 | - $html .= "\n"; |
|
| 330 | + //replace [form_name] |
|
| 331 | + $html = str_replace('[form_name]', $form['name'], $html); |
|
| 332 | + } |
|
| 333 | + $html .= "\n"; |
|
| 334 | 334 | |
| 335 | - //Return html if conf_field to prevent loop |
|
| 336 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 337 | - return $html; |
|
| 338 | - } |
|
| 335 | + //Return html if conf_field to prevent loop |
|
| 336 | + if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 337 | + return $html; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - //If field is in repeating section |
|
| 341 | - if ( $args['section_id'] ) { |
|
| 342 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 343 | - } else { |
|
| 344 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 345 | - } |
|
| 340 | + //If field is in repeating section |
|
| 341 | + if ( $args['section_id'] ) { |
|
| 342 | + $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 343 | + } else { |
|
| 344 | + $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | 347 | self::remove_collapse_shortcode( $html ); |
| 348 | 348 | |
@@ -350,18 +350,18 @@ discard block |
||
| 350 | 350 | $html = do_shortcode( $html ); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - return $html; |
|
| 354 | - } |
|
| 353 | + return $html; |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | - * Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.) |
|
| 358 | - * |
|
| 359 | - * @since 2.0 |
|
| 360 | - * @param $error_class string, pass by reference |
|
| 361 | - * @param $field array |
|
| 362 | - * @param $field_id int |
|
| 363 | - * @param $html string |
|
| 364 | - */ |
|
| 357 | + * Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.) |
|
| 358 | + * |
|
| 359 | + * @since 2.0 |
|
| 360 | + * @param $error_class string, pass by reference |
|
| 361 | + * @param $field array |
|
| 362 | + * @param $field_id int |
|
| 363 | + * @param $html string |
|
| 364 | + */ |
|
| 365 | 365 | private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) { |
| 366 | 366 | $error_class .= ' frm_'. $field['label'] .'_container'; |
| 367 | 367 | if ( $field['id'] != $field_id ) { |
@@ -420,46 +420,46 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
| 424 | - if ( $no_vars ) { |
|
| 425 | - $html = str_replace( '[if '. $code.']', '', $html ); |
|
| 426 | - $html = str_replace( '[/if '. $code.']', '', $html ); |
|
| 427 | - } else { |
|
| 428 | - $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html ); |
|
| 429 | - } |
|
| 423 | + public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
| 424 | + if ( $no_vars ) { |
|
| 425 | + $html = str_replace( '[if '. $code.']', '', $html ); |
|
| 426 | + $html = str_replace( '[/if '. $code.']', '', $html ); |
|
| 427 | + } else { |
|
| 428 | + $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html ); |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - $html = str_replace( '['. $code .']', $replace_with, $html ); |
|
| 432 | - } |
|
| 431 | + $html = str_replace( '['. $code .']', $replace_with, $html ); |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
| 435 | 435 | $args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) ); |
| 436 | - if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
|
| 437 | - $args['conditional_check'] = true; |
|
| 438 | - } |
|
| 439 | - |
|
| 440 | - $prefix = ''; |
|
| 441 | - if ( $args['conditional_check'] ) { |
|
| 442 | - if ( $args['conditional'] ) { |
|
| 443 | - $prefix = 'if '; |
|
| 444 | - } else if ( $args['foreach'] ) { |
|
| 445 | - $prefix = 'foreach '; |
|
| 446 | - } |
|
| 447 | - } |
|
| 448 | - |
|
| 449 | - $with_tags = $args['conditional_check'] ? 3 : 2; |
|
| 450 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 451 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 452 | - $tag = str_replace(']', '', $tag); |
|
| 453 | - $tags = explode(' ', $tag); |
|
| 454 | - if ( is_array($tags) ) { |
|
| 455 | - $tag = $tags[0]; |
|
| 456 | - } |
|
| 457 | - } else { |
|
| 458 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - return $tag; |
|
| 462 | - } |
|
| 436 | + if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
|
| 437 | + $args['conditional_check'] = true; |
|
| 438 | + } |
|
| 439 | + |
|
| 440 | + $prefix = ''; |
|
| 441 | + if ( $args['conditional_check'] ) { |
|
| 442 | + if ( $args['conditional'] ) { |
|
| 443 | + $prefix = 'if '; |
|
| 444 | + } else if ( $args['foreach'] ) { |
|
| 445 | + $prefix = 'foreach '; |
|
| 446 | + } |
|
| 447 | + } |
|
| 448 | + |
|
| 449 | + $with_tags = $args['conditional_check'] ? 3 : 2; |
|
| 450 | + if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 451 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 452 | + $tag = str_replace(']', '', $tag); |
|
| 453 | + $tags = explode(' ', $tag); |
|
| 454 | + if ( is_array($tags) ) { |
|
| 455 | + $tag = $tags[0]; |
|
| 456 | + } |
|
| 457 | + } else { |
|
| 458 | + $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + return $tag; |
|
| 462 | + } |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Remove [collapse_this] if it's still included after all processing |
@@ -472,128 +472,128 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | public static function display_recaptcha( $field ) { |
| 475 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 476 | - $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field); |
|
| 475 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 476 | + $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field); |
|
| 477 | 477 | |
| 478 | - $api_js_url = 'https://www.google.com/recaptcha/api.js'; |
|
| 479 | - if ( $lang != 'en' ) { |
|
| 480 | - $api_js_url .= '?hl='. $lang; |
|
| 481 | - } |
|
| 482 | - $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url); |
|
| 478 | + $api_js_url = 'https://www.google.com/recaptcha/api.js'; |
|
| 479 | + if ( $lang != 'en' ) { |
|
| 480 | + $api_js_url .= '?hl='. $lang; |
|
| 481 | + } |
|
| 482 | + $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url); |
|
| 483 | 483 | |
| 484 | - wp_register_script('recaptcha-api', $api_js_url, '', true); |
|
| 485 | - wp_enqueue_script('recaptcha-api'); |
|
| 484 | + wp_register_script('recaptcha-api', $api_js_url, '', true); |
|
| 485 | + wp_enqueue_script('recaptcha-api'); |
|
| 486 | 486 | |
| 487 | 487 | ?> |
| 488 | 488 | <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div> |
| 489 | 489 | <?php |
| 490 | - } |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | public static function show_single_option( $field ) { |
| 493 | - $field_name = $field['name']; |
|
| 494 | - $html_id = self::get_html_id($field); |
|
| 495 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 496 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 497 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 493 | + $field_name = $field['name']; |
|
| 494 | + $html_id = self::get_html_id($field); |
|
| 495 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 496 | + $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 497 | + $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 498 | 498 | |
| 499 | - // If this is an "Other" option, get the HTML for it |
|
| 499 | + // If this is an "Other" option, get the HTML for it |
|
| 500 | 500 | if ( self::is_other_opt( $opt_key ) ) { |
| 501 | - // Get string for Other text field, if needed |
|
| 501 | + // Get string for Other text field, if needed |
|
| 502 | 502 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
| 503 | - require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php'); |
|
| 504 | - } else { |
|
| 505 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php'); |
|
| 506 | - } |
|
| 507 | - } |
|
| 508 | - } |
|
| 503 | + require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php'); |
|
| 504 | + } else { |
|
| 505 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php'); |
|
| 506 | + } |
|
| 507 | + } |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | 510 | public static function dropdown_categories( $args ) { |
| 511 | 511 | $defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' ); |
| 512 | - $args = wp_parse_args($args, $defaults); |
|
| 512 | + $args = wp_parse_args($args, $defaults); |
|
| 513 | 513 | |
| 514 | - if ( ! $args['field'] ) { |
|
| 515 | - return; |
|
| 516 | - } |
|
| 514 | + if ( ! $args['field'] ) { |
|
| 515 | + return; |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - if ( ! $args['name'] ) { |
|
| 519 | - $args['name'] = 'item_meta['. $args['field']['id'] .']'; |
|
| 520 | - } |
|
| 518 | + if ( ! $args['name'] ) { |
|
| 519 | + $args['name'] = 'item_meta['. $args['field']['id'] .']'; |
|
| 520 | + } |
|
| 521 | 521 | |
| 522 | - $id = self::get_html_id($args['field']); |
|
| 523 | - $class = $args['field']['type']; |
|
| 522 | + $id = self::get_html_id($args['field']); |
|
| 523 | + $class = $args['field']['type']; |
|
| 524 | 524 | |
| 525 | - $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat']; |
|
| 526 | - $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']); |
|
| 525 | + $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat']; |
|
| 526 | + $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']); |
|
| 527 | 527 | |
| 528 | - if ( is_array($args['field']['value']) ) { |
|
| 529 | - if ( ! empty($exclude) ) { |
|
| 530 | - $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude)); |
|
| 531 | - } |
|
| 532 | - $selected = reset($args['field']['value']); |
|
| 533 | - } else { |
|
| 534 | - $selected = $args['field']['value']; |
|
| 535 | - } |
|
| 528 | + if ( is_array($args['field']['value']) ) { |
|
| 529 | + if ( ! empty($exclude) ) { |
|
| 530 | + $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude)); |
|
| 531 | + } |
|
| 532 | + $selected = reset($args['field']['value']); |
|
| 533 | + } else { |
|
| 534 | + $selected = $args['field']['value']; |
|
| 535 | + } |
|
| 536 | 536 | |
| 537 | - $tax_atts = array( |
|
| 538 | - 'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'], |
|
| 539 | - 'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected, |
|
| 540 | - 'hide_empty' => false, 'echo' => 0, 'orderby' => 'name', |
|
| 541 | - ); |
|
| 537 | + $tax_atts = array( |
|
| 538 | + 'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'], |
|
| 539 | + 'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected, |
|
| 540 | + 'hide_empty' => false, 'echo' => 0, 'orderby' => 'name', |
|
| 541 | + ); |
|
| 542 | 542 | |
| 543 | - $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']); |
|
| 543 | + $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']); |
|
| 544 | 544 | |
| 545 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 546 | - $post_type = FrmProFormsHelper::post_type($args['field']['form_id']); |
|
| 547 | - $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']); |
|
| 548 | - if ( ! $tax_atts['taxonomy'] ) { |
|
| 549 | - return; |
|
| 550 | - } |
|
| 545 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 546 | + $post_type = FrmProFormsHelper::post_type($args['field']['form_id']); |
|
| 547 | + $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']); |
|
| 548 | + if ( ! $tax_atts['taxonomy'] ) { |
|
| 549 | + return; |
|
| 550 | + } |
|
| 551 | 551 | |
| 552 | - // If field type is dropdown (not Dynamic), exclude children when parent is excluded |
|
| 553 | - if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) { |
|
| 554 | - $tax_atts['exclude_tree'] = $exclude; |
|
| 555 | - } |
|
| 556 | - } |
|
| 552 | + // If field type is dropdown (not Dynamic), exclude children when parent is excluded |
|
| 553 | + if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) { |
|
| 554 | + $tax_atts['exclude_tree'] = $exclude; |
|
| 555 | + } |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | - $dropdown = wp_dropdown_categories($tax_atts); |
|
| 558 | + $dropdown = wp_dropdown_categories($tax_atts); |
|
| 559 | 559 | |
| 560 | - $add_html = FrmFieldsController::input_html($args['field'], false); |
|
| 560 | + $add_html = FrmFieldsController::input_html($args['field'], false); |
|
| 561 | 561 | |
| 562 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 563 | - $add_html .= FrmProFieldsController::input_html($args['field'], false); |
|
| 564 | - } |
|
| 562 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 563 | + $add_html .= FrmProFieldsController::input_html($args['field'], false); |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | 566 | $dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) ."' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown ); |
| 567 | 567 | |
| 568 | - if ( is_array($args['field']['value']) ) { |
|
| 569 | - $skip = true; |
|
| 570 | - foreach ( $args['field']['value'] as $v ) { |
|
| 568 | + if ( is_array($args['field']['value']) ) { |
|
| 569 | + $skip = true; |
|
| 570 | + foreach ( $args['field']['value'] as $v ) { |
|
| 571 | 571 | if ( $skip ) { |
| 572 | - $skip = false; |
|
| 573 | - continue; |
|
| 574 | - } |
|
| 572 | + $skip = false; |
|
| 573 | + continue; |
|
| 574 | + } |
|
| 575 | 575 | $dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown ); |
| 576 | - unset($v); |
|
| 577 | - } |
|
| 578 | - } |
|
| 576 | + unset($v); |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | - return $dropdown; |
|
| 581 | - } |
|
| 580 | + return $dropdown; |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | 583 | public static function get_term_link( $tax_id ) { |
| 584 | - $tax = get_taxonomy($tax_id); |
|
| 585 | - if ( ! $tax ) { |
|
| 586 | - return; |
|
| 587 | - } |
|
| 584 | + $tax = get_taxonomy($tax_id); |
|
| 585 | + if ( ! $tax ) { |
|
| 586 | + return; |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | - $link = sprintf( |
|
| 590 | - __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
| 591 | - '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>' |
|
| 592 | - ); |
|
| 593 | - unset($tax); |
|
| 589 | + $link = sprintf( |
|
| 590 | + __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
| 591 | + '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>' |
|
| 592 | + ); |
|
| 593 | + unset($tax); |
|
| 594 | 594 | |
| 595 | - return $link; |
|
| 596 | - } |
|
| 595 | + return $link; |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | 598 | public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { |
| 599 | 599 | // Remove white space from hide_opt |
@@ -601,296 +601,296 @@ discard block |
||
| 601 | 601 | $hide_opt = rtrim( $hide_opt ); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if ( is_array($observed_value) ) { |
|
| 605 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - $m = false; |
|
| 609 | - if ( $cond == '==' ) { |
|
| 610 | - $m = $observed_value == $hide_opt; |
|
| 611 | - } else if ( $cond == '!=' ) { |
|
| 612 | - $m = $observed_value != $hide_opt; |
|
| 613 | - } else if ( $cond == '>' ) { |
|
| 614 | - $m = $observed_value > $hide_opt; |
|
| 615 | - } else if ( $cond == '<' ) { |
|
| 616 | - $m = $observed_value < $hide_opt; |
|
| 617 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 618 | - $m = stripos($observed_value, $hide_opt); |
|
| 619 | - if ( $cond == 'not LIKE' ) { |
|
| 620 | - $m = ( $m === false ) ? true : false; |
|
| 621 | - } else { |
|
| 622 | - $m = ( $m === false ) ? false : true; |
|
| 623 | - } |
|
| 624 | - } |
|
| 625 | - return $m; |
|
| 626 | - } |
|
| 604 | + if ( is_array($observed_value) ) { |
|
| 605 | + return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + $m = false; |
|
| 609 | + if ( $cond == '==' ) { |
|
| 610 | + $m = $observed_value == $hide_opt; |
|
| 611 | + } else if ( $cond == '!=' ) { |
|
| 612 | + $m = $observed_value != $hide_opt; |
|
| 613 | + } else if ( $cond == '>' ) { |
|
| 614 | + $m = $observed_value > $hide_opt; |
|
| 615 | + } else if ( $cond == '<' ) { |
|
| 616 | + $m = $observed_value < $hide_opt; |
|
| 617 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 618 | + $m = stripos($observed_value, $hide_opt); |
|
| 619 | + if ( $cond == 'not LIKE' ) { |
|
| 620 | + $m = ( $m === false ) ? true : false; |
|
| 621 | + } else { |
|
| 622 | + $m = ( $m === false ) ? false : true; |
|
| 623 | + } |
|
| 624 | + } |
|
| 625 | + return $m; |
|
| 626 | + } |
|
| 627 | 627 | |
| 628 | 628 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 629 | - $m = false; |
|
| 630 | - if ( $cond == '==' ) { |
|
| 631 | - if ( is_array($hide_opt) ) { |
|
| 632 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 633 | - $m = empty($m) ? false : true; |
|
| 634 | - } else { |
|
| 635 | - $m = in_array($hide_opt, $observed_value); |
|
| 636 | - } |
|
| 637 | - } else if ( $cond == '!=' ) { |
|
| 638 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 639 | - } else if ( $cond == '>' ) { |
|
| 640 | - $min = min($observed_value); |
|
| 641 | - $m = $min > $hide_opt; |
|
| 642 | - } else if ( $cond == '<' ) { |
|
| 643 | - $max = max($observed_value); |
|
| 644 | - $m = $max < $hide_opt; |
|
| 645 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 646 | - foreach ( $observed_value as $ob ) { |
|
| 647 | - $m = strpos($ob, $hide_opt); |
|
| 648 | - if ( $m !== false ) { |
|
| 649 | - $m = true; |
|
| 650 | - break; |
|
| 651 | - } |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - if ( $cond == 'not LIKE' ) { |
|
| 655 | - $m = ( $m === false ) ? true : false; |
|
| 656 | - } |
|
| 657 | - } |
|
| 658 | - |
|
| 659 | - return $m; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * Replace a few basic shortcodes and field ids |
|
| 664 | - * @since 2.0 |
|
| 665 | - * @return string |
|
| 666 | - */ |
|
| 629 | + $m = false; |
|
| 630 | + if ( $cond == '==' ) { |
|
| 631 | + if ( is_array($hide_opt) ) { |
|
| 632 | + $m = array_intersect($hide_opt, $observed_value); |
|
| 633 | + $m = empty($m) ? false : true; |
|
| 634 | + } else { |
|
| 635 | + $m = in_array($hide_opt, $observed_value); |
|
| 636 | + } |
|
| 637 | + } else if ( $cond == '!=' ) { |
|
| 638 | + $m = ! in_array($hide_opt, $observed_value); |
|
| 639 | + } else if ( $cond == '>' ) { |
|
| 640 | + $min = min($observed_value); |
|
| 641 | + $m = $min > $hide_opt; |
|
| 642 | + } else if ( $cond == '<' ) { |
|
| 643 | + $max = max($observed_value); |
|
| 644 | + $m = $max < $hide_opt; |
|
| 645 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 646 | + foreach ( $observed_value as $ob ) { |
|
| 647 | + $m = strpos($ob, $hide_opt); |
|
| 648 | + if ( $m !== false ) { |
|
| 649 | + $m = true; |
|
| 650 | + break; |
|
| 651 | + } |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + if ( $cond == 'not LIKE' ) { |
|
| 655 | + $m = ( $m === false ) ? true : false; |
|
| 656 | + } |
|
| 657 | + } |
|
| 658 | + |
|
| 659 | + return $m; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * Replace a few basic shortcodes and field ids |
|
| 664 | + * @since 2.0 |
|
| 665 | + * @return string |
|
| 666 | + */ |
|
| 667 | 667 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 668 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 669 | - $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 670 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 671 | - } |
|
| 668 | + if ( strpos($value, '[sitename]') !== false ) { |
|
| 669 | + $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 670 | + $value = str_replace('[sitename]', $new_value, $value); |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 674 | - $value = do_shortcode($value); |
|
| 673 | + $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 674 | + $value = do_shortcode($value); |
|
| 675 | 675 | |
| 676 | - return $value; |
|
| 677 | - } |
|
| 676 | + return $value; |
|
| 677 | + } |
|
| 678 | 678 | |
| 679 | 679 | public static function get_shortcodes( $content, $form_id ) { |
| 680 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 681 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 682 | - } |
|
| 680 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 681 | + return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 682 | + } |
|
| 683 | 683 | |
| 684 | - $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
| 684 | + $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
| 685 | 685 | |
| 686 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 686 | + $tagregexp = self::allowed_shortcodes($fields); |
|
| 687 | 687 | |
| 688 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 688 | + preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 689 | 689 | |
| 690 | - return $matches; |
|
| 691 | - } |
|
| 690 | + return $matches; |
|
| 691 | + } |
|
| 692 | 692 | |
| 693 | 693 | public static function allowed_shortcodes( $fields = array() ) { |
| 694 | - $tagregexp = array( |
|
| 695 | - 'editlink', 'id', 'key', 'ip', |
|
| 696 | - 'siteurl', 'sitename', 'admin_email', |
|
| 697 | - 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
| 694 | + $tagregexp = array( |
|
| 695 | + 'editlink', 'id', 'key', 'ip', |
|
| 696 | + 'siteurl', 'sitename', 'admin_email', |
|
| 697 | + 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
| 698 | 698 | 'parent[-|_]id', |
| 699 | - ); |
|
| 699 | + ); |
|
| 700 | 700 | |
| 701 | - foreach ( $fields as $field ) { |
|
| 702 | - $tagregexp[] = $field->id; |
|
| 703 | - $tagregexp[] = $field->field_key; |
|
| 704 | - } |
|
| 701 | + foreach ( $fields as $field ) { |
|
| 702 | + $tagregexp[] = $field->id; |
|
| 703 | + $tagregexp[] = $field->field_key; |
|
| 704 | + } |
|
| 705 | 705 | |
| 706 | - $tagregexp = implode('|', $tagregexp); |
|
| 707 | - return $tagregexp; |
|
| 708 | - } |
|
| 706 | + $tagregexp = implode('|', $tagregexp); |
|
| 707 | + return $tagregexp; |
|
| 708 | + } |
|
| 709 | 709 | |
| 710 | 710 | public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
| 711 | - $shortcode_values = array( |
|
| 712 | - 'id' => $entry->id, |
|
| 713 | - 'key' => $entry->item_key, |
|
| 714 | - 'ip' => $entry->ip, |
|
| 715 | - ); |
|
| 711 | + $shortcode_values = array( |
|
| 712 | + 'id' => $entry->id, |
|
| 713 | + 'key' => $entry->item_key, |
|
| 714 | + 'ip' => $entry->ip, |
|
| 715 | + ); |
|
| 716 | 716 | |
| 717 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 718 | - $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] ); |
|
| 717 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 718 | + $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] ); |
|
| 719 | 719 | |
| 720 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 720 | + if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 721 | 721 | $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
| 722 | - $tags = explode(' ', $tag); |
|
| 723 | - if ( is_array($tags) ) { |
|
| 724 | - $tag = $tags[0]; |
|
| 725 | - } |
|
| 726 | - } else { |
|
| 727 | - $tag = $shortcodes[2][ $short_key ]; |
|
| 728 | - } |
|
| 729 | - |
|
| 730 | - switch ( $tag ) { |
|
| 731 | - case 'id': |
|
| 732 | - case 'key': |
|
| 733 | - case 'ip': |
|
| 734 | - $replace_with = $shortcode_values[ $tag ]; |
|
| 735 | - break; |
|
| 736 | - |
|
| 737 | - case 'user_agent': |
|
| 738 | - case 'user-agent': |
|
| 739 | - $entry->description = maybe_unserialize($entry->description); |
|
| 722 | + $tags = explode(' ', $tag); |
|
| 723 | + if ( is_array($tags) ) { |
|
| 724 | + $tag = $tags[0]; |
|
| 725 | + } |
|
| 726 | + } else { |
|
| 727 | + $tag = $shortcodes[2][ $short_key ]; |
|
| 728 | + } |
|
| 729 | + |
|
| 730 | + switch ( $tag ) { |
|
| 731 | + case 'id': |
|
| 732 | + case 'key': |
|
| 733 | + case 'ip': |
|
| 734 | + $replace_with = $shortcode_values[ $tag ]; |
|
| 735 | + break; |
|
| 736 | + |
|
| 737 | + case 'user_agent': |
|
| 738 | + case 'user-agent': |
|
| 739 | + $entry->description = maybe_unserialize($entry->description); |
|
| 740 | 740 | $replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] ); |
| 741 | - break; |
|
| 742 | - |
|
| 743 | - case 'created_at': |
|
| 744 | - case 'created-at': |
|
| 745 | - case 'updated_at': |
|
| 746 | - case 'updated-at': |
|
| 747 | - if ( isset($atts['format']) ) { |
|
| 748 | - $time_format = ' '; |
|
| 749 | - } else { |
|
| 750 | - $atts['format'] = get_option('date_format'); |
|
| 751 | - $time_format = ''; |
|
| 752 | - } |
|
| 753 | - |
|
| 754 | - $this_tag = str_replace('-', '_', $tag); |
|
| 755 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 756 | - unset($this_tag); |
|
| 757 | - break; |
|
| 758 | - |
|
| 759 | - case 'created_by': |
|
| 760 | - case 'created-by': |
|
| 761 | - case 'updated_by': |
|
| 762 | - case 'updated-by': |
|
| 763 | - $this_tag = str_replace('-', '_', $tag); |
|
| 764 | - $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
|
| 765 | - unset($this_tag); |
|
| 766 | - break; |
|
| 741 | + break; |
|
| 742 | + |
|
| 743 | + case 'created_at': |
|
| 744 | + case 'created-at': |
|
| 745 | + case 'updated_at': |
|
| 746 | + case 'updated-at': |
|
| 747 | + if ( isset($atts['format']) ) { |
|
| 748 | + $time_format = ' '; |
|
| 749 | + } else { |
|
| 750 | + $atts['format'] = get_option('date_format'); |
|
| 751 | + $time_format = ''; |
|
| 752 | + } |
|
| 767 | 753 | |
| 768 | - case 'admin_email': |
|
| 769 | - case 'siteurl': |
|
| 770 | - case 'frmurl': |
|
| 771 | - case 'sitename': |
|
| 772 | - case 'get': |
|
| 773 | - $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
| 774 | - break; |
|
| 754 | + $this_tag = str_replace('-', '_', $tag); |
|
| 755 | + $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 756 | + unset($this_tag); |
|
| 757 | + break; |
|
| 775 | 758 | |
| 776 | - default: |
|
| 777 | - $field = FrmField::getOne( $tag ); |
|
| 778 | - if ( ! $field ) { |
|
| 779 | - break; |
|
| 780 | - } |
|
| 759 | + case 'created_by': |
|
| 760 | + case 'created-by': |
|
| 761 | + case 'updated_by': |
|
| 762 | + case 'updated-by': |
|
| 763 | + $this_tag = str_replace('-', '_', $tag); |
|
| 764 | + $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
|
| 765 | + unset($this_tag); |
|
| 766 | + break; |
|
| 767 | + |
|
| 768 | + case 'admin_email': |
|
| 769 | + case 'siteurl': |
|
| 770 | + case 'frmurl': |
|
| 771 | + case 'sitename': |
|
| 772 | + case 'get': |
|
| 773 | + $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
| 774 | + break; |
|
| 775 | + |
|
| 776 | + default: |
|
| 777 | + $field = FrmField::getOne( $tag ); |
|
| 778 | + if ( ! $field ) { |
|
| 779 | + break; |
|
| 780 | + } |
|
| 781 | 781 | |
| 782 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 782 | + $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 783 | 783 | |
| 784 | - $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
| 784 | + $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
| 785 | 785 | |
| 786 | - $atts['entry_id'] = $entry->id; |
|
| 787 | - $atts['entry_key'] = $entry->item_key; |
|
| 788 | - //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field); |
|
| 786 | + $atts['entry_id'] = $entry->id; |
|
| 787 | + $atts['entry_key'] = $entry->item_key; |
|
| 788 | + //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field); |
|
| 789 | 789 | |
| 790 | - if ( is_array($replace_with) ) { |
|
| 791 | - $replace_with = implode($sep, $replace_with); |
|
| 792 | - } |
|
| 790 | + if ( is_array($replace_with) ) { |
|
| 791 | + $replace_with = implode($sep, $replace_with); |
|
| 792 | + } |
|
| 793 | 793 | |
| 794 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 795 | - $replace_with = $field->name; |
|
| 796 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 797 | - $replace_with = $field->description; |
|
| 798 | - } else if ( empty($replace_with) && $replace_with != '0' ) { |
|
| 799 | - $replace_with = ''; |
|
| 800 | - } else { |
|
| 801 | - $replace_with = self::get_display_value($replace_with, $field, $atts); |
|
| 802 | - } |
|
| 794 | + if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 795 | + $replace_with = $field->name; |
|
| 796 | + } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 797 | + $replace_with = $field->description; |
|
| 798 | + } else if ( empty($replace_with) && $replace_with != '0' ) { |
|
| 799 | + $replace_with = ''; |
|
| 800 | + } else { |
|
| 801 | + $replace_with = self::get_display_value($replace_with, $field, $atts); |
|
| 802 | + } |
|
| 803 | 803 | |
| 804 | - unset($field); |
|
| 805 | - break; |
|
| 806 | - } |
|
| 804 | + unset($field); |
|
| 805 | + break; |
|
| 806 | + } |
|
| 807 | 807 | |
| 808 | - if ( isset($replace_with) ) { |
|
| 809 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 810 | - } |
|
| 808 | + if ( isset($replace_with) ) { |
|
| 809 | + $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 810 | + } |
|
| 811 | 811 | |
| 812 | - unset($atts, $conditional, $replace_with); |
|
| 812 | + unset($atts, $conditional, $replace_with); |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | return $content; |
| 816 | - } |
|
| 817 | - |
|
| 818 | - /** |
|
| 819 | - * Get the value to replace a few standard shortcodes |
|
| 820 | - * |
|
| 821 | - * @since 2.0 |
|
| 822 | - * @return string |
|
| 823 | - */ |
|
| 824 | - public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 825 | - $new_value = ''; |
|
| 826 | - switch ( $tag ) { |
|
| 827 | - case 'admin_email': |
|
| 828 | - $new_value = get_option('admin_email'); |
|
| 829 | - break; |
|
| 830 | - case 'siteurl': |
|
| 831 | - $new_value = FrmAppHelper::site_url(); |
|
| 832 | - break; |
|
| 833 | - case 'frmurl': |
|
| 834 | - $new_value = FrmAppHelper::plugin_url(); |
|
| 835 | - break; |
|
| 836 | - case 'sitename': |
|
| 837 | - $new_value = FrmAppHelper::site_name(); |
|
| 838 | - break; |
|
| 839 | - case 'get': |
|
| 840 | - $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 841 | - break; |
|
| 842 | - } |
|
| 843 | - |
|
| 844 | - return $new_value; |
|
| 845 | - } |
|
| 846 | - |
|
| 847 | - /** |
|
| 848 | - * Process the [get] shortcode |
|
| 849 | - * |
|
| 850 | - * @since 2.0 |
|
| 851 | - * @return string|array |
|
| 852 | - */ |
|
| 853 | - public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 854 | - if ( ! isset($atts['param']) ) { |
|
| 855 | - return ''; |
|
| 856 | - } |
|
| 857 | - |
|
| 858 | - if ( strpos($atts['param'], '[') ) { |
|
| 859 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 860 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 861 | - } |
|
| 862 | - |
|
| 863 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 864 | - $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 865 | - |
|
| 866 | - if ( $new_value == '' ) { |
|
| 867 | - if ( ! isset($atts['prev_val']) ) { |
|
| 868 | - $atts['prev_val'] = ''; |
|
| 869 | - } |
|
| 870 | - |
|
| 871 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 872 | - } |
|
| 873 | - |
|
| 874 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 875 | - $new_value = implode(', ', $new_value); |
|
| 876 | - } |
|
| 877 | - |
|
| 878 | - return $new_value; |
|
| 879 | - } |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + /** |
|
| 819 | + * Get the value to replace a few standard shortcodes |
|
| 820 | + * |
|
| 821 | + * @since 2.0 |
|
| 822 | + * @return string |
|
| 823 | + */ |
|
| 824 | + public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 825 | + $new_value = ''; |
|
| 826 | + switch ( $tag ) { |
|
| 827 | + case 'admin_email': |
|
| 828 | + $new_value = get_option('admin_email'); |
|
| 829 | + break; |
|
| 830 | + case 'siteurl': |
|
| 831 | + $new_value = FrmAppHelper::site_url(); |
|
| 832 | + break; |
|
| 833 | + case 'frmurl': |
|
| 834 | + $new_value = FrmAppHelper::plugin_url(); |
|
| 835 | + break; |
|
| 836 | + case 'sitename': |
|
| 837 | + $new_value = FrmAppHelper::site_name(); |
|
| 838 | + break; |
|
| 839 | + case 'get': |
|
| 840 | + $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 841 | + break; |
|
| 842 | + } |
|
| 843 | + |
|
| 844 | + return $new_value; |
|
| 845 | + } |
|
| 846 | + |
|
| 847 | + /** |
|
| 848 | + * Process the [get] shortcode |
|
| 849 | + * |
|
| 850 | + * @since 2.0 |
|
| 851 | + * @return string|array |
|
| 852 | + */ |
|
| 853 | + public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 854 | + if ( ! isset($atts['param']) ) { |
|
| 855 | + return ''; |
|
| 856 | + } |
|
| 857 | + |
|
| 858 | + if ( strpos($atts['param'], '[') ) { |
|
| 859 | + $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 860 | + $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 861 | + } |
|
| 862 | + |
|
| 863 | + $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 864 | + $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 865 | + |
|
| 866 | + if ( $new_value == '' ) { |
|
| 867 | + if ( ! isset($atts['prev_val']) ) { |
|
| 868 | + $atts['prev_val'] = ''; |
|
| 869 | + } |
|
| 870 | + |
|
| 871 | + $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 872 | + } |
|
| 873 | + |
|
| 874 | + if ( is_array($new_value) && ! $return_array ) { |
|
| 875 | + $new_value = implode(', ', $new_value); |
|
| 876 | + } |
|
| 877 | + |
|
| 878 | + return $new_value; |
|
| 879 | + } |
|
| 880 | 880 | |
| 881 | 881 | public static function get_display_value( $replace_with, $field, $atts = array() ) { |
| 882 | 882 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 883 | 883 | |
| 884 | 884 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
| 885 | 885 | |
| 886 | - if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
|
| 887 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 888 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 889 | - if ( is_array($replace_with) ) { |
|
| 890 | - $replace_with = implode("\n", $replace_with); |
|
| 891 | - } |
|
| 892 | - $replace_with = wpautop($replace_with); |
|
| 893 | - } |
|
| 886 | + if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
|
| 887 | + $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 888 | + if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 889 | + if ( is_array($replace_with) ) { |
|
| 890 | + $replace_with = implode("\n", $replace_with); |
|
| 891 | + } |
|
| 892 | + $replace_with = wpautop($replace_with); |
|
| 893 | + } |
|
| 894 | 894 | unset( $autop ); |
| 895 | 895 | } else if ( is_array( $replace_with ) ) { |
| 896 | 896 | $replace_with = implode( $sep, $replace_with ); |
@@ -900,57 +900,57 @@ discard block |
||
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | public static function get_field_types( $type ) { |
| 903 | - $single_input = array( |
|
| 904 | - 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
| 905 | - 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
| 906 | - 'user_id', 'tag', 'password', |
|
| 907 | - ); |
|
| 903 | + $single_input = array( |
|
| 904 | + 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
| 905 | + 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
| 906 | + 'user_id', 'tag', 'password', |
|
| 907 | + ); |
|
| 908 | 908 | $multiple_input = array( 'radio', 'checkbox', 'select', 'scale' ); |
| 909 | 909 | $other_type = array( 'divider', 'html', 'break' ); |
| 910 | 910 | |
| 911 | 911 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 912 | 912 | |
| 913 | - $field_types = array(); |
|
| 914 | - if ( in_array($type, $single_input) ) { |
|
| 915 | - self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 916 | - } else if ( in_array($type, $multiple_input) ) { |
|
| 917 | - self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 918 | - } else if ( in_array($type, $other_type) ) { |
|
| 919 | - self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 913 | + $field_types = array(); |
|
| 914 | + if ( in_array($type, $single_input) ) { |
|
| 915 | + self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 916 | + } else if ( in_array($type, $multiple_input) ) { |
|
| 917 | + self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 918 | + } else if ( in_array($type, $other_type) ) { |
|
| 919 | + self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 920 | 920 | } else if ( isset( $field_selection[ $type ] ) ) { |
| 921 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 922 | - } |
|
| 923 | - |
|
| 924 | - return $field_types; |
|
| 925 | - } |
|
| 926 | - |
|
| 927 | - private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 928 | - foreach ( $inputs as $input ) { |
|
| 929 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 930 | - unset($input); |
|
| 931 | - } |
|
| 932 | - } |
|
| 933 | - |
|
| 934 | - /** |
|
| 935 | - * Check if current field option is an "other" option |
|
| 936 | - * |
|
| 937 | - * @since 2.0.6 |
|
| 938 | - * |
|
| 939 | - * @param string $opt_key |
|
| 940 | - * @return boolean Returns true if current field option is an "Other" option |
|
| 941 | - */ |
|
| 942 | - public static function is_other_opt( $opt_key ) { |
|
| 943 | - return $opt_key && strpos( $opt_key, 'other' ) !== false; |
|
| 944 | - } |
|
| 945 | - |
|
| 946 | - /** |
|
| 947 | - * Get value that belongs in "Other" text box |
|
| 948 | - * |
|
| 949 | - * @since 2.0.6 |
|
| 950 | - * |
|
| 951 | - * @param array $args |
|
| 952 | - */ |
|
| 953 | - public static function get_other_val( $args ) { |
|
| 921 | + $field_types[ $type ] = $field_selection[ $type ]; |
|
| 922 | + } |
|
| 923 | + |
|
| 924 | + return $field_types; |
|
| 925 | + } |
|
| 926 | + |
|
| 927 | + private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 928 | + foreach ( $inputs as $input ) { |
|
| 929 | + $field_types[ $input ] = $fields[ $input ]; |
|
| 930 | + unset($input); |
|
| 931 | + } |
|
| 932 | + } |
|
| 933 | + |
|
| 934 | + /** |
|
| 935 | + * Check if current field option is an "other" option |
|
| 936 | + * |
|
| 937 | + * @since 2.0.6 |
|
| 938 | + * |
|
| 939 | + * @param string $opt_key |
|
| 940 | + * @return boolean Returns true if current field option is an "Other" option |
|
| 941 | + */ |
|
| 942 | + public static function is_other_opt( $opt_key ) { |
|
| 943 | + return $opt_key && strpos( $opt_key, 'other' ) !== false; |
|
| 944 | + } |
|
| 945 | + |
|
| 946 | + /** |
|
| 947 | + * Get value that belongs in "Other" text box |
|
| 948 | + * |
|
| 949 | + * @since 2.0.6 |
|
| 950 | + * |
|
| 951 | + * @param array $args |
|
| 952 | + */ |
|
| 953 | + public static function get_other_val( $args ) { |
|
| 954 | 954 | $defaults = array( |
| 955 | 955 | 'opt_key' => 0, 'field' => array(), |
| 956 | 956 | 'parent' => false, 'pointer' => false, |
@@ -1026,20 +1026,20 @@ discard block |
||
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | return $other_val; |
| 1029 | - } |
|
| 1030 | - |
|
| 1031 | - /** |
|
| 1032 | - * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 1033 | - * Intended for front-end use |
|
| 1034 | - * |
|
| 1035 | - * @since 2.0.6 |
|
| 1036 | - * |
|
| 1037 | - * @param array $args should include field, opt_key and field name |
|
| 1038 | - * @param boolean $other_opt |
|
| 1039 | - * @param string $checked |
|
| 1040 | - * @return string $other_val |
|
| 1041 | - */ |
|
| 1042 | - public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 1029 | + } |
|
| 1030 | + |
|
| 1031 | + /** |
|
| 1032 | + * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 1033 | + * Intended for front-end use |
|
| 1034 | + * |
|
| 1035 | + * @since 2.0.6 |
|
| 1036 | + * |
|
| 1037 | + * @param array $args should include field, opt_key and field name |
|
| 1038 | + * @param boolean $other_opt |
|
| 1039 | + * @param string $checked |
|
| 1040 | + * @return string $other_val |
|
| 1041 | + */ |
|
| 1042 | + public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 1043 | 1043 | //Check if this is an "Other" option |
| 1044 | 1044 | if ( ! self::is_other_opt( $args['opt_key'] ) ) { |
| 1045 | 1045 | return; |
@@ -1055,8 +1055,8 @@ discard block |
||
| 1055 | 1055 | $checked = 'checked="checked" '; |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | - return $other_args; |
|
| 1059 | - } |
|
| 1058 | + return $other_args; |
|
| 1059 | + } |
|
| 1060 | 1060 | |
| 1061 | 1061 | /** |
| 1062 | 1062 | * @param array $args |
@@ -1105,8 +1105,8 @@ discard block |
||
| 1105 | 1105 | * @since 2.0.6 |
| 1106 | 1106 | */ |
| 1107 | 1107 | public static function include_other_input( $args ) { |
| 1108 | - if ( ! $args['other_opt'] ) { |
|
| 1109 | - return; |
|
| 1108 | + if ( ! $args['other_opt'] ) { |
|
| 1109 | + return; |
|
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | $classes = array( 'frm_other_input' ); |
@@ -1127,15 +1127,15 @@ discard block |
||
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | /** |
| 1130 | - * Get the HTML id for an "Other" text field |
|
| 1131 | - * Note: This does not affect fields in repeating sections |
|
| 1132 | - * |
|
| 1133 | - * @since 2.0.08 |
|
| 1134 | - * @param string $type - field type |
|
| 1135 | - * @param string $html_id |
|
| 1136 | - * @param string|boolean $opt_key |
|
| 1137 | - * @return string $other_id |
|
| 1138 | - */ |
|
| 1130 | + * Get the HTML id for an "Other" text field |
|
| 1131 | + * Note: This does not affect fields in repeating sections |
|
| 1132 | + * |
|
| 1133 | + * @since 2.0.08 |
|
| 1134 | + * @param string $type - field type |
|
| 1135 | + * @param string $html_id |
|
| 1136 | + * @param string|boolean $opt_key |
|
| 1137 | + * @return string $other_id |
|
| 1138 | + */ |
|
| 1139 | 1139 | public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) { |
| 1140 | 1140 | $other_id = $html_id; |
| 1141 | 1141 | |
@@ -1190,171 +1190,171 @@ discard block |
||
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | public static function switch_field_ids( $val ) { |
| 1193 | - global $frm_duplicate_ids; |
|
| 1194 | - $replace = array(); |
|
| 1195 | - $replace_with = array(); |
|
| 1196 | - foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1197 | - $replace[] = '[if '. $old .']'; |
|
| 1198 | - $replace_with[] = '[if '. $new .']'; |
|
| 1199 | - $replace[] = '[if '. $old .' '; |
|
| 1200 | - $replace_with[] = '[if '. $new .' '; |
|
| 1201 | - $replace[] = '[/if '. $old .']'; |
|
| 1202 | - $replace_with[] = '[/if '. $new .']'; |
|
| 1203 | - $replace[] = '[foreach '. $old .']'; |
|
| 1204 | - $replace_with[] = '[foreach '. $new .']'; |
|
| 1205 | - $replace[] = '[/foreach '. $old .']'; |
|
| 1206 | - $replace_with[] = '[/foreach '. $new .']'; |
|
| 1207 | - $replace[] = '['. $old .']'; |
|
| 1208 | - $replace_with[] = '['. $new .']'; |
|
| 1209 | - $replace[] = '['. $old .' '; |
|
| 1210 | - $replace_with[] = '['. $new .' '; |
|
| 1211 | - unset($old, $new); |
|
| 1212 | - } |
|
| 1193 | + global $frm_duplicate_ids; |
|
| 1194 | + $replace = array(); |
|
| 1195 | + $replace_with = array(); |
|
| 1196 | + foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1197 | + $replace[] = '[if '. $old .']'; |
|
| 1198 | + $replace_with[] = '[if '. $new .']'; |
|
| 1199 | + $replace[] = '[if '. $old .' '; |
|
| 1200 | + $replace_with[] = '[if '. $new .' '; |
|
| 1201 | + $replace[] = '[/if '. $old .']'; |
|
| 1202 | + $replace_with[] = '[/if '. $new .']'; |
|
| 1203 | + $replace[] = '[foreach '. $old .']'; |
|
| 1204 | + $replace_with[] = '[foreach '. $new .']'; |
|
| 1205 | + $replace[] = '[/foreach '. $old .']'; |
|
| 1206 | + $replace_with[] = '[/foreach '. $new .']'; |
|
| 1207 | + $replace[] = '['. $old .']'; |
|
| 1208 | + $replace_with[] = '['. $new .']'; |
|
| 1209 | + $replace[] = '['. $old .' '; |
|
| 1210 | + $replace_with[] = '['. $new .' '; |
|
| 1211 | + unset($old, $new); |
|
| 1212 | + } |
|
| 1213 | 1213 | if ( is_array( $val ) ) { |
| 1214 | 1214 | foreach ( $val as $k => $v ) { |
| 1215 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1216 | - unset($k, $v); |
|
| 1217 | - } |
|
| 1218 | - } else { |
|
| 1219 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1220 | - } |
|
| 1221 | - |
|
| 1222 | - return $val; |
|
| 1223 | - } |
|
| 1224 | - |
|
| 1225 | - public static function get_us_states() { |
|
| 1226 | - return apply_filters( 'frm_us_states', array( |
|
| 1227 | - 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
| 1228 | - 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
| 1229 | - 'DC' => 'District of Columbia', |
|
| 1230 | - 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
| 1231 | - 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
| 1232 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1233 | - 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
| 1234 | - 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
| 1235 | - 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
| 1236 | - 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
| 1237 | - 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
| 1238 | - 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
| 1239 | - 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
| 1240 | - 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
| 1241 | - ) ); |
|
| 1242 | - } |
|
| 1243 | - |
|
| 1244 | - public static function get_countries() { |
|
| 1245 | - return apply_filters( 'frm_countries', array( |
|
| 1246 | - __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
| 1247 | - __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
| 1248 | - __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
| 1249 | - __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
| 1250 | - __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
| 1251 | - __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
| 1252 | - __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
| 1253 | - __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
| 1254 | - __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
| 1255 | - __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
| 1256 | - __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
| 1257 | - __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
| 1258 | - __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
| 1259 | - __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
| 1260 | - __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
| 1261 | - __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
| 1262 | - __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
| 1263 | - __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
| 1264 | - __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
| 1265 | - __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
| 1266 | - __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
| 1267 | - __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
| 1268 | - __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
| 1269 | - __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
| 1270 | - __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
| 1271 | - __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
| 1272 | - __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
| 1273 | - __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
| 1274 | - __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
| 1275 | - __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
| 1276 | - __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
| 1277 | - __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
| 1278 | - __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
| 1279 | - __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
| 1280 | - __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
| 1281 | - __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
| 1282 | - __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
| 1283 | - __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
| 1284 | - __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
| 1285 | - __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
| 1286 | - __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
| 1287 | - __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
| 1288 | - __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
| 1289 | - __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
| 1290 | - __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
| 1291 | - __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
| 1292 | - __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
| 1293 | - __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
| 1294 | - __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
| 1295 | - __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
| 1296 | - __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
| 1297 | - __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
| 1298 | - __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
| 1299 | - __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
| 1300 | - __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
| 1301 | - __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
| 1302 | - __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
| 1303 | - __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
| 1304 | - __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
| 1305 | - __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
| 1306 | - __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
| 1307 | - __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
| 1308 | - __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
| 1309 | - __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
| 1310 | - __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
| 1311 | - __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
| 1312 | - __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
| 1313 | - __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
| 1314 | - __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
| 1315 | - __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
| 1316 | - __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
| 1317 | - __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
| 1318 | - __( 'Zimbabwe', 'formidable' ), |
|
| 1319 | - ) ); |
|
| 1320 | - } |
|
| 1215 | + $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1216 | + unset($k, $v); |
|
| 1217 | + } |
|
| 1218 | + } else { |
|
| 1219 | + $val = str_replace($replace, $replace_with, $val); |
|
| 1220 | + } |
|
| 1221 | + |
|
| 1222 | + return $val; |
|
| 1223 | + } |
|
| 1224 | + |
|
| 1225 | + public static function get_us_states() { |
|
| 1226 | + return apply_filters( 'frm_us_states', array( |
|
| 1227 | + 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
| 1228 | + 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
| 1229 | + 'DC' => 'District of Columbia', |
|
| 1230 | + 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
| 1231 | + 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
| 1232 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1233 | + 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
| 1234 | + 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
| 1235 | + 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
| 1236 | + 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
| 1237 | + 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
| 1238 | + 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
| 1239 | + 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
| 1240 | + 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
| 1241 | + ) ); |
|
| 1242 | + } |
|
| 1243 | + |
|
| 1244 | + public static function get_countries() { |
|
| 1245 | + return apply_filters( 'frm_countries', array( |
|
| 1246 | + __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
| 1247 | + __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
| 1248 | + __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
| 1249 | + __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
| 1250 | + __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
| 1251 | + __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
| 1252 | + __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
| 1253 | + __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
| 1254 | + __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
| 1255 | + __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
| 1256 | + __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
| 1257 | + __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
| 1258 | + __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
| 1259 | + __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
| 1260 | + __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
| 1261 | + __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
| 1262 | + __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
| 1263 | + __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
| 1264 | + __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
| 1265 | + __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
| 1266 | + __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
| 1267 | + __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
| 1268 | + __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
| 1269 | + __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
| 1270 | + __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
| 1271 | + __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
| 1272 | + __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
| 1273 | + __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
| 1274 | + __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
| 1275 | + __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
| 1276 | + __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
| 1277 | + __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
| 1278 | + __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
| 1279 | + __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
| 1280 | + __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
| 1281 | + __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
| 1282 | + __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
| 1283 | + __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
| 1284 | + __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
| 1285 | + __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
| 1286 | + __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
| 1287 | + __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
| 1288 | + __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
| 1289 | + __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
| 1290 | + __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
| 1291 | + __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
| 1292 | + __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
| 1293 | + __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
| 1294 | + __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
| 1295 | + __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
| 1296 | + __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
| 1297 | + __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
| 1298 | + __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
| 1299 | + __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
| 1300 | + __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
| 1301 | + __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
| 1302 | + __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
| 1303 | + __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
| 1304 | + __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
| 1305 | + __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
| 1306 | + __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
| 1307 | + __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
| 1308 | + __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
| 1309 | + __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
| 1310 | + __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
| 1311 | + __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
| 1312 | + __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
| 1313 | + __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
| 1314 | + __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
| 1315 | + __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
| 1316 | + __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
| 1317 | + __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
| 1318 | + __( 'Zimbabwe', 'formidable' ), |
|
| 1319 | + ) ); |
|
| 1320 | + } |
|
| 1321 | 1321 | |
| 1322 | 1322 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1323 | 1323 | $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
| 1324 | 1324 | |
| 1325 | - $states = FrmFieldsHelper::get_us_states(); |
|
| 1326 | - $state_abv = array_keys($states); |
|
| 1327 | - sort($state_abv); |
|
| 1325 | + $states = FrmFieldsHelper::get_us_states(); |
|
| 1326 | + $state_abv = array_keys($states); |
|
| 1327 | + sort($state_abv); |
|
| 1328 | 1328 | $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
| 1329 | 1329 | |
| 1330 | - $states = array_values($states); |
|
| 1331 | - sort($states); |
|
| 1330 | + $states = array_values($states); |
|
| 1331 | + sort($states); |
|
| 1332 | 1332 | $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
| 1333 | - unset($state_abv, $states); |
|
| 1333 | + unset($state_abv, $states); |
|
| 1334 | 1334 | |
| 1335 | 1335 | $prepop[ __( 'Age', 'formidable' ) ] = array( |
| 1336 | - __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
| 1337 | - __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
| 1338 | - __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
| 1339 | - ); |
|
| 1336 | + __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
| 1337 | + __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
| 1338 | + __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
| 1339 | + ); |
|
| 1340 | 1340 | |
| 1341 | 1341 | $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
| 1342 | - __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1343 | - __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1344 | - ); |
|
| 1342 | + __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1343 | + __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1344 | + ); |
|
| 1345 | 1345 | |
| 1346 | 1346 | $prepop[ __( 'Importance', 'formidable' ) ] = array( |
| 1347 | - __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1348 | - __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1349 | - ); |
|
| 1347 | + __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1348 | + __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1349 | + ); |
|
| 1350 | 1350 | |
| 1351 | 1351 | $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
| 1352 | - __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1353 | - __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1354 | - ); |
|
| 1352 | + __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1353 | + __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1354 | + ); |
|
| 1355 | 1355 | |
| 1356 | 1356 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 1357 | - } |
|
| 1357 | + } |
|
| 1358 | 1358 | |
| 1359 | 1359 | public static function field_selection() { |
| 1360 | 1360 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' ); |
@@ -1391,8 +1391,8 @@ discard block |
||
| 1391 | 1391 | return FrmField::is_required( $field ); |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | - public static function maybe_get_field( &$field ) { |
|
| 1394 | + public static function maybe_get_field( &$field ) { |
|
| 1395 | 1395 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' ); |
| 1396 | 1396 | FrmField::maybe_get_field( $field ); |
| 1397 | - } |
|
| 1397 | + } |
|
| 1398 | 1398 | } |
@@ -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 | |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
| 9 | 9 | |
| 10 | - if ( strpos($type, '|') ) { |
|
| 11 | - list($type, $setting) = explode('|', $type); |
|
| 10 | + if ( strpos( $type, '|' ) ) { |
|
| 11 | + list( $type, $setting ) = explode( '|', $type ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 14 | + $defaults = self::get_default_field_opts( $type, $form_id ); |
|
| 15 | + $defaults['field_options']['custom_html'] = self::get_default_html( $type ); |
|
| 16 | 16 | |
| 17 | 17 | $values = array(); |
| 18 | 18 | |
@@ -20,20 +20,20 @@ discard block |
||
| 20 | 20 | if ( $var == 'field_options' ) { |
| 21 | 21 | $values['field_options'] = array(); |
| 22 | 22 | foreach ( $default as $opt_var => $opt_default ) { |
| 23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | - unset($opt_var, $opt_default); |
|
| 23 | + $values['field_options'][$opt_var] = $opt_default; |
|
| 24 | + unset( $opt_var, $opt_default ); |
|
| 25 | 25 | } |
| 26 | 26 | } else { |
| 27 | - $values[ $var ] = $default; |
|
| 27 | + $values[$var] = $default; |
|
| 28 | 28 | } |
| 29 | - unset($var, $default); |
|
| 29 | + unset( $var, $default ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ( isset( $setting ) && ! empty( $setting ) ) { |
| 33 | 33 | if ( 'data' == $type ) { |
| 34 | 34 | $values['field_options']['data_type'] = $setting; |
| 35 | 35 | } else { |
| 36 | - $values['field_options'][ $setting ] = 1; |
|
| 36 | + $values['field_options'][$setting] = 1; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $fields = FrmField::field_selection(); |
| 59 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 59 | + $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
|
| 60 | 60 | |
| 61 | - if ( isset( $fields[ $type ] ) ) { |
|
| 62 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 61 | + if ( isset( $fields[$type] ) ) { |
|
| 62 | + $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type]; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - unset($fields); |
|
| 65 | + unset( $fields ); |
|
| 66 | 66 | |
| 67 | 67 | return $values; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public static function get_html_id( $field, $plus = '' ) { |
| 71 | - return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field); |
|
| 71 | + return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field ); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public static function setup_edit_vars( $record, $doing_ajax = false ) { |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $values['form_name'] = ''; |
| 89 | 89 | } else { |
| 90 | 90 | foreach ( $defaults as $var => $default ) { |
| 91 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 92 | - unset($var, $default); |
|
| 91 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 92 | + unset( $var, $default ); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $values['options'] = $record->options; |
| 101 | 101 | $values['field_options'] = $record->field_options; |
| 102 | 102 | |
| 103 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 103 | + $defaults = self::get_default_field_opts( $values['type'], $record, true ); |
|
| 104 | 104 | |
| 105 | 105 | if ( $values['type'] == 'captcha' ) { |
| 106 | 106 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ( $defaults as $opt => $default ) { |
| 111 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 112 | - unset($opt, $default); |
|
| 111 | + $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default; |
|
| 112 | + unset( $opt, $default ); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 115 | + $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type ); |
|
| 116 | 116 | |
| 117 | 117 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 118 | 118 | } |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | global $wpdb; |
| 133 | 133 | |
| 134 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 134 | + $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id; |
|
| 135 | 135 | |
| 136 | - $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key; |
|
| 136 | + $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key; |
|
| 137 | 137 | |
| 138 | 138 | $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); |
| 139 | 139 | |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
| 152 | 152 | global $wpdb; |
| 153 | 153 | |
| 154 | - $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key'); |
|
| 154 | + $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
|
| 155 | 155 | $values['form_id'] = $form_id; |
| 156 | - $values['options'] = maybe_serialize($field->options); |
|
| 157 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 156 | + $values['options'] = maybe_serialize( $field->options ); |
|
| 157 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
| 158 | 158 | |
| 159 | 159 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 160 | - $values[ $col ] = $field->{$col}; |
|
| 160 | + $values[$col] = $field->{$col}; |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
@@ -170,19 +170,19 @@ discard block |
||
| 170 | 170 | $field_name = is_array( $field ) ? $field['name'] : $field->name; |
| 171 | 171 | |
| 172 | 172 | $defaults = array( |
| 173 | - 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ), |
|
| 174 | - 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ), |
|
| 173 | + 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ), |
|
| 174 | + 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ), |
|
| 175 | 175 | 'blank' => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ), |
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | 178 | $msg = FrmField::get_option( $field, $error ); |
| 179 | - $msg = ( $msg == $defaults[ $error ]['full'] || empty( $msg ) ) ? $defaults[ $error ]['part'] : $msg; |
|
| 179 | + $msg = ( $msg == $defaults[$error]['full'] || empty( $msg ) ) ? $defaults[$error]['part'] : $msg; |
|
| 180 | 180 | return $msg; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | public static function get_form_fields( $form_id, $error = false ) { |
| 184 | - $fields = FrmField::get_all_for_form($form_id); |
|
| 185 | - $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error); |
|
| 184 | + $fields = FrmField::get_all_for_form( $form_id ); |
|
| 185 | + $fields = apply_filters( 'frm_get_paged_fields', $fields, $form_id, $error ); |
|
| 186 | 186 | return $fields; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -205,57 +205,57 @@ discard block |
||
| 205 | 205 | </div> |
| 206 | 206 | DEFAULT_HTML; |
| 207 | 207 | } else { |
| 208 | - $default_html = apply_filters('frm_other_custom_html', '', $type); |
|
| 208 | + $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 211 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 215 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 215 | + $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form ); |
|
| 216 | 216 | |
| 217 | 217 | $defaults = array( |
| 218 | - 'field_name' => 'item_meta['. $field['id'] .']', |
|
| 218 | + 'field_name' => 'item_meta[' . $field['id'] . ']', |
|
| 219 | 219 | 'field_id' => $field['id'], |
| 220 | 220 | 'field_plus_id' => '', |
| 221 | 221 | 'section_id' => '', |
| 222 | 222 | ); |
| 223 | - $args = wp_parse_args($args, $defaults); |
|
| 223 | + $args = wp_parse_args( $args, $defaults ); |
|
| 224 | 224 | $field_name = $args['field_name']; |
| 225 | 225 | $field_id = $args['field_id']; |
| 226 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 226 | + $html_id = self::get_html_id( $field, $args['field_plus_id'] ); |
|
| 227 | 227 | |
| 228 | - if ( FrmField::is_multiple_select($field) ) { |
|
| 228 | + if ( FrmField::is_multiple_select( $field ) ) { |
|
| 229 | 229 | $field_name .= '[]'; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | //replace [id] |
| 233 | - $html = str_replace('[id]', $field_id, $html); |
|
| 233 | + $html = str_replace( '[id]', $field_id, $html ); |
|
| 234 | 234 | |
| 235 | 235 | // Remove the for attribute for captcha |
| 236 | 236 | if ( $field['type'] == 'captcha' ) { |
| 237 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
| 237 | + $html = str_replace( ' for="field_[key]"', '', $html ); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // set the label for |
| 241 | - $html = str_replace('field_[key]', $html_id, $html); |
|
| 241 | + $html = str_replace( 'field_[key]', $html_id, $html ); |
|
| 242 | 242 | |
| 243 | 243 | //replace [key] |
| 244 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
| 244 | + $html = str_replace( '[key]', $field['field_key'], $html ); |
|
| 245 | 245 | |
| 246 | 246 | //replace [description] and [required_label] and [error] |
| 247 | 247 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
| 248 | 248 | if ( ! is_array( $errors ) ) { |
| 249 | 249 | $errors = array(); |
| 250 | 250 | } |
| 251 | - $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
|
| 251 | + $error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false; |
|
| 252 | 252 | |
| 253 | 253 | //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
| 254 | 254 | if ( $field['type'] == 'divider' ) { |
| 255 | 255 | if ( FrmField::is_option_true( $field, 'description' ) ) { |
| 256 | 256 | $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
| 257 | 257 | } else { |
| 258 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 258 | + $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html ); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -265,83 +265,83 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | //replace [required_class] |
| 267 | 267 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
| 268 | - $html = str_replace('[required_class]', $required_class, $html); |
|
| 268 | + $html = str_replace( '[required_class]', $required_class, $html ); |
|
| 269 | 269 | |
| 270 | 270 | //replace [label_position] |
| 271 | - $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 271 | + $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form ); |
|
| 272 | 272 | $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
| 273 | 273 | $html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html ); |
| 274 | 274 | |
| 275 | 275 | //replace [field_name] |
| 276 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
| 276 | + $html = str_replace( '[field_name]', $field['name'], $html ); |
|
| 277 | 277 | |
| 278 | 278 | //replace [error_class] |
| 279 | - $error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
|
| 279 | + $error_class = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : ''; |
|
| 280 | 280 | self::get_more_field_classes( $error_class, $field, $field_id, $html ); |
| 281 | 281 | if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) { |
| 282 | 282 | // there is no error_class shortcode to use for addign fields |
| 283 | 283 | $html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html ); |
| 284 | 284 | } |
| 285 | - $html = str_replace('[error_class]', $error_class, $html); |
|
| 285 | + $html = str_replace( '[error_class]', $error_class, $html ); |
|
| 286 | 286 | |
| 287 | 287 | //replace [entry_key] |
| 288 | 288 | $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
| 289 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 289 | + $html = str_replace( '[entry_key]', $entry_key, $html ); |
|
| 290 | 290 | |
| 291 | 291 | //replace [input] |
| 292 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 292 | + preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
| 293 | 293 | global $frm_vars; |
| 294 | 294 | $frm_settings = FrmAppHelper::get_settings(); |
| 295 | 295 | |
| 296 | 296 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 297 | - $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
| 297 | + $atts = shortcode_parse_atts( $shortcodes[2][$short_key] ); |
|
| 298 | 298 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
| 299 | 299 | |
| 300 | 300 | $replace_with = ''; |
| 301 | 301 | |
| 302 | 302 | if ( $tag == 'input' ) { |
| 303 | - if ( isset($atts['opt']) ) { |
|
| 304 | - $atts['opt']--; |
|
| 303 | + if ( isset( $atts['opt'] ) ) { |
|
| 304 | + $atts['opt'] --; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 308 | - if ( isset($atts['class']) ) { |
|
| 309 | - unset($atts['class']); |
|
| 307 | + $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : ''; |
|
| 308 | + if ( isset( $atts['class'] ) ) { |
|
| 309 | + unset( $atts['class'] ); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $field['shortcodes'] = $atts; |
| 313 | 313 | ob_start(); |
| 314 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php'); |
|
| 314 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' ); |
|
| 315 | 315 | $replace_with = ob_get_contents(); |
| 316 | 316 | ob_end_clean(); |
| 317 | 317 | } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
| 318 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 318 | + $replace_with = FrmProEntriesController::entry_delete_link( $atts ); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 321 | + $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html ); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if ( $form ) { |
| 325 | 325 | $form = (array) $form; |
| 326 | 326 | |
| 327 | 327 | //replace [form_key] |
| 328 | - $html = str_replace('[form_key]', $form['form_key'], $html); |
|
| 328 | + $html = str_replace( '[form_key]', $form['form_key'], $html ); |
|
| 329 | 329 | |
| 330 | 330 | //replace [form_name] |
| 331 | - $html = str_replace('[form_name]', $form['name'], $html); |
|
| 331 | + $html = str_replace( '[form_name]', $form['name'], $html ); |
|
| 332 | 332 | } |
| 333 | 333 | $html .= "\n"; |
| 334 | 334 | |
| 335 | 335 | //Return html if conf_field to prevent loop |
| 336 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 336 | + if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) { |
|
| 337 | 337 | return $html; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | //If field is in repeating section |
| 341 | 341 | if ( $args['section_id'] ) { |
| 342 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 342 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) ); |
|
| 343 | 343 | } else { |
| 344 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 344 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) ); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | self::remove_collapse_shortcode( $html ); |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | * @param $html string |
| 364 | 364 | */ |
| 365 | 365 | private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) { |
| 366 | - $error_class .= ' frm_'. $field['label'] .'_container'; |
|
| 366 | + $error_class .= ' frm_' . $field['label'] . '_container'; |
|
| 367 | 367 | if ( $field['id'] != $field_id ) { |
| 368 | 368 | // add a class for repeating/embedded fields |
| 369 | - $error_class .= ' frm_field_'. $field['id'] .'_container'; |
|
| 369 | + $error_class .= ' frm_field_' . $field['id'] . '_container'; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // Add class to embedded form field |
@@ -413,22 +413,22 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | //insert custom CSS classes |
| 415 | 415 | if ( ! empty( $field['classes'] ) ) { |
| 416 | - if ( ! strpos( $html, 'frm_form_field ') ) { |
|
| 416 | + if ( ! strpos( $html, 'frm_form_field ' ) ) { |
|
| 417 | 417 | $error_class .= ' frm_form_field'; |
| 418 | 418 | } |
| 419 | - $error_class .= ' '. $field['classes']; |
|
| 419 | + $error_class .= ' ' . $field['classes']; |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
| 424 | 424 | if ( $no_vars ) { |
| 425 | - $html = str_replace( '[if '. $code.']', '', $html ); |
|
| 426 | - $html = str_replace( '[/if '. $code.']', '', $html ); |
|
| 425 | + $html = str_replace( '[if ' . $code . ']', '', $html ); |
|
| 426 | + $html = str_replace( '[/if ' . $code . ']', '', $html ); |
|
| 427 | 427 | } else { |
| 428 | - $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html ); |
|
| 428 | + $html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html ); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - $html = str_replace( '['. $code .']', $replace_with, $html ); |
|
| 431 | + $html = str_replace( '[' . $code . ']', $replace_with, $html ); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
@@ -447,15 +447,15 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 450 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 451 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 452 | - $tag = str_replace(']', '', $tag); |
|
| 453 | - $tags = explode(' ', $tag); |
|
| 454 | - if ( is_array($tags) ) { |
|
| 450 | + if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) { |
|
| 451 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] ); |
|
| 452 | + $tag = str_replace( ']', '', $tag ); |
|
| 453 | + $tags = explode( ' ', $tag ); |
|
| 454 | + if ( is_array( $tags ) ) { |
|
| 455 | 455 | $tag = $tags[0]; |
| 456 | 456 | } |
| 457 | 457 | } else { |
| 458 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 458 | + $tag = $shortcodes[$with_tags - 1][$short_key]; |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | return $tag; |
@@ -473,16 +473,16 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | public static function display_recaptcha( $field ) { |
| 475 | 475 | $frm_settings = FrmAppHelper::get_settings(); |
| 476 | - $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field); |
|
| 476 | + $lang = apply_filters( 'frm_recaptcha_lang', $frm_settings->re_lang, $field ); |
|
| 477 | 477 | |
| 478 | 478 | $api_js_url = 'https://www.google.com/recaptcha/api.js'; |
| 479 | 479 | if ( $lang != 'en' ) { |
| 480 | - $api_js_url .= '?hl='. $lang; |
|
| 480 | + $api_js_url .= '?hl=' . $lang; |
|
| 481 | 481 | } |
| 482 | - $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url); |
|
| 482 | + $api_js_url = apply_filters( 'frm_recpatcha_js_url', $api_js_url ); |
|
| 483 | 483 | |
| 484 | - wp_register_script('recaptcha-api', $api_js_url, '', true); |
|
| 485 | - wp_enqueue_script('recaptcha-api'); |
|
| 484 | + wp_register_script( 'recaptcha-api', $api_js_url, '', true ); |
|
| 485 | + wp_enqueue_script( 'recaptcha-api' ); |
|
| 486 | 486 | |
| 487 | 487 | ?> |
| 488 | 488 | <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div> |
@@ -491,45 +491,45 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | public static function show_single_option( $field ) { |
| 493 | 493 | $field_name = $field['name']; |
| 494 | - $html_id = self::get_html_id($field); |
|
| 494 | + $html_id = self::get_html_id( $field ); |
|
| 495 | 495 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 496 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 497 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 496 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 497 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
| 498 | 498 | |
| 499 | 499 | // If this is an "Other" option, get the HTML for it |
| 500 | 500 | if ( self::is_other_opt( $opt_key ) ) { |
| 501 | 501 | // Get string for Other text field, if needed |
| 502 | 502 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
| 503 | - require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php'); |
|
| 503 | + require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' ); |
|
| 504 | 504 | } else { |
| 505 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php'); |
|
| 505 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | public static function dropdown_categories( $args ) { |
| 511 | 511 | $defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' ); |
| 512 | - $args = wp_parse_args($args, $defaults); |
|
| 512 | + $args = wp_parse_args( $args, $defaults ); |
|
| 513 | 513 | |
| 514 | 514 | if ( ! $args['field'] ) { |
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ( ! $args['name'] ) { |
| 519 | - $args['name'] = 'item_meta['. $args['field']['id'] .']'; |
|
| 519 | + $args['name'] = 'item_meta[' . $args['field']['id'] . ']'; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - $id = self::get_html_id($args['field']); |
|
| 522 | + $id = self::get_html_id( $args['field'] ); |
|
| 523 | 523 | $class = $args['field']['type']; |
| 524 | 524 | |
| 525 | - $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat']; |
|
| 526 | - $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']); |
|
| 525 | + $exclude = ( is_array( $args['field']['exclude_cat'] ) ) ? implode( ',', $args['field']['exclude_cat'] ) : $args['field']['exclude_cat']; |
|
| 526 | + $exclude = apply_filters( 'frm_exclude_cats', $exclude, $args['field'] ); |
|
| 527 | 527 | |
| 528 | - if ( is_array($args['field']['value']) ) { |
|
| 529 | - if ( ! empty($exclude) ) { |
|
| 530 | - $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude)); |
|
| 528 | + if ( is_array( $args['field']['value'] ) ) { |
|
| 529 | + if ( ! empty( $exclude ) ) { |
|
| 530 | + $args['field']['value'] = array_diff( $args['field']['value'], explode( ',', $exclude ) ); |
|
| 531 | 531 | } |
| 532 | - $selected = reset($args['field']['value']); |
|
| 532 | + $selected = reset( $args['field']['value'] ); |
|
| 533 | 533 | } else { |
| 534 | 534 | $selected = $args['field']['value']; |
| 535 | 535 | } |
@@ -540,40 +540,40 @@ discard block |
||
| 540 | 540 | 'hide_empty' => false, 'echo' => 0, 'orderby' => 'name', |
| 541 | 541 | ); |
| 542 | 542 | |
| 543 | - $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']); |
|
| 543 | + $tax_atts = apply_filters( 'frm_dropdown_cat', $tax_atts, $args['field'] ); |
|
| 544 | 544 | |
| 545 | 545 | if ( FrmAppHelper::pro_is_installed() ) { |
| 546 | - $post_type = FrmProFormsHelper::post_type($args['field']['form_id']); |
|
| 547 | - $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']); |
|
| 546 | + $post_type = FrmProFormsHelper::post_type( $args['field']['form_id'] ); |
|
| 547 | + $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy( $post_type, $args['field'] ); |
|
| 548 | 548 | if ( ! $tax_atts['taxonomy'] ) { |
| 549 | 549 | return; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // If field type is dropdown (not Dynamic), exclude children when parent is excluded |
| 553 | - if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) { |
|
| 553 | + if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical( $tax_atts['taxonomy'] ) ) { |
|
| 554 | 554 | $tax_atts['exclude_tree'] = $exclude; |
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | - $dropdown = wp_dropdown_categories($tax_atts); |
|
| 558 | + $dropdown = wp_dropdown_categories( $tax_atts ); |
|
| 559 | 559 | |
| 560 | - $add_html = FrmFieldsController::input_html($args['field'], false); |
|
| 560 | + $add_html = FrmFieldsController::input_html( $args['field'], false ); |
|
| 561 | 561 | |
| 562 | 562 | if ( FrmAppHelper::pro_is_installed() ) { |
| 563 | - $add_html .= FrmProFieldsController::input_html($args['field'], false); |
|
| 563 | + $add_html .= FrmProFieldsController::input_html( $args['field'], false ); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - $dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) ."' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown ); |
|
| 566 | + $dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown ); |
|
| 567 | 567 | |
| 568 | - if ( is_array($args['field']['value']) ) { |
|
| 568 | + if ( is_array( $args['field']['value'] ) ) { |
|
| 569 | 569 | $skip = true; |
| 570 | 570 | foreach ( $args['field']['value'] as $v ) { |
| 571 | 571 | if ( $skip ) { |
| 572 | 572 | $skip = false; |
| 573 | 573 | continue; |
| 574 | 574 | } |
| 575 | - $dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown ); |
|
| 576 | - unset($v); |
|
| 575 | + $dropdown = str_replace( ' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown ); |
|
| 576 | + unset( $v ); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
@@ -581,16 +581,16 @@ discard block |
||
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | public static function get_term_link( $tax_id ) { |
| 584 | - $tax = get_taxonomy($tax_id); |
|
| 584 | + $tax = get_taxonomy( $tax_id ); |
|
| 585 | 585 | if ( ! $tax ) { |
| 586 | 586 | return; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | $link = sprintf( |
| 590 | 590 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
| 591 | - '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>' |
|
| 591 | + '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
|
| 592 | 592 | ); |
| 593 | - unset($tax); |
|
| 593 | + unset( $tax ); |
|
| 594 | 594 | |
| 595 | 595 | return $link; |
| 596 | 596 | } |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | $hide_opt = rtrim( $hide_opt ); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if ( is_array($observed_value) ) { |
|
| 605 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 604 | + if ( is_array( $observed_value ) ) { |
|
| 605 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | $m = false; |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | } else if ( $cond == '<' ) { |
| 616 | 616 | $m = $observed_value < $hide_opt; |
| 617 | 617 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 618 | - $m = stripos($observed_value, $hide_opt); |
|
| 618 | + $m = stripos( $observed_value, $hide_opt ); |
|
| 619 | 619 | if ( $cond == 'not LIKE' ) { |
| 620 | 620 | $m = ( $m === false ) ? true : false; |
| 621 | 621 | } else { |
@@ -628,23 +628,23 @@ discard block |
||
| 628 | 628 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 629 | 629 | $m = false; |
| 630 | 630 | if ( $cond == '==' ) { |
| 631 | - if ( is_array($hide_opt) ) { |
|
| 632 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 633 | - $m = empty($m) ? false : true; |
|
| 631 | + if ( is_array( $hide_opt ) ) { |
|
| 632 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
| 633 | + $m = empty( $m ) ? false : true; |
|
| 634 | 634 | } else { |
| 635 | - $m = in_array($hide_opt, $observed_value); |
|
| 635 | + $m = in_array( $hide_opt, $observed_value ); |
|
| 636 | 636 | } |
| 637 | 637 | } else if ( $cond == '!=' ) { |
| 638 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 638 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
| 639 | 639 | } else if ( $cond == '>' ) { |
| 640 | - $min = min($observed_value); |
|
| 640 | + $min = min( $observed_value ); |
|
| 641 | 641 | $m = $min > $hide_opt; |
| 642 | 642 | } else if ( $cond == '<' ) { |
| 643 | - $max = max($observed_value); |
|
| 643 | + $max = max( $observed_value ); |
|
| 644 | 644 | $m = $max < $hide_opt; |
| 645 | 645 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 646 | 646 | foreach ( $observed_value as $ob ) { |
| 647 | - $m = strpos($ob, $hide_opt); |
|
| 647 | + $m = strpos( $ob, $hide_opt ); |
|
| 648 | 648 | if ( $m !== false ) { |
| 649 | 649 | $m = true; |
| 650 | 650 | break; |
@@ -665,27 +665,27 @@ discard block |
||
| 665 | 665 | * @return string |
| 666 | 666 | */ |
| 667 | 667 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 668 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 668 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
| 669 | 669 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
| 670 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 670 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 674 | - $value = do_shortcode($value); |
|
| 673 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
| 674 | + $value = do_shortcode( $value ); |
|
| 675 | 675 | |
| 676 | 676 | return $value; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | public static function get_shortcodes( $content, $form_id ) { |
| 680 | 680 | if ( FrmAppHelper::pro_is_installed() ) { |
| 681 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 681 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
| 685 | 685 | |
| 686 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 686 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
| 687 | 687 | |
| 688 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 688 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
| 689 | 689 | |
| 690 | 690 | return $matches; |
| 691 | 691 | } |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | $tagregexp[] = $field->field_key; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | - $tagregexp = implode('|', $tagregexp); |
|
| 706 | + $tagregexp = implode( '|', $tagregexp ); |
|
| 707 | 707 | return $tagregexp; |
| 708 | 708 | } |
| 709 | 709 | |
@@ -715,28 +715,28 @@ discard block |
||
| 715 | 715 | ); |
| 716 | 716 | |
| 717 | 717 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 718 | - $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] ); |
|
| 718 | + $atts = shortcode_parse_atts( $shortcodes[3][$short_key] ); |
|
| 719 | 719 | |
| 720 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 721 | - $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
|
| 722 | - $tags = explode(' ', $tag); |
|
| 723 | - if ( is_array($tags) ) { |
|
| 720 | + if ( ! empty( $shortcodes[3][$short_key] ) ) { |
|
| 721 | + $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] ); |
|
| 722 | + $tags = explode( ' ', $tag ); |
|
| 723 | + if ( is_array( $tags ) ) { |
|
| 724 | 724 | $tag = $tags[0]; |
| 725 | 725 | } |
| 726 | 726 | } else { |
| 727 | - $tag = $shortcodes[2][ $short_key ]; |
|
| 727 | + $tag = $shortcodes[2][$short_key]; |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | switch ( $tag ) { |
| 731 | 731 | case 'id': |
| 732 | 732 | case 'key': |
| 733 | 733 | case 'ip': |
| 734 | - $replace_with = $shortcode_values[ $tag ]; |
|
| 734 | + $replace_with = $shortcode_values[$tag]; |
|
| 735 | 735 | break; |
| 736 | 736 | |
| 737 | 737 | case 'user_agent': |
| 738 | 738 | case 'user-agent': |
| 739 | - $entry->description = maybe_unserialize($entry->description); |
|
| 739 | + $entry->description = maybe_unserialize( $entry->description ); |
|
| 740 | 740 | $replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] ); |
| 741 | 741 | break; |
| 742 | 742 | |
@@ -744,25 +744,25 @@ discard block |
||
| 744 | 744 | case 'created-at': |
| 745 | 745 | case 'updated_at': |
| 746 | 746 | case 'updated-at': |
| 747 | - if ( isset($atts['format']) ) { |
|
| 747 | + if ( isset( $atts['format'] ) ) { |
|
| 748 | 748 | $time_format = ' '; |
| 749 | 749 | } else { |
| 750 | - $atts['format'] = get_option('date_format'); |
|
| 750 | + $atts['format'] = get_option( 'date_format' ); |
|
| 751 | 751 | $time_format = ''; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | - $this_tag = str_replace('-', '_', $tag); |
|
| 755 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 756 | - unset($this_tag); |
|
| 754 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 755 | + $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format ); |
|
| 756 | + unset( $this_tag ); |
|
| 757 | 757 | break; |
| 758 | 758 | |
| 759 | 759 | case 'created_by': |
| 760 | 760 | case 'created-by': |
| 761 | 761 | case 'updated_by': |
| 762 | 762 | case 'updated-by': |
| 763 | - $this_tag = str_replace('-', '_', $tag); |
|
| 763 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 764 | 764 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
| 765 | - unset($this_tag); |
|
| 765 | + unset( $this_tag ); |
|
| 766 | 766 | break; |
| 767 | 767 | |
| 768 | 768 | case 'admin_email': |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | break; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 782 | + $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
|
| 783 | 783 | |
| 784 | 784 | $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
| 785 | 785 | |
@@ -787,29 +787,29 @@ discard block |
||
| 787 | 787 | $atts['entry_key'] = $entry->item_key; |
| 788 | 788 | //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field); |
| 789 | 789 | |
| 790 | - if ( is_array($replace_with) ) { |
|
| 791 | - $replace_with = implode($sep, $replace_with); |
|
| 790 | + if ( is_array( $replace_with ) ) { |
|
| 791 | + $replace_with = implode( $sep, $replace_with ); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 794 | + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) { |
|
| 795 | 795 | $replace_with = $field->name; |
| 796 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 796 | + } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) { |
|
| 797 | 797 | $replace_with = $field->description; |
| 798 | - } else if ( empty($replace_with) && $replace_with != '0' ) { |
|
| 798 | + } else if ( empty( $replace_with ) && $replace_with != '0' ) { |
|
| 799 | 799 | $replace_with = ''; |
| 800 | 800 | } else { |
| 801 | - $replace_with = self::get_display_value($replace_with, $field, $atts); |
|
| 801 | + $replace_with = self::get_display_value( $replace_with, $field, $atts ); |
|
| 802 | 802 | } |
| 803 | 803 | |
| 804 | - unset($field); |
|
| 804 | + unset( $field ); |
|
| 805 | 805 | break; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | - if ( isset($replace_with) ) { |
|
| 809 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 808 | + if ( isset( $replace_with ) ) { |
|
| 809 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | - unset($atts, $conditional, $replace_with); |
|
| 812 | + unset( $atts, $conditional, $replace_with ); |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | return $content; |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | $new_value = ''; |
| 826 | 826 | switch ( $tag ) { |
| 827 | 827 | case 'admin_email': |
| 828 | - $new_value = get_option('admin_email'); |
|
| 828 | + $new_value = get_option( 'admin_email' ); |
|
| 829 | 829 | break; |
| 830 | 830 | case 'siteurl': |
| 831 | 831 | $new_value = FrmAppHelper::site_url(); |
@@ -851,28 +851,28 @@ discard block |
||
| 851 | 851 | * @return string|array |
| 852 | 852 | */ |
| 853 | 853 | public static function process_get_shortcode( $atts, $return_array = false ) { |
| 854 | - if ( ! isset($atts['param']) ) { |
|
| 854 | + if ( ! isset( $atts['param'] ) ) { |
|
| 855 | 855 | return ''; |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - if ( strpos($atts['param'], '[') ) { |
|
| 859 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 860 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 858 | + if ( strpos( $atts['param'], '[' ) ) { |
|
| 859 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
| 860 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 863 | + $new_value = FrmAppHelper::get_param( $atts['param'], '' ); |
|
| 864 | 864 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
| 865 | 865 | |
| 866 | 866 | if ( $new_value == '' ) { |
| 867 | - if ( ! isset($atts['prev_val']) ) { |
|
| 867 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
| 868 | 868 | $atts['prev_val'] = ''; |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 871 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 875 | - $new_value = implode(', ', $new_value); |
|
| 874 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
| 875 | + $new_value = implode( ', ', $new_value ); |
|
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | return $new_value; |
@@ -884,12 +884,12 @@ discard block |
||
| 884 | 884 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
| 885 | 885 | |
| 886 | 886 | if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
| 887 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 888 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 889 | - if ( is_array($replace_with) ) { |
|
| 890 | - $replace_with = implode("\n", $replace_with); |
|
| 887 | + $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true; |
|
| 888 | + if ( apply_filters( 'frm_use_wpautop', $autop ) ) { |
|
| 889 | + if ( is_array( $replace_with ) ) { |
|
| 890 | + $replace_with = implode( "\n", $replace_with ); |
|
| 891 | 891 | } |
| 892 | - $replace_with = wpautop($replace_with); |
|
| 892 | + $replace_with = wpautop( $replace_with ); |
|
| 893 | 893 | } |
| 894 | 894 | unset( $autop ); |
| 895 | 895 | } else if ( is_array( $replace_with ) ) { |
@@ -911,14 +911,14 @@ discard block |
||
| 911 | 911 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 912 | 912 | |
| 913 | 913 | $field_types = array(); |
| 914 | - if ( in_array($type, $single_input) ) { |
|
| 914 | + if ( in_array( $type, $single_input ) ) { |
|
| 915 | 915 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 916 | - } else if ( in_array($type, $multiple_input) ) { |
|
| 916 | + } else if ( in_array( $type, $multiple_input ) ) { |
|
| 917 | 917 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 918 | - } else if ( in_array($type, $other_type) ) { |
|
| 918 | + } else if ( in_array( $type, $other_type ) ) { |
|
| 919 | 919 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
| 920 | - } else if ( isset( $field_selection[ $type ] ) ) { |
|
| 921 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 920 | + } else if ( isset( $field_selection[$type] ) ) { |
|
| 921 | + $field_types[$type] = $field_selection[$type]; |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | return $field_types; |
@@ -926,8 +926,8 @@ discard block |
||
| 926 | 926 | |
| 927 | 927 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 928 | 928 | foreach ( $inputs as $input ) { |
| 929 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 930 | - unset($input); |
|
| 929 | + $field_types[$input] = $fields[$input]; |
|
| 930 | + unset( $input ); |
|
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | 933 | |
@@ -972,21 +972,21 @@ discard block |
||
| 972 | 972 | // Check posted vals before checking saved values |
| 973 | 973 | |
| 974 | 974 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 975 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 975 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 976 | 976 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 977 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 977 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : ''; |
|
| 978 | 978 | } else { |
| 979 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
| 979 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
| 980 | 980 | } |
| 981 | 981 | return $other_val; |
| 982 | 982 | |
| 983 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 983 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 984 | 984 | // For normal fields |
| 985 | 985 | |
| 986 | 986 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 987 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 987 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
| 988 | 988 | } else { |
| 989 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
| 989 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
| 990 | 990 | } |
| 991 | 991 | return $other_val; |
| 992 | 992 | } |
@@ -995,8 +995,8 @@ discard block |
||
| 995 | 995 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 996 | 996 | // Check if there is an "other" val in saved value and make sure the |
| 997 | 997 | // "other" val is not equal to the Other checkbox option |
| 998 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 999 | - $other_val = $field['value'][ $opt_key ]; |
|
| 998 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 999 | + $other_val = $field['value'][$opt_key]; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | } else { |
| 1002 | 1002 | /** |
@@ -1008,8 +1008,8 @@ discard block |
||
| 1008 | 1008 | // Multi-select dropdowns - key is not preserved |
| 1009 | 1009 | if ( is_array( $field['value'] ) ) { |
| 1010 | 1010 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1011 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1012 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1011 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1012 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | } else if ( $temp_val == $field['value'] ) { |
| 1015 | 1015 | // For radio and regular dropdowns |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | private static function set_other_name( $args, &$other_args ) { |
| 1067 | 1067 | //Set up name for other field |
| 1068 | 1068 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
| 1069 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
| 1069 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
| 1070 | 1070 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
| 1071 | 1071 | |
| 1072 | 1072 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | // Count should only be greater than 3 if inside of a repeating section |
| 1093 | 1093 | if ( count( $temp_array ) > 3 ) { |
| 1094 | 1094 | $parent = str_replace( ']', '', $temp_array[1] ); |
| 1095 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
| 1095 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | // Get text for "other" text field |
@@ -1194,29 +1194,29 @@ discard block |
||
| 1194 | 1194 | $replace = array(); |
| 1195 | 1195 | $replace_with = array(); |
| 1196 | 1196 | foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
| 1197 | - $replace[] = '[if '. $old .']'; |
|
| 1198 | - $replace_with[] = '[if '. $new .']'; |
|
| 1199 | - $replace[] = '[if '. $old .' '; |
|
| 1200 | - $replace_with[] = '[if '. $new .' '; |
|
| 1201 | - $replace[] = '[/if '. $old .']'; |
|
| 1202 | - $replace_with[] = '[/if '. $new .']'; |
|
| 1203 | - $replace[] = '[foreach '. $old .']'; |
|
| 1204 | - $replace_with[] = '[foreach '. $new .']'; |
|
| 1205 | - $replace[] = '[/foreach '. $old .']'; |
|
| 1206 | - $replace_with[] = '[/foreach '. $new .']'; |
|
| 1207 | - $replace[] = '['. $old .']'; |
|
| 1208 | - $replace_with[] = '['. $new .']'; |
|
| 1209 | - $replace[] = '['. $old .' '; |
|
| 1210 | - $replace_with[] = '['. $new .' '; |
|
| 1211 | - unset($old, $new); |
|
| 1197 | + $replace[] = '[if ' . $old . ']'; |
|
| 1198 | + $replace_with[] = '[if ' . $new . ']'; |
|
| 1199 | + $replace[] = '[if ' . $old . ' '; |
|
| 1200 | + $replace_with[] = '[if ' . $new . ' '; |
|
| 1201 | + $replace[] = '[/if ' . $old . ']'; |
|
| 1202 | + $replace_with[] = '[/if ' . $new . ']'; |
|
| 1203 | + $replace[] = '[foreach ' . $old . ']'; |
|
| 1204 | + $replace_with[] = '[foreach ' . $new . ']'; |
|
| 1205 | + $replace[] = '[/foreach ' . $old . ']'; |
|
| 1206 | + $replace_with[] = '[/foreach ' . $new . ']'; |
|
| 1207 | + $replace[] = '[' . $old . ']'; |
|
| 1208 | + $replace_with[] = '[' . $new . ']'; |
|
| 1209 | + $replace[] = '[' . $old . ' '; |
|
| 1210 | + $replace_with[] = '[' . $new . ' '; |
|
| 1211 | + unset( $old, $new ); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | if ( is_array( $val ) ) { |
| 1214 | 1214 | foreach ( $val as $k => $v ) { |
| 1215 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1216 | - unset($k, $v); |
|
| 1215 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1216 | + unset( $k, $v ); |
|
| 1217 | 1217 | } |
| 1218 | 1218 | } else { |
| 1219 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1219 | + $val = str_replace( $replace, $replace_with, $val ); |
|
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | return $val; |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | 'DC' => 'District of Columbia', |
| 1230 | 1230 | 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
| 1231 | 1231 | 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
| 1232 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1232 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', |
|
| 1233 | 1233 | 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
| 1234 | 1234 | 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
| 1235 | 1235 | 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
@@ -1320,35 +1320,35 @@ discard block |
||
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | 1322 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1323 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
| 1323 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
| 1324 | 1324 | |
| 1325 | 1325 | $states = FrmFieldsHelper::get_us_states(); |
| 1326 | - $state_abv = array_keys($states); |
|
| 1327 | - sort($state_abv); |
|
| 1328 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1326 | + $state_abv = array_keys( $states ); |
|
| 1327 | + sort( $state_abv ); |
|
| 1328 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1329 | 1329 | |
| 1330 | - $states = array_values($states); |
|
| 1331 | - sort($states); |
|
| 1332 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1333 | - unset($state_abv, $states); |
|
| 1330 | + $states = array_values( $states ); |
|
| 1331 | + sort( $states ); |
|
| 1332 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1333 | + unset( $state_abv, $states ); |
|
| 1334 | 1334 | |
| 1335 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1335 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1336 | 1336 | __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
| 1337 | 1337 | __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
| 1338 | 1338 | __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
| 1339 | 1339 | ); |
| 1340 | 1340 | |
| 1341 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1341 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1342 | 1342 | __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1343 | 1343 | __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1344 | 1344 | ); |
| 1345 | 1345 | |
| 1346 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1346 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1347 | 1347 | __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1348 | 1348 | __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1349 | 1349 | ); |
| 1350 | 1350 | |
| 1351 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1351 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1352 | 1352 | __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1353 | 1353 | __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1354 | 1354 | ); |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $display = apply_filters('frm_display_field_options', array( |
| 4 | - 'type' => $field['type'], 'field_data' => $field, |
|
| 5 | - 'required' => true, 'unique' => false, 'read_only' => false, |
|
| 6 | - 'description' => true, 'options' => true, 'label_position' => true, |
|
| 7 | - 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
|
| 8 | - 'default_blank' => true, 'css' => true, 'conf_field' => false, |
|
| 4 | + 'type' => $field['type'], 'field_data' => $field, |
|
| 5 | + 'required' => true, 'unique' => false, 'read_only' => false, |
|
| 6 | + 'description' => true, 'options' => true, 'label_position' => true, |
|
| 7 | + 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
|
| 8 | + 'default_blank' => true, 'css' => true, 'conf_field' => false, |
|
| 9 | 9 | 'max' => true, 'captcha_size' => false, |
| 10 | 10 | )); |
| 11 | 11 | |
@@ -25,19 +25,19 @@ discard block |
||
| 25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
| 26 | 26 | |
| 27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
| 28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
| 29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
| 30 | - } else { |
|
| 28 | + if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
| 29 | + $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
| 30 | + } else { |
|
| 31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
| 32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | if ( ! isset( $ajax ) ) { |
| 40 | - $li_classes .= ' ui-state-default widgets-holder-wrap'; ?> |
|
| 40 | + $li_classes .= ' ui-state-default widgets-holder-wrap'; ?> |
|
| 41 | 41 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?>" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo ( 'divider' == $field['type'] ) ? esc_attr( $field['form_select'] ) : esc_attr( $field['form_id'] ); ?>"> |
| 42 | 42 | <?php |
| 43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | </span> |
| 60 | 60 | <?php } |
| 61 | 61 | |
| 62 | - ?> |
|
| 62 | + ?> |
|
| 63 | 63 | <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
| 64 | 64 | |
| 65 | 65 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
| 106 | 106 | <div class="frm-show-click frm_small_top_margin"><?php |
| 107 | 107 | |
| 108 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 109 | - echo '<p class="howto">'. FrmFieldsHelper::get_term_link($field['taxonomy']) .'</p>'; |
|
| 108 | + if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 109 | + echo '<p class="howto">'. FrmFieldsHelper::get_term_link($field['taxonomy']) .'</p>'; |
|
| 110 | 110 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
| 111 | 111 | ?> |
| 112 | 112 | <div id="frm_add_field_<?php echo esc_attr( $field['id'] ); ?>"> |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | <a href="javascript:void(0);" id="other_button_<?php echo esc_attr( $field['id'] ); ?>" data-opttype="other" data-ftype="<?php echo esc_attr( $field['type'] ) ?>" class="button frm_cb_button frm_add_opt<?php echo ( in_array( $field['type'], array( 'radio', 'select' ) ) && $field['other'] == true ? ' frm_hidden' : '' ); ?>"><?php _e( 'Add "Other"', 'formidable' ) ?></a> |
| 118 | 118 | <input type="hidden" value="<?php echo esc_attr( $field['other'] ); ?>" id="other_input_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[other_<?php echo esc_attr( $field['id'] ); ?>]"> |
| 119 | 119 | <?php |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
| 122 | + if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
| 123 | 123 | <a href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $field['name']))), 20) . ' '. __( 'Field Choices', 'formidable' ); ?>" class="thickbox frm_orange"><?php _e( 'Bulk Edit Options', 'formidable' ) ?></a> |
| 124 | 124 | <?php } ?> |
| 125 | 125 | </div> |
| 126 | 126 | <?php |
| 127 | - } |
|
| 127 | + } |
|
| 128 | 128 | ?> |
| 129 | 129 | </div> |
| 130 | 130 | <?php |
@@ -156,28 +156,28 @@ discard block |
||
| 156 | 156 | if ( $display['required'] ) { ?> |
| 157 | 157 | <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
| 158 | 158 | <?php |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | 161 | if ( $display['unique'] ) { |
| 162 | - if ( ! isset( $field['unique'] ) ) { |
|
| 163 | - $field['unique'] = false; |
|
| 164 | - } |
|
| 165 | - ?> |
|
| 162 | + if ( ! isset( $field['unique'] ) ) { |
|
| 163 | + $field['unique'] = false; |
|
| 164 | + } |
|
| 165 | + ?> |
|
| 166 | 166 | <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ) ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ) ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" /> <?php _e( 'Unique', 'formidable' ) ?></label> |
| 167 | 167 | <?php |
| 168 | - } |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | 170 | if ( $display['read_only'] ) { |
| 171 | - if ( ! isset( $field['read_only'] ) ) { |
|
| 172 | - $field['read_only'] = false; |
|
| 171 | + if ( ! isset( $field['read_only'] ) ) { |
|
| 172 | + $field['read_only'] = false; |
|
| 173 | 173 | } |
| 174 | - ?> |
|
| 174 | + ?> |
|
| 175 | 175 | <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label> |
| 176 | 176 | <?php } |
| 177 | 177 | |
| 178 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
| 178 | + do_action('frm_field_options_form_top', $field, $display, $values); |
|
| 179 | 179 | |
| 180 | - ?> |
|
| 180 | + ?> |
|
| 181 | 181 | <?php |
| 182 | 182 | if ( $display['required'] ) { ?> |
| 183 | 183 | <div class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>"> |
@@ -233,14 +233,14 @@ discard block |
||
| 233 | 233 | <?php _e( 'automatic width', 'formidable' ) ?> |
| 234 | 234 | </label> |
| 235 | 235 | <?php |
| 236 | - } |
|
| 236 | + } |
|
| 237 | 237 | } else { ?> |
| 238 | 238 | <input type="text" name="field_options[size_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['size'] ); ?>" size="5" /> <span class="howto"><?php _e( 'pixels wide', 'formidable' ) ?></span> |
| 239 | 239 | |
| 240 | 240 | <?php if ( $display['max'] ) { ?> |
| 241 | 241 | <input type="text" name="field_options[max_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['max'] ); ?>" size="5" /> <span class="howto"><?php echo ( $field['type'] == 'textarea' || $field['type'] == 'rte' ) ? __( 'rows high', 'formidable' ) : __( 'characters maximum', 'formidable' ) ?></span> |
| 242 | 242 | <?php } |
| 243 | - } ?> |
|
| 243 | + } ?> |
|
| 244 | 244 | </td> |
| 245 | 245 | </tr> |
| 246 | 246 | <?php } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } ?> |
| 259 | 259 | <?php do_action('frm_field_options_form', $field, $display, $values); |
| 260 | 260 | |
| 261 | - if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
|
| 261 | + if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
|
| 262 | 262 | <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
| 263 | 263 | <td colspan="2"> |
| 264 | 264 | <div class="menu-settings"> |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" /> |
| 272 | 272 | </p> |
| 273 | 273 | <?php |
| 274 | - } |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | 276 | if ( $display['invalid'] ) { ?> |
| 277 | 277 | <p><label><?php _e( 'Invalid Format', 'formidable' ) ?></label> |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" /> |
| 287 | 287 | </p> |
| 288 | 288 | <?php |
| 289 | - } |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | 291 | if ( $display['conf_field'] ) { ?> |
| 292 | 292 | <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>"> |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" /> |
| 295 | 295 | </p> |
| 296 | 296 | <?php |
| 297 | - } ?> |
|
| 297 | + } ?> |
|
| 298 | 298 | </div> |
| 299 | 299 | </div> |
| 300 | 300 | </td> |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$display = apply_filters('frm_display_field_options', array( |
|
| 3 | +$display = apply_filters( 'frm_display_field_options', array( |
|
| 4 | 4 | 'type' => $field['type'], 'field_data' => $field, |
| 5 | 5 | 'required' => true, 'unique' => false, 'read_only' => false, |
| 6 | 6 | 'description' => true, 'options' => true, 'label_position' => true, |
| 7 | 7 | 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
| 8 | 8 | 'default_blank' => true, 'css' => true, 'conf_field' => false, |
| 9 | 9 | 'max' => true, 'captcha_size' => false, |
| 10 | -)); |
|
| 10 | +) ); |
|
| 11 | 11 | |
| 12 | -$li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_'. $display['type']; |
|
| 13 | -$li_classes = apply_filters('frm_build_field_class', $li_classes, $field ); |
|
| 12 | +$li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type']; |
|
| 13 | +$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field ); |
|
| 14 | 14 | |
| 15 | 15 | if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) { |
| 16 | 16 | ?> |
| 17 | 17 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>"> |
| 18 | 18 | <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" /> |
| 19 | -<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span> |
|
| 19 | +<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span> |
|
| 20 | 20 | </li> |
| 21 | 21 | <?php |
| 22 | 22 | return; |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
| 26 | 26 | |
| 27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
| 28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
| 29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
| 28 | + if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) { |
|
| 29 | + $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection ); |
|
| 30 | 30 | } else { |
| 31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
| 32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a> |
| 52 | 52 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a> |
| 53 | 53 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a> |
| 54 | - <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" /> |
|
| 55 | - <?php do_action('frm_extra_field_actions', $field['id']); ?> |
|
| 54 | + <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" /> |
|
| 55 | + <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?> |
|
| 56 | 56 | <?php if ( $display['required'] ) { ?> |
| 57 | 57 | <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>"> |
| 58 | 58 | <a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a> |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | <?php } |
| 61 | 61 | |
| 62 | 62 | ?> |
| 63 | - <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
| 63 | + <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container"> |
| 67 | 67 | <div class="frm_form_fields" data-ftype="<?php echo esc_attr( $display['type'] ) ?>"> |
| 68 | 68 | <?php |
| 69 | -include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/show-build.php'); |
|
| 69 | +include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/show-build.php' ); |
|
| 70 | 70 | |
| 71 | 71 | if ( $display['clear_on_focus'] ) { |
| 72 | 72 | FrmFieldsHelper::clear_on_focus_html( $field, $display ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | </div> |
| 79 | 79 | <?php |
| 80 | 80 | if ( $display['description'] ) { ?> |
| 81 | - <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
| 81 | + <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
| 82 | 82 | <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" /> |
| 83 | 83 | |
| 84 | 84 | <?php } ?> |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_container" class="frm_conf_field_container frm_form_fields frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>"> |
| 89 | 89 | <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_conf_container"> |
| 90 | 90 | <div class="frm_form_fields"> |
| 91 | - <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" <?php do_action('frm_field_input_html', $field) ?> /> |
|
| 91 | + <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" <?php do_action( 'frm_field_input_html', $field ) ?> /> |
|
| 92 | 92 | </div> |
| 93 | - <div class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div> |
|
| 93 | + <div class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div> |
|
| 94 | 94 | <input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" /> |
| 95 | 95 | </div> |
| 96 | 96 | <?php if ( $display['clear_on_focus'] ) { ?> |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
| 106 | 106 | <div class="frm-show-click frm_small_top_margin"><?php |
| 107 | 107 | |
| 108 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 109 | - echo '<p class="howto">'. FrmFieldsHelper::get_term_link($field['taxonomy']) .'</p>'; |
|
| 108 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 109 | + echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>'; |
|
| 110 | 110 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
| 111 | 111 | ?> |
| 112 | 112 | <div id="frm_add_field_<?php echo esc_attr( $field['id'] ); ?>"> |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | <?php |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
| 123 | - <a href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $field['name']))), 20) . ' '. __( 'Field Choices', 'formidable' ); ?>" class="thickbox frm_orange"><?php _e( 'Bulk Edit Options', 'formidable' ) ?></a> |
|
| 122 | + if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?> |
|
| 123 | + <a href="<?php echo esc_url( admin_url( 'admin-ajax.php' ) . '?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ?>" title="<?php echo FrmAppHelper::truncate( esc_attr( strip_tags( str_replace( '"', '"', $field['name'] ) ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ); ?>" class="thickbox frm_orange"><?php _e( 'Bulk Edit Options', 'formidable' ) ?></a> |
|
| 124 | 124 | <?php } ?> |
| 125 | 125 | </div> |
| 126 | 126 | <?php |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | <?php |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | -do_action('frm_before_field_options', $field); |
|
| 133 | +do_action( 'frm_before_field_options', $field ); |
|
| 134 | 134 | |
| 135 | 135 | if ( $display['options'] ) { ?> |
| 136 | 136 | <div class="widget"> |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | </div> |
| 141 | 141 | <div class="widget-inside"> |
| 142 | 142 | <table class="form-table frm_clear_none"> |
| 143 | - <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?> |
|
| 143 | + <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?> |
|
| 144 | 144 | <tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td> |
| 145 | 145 | <td> |
| 146 | - <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
| 146 | + <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
| 147 | 147 | <?php |
| 148 | 148 | foreach ( $field_types as $fkey => $ftype ) { ?> |
| 149 | - <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option> |
|
| 149 | + <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option> |
|
| 150 | 150 | <?php |
| 151 | 151 | unset( $fkey, $ftype ); |
| 152 | 152 | } ?> |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | <?php |
| 156 | 156 | if ( $display['required'] ) { ?> |
| 157 | - <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
|
| 157 | + <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"' : ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
|
| 158 | 158 | <?php |
| 159 | 159 | } |
| 160 | 160 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label> |
| 176 | 176 | <?php } |
| 177 | 177 | |
| 178 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
| 178 | + do_action( 'frm_field_options_form_top', $field, $display, $values ); |
|
| 179 | 179 | |
| 180 | 180 | ?> |
| 181 | 181 | <?php |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | if ( $display['label_position'] ) { ?> |
| 212 | 212 | <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td> |
| 213 | 213 | <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]"> |
| 214 | - <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
| 215 | - <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
| 216 | - <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
| 217 | - <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
| 218 | - <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
| 219 | - <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
| 220 | - <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
| 214 | + <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
| 215 | + <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
| 216 | + <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
| 217 | + <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
| 218 | + <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
| 219 | + <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
| 220 | + <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
| 221 | 221 | </select> |
| 222 | 222 | </td> |
| 223 | 223 | </tr> |
@@ -249,17 +249,17 @@ discard block |
||
| 249 | 249 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ) ?>" ></span> |
| 250 | 250 | </td> |
| 251 | 251 | <td><select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ) ?>]"> |
| 252 | - <option value="default"<?php selected($field['captcha_size'], 'default'); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
| 253 | - <option value="compact"<?php selected($field['captcha_size'], 'compact'); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
| 252 | + <option value="default"<?php selected( $field['captcha_size'], 'default' ); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
| 253 | + <option value="compact"<?php selected( $field['captcha_size'], 'compact' ); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
| 254 | 254 | </select> |
| 255 | 255 | </td> |
| 256 | 256 | </tr> |
| 257 | 257 | <?php |
| 258 | 258 | } ?> |
| 259 | - <?php do_action('frm_field_options_form', $field, $display, $values); |
|
| 259 | + <?php do_action( 'frm_field_options_form', $field, $display, $values ); |
|
| 260 | 260 | |
| 261 | 261 | if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
| 262 | - <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
| 262 | + <tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
| 263 | 263 | <td colspan="2"> |
| 264 | 264 | <div class="menu-settings"> |
| 265 | 265 | <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3> |
@@ -323,4 +323,4 @@ discard block |
||
| 323 | 323 | <?php |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | -unset($display); |
|
| 326 | +unset( $display ); |
|