@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | <a href="?page=formidable-styles&page-tab=default#tabs-panel-default-color" class="nav-tab-link" data-type="tabs-panel-default-color"><?php _e( 'Default', 'formidable' ) ?></a> |
| 5 | 5 | </li> |
| 6 | 6 | <li <?php echo ( 'active-color' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=active-color#page-active-color') ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
| 7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=active-color#page-active-color' ) ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
| 8 | 8 | </li> |
| 9 | 9 | <li <?php echo ( 'active-error' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 10 | 10 | <a href="?page=formidable-styles&page-tab=active-error#tabs-panel-active-error" class="nav-tab-link" data-type="tabs-panel-active-error"><?php _e( 'Error', 'formidable' ) ?></a> |
@@ -19,34 +19,34 @@ discard block |
||
| 19 | 19 | ?>"> |
| 20 | 20 | <div class="field-group field-group-border clearfix"> |
| 21 | 21 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 22 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color') ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
| 22 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color' ) ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
| 23 | 23 | </div> |
| 24 | 24 | <div class="field-group clearfix"> |
| 25 | 25 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 26 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color') ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
| 26 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color' ) ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <div class="field-group field-group-border clearfix"> |
| 30 | 30 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color') ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
| 31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color' ) ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
| 32 | 32 | </div> |
| 33 | 33 | <div class="field-group clearfix"> |
| 34 | 34 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
| 35 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_border_width') ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
| 35 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_width' ) ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
| 36 | 36 | </div> |
| 37 | 37 | <div class="field-group clearfix"> |
| 38 | 38 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
| 39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_border_style') ) ?>" id="frm_field_border_style"> |
|
| 40 | - <option value="solid" <?php selected($style->post_content['field_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 41 | - <option value="dotted" <?php selected($style->post_content['field_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 42 | - <option value="dashed" <?php selected($style->post_content['field_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 43 | - <option value="double" <?php selected($style->post_content['field_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_style' ) ) ?>" id="frm_field_border_style"> |
|
| 40 | + <option value="solid" <?php selected( $style->post_content['field_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 41 | + <option value="dotted" <?php selected( $style->post_content['field_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 42 | + <option value="dashed" <?php selected( $style->post_content['field_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 43 | + <option value="double" <?php selected( $style->post_content['field_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 44 | 44 | </select> |
| 45 | 45 | </div> |
| 46 | 46 | <div class="clear"></div> |
| 47 | 47 | <p class="frm_no_bottom_margin"> |
| 48 | 48 | <label> |
| 49 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow') ) ?>" id="frm_remove_box_shadow" value="1" <?php checked($style->post_content['remove_box_shadow'], 1) ?> /> |
|
| 49 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow' ) ) ?>" id="frm_remove_box_shadow" value="1" <?php checked( $style->post_content['remove_box_shadow'], 1 ) ?> /> |
|
| 50 | 50 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
| 51 | 51 | </label> |
| 52 | 52 | </p> |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | ?>"> |
| 58 | 58 | <div class="field-group field-group-border clearfix"> |
| 59 | 59 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 60 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_active') ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
| 60 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_active' ) ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
| 61 | 61 | </div> |
| 62 | 62 | <div class="field-group clearfix"> |
| 63 | 63 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 64 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_active') ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
| 64 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_active' ) ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
| 65 | 65 | </div> |
| 66 | 66 | <div class="clear"></div> |
| 67 | 67 | <p class="frm_no_bottom_margin"> |
| 68 | 68 | <label> |
| 69 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow_active') ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked($style->post_content['remove_box_shadow_active'], 1) ?> /> |
|
| 69 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow_active' ) ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked( $style->post_content['remove_box_shadow_active'], 1 ) ?> /> |
|
| 70 | 70 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
| 71 | 71 | </label> |
| 72 | 72 | </p> |
@@ -77,28 +77,28 @@ discard block |
||
| 77 | 77 | ?>"> |
| 78 | 78 | <div class="field-group field-group-border clearfix"> |
| 79 | 79 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 80 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_error') ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
| 80 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_error' ) ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
| 81 | 81 | </div> |
| 82 | 82 | <div class="field-group clearfix"> |
| 83 | 83 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 84 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_error') ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
| 84 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_error' ) ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
| 85 | 85 | </div> |
| 86 | 86 | |
| 87 | 87 | <div class="field-group field-group-border clearfix"> |
| 88 | 88 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 89 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_error') ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
| 89 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_error' ) ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
| 90 | 90 | </div> |
| 91 | 91 | <div class="field-group clearfix"> |
| 92 | 92 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
| 93 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_width_error') ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
| 93 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_width_error' ) ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
| 94 | 94 | </div> |
| 95 | 95 | <div class="field-group clearfix"> |
| 96 | 96 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
| 97 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('border_style_error') ) ?>" id="frm_border_style_error"> |
|
| 98 | - <option value="solid" <?php selected($style->post_content['border_style_error'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 99 | - <option value="dotted" <?php selected($style->post_content['border_style_error'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 100 | - <option value="dashed" <?php selected($style->post_content['border_style_error'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 101 | - <option value="double" <?php selected($style->post_content['border_style_error'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 97 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'border_style_error' ) ) ?>" id="frm_border_style_error"> |
|
| 98 | + <option value="solid" <?php selected( $style->post_content['border_style_error'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 99 | + <option value="dotted" <?php selected( $style->post_content['border_style_error'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 100 | + <option value="dashed" <?php selected( $style->post_content['border_style_error'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 101 | + <option value="double" <?php selected( $style->post_content['border_style_error'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 102 | 102 | </select> |
| 103 | 103 | </div> |
| 104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | ?>"> |
| 111 | 111 | <div class="field-group field-group-border clearfix"> |
| 112 | 112 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 113 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_disabled') ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
| 113 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_disabled' ) ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
| 114 | 114 | </div> |
| 115 | 115 | <div class="field-group clearfix"> |
| 116 | 116 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 117 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_disabled') ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
| 117 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_disabled' ) ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
| 118 | 118 | </div> |
| 119 | 119 | |
| 120 | 120 | <div class="field-group clearfix"> |
| 121 | 121 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 122 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_disabled') ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
| 122 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_disabled' ) ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
| 123 | 123 | </div> |
| 124 | 124 | <div class="clear"></div> |
| 125 | 125 | </div><!-- /.tabs-panel --> |
@@ -1,42 +1,42 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_font_size') ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_font_size' ) ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_height') ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_height' ) ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | 11 | <div class="field-group clearfix frm-first-row"> |
| 12 | 12 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
| 13 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_width') ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 13 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_width' ) ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="clear"></div> |
| 17 | 17 | <p class="frm_no_bottom_margin"> |
| 18 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('auto_width') ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 18 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'auto_width' ) ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 19 | 19 | <?php _e( 'Automatic Width for drop-down fields', 'formidable' ) ?></label> |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <div class="field-group clearfix"> |
| 23 | 23 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 24 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_pad') ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 24 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_pad' ) ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <div class="field-group clearfix"> |
| 28 | 28 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
| 29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_margin') ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_margin' ) ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 30 | 30 | </div> |
| 31 | 31 | |
| 32 | 32 | <div class="field-group clearfix"> |
| 33 | 33 | <label><?php _e( 'Corners', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Formidable uses CSS3 border-radius for corner rounding, which is not currently supported by Internet Explorer.', 'formidable' ) ?>" ></span></label> |
| 34 | - <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('border_radius') ) ?>" id="frm_border_radius" /> |
|
| 34 | + <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_radius' ) ) ?>" id="frm_border_radius" /> |
|
| 35 | 35 | </div> |
| 36 | 36 | |
| 37 | 37 | <div class="field-group clearfix frm-first-row"> |
| 38 | 38 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_weight') ) ?>" id="frm_field_weight"> |
|
| 39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_weight' ) ) ?>" id="frm_field_weight"> |
|
| 40 | 40 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 41 | 41 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['field_weight'], $value ) ?>><?php echo $name ?></option> |
| 42 | 42 | <?php } ?> |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
| 18 | 18 | \ No newline at end of file |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
| 18 | 18 | \ No newline at end of file |
@@ -1,59 +1,59 @@ |
||
| 1 | 1 | <p> |
| 2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
| 2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
| 3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
| 4 | 4 | </label> |
| 5 | 5 | </p> |
| 6 | 6 | |
| 7 | 7 | <div class="field-group clearfix frm-first-row"> |
| 8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
| 9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
| 10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
| 10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 13 | 13 | </select> |
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="field-group clearfix frm-first-row"> |
| 17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
| 18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 19 | 19 | </div> |
| 20 | 20 | |
| 21 | 21 | <div class="field-group clearfix frm-first-row"> |
| 22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
| 23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <div class="field-group field-group-border clearfix"> |
| 27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <div class="field-group clearfix"> |
| 32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | <div class="field-group clearfix"> |
| 37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
| 42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
| 43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <div class="field-group clearfix frm-half"> |
| 47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
| 48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
| 49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
| 49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 51 | 51 | </select> |
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <div class="clear"></div> |
| 55 | 55 | <p class="frm_no_bottom_margin"> |
| 56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
| 56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
| 57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
| 58 | 58 | </label> |
| 59 | 59 | </p> |
@@ -134,6 +134,6 @@ |
||
| 134 | 134 | |
| 135 | 135 | public static function get_random_tip( $tips ) { |
| 136 | 136 | $random = rand( 0, count( $tips ) - 1 ); |
| 137 | - return $tips[ $random ]; |
|
| 137 | + return $tips[$random]; |
|
| 138 | 138 | } |
| 139 | 139 | } |
@@ -7,10 +7,10 @@ |
||
| 7 | 7 | continue; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) { |
|
| 11 | - $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] ); |
|
| 10 | + if ( isset( $plugin_names[$addon['info']['slug']] ) ) { |
|
| 11 | + $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] ); |
|
| 12 | 12 | } else { |
| 13 | - $installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
| 13 | + $installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
| 14 | 14 | } |
| 15 | 15 | $has_thumbnail = ! empty( $addon['info']['thumbnail'] ); |
| 16 | 16 | if ( $addon['info']['slug'] == 'formidable-pro' ) { |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | class FrmAddonsController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - add_submenu_page( 'formidable', 'Formidable | '. __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); |
|
| 6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | public static function list_addons() { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $keyed_addons = array(); |
| 36 | 36 | foreach ( $addons as $addon ) { |
| 37 | - $keyed_addons[ $addon['info']['slug'] ] = $addon; |
|
| 37 | + $keyed_addons[$addon['info']['slug']] = $addon; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $plugin_order = array( |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | $ordered_addons = array(); |
| 45 | 45 | foreach ( $plugin_order as $plugin ) { |
| 46 | - if ( isset( $keyed_addons[ $plugin ] ) ) { |
|
| 47 | - $ordered_addons[] = $keyed_addons[ $plugin ]; |
|
| 48 | - unset( $keyed_addons[ $plugin ] ); |
|
| 46 | + if ( isset( $keyed_addons[$plugin] ) ) { |
|
| 47 | + $ordered_addons[] = $keyed_addons[$plugin]; |
|
| 48 | + unset( $keyed_addons[$plugin] ); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | $addons = $ordered_addons + $keyed_addons; |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public static function get_licenses() { |
| 83 | - $license = get_option('frmpro-credentials'); |
|
| 83 | + $license = get_option( 'frmpro-credentials' ); |
|
| 84 | 84 | if ( $license && is_array( $license ) && isset( $license['license'] ) ) { |
| 85 | - $url = 'http://formidablepro.com/frm-edd-api/licenses?l='. urlencode( base64_encode( $license['license'] ) ); |
|
| 85 | + $url = 'http://formidablepro.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) ); |
|
| 86 | 86 | $licenses = self::send_api_request( $url, array( 'name' => 'frm_api_licence', 'expires' => 60 * 60 * 5 ) ); |
| 87 | 87 | echo json_encode( $licenses ); |
| 88 | 88 | } |
@@ -2,140 +2,140 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFormsController { |
| 4 | 4 | |
| 5 | - public static function menu() { |
|
| 5 | + public static function menu() { |
|
| 6 | 6 | $menu_label = __( 'Forms', 'formidable' ); |
| 7 | 7 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 8 | 8 | $menu_label .= ' (Lite)'; |
| 9 | 9 | } |
| 10 | 10 | add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
| 11 | 11 | |
| 12 | - add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 12 | + add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 13 | 13 | |
| 14 | - add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 14 | + add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 15 | 15 | add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public static function head() { |
|
| 19 | - wp_enqueue_script('formidable-editinplace'); |
|
| 18 | + public static function head() { |
|
| 19 | + wp_enqueue_script('formidable-editinplace'); |
|
| 20 | 20 | |
| 21 | - if ( wp_is_mobile() ) { |
|
| 22 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
| 23 | - } |
|
| 24 | - } |
|
| 21 | + if ( wp_is_mobile() ) { |
|
| 22 | + wp_enqueue_script( 'jquery-touch-punch' ); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public static function register_widgets() { |
|
| 27 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 28 | - register_widget('FrmShowForm'); |
|
| 29 | - } |
|
| 26 | + public static function register_widgets() { |
|
| 27 | + require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 28 | + register_widget('FrmShowForm'); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public static function list_form() { |
|
| 32 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
| 31 | + public static function list_form() { |
|
| 32 | + FrmAppHelper::permission_check('frm_view_forms'); |
|
| 33 | 33 | |
| 34 | 34 | $params = FrmForm::list_page_params(); |
| 35 | - $errors = self::process_bulk_form_actions( array()); |
|
| 36 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 35 | + $errors = self::process_bulk_form_actions( array()); |
|
| 36 | + $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 37 | 37 | |
| 38 | 38 | return self::display_forms_list( $params, '', $errors ); |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | public static function new_form( $values = array() ) { |
| 42 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 42 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 43 | 43 | |
| 44 | - global $frm_vars; |
|
| 44 | + global $frm_vars; |
|
| 45 | 45 | |
| 46 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 46 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 47 | 47 | $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
| 48 | 48 | |
| 49 | 49 | if ( $action == 'create' ) { |
| 50 | - return self::create($values); |
|
| 50 | + return self::create($values); |
|
| 51 | 51 | } else if ( $action == 'new' ) { |
| 52 | 52 | $frm_field_selection = FrmField::field_selection(); |
| 53 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
| 54 | - $id = FrmForm::create( $values ); |
|
| 55 | - $form = FrmForm::getOne($id); |
|
| 53 | + $values = FrmFormsHelper::setup_new_vars($values); |
|
| 54 | + $id = FrmForm::create( $values ); |
|
| 55 | + $form = FrmForm::getOne($id); |
|
| 56 | 56 | |
| 57 | - // add default email notification |
|
| 58 | - $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
| 59 | - $action_control->create($form->id); |
|
| 57 | + // add default email notification |
|
| 58 | + $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
| 59 | + $action_control->create($form->id); |
|
| 60 | 60 | |
| 61 | 61 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 62 | 62 | |
| 63 | - $values['id'] = $id; |
|
| 64 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 65 | - } |
|
| 66 | - } |
|
| 63 | + $values['id'] = $id; |
|
| 64 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | public static function create( $values = array() ) { |
| 69 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 69 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 70 | 70 | |
| 71 | - global $frm_vars; |
|
| 72 | - if ( empty( $values ) ) { |
|
| 73 | - $values = $_POST; |
|
| 74 | - } |
|
| 71 | + global $frm_vars; |
|
| 72 | + if ( empty( $values ) ) { |
|
| 73 | + $values = $_POST; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - //Set radio button and checkbox meta equal to "other" value |
|
| 77 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 78 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 79 | - } |
|
| 76 | + //Set radio button and checkbox meta equal to "other" value |
|
| 77 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 78 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 82 | 82 | |
| 83 | - if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
| 84 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 85 | - $errors = array( 'form' => $frm_settings->admin_permission ); |
|
| 86 | - } else { |
|
| 87 | - $errors = FrmForm::validate($values); |
|
| 88 | - } |
|
| 83 | + if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
| 84 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 85 | + $errors = array( 'form' => $frm_settings->admin_permission ); |
|
| 86 | + } else { |
|
| 87 | + $errors = FrmForm::validate($values); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - if ( count($errors) > 0 ) { |
|
| 91 | - $hide_preview = true; |
|
| 90 | + if ( count($errors) > 0 ) { |
|
| 91 | + $hide_preview = true; |
|
| 92 | 92 | $frm_field_selection = FrmField::field_selection(); |
| 93 | - $form = FrmForm::getOne( $id ); |
|
| 94 | - $fields = FrmField::get_all_for_form($id); |
|
| 93 | + $form = FrmForm::getOne( $id ); |
|
| 94 | + $fields = FrmField::get_all_for_form($id); |
|
| 95 | 95 | |
| 96 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 96 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 97 | 97 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 98 | 98 | |
| 99 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 100 | - } else { |
|
| 101 | - FrmForm::update( $id, $values, true ); |
|
| 102 | - die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 103 | - } |
|
| 104 | - } |
|
| 99 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 100 | + } else { |
|
| 101 | + FrmForm::update( $id, $values, true ); |
|
| 102 | + die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - public static function edit( $values = false ) { |
|
| 107 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 106 | + public static function edit( $values = false ) { |
|
| 107 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 108 | 108 | |
| 109 | 109 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 110 | - return self::get_edit_vars($id); |
|
| 111 | - } |
|
| 110 | + return self::get_edit_vars($id); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - public static function settings( $id = false, $message = '' ) { |
|
| 114 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 113 | + public static function settings( $id = false, $message = '' ) { |
|
| 114 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 115 | 115 | |
| 116 | - if ( ! $id || ! is_numeric($id) ) { |
|
| 116 | + if ( ! $id || ! is_numeric($id) ) { |
|
| 117 | 117 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | return self::get_settings_vars( $id, array(), $message ); |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - public static function update_settings() { |
|
| 123 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 122 | + public static function update_settings() { |
|
| 123 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 124 | 124 | |
| 125 | 125 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 126 | 126 | |
| 127 | - $errors = FrmForm::validate($_POST); |
|
| 128 | - if ( count($errors) > 0 ) { |
|
| 129 | - return self::get_settings_vars($id, $errors); |
|
| 130 | - } |
|
| 127 | + $errors = FrmForm::validate($_POST); |
|
| 128 | + if ( count($errors) > 0 ) { |
|
| 129 | + return self::get_settings_vars($id, $errors); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - do_action('frm_before_update_form_settings', $id); |
|
| 132 | + do_action('frm_before_update_form_settings', $id); |
|
| 133 | 133 | |
| 134 | 134 | FrmForm::update( $id, $_POST ); |
| 135 | 135 | |
| 136 | - $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
| 136 | + $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
| 137 | 137 | return self::get_settings_vars( $id, array(), $message ); |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | public static function edit_key() { |
| 141 | 141 | $values = self::edit_in_place_value( 'form_key' ); |
@@ -165,43 +165,43 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | public static function update( $values = array() ) { |
| 167 | 167 | if ( empty( $values ) ) { |
| 168 | - $values = $_POST; |
|
| 169 | - } |
|
| 168 | + $values = $_POST; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - //Set radio button and checkbox meta equal to "other" value |
|
| 172 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 173 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 174 | - } |
|
| 171 | + //Set radio button and checkbox meta equal to "other" value |
|
| 172 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 173 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - $errors = FrmForm::validate( $values ); |
|
| 177 | - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
| 178 | - if ( $permission_error !== false ) { |
|
| 179 | - $errors['form'] = $permission_error; |
|
| 180 | - } |
|
| 176 | + $errors = FrmForm::validate( $values ); |
|
| 177 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
| 178 | + if ( $permission_error !== false ) { |
|
| 179 | + $errors['form'] = $permission_error; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 183 | 183 | |
| 184 | 184 | if ( count( $errors ) > 0 ) { |
| 185 | - return self::get_edit_vars( $id, $errors ); |
|
| 185 | + return self::get_edit_vars( $id, $errors ); |
|
| 186 | 186 | } else { |
| 187 | - FrmForm::update( $id, $values ); |
|
| 188 | - $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 189 | - if ( defined( 'DOING_AJAX' ) ) { |
|
| 187 | + FrmForm::update( $id, $values ); |
|
| 188 | + $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 189 | + if ( defined( 'DOING_AJAX' ) ) { |
|
| 190 | 190 | wp_die( $message ); |
| 191 | - } |
|
| 191 | + } |
|
| 192 | 192 | return self::get_edit_vars( $id, array(), $message ); |
| 193 | - } |
|
| 194 | - } |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - public static function bulk_create_template( $ids ) { |
|
| 197 | - FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 196 | + public static function bulk_create_template( $ids ) { |
|
| 197 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 198 | 198 | |
| 199 | - foreach ( $ids as $id ) { |
|
| 200 | - FrmForm::duplicate( $id, true, true ); |
|
| 201 | - } |
|
| 199 | + foreach ( $ids as $id ) { |
|
| 200 | + FrmForm::duplicate( $id, true, true ); |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - return __( 'Form template was Successfully Created', 'formidable' ); |
|
| 204 | - } |
|
| 203 | + return __( 'Form template was Successfully Created', 'formidable' ); |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * Redirect to the url for creating from a template |
@@ -222,45 +222,45 @@ discard block |
||
| 222 | 222 | wp_die(); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - public static function duplicate() { |
|
| 226 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 225 | + public static function duplicate() { |
|
| 226 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 227 | 227 | |
| 228 | 228 | $params = FrmForm::list_page_params(); |
| 229 | - $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
| 230 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 231 | - if ( $form ) { |
|
| 229 | + $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
| 230 | + $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 231 | + if ( $form ) { |
|
| 232 | 232 | return self::get_edit_vars( $form, array(), $message, true ); |
| 233 | - } else { |
|
| 234 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 235 | - } |
|
| 236 | - } |
|
| 233 | + } else { |
|
| 234 | + return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - public static function page_preview() { |
|
| 238 | + public static function page_preview() { |
|
| 239 | 239 | $params = FrmForm::list_page_params(); |
| 240 | - if ( ! $params['form'] ) { |
|
| 241 | - return; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - $form = FrmForm::getOne( $params['form'] ); |
|
| 245 | - if ( ! $form ) { |
|
| 246 | - return; |
|
| 247 | - } |
|
| 248 | - return self::show_form( $form->id, '', true, true ); |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - public static function preview() { |
|
| 252 | - do_action( 'frm_wp' ); |
|
| 253 | - |
|
| 254 | - global $frm_vars; |
|
| 255 | - $frm_vars['preview'] = true; |
|
| 256 | - |
|
| 257 | - if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
| 258 | - global $wp; |
|
| 259 | - $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 260 | - include_once( $root.'/wp-config.php' ); |
|
| 261 | - $wp->init(); |
|
| 262 | - $wp->register_globals(); |
|
| 263 | - } |
|
| 240 | + if ( ! $params['form'] ) { |
|
| 241 | + return; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + $form = FrmForm::getOne( $params['form'] ); |
|
| 245 | + if ( ! $form ) { |
|
| 246 | + return; |
|
| 247 | + } |
|
| 248 | + return self::show_form( $form->id, '', true, true ); |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + public static function preview() { |
|
| 252 | + do_action( 'frm_wp' ); |
|
| 253 | + |
|
| 254 | + global $frm_vars; |
|
| 255 | + $frm_vars['preview'] = true; |
|
| 256 | + |
|
| 257 | + if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
| 258 | + global $wp; |
|
| 259 | + $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 260 | + include_once( $root.'/wp-config.php' ); |
|
| 261 | + $wp->init(); |
|
| 262 | + $wp->register_globals(); |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | 265 | self::register_pro_scripts(); |
| 266 | 266 | |
@@ -274,11 +274,11 @@ discard block |
||
| 274 | 274 | $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 ); |
| 275 | 275 | if ( empty( $form ) ) { |
| 276 | 276 | $form = FrmForm::getAll( array(), '', 1 ); |
| 277 | - } |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 280 | - wp_die(); |
|
| 281 | - } |
|
| 279 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 280 | + wp_die(); |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | public static function register_pro_scripts() { |
| 284 | 284 | if ( FrmAppHelper::pro_is_installed() ) { |
@@ -288,22 +288,22 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - public static function untrash() { |
|
| 291 | + public static function untrash() { |
|
| 292 | 292 | self::change_form_status( 'untrash' ); |
| 293 | - } |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | 295 | public static function bulk_untrash( $ids ) { |
| 296 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 296 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 297 | 297 | |
| 298 | - $count = FrmForm::set_status( $ids, 'published' ); |
|
| 298 | + $count = FrmForm::set_status( $ids, 'published' ); |
|
| 299 | 299 | |
| 300 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 301 | - return $message; |
|
| 302 | - } |
|
| 300 | + $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 301 | + return $message; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - public static function trash() { |
|
| 304 | + public static function trash() { |
|
| 305 | 305 | self::change_form_status( 'trash' ); |
| 306 | - } |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | 309 | * @param string $status |
@@ -341,68 +341,68 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | public static function bulk_trash( $ids ) { |
| 344 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 344 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 345 | 345 | |
| 346 | - $count = 0; |
|
| 347 | - foreach ( $ids as $id ) { |
|
| 348 | - if ( FrmForm::trash( $id ) ) { |
|
| 349 | - $count++; |
|
| 350 | - } |
|
| 351 | - } |
|
| 346 | + $count = 0; |
|
| 347 | + foreach ( $ids as $id ) { |
|
| 348 | + if ( FrmForm::trash( $id ) ) { |
|
| 349 | + $count++; |
|
| 350 | + } |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 354 | - $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>' ); |
|
| 353 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 354 | + $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>' ); |
|
| 355 | 355 | |
| 356 | - return $message; |
|
| 357 | - } |
|
| 356 | + return $message; |
|
| 357 | + } |
|
| 358 | 358 | |
| 359 | - public static function destroy() { |
|
| 360 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 359 | + public static function destroy() { |
|
| 360 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 361 | 361 | |
| 362 | 362 | $params = FrmForm::list_page_params(); |
| 363 | 363 | |
| 364 | - //check nonce url |
|
| 365 | - check_admin_referer('destroy_form_' . $params['id']); |
|
| 364 | + //check nonce url |
|
| 365 | + check_admin_referer('destroy_form_' . $params['id']); |
|
| 366 | 366 | |
| 367 | - $count = 0; |
|
| 368 | - if ( FrmForm::destroy( $params['id'] ) ) { |
|
| 369 | - $count++; |
|
| 370 | - } |
|
| 367 | + $count = 0; |
|
| 368 | + if ( FrmForm::destroy( $params['id'] ) ) { |
|
| 369 | + $count++; |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 372 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 373 | 373 | |
| 374 | 374 | self::display_forms_list( $params, $message ); |
| 375 | - } |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | 377 | public static function bulk_destroy( $ids ) { |
| 378 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 378 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 379 | 379 | |
| 380 | - $count = 0; |
|
| 381 | - foreach ( $ids as $id ) { |
|
| 382 | - $d = FrmForm::destroy( $id ); |
|
| 383 | - if ( $d ) { |
|
| 384 | - $count++; |
|
| 385 | - } |
|
| 386 | - } |
|
| 380 | + $count = 0; |
|
| 381 | + foreach ( $ids as $id ) { |
|
| 382 | + $d = FrmForm::destroy( $id ); |
|
| 383 | + if ( $d ) { |
|
| 384 | + $count++; |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 388 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 389 | 389 | |
| 390 | - return $message; |
|
| 391 | - } |
|
| 390 | + return $message; |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | - private static function delete_all() { |
|
| 394 | - //check nonce url |
|
| 395 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 396 | - if ( $permission_error !== false ) { |
|
| 393 | + private static function delete_all() { |
|
| 394 | + //check nonce url |
|
| 395 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 396 | + if ( $permission_error !== false ) { |
|
| 397 | 397 | self::display_forms_list( array(), '', array( $permission_error ) ); |
| 398 | - return; |
|
| 399 | - } |
|
| 398 | + return; |
|
| 399 | + } |
|
| 400 | 400 | |
| 401 | 401 | $count = FrmForm::scheduled_delete( time() ); |
| 402 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 402 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 403 | 403 | |
| 404 | 404 | self::display_forms_list( array(), $message ); |
| 405 | - } |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | 407 | public static function scheduled_delete( $delete_timestamp = '' ) { |
| 408 | 408 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' ); |
@@ -410,11 +410,11 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | - * Inserts Formidable button |
|
| 414 | - * Hook exists since 2.5.0 |
|
| 415 | - * |
|
| 416 | - * @since 2.0.15 |
|
| 417 | - */ |
|
| 413 | + * Inserts Formidable button |
|
| 414 | + * Hook exists since 2.5.0 |
|
| 415 | + * |
|
| 416 | + * @since 2.0.15 |
|
| 417 | + */ |
|
| 418 | 418 | public static function insert_form_button() { |
| 419 | 419 | if ( current_user_can('frm_view_forms') ) { |
| 420 | 420 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -423,48 +423,48 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - public static function insert_form_popup() { |
|
| 426 | + public static function insert_form_popup() { |
|
| 427 | 427 | $page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) ); |
| 428 | 428 | if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) { |
| 429 | - return; |
|
| 430 | - } |
|
| 429 | + return; |
|
| 430 | + } |
|
| 431 | 431 | |
| 432 | - FrmAppHelper::load_admin_wide_js(); |
|
| 432 | + FrmAppHelper::load_admin_wide_js(); |
|
| 433 | 433 | |
| 434 | - $shortcodes = array( |
|
| 434 | + $shortcodes = array( |
|
| 435 | 435 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
| 436 | - ); |
|
| 436 | + ); |
|
| 437 | 437 | |
| 438 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 438 | + $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 439 | 439 | |
| 440 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 441 | - } |
|
| 440 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 441 | + } |
|
| 442 | 442 | |
| 443 | - public static function get_shortcode_opts() { |
|
| 444 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 443 | + public static function get_shortcode_opts() { |
|
| 444 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 445 | 445 | |
| 446 | 446 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
| 447 | - if ( empty($shortcode) ) { |
|
| 448 | - wp_die(); |
|
| 449 | - } |
|
| 447 | + if ( empty($shortcode) ) { |
|
| 448 | + wp_die(); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 452 | - echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 451 | + echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 452 | + echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 453 | 453 | |
| 454 | - $form_id = ''; |
|
| 455 | - $opts = array(); |
|
| 454 | + $form_id = ''; |
|
| 455 | + $opts = array(); |
|
| 456 | 456 | switch ( $shortcode ) { |
| 457 | - case 'formidable': |
|
| 458 | - $opts = array( |
|
| 457 | + case 'formidable': |
|
| 458 | + $opts = array( |
|
| 459 | 459 | 'form_id' => 'id', |
| 460 | - //'key' => ', |
|
| 460 | + //'key' => ', |
|
| 461 | 461 | 'title' => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ), |
| 462 | 462 | 'description' => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ), |
| 463 | 463 | 'minimize' => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ), |
| 464 | - ); |
|
| 465 | - break; |
|
| 466 | - } |
|
| 467 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 464 | + ); |
|
| 465 | + break; |
|
| 466 | + } |
|
| 467 | + $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 468 | 468 | |
| 469 | 469 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
| 470 | 470 | // allow other shortcodes to use the required form id option |
@@ -472,63 +472,63 @@ discard block |
||
| 472 | 472 | unset( $opts['form_id'] ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 475 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 476 | 476 | |
| 477 | - echo '</div>'; |
|
| 477 | + echo '</div>'; |
|
| 478 | 478 | |
| 479 | - wp_die(); |
|
| 480 | - } |
|
| 479 | + wp_die(); |
|
| 480 | + } |
|
| 481 | 481 | |
| 482 | 482 | public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) { |
| 483 | - FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 483 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 484 | 484 | if ( ! empty( $deprecated_errors ) ) { |
| 485 | 485 | $errors = $deprecated_errors; |
| 486 | 486 | _deprecated_argument( 'errors', '2.0.8' ); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - global $wpdb, $frm_vars; |
|
| 489 | + global $wpdb, $frm_vars; |
|
| 490 | 490 | |
| 491 | 491 | if ( empty( $params ) ) { |
| 492 | 492 | $params = FrmForm::list_page_params(); |
| 493 | - } |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | - $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
| 495 | + $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
| 496 | 496 | |
| 497 | - $pagenum = $wp_list_table->get_pagenum(); |
|
| 497 | + $pagenum = $wp_list_table->get_pagenum(); |
|
| 498 | 498 | |
| 499 | - $wp_list_table->prepare_items(); |
|
| 499 | + $wp_list_table->prepare_items(); |
|
| 500 | 500 | |
| 501 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 502 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 501 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 502 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 503 | 503 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
| 504 | - die(); |
|
| 505 | - } |
|
| 504 | + die(); |
|
| 505 | + } |
|
| 506 | 506 | |
| 507 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 508 | - } |
|
| 507 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | 510 | public static function get_columns( $columns ) { |
| 511 | - $columns['cb'] = '<input type="checkbox" />'; |
|
| 512 | - $columns['id'] = 'ID'; |
|
| 511 | + $columns['cb'] = '<input type="checkbox" />'; |
|
| 512 | + $columns['id'] = 'ID'; |
|
| 513 | 513 | |
| 514 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
| 514 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
| 515 | 515 | |
| 516 | - if ( 'template' == $type ) { |
|
| 517 | - $columns['name'] = __( 'Template Name', 'formidable' ); |
|
| 518 | - $columns['type'] = __( 'Type', 'formidable' ); |
|
| 519 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 520 | - } else { |
|
| 521 | - $columns['name'] = __( 'Form Title', 'formidable' ); |
|
| 522 | - $columns['entries'] = __( 'Entries', 'formidable' ); |
|
| 523 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 524 | - $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
| 525 | - } |
|
| 516 | + if ( 'template' == $type ) { |
|
| 517 | + $columns['name'] = __( 'Template Name', 'formidable' ); |
|
| 518 | + $columns['type'] = __( 'Type', 'formidable' ); |
|
| 519 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 520 | + } else { |
|
| 521 | + $columns['name'] = __( 'Form Title', 'formidable' ); |
|
| 522 | + $columns['entries'] = __( 'Entries', 'formidable' ); |
|
| 523 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
| 524 | + $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
| 525 | + } |
|
| 526 | 526 | |
| 527 | - $columns['created_at'] = __( 'Date', 'formidable' ); |
|
| 527 | + $columns['created_at'] = __( 'Date', 'formidable' ); |
|
| 528 | 528 | |
| 529 | 529 | add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) ); |
| 530 | 530 | |
| 531 | - return $columns; |
|
| 531 | + return $columns; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | public static function get_sortable_columns() { |
@@ -542,110 +542,110 @@ discard block |
||
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | public static function hidden_columns( $result ) { |
| 545 | - $return = false; |
|
| 546 | - foreach ( (array) $result as $r ) { |
|
| 547 | - if ( ! empty( $r ) ) { |
|
| 548 | - $return = true; |
|
| 549 | - break; |
|
| 550 | - } |
|
| 551 | - } |
|
| 545 | + $return = false; |
|
| 546 | + foreach ( (array) $result as $r ) { |
|
| 547 | + if ( ! empty( $r ) ) { |
|
| 548 | + $return = true; |
|
| 549 | + break; |
|
| 550 | + } |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | - if ( $return ) { |
|
| 554 | - return $result; |
|
| 553 | + if ( $return ) { |
|
| 554 | + return $result; |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 557 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 558 | 558 | |
| 559 | - $result[] = 'created_at'; |
|
| 560 | - if ( $type == 'template' ) { |
|
| 561 | - $result[] = 'id'; |
|
| 562 | - $result[] = 'form_key'; |
|
| 563 | - } |
|
| 559 | + $result[] = 'created_at'; |
|
| 560 | + if ( $type == 'template' ) { |
|
| 561 | + $result[] = 'id'; |
|
| 562 | + $result[] = 'form_key'; |
|
| 563 | + } |
|
| 564 | 564 | |
| 565 | - return $result; |
|
| 566 | - } |
|
| 565 | + return $result; |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | 568 | public static function save_per_page( $save, $option, $value ) { |
| 569 | - if ( $option == 'formidable_page_formidable_per_page' ) { |
|
| 570 | - $save = (int) $value; |
|
| 571 | - } |
|
| 572 | - return $save; |
|
| 573 | - } |
|
| 569 | + if ( $option == 'formidable_page_formidable_per_page' ) { |
|
| 570 | + $save = (int) $value; |
|
| 571 | + } |
|
| 572 | + return $save; |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | 575 | private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) { |
| 576 | - global $frm_vars; |
|
| 576 | + global $frm_vars; |
|
| 577 | 577 | |
| 578 | - $form = FrmForm::getOne( $id ); |
|
| 579 | - if ( ! $form ) { |
|
| 580 | - wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
| 581 | - } |
|
| 578 | + $form = FrmForm::getOne( $id ); |
|
| 579 | + if ( ! $form ) { |
|
| 580 | + wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | - if ( $form->parent_form_id ) { |
|
| 584 | - 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>' )); |
|
| 585 | - } |
|
| 583 | + if ( $form->parent_form_id ) { |
|
| 584 | + 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>' )); |
|
| 585 | + } |
|
| 586 | 586 | |
| 587 | 587 | $frm_field_selection = FrmField::field_selection(); |
| 588 | - $fields = FrmField::get_all_for_form($form->id); |
|
| 588 | + $fields = FrmField::get_all_for_form($form->id); |
|
| 589 | 589 | |
| 590 | - // Automatically add end section fields if they don't exist (2.0 migration) |
|
| 591 | - $reset_fields = false; |
|
| 592 | - FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
| 590 | + // Automatically add end section fields if they don't exist (2.0 migration) |
|
| 591 | + $reset_fields = false; |
|
| 592 | + FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
| 593 | 593 | |
| 594 | - if ( $reset_fields ) { |
|
| 595 | - $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
| 596 | - } |
|
| 594 | + if ( $reset_fields ) { |
|
| 595 | + $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 598 | + unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 599 | 599 | |
| 600 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 600 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 601 | 601 | |
| 602 | - $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 603 | - if ( $form->is_template && $message == $edit_message ) { |
|
| 604 | - $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
| 605 | - } |
|
| 602 | + $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
| 603 | + if ( $form->is_template && $message == $edit_message ) { |
|
| 604 | + $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
| 605 | + } |
|
| 606 | 606 | |
| 607 | 607 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 608 | 608 | |
| 609 | - if ( $form->default_template ) { |
|
| 610 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 611 | - } else if ( defined('DOING_AJAX') ) { |
|
| 612 | - wp_die(); |
|
| 613 | - } else if ( $create_link ) { |
|
| 614 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 615 | - } else { |
|
| 616 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 617 | - } |
|
| 618 | - } |
|
| 609 | + if ( $form->default_template ) { |
|
| 610 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 611 | + } else if ( defined('DOING_AJAX') ) { |
|
| 612 | + wp_die(); |
|
| 613 | + } else if ( $create_link ) { |
|
| 614 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 615 | + } else { |
|
| 616 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 617 | + } |
|
| 618 | + } |
|
| 619 | 619 | |
| 620 | 620 | public static function get_settings_vars( $id, $errors = array(), $message = '' ) { |
| 621 | 621 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 622 | 622 | |
| 623 | - global $frm_vars; |
|
| 623 | + global $frm_vars; |
|
| 624 | 624 | |
| 625 | - $form = FrmForm::getOne( $id ); |
|
| 625 | + $form = FrmForm::getOne( $id ); |
|
| 626 | 626 | |
| 627 | - $fields = FrmField::get_all_for_form($id); |
|
| 628 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 627 | + $fields = FrmField::get_all_for_form($id); |
|
| 628 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 629 | 629 | |
| 630 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 631 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 632 | - } |
|
| 630 | + if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 631 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 632 | + } |
|
| 633 | 633 | |
| 634 | - $action_controls = FrmFormActionsController::get_form_actions(); |
|
| 634 | + $action_controls = FrmFormActionsController::get_form_actions(); |
|
| 635 | 635 | |
| 636 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 637 | - $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
| 636 | + $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 637 | + $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
| 638 | 638 | |
| 639 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
| 639 | + $styles = apply_filters('frm_get_style_opts', array()); |
|
| 640 | 640 | |
| 641 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 642 | - } |
|
| 641 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 642 | + } |
|
| 643 | 643 | |
| 644 | - public static function mb_tags_box( $form_id, $class = '' ) { |
|
| 645 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 646 | - $linked_forms = array(); |
|
| 647 | - $col = 'one'; |
|
| 648 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 644 | + public static function mb_tags_box( $form_id, $class = '' ) { |
|
| 645 | + $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 646 | + $linked_forms = array(); |
|
| 647 | + $col = 'one'; |
|
| 648 | + $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 649 | 649 | |
| 650 | 650 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
| 651 | 651 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $entry_shortcodes = self::get_shortcode_helpers( $settings_tab ); |
| 654 | 654 | |
| 655 | 655 | include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' ); |
| 656 | - } |
|
| 656 | + } |
|
| 657 | 657 | |
| 658 | 658 | /** |
| 659 | 659 | * Get an array of the options to display in the advanced tab |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | '' => '', |
| 695 | 695 | 'siteurl' => __( 'Site URL', 'formidable' ), |
| 696 | 696 | 'sitename' => __( 'Site Name', 'formidable' ), |
| 697 | - ); |
|
| 697 | + ); |
|
| 698 | 698 | |
| 699 | 699 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 700 | 700 | unset( $entry_shortcodes['post_id'] ); |
@@ -721,38 +721,38 @@ discard block |
||
| 721 | 721 | return $entry_shortcodes; |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - // Insert the form class setting into the form |
|
| 724 | + // Insert the form class setting into the form |
|
| 725 | 725 | public static function form_classes( $form ) { |
| 726 | - if ( isset($form->options['form_class']) ) { |
|
| 726 | + if ( isset($form->options['form_class']) ) { |
|
| 727 | 727 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
| 728 | - } |
|
| 729 | - } |
|
| 728 | + } |
|
| 729 | + } |
|
| 730 | 730 | |
| 731 | - public static function get_email_html() { |
|
| 732 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 731 | + public static function get_email_html() { |
|
| 732 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 733 | 733 | echo FrmEntryFormat::show_entry( array( |
| 734 | 734 | 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 735 | - 'default_email' => true, |
|
| 735 | + 'default_email' => true, |
|
| 736 | 736 | 'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ), |
| 737 | - ) ); |
|
| 738 | - wp_die(); |
|
| 737 | + ) ); |
|
| 738 | + wp_die(); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - public static function filter_content( $content, $form, $entry = false ) { |
|
| 741 | + public static function filter_content( $content, $form, $entry = false ) { |
|
| 742 | 742 | self::get_entry_by_param( $entry ); |
| 743 | - if ( ! $entry ) { |
|
| 744 | - return $content; |
|
| 745 | - } |
|
| 743 | + if ( ! $entry ) { |
|
| 744 | + return $content; |
|
| 745 | + } |
|
| 746 | 746 | |
| 747 | - if ( is_object( $form ) ) { |
|
| 748 | - $form = $form->id; |
|
| 749 | - } |
|
| 747 | + if ( is_object( $form ) ) { |
|
| 748 | + $form = $form->id; |
|
| 749 | + } |
|
| 750 | 750 | |
| 751 | - $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
| 752 | - $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
| 751 | + $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
| 752 | + $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
| 753 | 753 | |
| 754 | - return $content; |
|
| 755 | - } |
|
| 754 | + return $content; |
|
| 755 | + } |
|
| 756 | 756 | |
| 757 | 757 | private static function get_entry_by_param( &$entry ) { |
| 758 | 758 | if ( ! $entry || ! is_object( $entry ) ) { |
@@ -764,287 +764,287 @@ discard block |
||
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | - public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
| 768 | - return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
| 769 | - } |
|
| 767 | + public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
| 768 | + return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
| 769 | + } |
|
| 770 | 770 | |
| 771 | - public static function process_bulk_form_actions( $errors ) { |
|
| 772 | - if ( ! $_REQUEST ) { |
|
| 773 | - return $errors; |
|
| 774 | - } |
|
| 771 | + public static function process_bulk_form_actions( $errors ) { |
|
| 772 | + if ( ! $_REQUEST ) { |
|
| 773 | + return $errors; |
|
| 774 | + } |
|
| 775 | 775 | |
| 776 | 776 | $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
| 777 | - if ( $bulkaction == -1 ) { |
|
| 777 | + if ( $bulkaction == -1 ) { |
|
| 778 | 778 | $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 779 | - } |
|
| 780 | - |
|
| 781 | - if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
| 782 | - FrmAppHelper::remove_get_action(); |
|
| 783 | - |
|
| 784 | - $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
| 785 | - } |
|
| 786 | - |
|
| 787 | - $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
| 788 | - if ( empty( $ids ) ) { |
|
| 789 | - $errors[] = __( 'No forms were specified', 'formidable' ); |
|
| 790 | - return $errors; |
|
| 791 | - } |
|
| 792 | - |
|
| 793 | - $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 794 | - if ( $permission_error !== false ) { |
|
| 795 | - $errors[] = $permission_error; |
|
| 796 | - return $errors; |
|
| 797 | - } |
|
| 798 | - |
|
| 799 | - if ( ! is_array( $ids ) ) { |
|
| 800 | - $ids = explode( ',', $ids ); |
|
| 801 | - } |
|
| 802 | - |
|
| 803 | - switch ( $bulkaction ) { |
|
| 804 | - case 'delete': |
|
| 805 | - $message = self::bulk_destroy( $ids ); |
|
| 806 | - break; |
|
| 807 | - case 'trash': |
|
| 808 | - $message = self::bulk_trash( $ids ); |
|
| 809 | - break; |
|
| 810 | - case 'untrash': |
|
| 811 | - $message = self::bulk_untrash( $ids ); |
|
| 812 | - break; |
|
| 813 | - case 'create_template': |
|
| 814 | - $message = self::bulk_create_template( $ids ); |
|
| 815 | - break; |
|
| 816 | - } |
|
| 817 | - |
|
| 818 | - if ( isset( $message ) && ! empty( $message ) ) { |
|
| 779 | + } |
|
| 780 | + |
|
| 781 | + if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
| 782 | + FrmAppHelper::remove_get_action(); |
|
| 783 | + |
|
| 784 | + $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
| 785 | + } |
|
| 786 | + |
|
| 787 | + $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
| 788 | + if ( empty( $ids ) ) { |
|
| 789 | + $errors[] = __( 'No forms were specified', 'formidable' ); |
|
| 790 | + return $errors; |
|
| 791 | + } |
|
| 792 | + |
|
| 793 | + $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 794 | + if ( $permission_error !== false ) { |
|
| 795 | + $errors[] = $permission_error; |
|
| 796 | + return $errors; |
|
| 797 | + } |
|
| 798 | + |
|
| 799 | + if ( ! is_array( $ids ) ) { |
|
| 800 | + $ids = explode( ',', $ids ); |
|
| 801 | + } |
|
| 802 | + |
|
| 803 | + switch ( $bulkaction ) { |
|
| 804 | + case 'delete': |
|
| 805 | + $message = self::bulk_destroy( $ids ); |
|
| 806 | + break; |
|
| 807 | + case 'trash': |
|
| 808 | + $message = self::bulk_trash( $ids ); |
|
| 809 | + break; |
|
| 810 | + case 'untrash': |
|
| 811 | + $message = self::bulk_untrash( $ids ); |
|
| 812 | + break; |
|
| 813 | + case 'create_template': |
|
| 814 | + $message = self::bulk_create_template( $ids ); |
|
| 815 | + break; |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + if ( isset( $message ) && ! empty( $message ) ) { |
|
| 819 | 819 | echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>'; |
| 820 | - } |
|
| 820 | + } |
|
| 821 | 821 | |
| 822 | - return $errors; |
|
| 823 | - } |
|
| 822 | + return $errors; |
|
| 823 | + } |
|
| 824 | 824 | |
| 825 | - public static function add_default_templates( $path, $default = true, $template = true ) { |
|
| 826 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
| 825 | + public static function add_default_templates( $path, $default = true, $template = true ) { |
|
| 826 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
| 827 | 827 | |
| 828 | - $path = untrailingslashit(trim($path)); |
|
| 829 | - $templates = glob( $path .'/*.php' ); |
|
| 828 | + $path = untrailingslashit(trim($path)); |
|
| 829 | + $templates = glob( $path .'/*.php' ); |
|
| 830 | 830 | |
| 831 | 831 | for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
| 832 | - $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 832 | + $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 833 | 833 | $template_query = array( 'form_key' => $filename ); |
| 834 | - if ( $template ) { |
|
| 835 | - $template_query['is_template'] = 1; |
|
| 836 | - } |
|
| 837 | - if ( $default ) { |
|
| 838 | - $template_query['default_template'] = 1; |
|
| 839 | - } |
|
| 834 | + if ( $template ) { |
|
| 835 | + $template_query['is_template'] = 1; |
|
| 836 | + } |
|
| 837 | + if ( $default ) { |
|
| 838 | + $template_query['default_template'] = 1; |
|
| 839 | + } |
|
| 840 | 840 | $form = FrmForm::getAll( $template_query, '', 1 ); |
| 841 | 841 | |
| 842 | - $values = FrmFormsHelper::setup_new_vars(); |
|
| 843 | - $values['form_key'] = $filename; |
|
| 844 | - $values['is_template'] = $template; |
|
| 845 | - $values['status'] = 'published'; |
|
| 846 | - if ( $default ) { |
|
| 847 | - $values['default_template'] = 1; |
|
| 848 | - } |
|
| 849 | - |
|
| 850 | - include( $templates[ $i ] ); |
|
| 851 | - |
|
| 852 | - //get updated form |
|
| 853 | - if ( isset($form) && ! empty($form) ) { |
|
| 854 | - $old_id = $form->id; |
|
| 855 | - $form = FrmForm::getOne($form->id); |
|
| 856 | - } else { |
|
| 857 | - $old_id = false; |
|
| 842 | + $values = FrmFormsHelper::setup_new_vars(); |
|
| 843 | + $values['form_key'] = $filename; |
|
| 844 | + $values['is_template'] = $template; |
|
| 845 | + $values['status'] = 'published'; |
|
| 846 | + if ( $default ) { |
|
| 847 | + $values['default_template'] = 1; |
|
| 848 | + } |
|
| 849 | + |
|
| 850 | + include( $templates[ $i ] ); |
|
| 851 | + |
|
| 852 | + //get updated form |
|
| 853 | + if ( isset($form) && ! empty($form) ) { |
|
| 854 | + $old_id = $form->id; |
|
| 855 | + $form = FrmForm::getOne($form->id); |
|
| 856 | + } else { |
|
| 857 | + $old_id = false; |
|
| 858 | 858 | $form = FrmForm::getAll( $template_query, '', 1 ); |
| 859 | - } |
|
| 859 | + } |
|
| 860 | 860 | |
| 861 | - if ( $form ) { |
|
| 861 | + if ( $form ) { |
|
| 862 | 862 | do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) ); |
| 863 | - } |
|
| 864 | - } |
|
| 865 | - } |
|
| 863 | + } |
|
| 864 | + } |
|
| 865 | + } |
|
| 866 | 866 | |
| 867 | - public static function route() { |
|
| 868 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 869 | - $vars = array(); |
|
| 867 | + public static function route() { |
|
| 868 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 869 | + $vars = array(); |
|
| 870 | 870 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
| 871 | 871 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 872 | 872 | |
| 873 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 874 | - $json_vars = json_decode($json_vars, true); |
|
| 875 | - if ( empty($json_vars) ) { |
|
| 876 | - // json decoding failed so we should return an error message |
|
| 873 | + $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 874 | + $json_vars = json_decode($json_vars, true); |
|
| 875 | + if ( empty($json_vars) ) { |
|
| 876 | + // json decoding failed so we should return an error message |
|
| 877 | 877 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 878 | - if ( 'edit' == $action ) { |
|
| 879 | - $action = 'update'; |
|
| 880 | - } |
|
| 881 | - |
|
| 882 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 883 | - } else { |
|
| 884 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 885 | - $action = $vars[ $action ]; |
|
| 878 | + if ( 'edit' == $action ) { |
|
| 879 | + $action = 'update'; |
|
| 880 | + } |
|
| 881 | + |
|
| 882 | + add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 883 | + } else { |
|
| 884 | + $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 885 | + $action = $vars[ $action ]; |
|
| 886 | 886 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
| 887 | 887 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
| 888 | 888 | $_POST = array_merge( $_POST, $_REQUEST ); |
| 889 | - } |
|
| 890 | - } else { |
|
| 889 | + } |
|
| 890 | + } else { |
|
| 891 | 891 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 892 | - if ( isset( $_REQUEST['delete_all'] ) ) { |
|
| 893 | - // override the action for this page |
|
| 894 | - $action = 'delete_all'; |
|
| 895 | - } |
|
| 896 | - } |
|
| 892 | + if ( isset( $_REQUEST['delete_all'] ) ) { |
|
| 893 | + // override the action for this page |
|
| 894 | + $action = 'delete_all'; |
|
| 895 | + } |
|
| 896 | + } |
|
| 897 | 897 | |
| 898 | 898 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
| 899 | - FrmAppHelper::trigger_hook_load( 'form' ); |
|
| 900 | - |
|
| 901 | - switch ( $action ) { |
|
| 902 | - case 'new': |
|
| 903 | - return self::new_form($vars); |
|
| 904 | - case 'create': |
|
| 905 | - case 'edit': |
|
| 906 | - case 'update': |
|
| 907 | - case 'duplicate': |
|
| 908 | - case 'trash': |
|
| 909 | - case 'untrash': |
|
| 910 | - case 'destroy': |
|
| 911 | - case 'delete_all': |
|
| 912 | - case 'settings': |
|
| 913 | - case 'update_settings': |
|
| 899 | + FrmAppHelper::trigger_hook_load( 'form' ); |
|
| 900 | + |
|
| 901 | + switch ( $action ) { |
|
| 902 | + case 'new': |
|
| 903 | + return self::new_form($vars); |
|
| 904 | + case 'create': |
|
| 905 | + case 'edit': |
|
| 906 | + case 'update': |
|
| 907 | + case 'duplicate': |
|
| 908 | + case 'trash': |
|
| 909 | + case 'untrash': |
|
| 910 | + case 'destroy': |
|
| 911 | + case 'delete_all': |
|
| 912 | + case 'settings': |
|
| 913 | + case 'update_settings': |
|
| 914 | 914 | return self::$action( $vars ); |
| 915 | - default: |
|
| 916 | - do_action('frm_form_action_'. $action); |
|
| 917 | - if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 918 | - return; |
|
| 919 | - } |
|
| 915 | + default: |
|
| 916 | + do_action('frm_form_action_'. $action); |
|
| 917 | + if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 918 | + return; |
|
| 919 | + } |
|
| 920 | 920 | |
| 921 | 921 | $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
| 922 | - if ( $action == -1 ) { |
|
| 922 | + if ( $action == -1 ) { |
|
| 923 | 923 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 924 | - } |
|
| 924 | + } |
|
| 925 | 925 | |
| 926 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
| 927 | - FrmAppHelper::remove_get_action(); |
|
| 928 | - return self::list_form(); |
|
| 929 | - } |
|
| 926 | + if ( strpos($action, 'bulk_') === 0 ) { |
|
| 927 | + FrmAppHelper::remove_get_action(); |
|
| 928 | + return self::list_form(); |
|
| 929 | + } |
|
| 930 | 930 | |
| 931 | - return self::display_forms_list(); |
|
| 932 | - } |
|
| 933 | - } |
|
| 931 | + return self::display_forms_list(); |
|
| 932 | + } |
|
| 933 | + } |
|
| 934 | 934 | |
| 935 | - public static function json_error( $errors ) { |
|
| 936 | - $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
| 937 | - return $errors; |
|
| 938 | - } |
|
| 935 | + public static function json_error( $errors ) { |
|
| 936 | + $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
| 937 | + return $errors; |
|
| 938 | + } |
|
| 939 | 939 | |
| 940 | 940 | |
| 941 | - /* FRONT-END FORMS */ |
|
| 942 | - public static function admin_bar_css() { |
|
| 941 | + /* FRONT-END FORMS */ |
|
| 942 | + public static function admin_bar_css() { |
|
| 943 | 943 | if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
| 944 | - return; |
|
| 945 | - } |
|
| 944 | + return; |
|
| 945 | + } |
|
| 946 | 946 | |
| 947 | 947 | add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' ); |
| 948 | 948 | FrmAppHelper::load_font_style(); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | public static function admin_bar_configure() { |
| 952 | - global $frm_vars; |
|
| 953 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
| 954 | - return; |
|
| 955 | - } |
|
| 956 | - |
|
| 957 | - $actions = array(); |
|
| 958 | - foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
| 959 | - if ( is_object($form) ) { |
|
| 960 | - $actions[ $form->id ] = $form->name; |
|
| 961 | - } |
|
| 962 | - unset($form); |
|
| 963 | - } |
|
| 964 | - |
|
| 965 | - if ( empty($actions) ) { |
|
| 966 | - return; |
|
| 967 | - } |
|
| 968 | - |
|
| 969 | - asort($actions); |
|
| 970 | - |
|
| 971 | - global $wp_admin_bar; |
|
| 972 | - |
|
| 973 | - if ( count($actions) == 1 ) { |
|
| 974 | - $wp_admin_bar->add_menu( array( |
|
| 975 | - 'title' => 'Edit Form', |
|
| 976 | - 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 977 | - 'id' => 'frm-forms', |
|
| 978 | - ) ); |
|
| 979 | - } else { |
|
| 980 | - $wp_admin_bar->add_menu( array( |
|
| 981 | - 'id' => 'frm-forms', |
|
| 982 | - 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
| 983 | - 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 984 | - 'meta' => array( |
|
| 952 | + global $frm_vars; |
|
| 953 | + if ( empty($frm_vars['forms_loaded']) ) { |
|
| 954 | + return; |
|
| 955 | + } |
|
| 956 | + |
|
| 957 | + $actions = array(); |
|
| 958 | + foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
| 959 | + if ( is_object($form) ) { |
|
| 960 | + $actions[ $form->id ] = $form->name; |
|
| 961 | + } |
|
| 962 | + unset($form); |
|
| 963 | + } |
|
| 964 | + |
|
| 965 | + if ( empty($actions) ) { |
|
| 966 | + return; |
|
| 967 | + } |
|
| 968 | + |
|
| 969 | + asort($actions); |
|
| 970 | + |
|
| 971 | + global $wp_admin_bar; |
|
| 972 | + |
|
| 973 | + if ( count($actions) == 1 ) { |
|
| 974 | + $wp_admin_bar->add_menu( array( |
|
| 975 | + 'title' => 'Edit Form', |
|
| 976 | + 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 977 | + 'id' => 'frm-forms', |
|
| 978 | + ) ); |
|
| 979 | + } else { |
|
| 980 | + $wp_admin_bar->add_menu( array( |
|
| 981 | + 'id' => 'frm-forms', |
|
| 982 | + 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
| 983 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 984 | + 'meta' => array( |
|
| 985 | 985 | 'title' => __( 'Edit Forms', 'formidable' ), |
| 986 | - ), |
|
| 987 | - ) ); |
|
| 986 | + ), |
|
| 987 | + ) ); |
|
| 988 | 988 | |
| 989 | - foreach ( $actions as $form_id => $name ) { |
|
| 989 | + foreach ( $actions as $form_id => $name ) { |
|
| 990 | 990 | |
| 991 | - $wp_admin_bar->add_menu( array( |
|
| 992 | - 'parent' => 'frm-forms', |
|
| 993 | - 'id' => 'edit_form_'. $form_id, |
|
| 994 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 991 | + $wp_admin_bar->add_menu( array( |
|
| 992 | + 'parent' => 'frm-forms', |
|
| 993 | + 'id' => 'edit_form_'. $form_id, |
|
| 994 | + 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 995 | 995 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
| 996 | - ) ); |
|
| 997 | - } |
|
| 998 | - } |
|
| 999 | - } |
|
| 996 | + ) ); |
|
| 997 | + } |
|
| 998 | + } |
|
| 999 | + } |
|
| 1000 | 1000 | |
| 1001 | - //formidable shortcode |
|
| 1001 | + //formidable shortcode |
|
| 1002 | 1002 | public static function get_form_shortcode( $atts ) { |
| 1003 | - global $frm_vars; |
|
| 1004 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 1005 | - $sc = '[formidable'; |
|
| 1003 | + global $frm_vars; |
|
| 1004 | + if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 1005 | + $sc = '[formidable'; |
|
| 1006 | 1006 | if ( ! empty( $atts ) ) { |
| 1007 | 1007 | foreach ( $atts as $k => $v ) { |
| 1008 | 1008 | $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | - return $sc .']'; |
|
| 1012 | - } |
|
| 1013 | - |
|
| 1014 | - $shortcode_atts = shortcode_atts( array( |
|
| 1015 | - 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
| 1016 | - 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
| 1017 | - 'exclude_fields' => array(), 'minimize' => false, |
|
| 1018 | - ), $atts); |
|
| 1019 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1020 | - |
|
| 1021 | - return self::show_form( |
|
| 1022 | - $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
| 1023 | - $shortcode_atts['description'], $atts |
|
| 1024 | - ); |
|
| 1025 | - } |
|
| 1026 | - |
|
| 1027 | - public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
| 1028 | - if ( empty( $id ) ) { |
|
| 1029 | - $id = $key; |
|
| 1030 | - } |
|
| 1031 | - |
|
| 1032 | - // no form id or key set |
|
| 1033 | - if ( empty( $id ) ) { |
|
| 1034 | - return __( 'Please select a valid form', 'formidable' ); |
|
| 1035 | - } |
|
| 1036 | - |
|
| 1037 | - $form = FrmForm::getOne( $id ); |
|
| 1038 | - if ( ! $form || $form->parent_form_id ) { |
|
| 1039 | - return __( 'Please select a valid form', 'formidable' ); |
|
| 1040 | - } |
|
| 1011 | + return $sc .']'; |
|
| 1012 | + } |
|
| 1013 | + |
|
| 1014 | + $shortcode_atts = shortcode_atts( array( |
|
| 1015 | + 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
| 1016 | + 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
| 1017 | + 'exclude_fields' => array(), 'minimize' => false, |
|
| 1018 | + ), $atts); |
|
| 1019 | + do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1020 | + |
|
| 1021 | + return self::show_form( |
|
| 1022 | + $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
| 1023 | + $shortcode_atts['description'], $atts |
|
| 1024 | + ); |
|
| 1025 | + } |
|
| 1026 | + |
|
| 1027 | + public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
| 1028 | + if ( empty( $id ) ) { |
|
| 1029 | + $id = $key; |
|
| 1030 | + } |
|
| 1031 | + |
|
| 1032 | + // no form id or key set |
|
| 1033 | + if ( empty( $id ) ) { |
|
| 1034 | + return __( 'Please select a valid form', 'formidable' ); |
|
| 1035 | + } |
|
| 1036 | + |
|
| 1037 | + $form = FrmForm::getOne( $id ); |
|
| 1038 | + if ( ! $form || $form->parent_form_id ) { |
|
| 1039 | + return __( 'Please select a valid form', 'formidable' ); |
|
| 1040 | + } |
|
| 1041 | 1041 | |
| 1042 | 1042 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
| 1043 | - FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
| 1043 | + FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
| 1044 | 1044 | |
| 1045 | - $form = apply_filters( 'frm_pre_display_form', $form ); |
|
| 1045 | + $form = apply_filters( 'frm_pre_display_form', $form ); |
|
| 1046 | 1046 | |
| 1047 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 1047 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 1048 | 1048 | |
| 1049 | 1049 | if ( self::is_viewable_draft_form( $form ) ) { |
| 1050 | 1050 | // don't show a draft form on a page |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | return $form; |
| 1068 | - } |
|
| 1068 | + } |
|
| 1069 | 1069 | |
| 1070 | 1070 | private static function is_viewable_draft_form( $form ) { |
| 1071 | 1071 | global $post; |
@@ -1081,98 +1081,98 @@ discard block |
||
| 1081 | 1081 | 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'] ); |
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | - public static function get_form( $form, $title, $description, $atts = array() ) { |
|
| 1085 | - ob_start(); |
|
| 1084 | + public static function get_form( $form, $title, $description, $atts = array() ) { |
|
| 1085 | + ob_start(); |
|
| 1086 | 1086 | |
| 1087 | - self::get_form_contents( $form, $title, $description, $atts ); |
|
| 1087 | + self::get_form_contents( $form, $title, $description, $atts ); |
|
| 1088 | 1088 | self::enqueue_scripts( FrmForm::get_params( $form ) ); |
| 1089 | 1089 | |
| 1090 | - $contents = ob_get_contents(); |
|
| 1091 | - ob_end_clean(); |
|
| 1090 | + $contents = ob_get_contents(); |
|
| 1091 | + ob_end_clean(); |
|
| 1092 | 1092 | |
| 1093 | 1093 | self::maybe_minimize_form( $atts, $contents ); |
| 1094 | 1094 | |
| 1095 | - return $contents; |
|
| 1096 | - } |
|
| 1095 | + return $contents; |
|
| 1096 | + } |
|
| 1097 | 1097 | |
| 1098 | 1098 | public static function enqueue_scripts( $params ) { |
| 1099 | 1099 | do_action( 'frm_enqueue_form_scripts', $params ); |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | public static function get_form_contents( $form, $title, $description, $atts ) { |
| 1103 | - global $frm_vars; |
|
| 1103 | + global $frm_vars; |
|
| 1104 | 1104 | |
| 1105 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 1105 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 1106 | 1106 | |
| 1107 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1107 | + $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1108 | 1108 | |
| 1109 | - $user_ID = get_current_user_id(); |
|
| 1109 | + $user_ID = get_current_user_id(); |
|
| 1110 | 1110 | $params = FrmForm::get_params( $form ); |
| 1111 | - $message = $errors = ''; |
|
| 1111 | + $message = $errors = ''; |
|
| 1112 | 1112 | |
| 1113 | - if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
| 1114 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1115 | - } |
|
| 1113 | + if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
| 1114 | + $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1115 | + } |
|
| 1116 | 1116 | |
| 1117 | 1117 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 1118 | - $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
| 1119 | - |
|
| 1120 | - if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
| 1121 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1122 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1123 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1124 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1125 | - } |
|
| 1126 | - return; |
|
| 1127 | - } |
|
| 1128 | - |
|
| 1129 | - if ( ! empty($errors) ) { |
|
| 1130 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1131 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1132 | - return; |
|
| 1133 | - } |
|
| 1134 | - |
|
| 1135 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1136 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1137 | - return; |
|
| 1138 | - } |
|
| 1139 | - |
|
| 1140 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1141 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1142 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1143 | - |
|
| 1144 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1145 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1118 | + $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
| 1119 | + |
|
| 1120 | + if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
| 1121 | + do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1122 | + if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1123 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1124 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1125 | + } |
|
| 1126 | + return; |
|
| 1127 | + } |
|
| 1128 | + |
|
| 1129 | + if ( ! empty($errors) ) { |
|
| 1130 | + $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1131 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1132 | + return; |
|
| 1133 | + } |
|
| 1134 | + |
|
| 1135 | + do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1136 | + if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1137 | + return; |
|
| 1138 | + } |
|
| 1139 | + |
|
| 1140 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1141 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1142 | + $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1143 | + |
|
| 1144 | + if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1145 | + do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1146 | 1146 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1147 | - return; |
|
| 1148 | - } |
|
| 1147 | + return; |
|
| 1148 | + } |
|
| 1149 | 1149 | |
| 1150 | - if ( $created && is_numeric($created) ) { |
|
| 1151 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1152 | - $class = 'frm_message'; |
|
| 1153 | - } else { |
|
| 1154 | - $message = $frm_settings->failed_msg; |
|
| 1155 | - $class = 'frm_error_style'; |
|
| 1156 | - } |
|
| 1150 | + if ( $created && is_numeric($created) ) { |
|
| 1151 | + $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1152 | + $class = 'frm_message'; |
|
| 1153 | + } else { |
|
| 1154 | + $message = $frm_settings->failed_msg; |
|
| 1155 | + $class = 'frm_error_style'; |
|
| 1156 | + } |
|
| 1157 | 1157 | |
| 1158 | 1158 | $message = FrmFormsHelper::get_success_message( array( |
| 1159 | 1159 | 'message' => $message, 'form' => $form, |
| 1160 | 1160 | 'entry_id' => $created, 'class' => $class, |
| 1161 | 1161 | ) ); |
| 1162 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1162 | + $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1163 | 1163 | |
| 1164 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1165 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1166 | - } else { |
|
| 1167 | - global $frm_vars; |
|
| 1164 | + if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1165 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1166 | + } else { |
|
| 1167 | + global $frm_vars; |
|
| 1168 | 1168 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 1169 | 1169 | |
| 1170 | - $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1171 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1172 | - } |
|
| 1170 | + $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1171 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1172 | + } |
|
| 1173 | 1173 | |
| 1174 | 1174 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1175 | - } |
|
| 1175 | + } |
|
| 1176 | 1176 | |
| 1177 | 1177 | public static function front_head() { |
| 1178 | 1178 | $version = FrmAppHelper::plugin_version(); |
@@ -7,16 +7,16 @@ discard block |
||
| 7 | 7 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 8 | 8 | $menu_label .= ' (Lite)'; |
| 9 | 9 | } |
| 10 | - add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 10 | + add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
| 11 | 11 | |
| 12 | - add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 12 | + add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
| 13 | 13 | |
| 14 | - add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 15 | - add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
| 14 | + add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
| 15 | + add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public static function head() { |
| 19 | - wp_enqueue_script('formidable-editinplace'); |
|
| 19 | + wp_enqueue_script( 'formidable-editinplace' ); |
|
| 20 | 20 | |
| 21 | 21 | if ( wp_is_mobile() ) { |
| 22 | 22 | wp_enqueue_script( 'jquery-touch-punch' ); |
@@ -24,49 +24,49 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function register_widgets() { |
| 27 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
| 28 | - register_widget('FrmShowForm'); |
|
| 27 | + require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' ); |
|
| 28 | + register_widget( 'FrmShowForm' ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function list_form() { |
| 32 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
| 32 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
| 33 | 33 | |
| 34 | 34 | $params = FrmForm::list_page_params(); |
| 35 | - $errors = self::process_bulk_form_actions( array()); |
|
| 36 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
| 35 | + $errors = self::process_bulk_form_actions( array() ); |
|
| 36 | + $errors = apply_filters( 'frm_admin_list_form_action', $errors ); |
|
| 37 | 37 | |
| 38 | 38 | return self::display_forms_list( $params, '', $errors ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public static function new_form( $values = array() ) { |
| 42 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 42 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 43 | 43 | |
| 44 | 44 | global $frm_vars; |
| 45 | 45 | |
| 46 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 47 | - $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
|
| 46 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 47 | + $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action]; |
|
| 48 | 48 | |
| 49 | 49 | if ( $action == 'create' ) { |
| 50 | - return self::create($values); |
|
| 50 | + return self::create( $values ); |
|
| 51 | 51 | } else if ( $action == 'new' ) { |
| 52 | 52 | $frm_field_selection = FrmField::field_selection(); |
| 53 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
| 53 | + $values = FrmFormsHelper::setup_new_vars( $values ); |
|
| 54 | 54 | $id = FrmForm::create( $values ); |
| 55 | - $form = FrmForm::getOne($id); |
|
| 55 | + $form = FrmForm::getOne( $id ); |
|
| 56 | 56 | |
| 57 | 57 | // add default email notification |
| 58 | 58 | $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
| 59 | - $action_control->create($form->id); |
|
| 59 | + $action_control->create( $form->id ); |
|
| 60 | 60 | |
| 61 | 61 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 62 | 62 | |
| 63 | 63 | $values['id'] = $id; |
| 64 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 64 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public static function create( $values = array() ) { |
| 69 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 69 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 70 | 70 | |
| 71 | 71 | global $frm_vars; |
| 72 | 72 | if ( empty( $values ) ) { |
@@ -78,58 +78,58 @@ discard block |
||
| 78 | 78 | $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
| 81 | + $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
| 82 | 82 | |
| 83 | 83 | if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
| 84 | 84 | $frm_settings = FrmAppHelper::get_settings(); |
| 85 | 85 | $errors = array( 'form' => $frm_settings->admin_permission ); |
| 86 | 86 | } else { |
| 87 | - $errors = FrmForm::validate($values); |
|
| 87 | + $errors = FrmForm::validate( $values ); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( count($errors) > 0 ) { |
|
| 90 | + if ( count( $errors ) > 0 ) { |
|
| 91 | 91 | $hide_preview = true; |
| 92 | 92 | $frm_field_selection = FrmField::field_selection(); |
| 93 | 93 | $form = FrmForm::getOne( $id ); |
| 94 | - $fields = FrmField::get_all_for_form($id); |
|
| 94 | + $fields = FrmField::get_all_for_form( $id ); |
|
| 95 | 95 | |
| 96 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 96 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 97 | 97 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 98 | 98 | |
| 99 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 99 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 100 | 100 | } else { |
| 101 | 101 | FrmForm::update( $id, $values, true ); |
| 102 | - die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id))); |
|
| 102 | + die( FrmAppHelper::js_redirect( admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ) ) ); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public static function edit( $values = false ) { |
| 107 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 107 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 108 | 108 | |
| 109 | 109 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 110 | - return self::get_edit_vars($id); |
|
| 110 | + return self::get_edit_vars( $id ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public static function settings( $id = false, $message = '' ) { |
| 114 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 114 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 115 | 115 | |
| 116 | - if ( ! $id || ! is_numeric($id) ) { |
|
| 116 | + if ( ! $id || ! is_numeric( $id ) ) { |
|
| 117 | 117 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 118 | 118 | } |
| 119 | 119 | return self::get_settings_vars( $id, array(), $message ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public static function update_settings() { |
| 123 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 123 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 124 | 124 | |
| 125 | 125 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 126 | 126 | |
| 127 | - $errors = FrmForm::validate($_POST); |
|
| 128 | - if ( count($errors) > 0 ) { |
|
| 129 | - return self::get_settings_vars($id, $errors); |
|
| 127 | + $errors = FrmForm::validate( $_POST ); |
|
| 128 | + if ( count( $errors ) > 0 ) { |
|
| 129 | + return self::get_settings_vars( $id, $errors ); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - do_action('frm_before_update_form_settings', $id); |
|
| 132 | + do_action( 'frm_before_update_form_settings', $id ); |
|
| 133 | 133 | |
| 134 | 134 | FrmForm::update( $id, $_POST ); |
| 135 | 135 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | private static function edit_in_place_value( $field ) { |
| 153 | 153 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 154 | - FrmAppHelper::permission_check('frm_edit_forms', 'hide'); |
|
| 154 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 155 | 155 | |
| 156 | 156 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 157 | 157 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' ); |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | public static function duplicate() { |
| 226 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 226 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 227 | 227 | |
| 228 | 228 | $params = FrmForm::list_page_params(); |
| 229 | 229 | $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
| 230 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 230 | + $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
| 231 | 231 | if ( $form ) { |
| 232 | 232 | return self::get_edit_vars( $form, array(), $message, true ); |
| 233 | 233 | } else { |
| 234 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
| 234 | + return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) ); |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -257,14 +257,14 @@ discard block |
||
| 257 | 257 | if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
| 258 | 258 | global $wp; |
| 259 | 259 | $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
| 260 | - include_once( $root.'/wp-config.php' ); |
|
| 260 | + include_once( $root . '/wp-config.php' ); |
|
| 261 | 261 | $wp->init(); |
| 262 | 262 | $wp->register_globals(); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | self::register_pro_scripts(); |
| 266 | 266 | |
| 267 | - header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) ); |
|
| 267 | + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
| 268 | 268 | |
| 269 | 269 | $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' ); |
| 270 | 270 | if ( $key == '' ) { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $form = FrmForm::getAll( array(), '', 1 ); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php'); |
|
| 279 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' ); |
|
| 280 | 280 | wp_die(); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if ( FrmAppHelper::pro_is_installed() ) { |
| 285 | 285 | wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true ); |
| 286 | 286 | wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true ); |
| 287 | - wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true ); |
|
| 287 | + wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true ); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | public static function bulk_untrash( $ids ) { |
| 296 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 296 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 297 | 297 | |
| 298 | 298 | $count = FrmForm::set_status( $ids, 'published' ); |
| 299 | 299 | |
| 300 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 300 | + $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
| 301 | 301 | return $message; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -316,90 +316,90 @@ discard block |
||
| 316 | 316 | 'trash' => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ), |
| 317 | 317 | ); |
| 318 | 318 | |
| 319 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 319 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 320 | 320 | return; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 323 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 324 | 324 | |
| 325 | 325 | $params = FrmForm::list_page_params(); |
| 326 | 326 | |
| 327 | 327 | //check nonce url |
| 328 | - check_admin_referer($status .'_form_' . $params['id']); |
|
| 328 | + check_admin_referer( $status . '_form_' . $params['id'] ); |
|
| 329 | 329 | |
| 330 | 330 | $count = 0; |
| 331 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 332 | - $count++; |
|
| 331 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 332 | + $count ++; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
| 336 | - $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>' ); |
|
| 335 | + $available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
| 336 | + $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>' ); |
|
| 337 | 337 | |
| 338 | - $message = $available_status[ $status ]['message']; |
|
| 338 | + $message = $available_status[$status]['message']; |
|
| 339 | 339 | |
| 340 | 340 | self::display_forms_list( $params, $message ); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | public static function bulk_trash( $ids ) { |
| 344 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 344 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 345 | 345 | |
| 346 | 346 | $count = 0; |
| 347 | 347 | foreach ( $ids as $id ) { |
| 348 | 348 | if ( FrmForm::trash( $id ) ) { |
| 349 | - $count++; |
|
| 349 | + $count ++; |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
| 354 | - $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>' ); |
|
| 354 | + $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>' ); |
|
| 355 | 355 | |
| 356 | 356 | return $message; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | public static function destroy() { |
| 360 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 360 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 361 | 361 | |
| 362 | 362 | $params = FrmForm::list_page_params(); |
| 363 | 363 | |
| 364 | 364 | //check nonce url |
| 365 | - check_admin_referer('destroy_form_' . $params['id']); |
|
| 365 | + check_admin_referer( 'destroy_form_' . $params['id'] ); |
|
| 366 | 366 | |
| 367 | 367 | $count = 0; |
| 368 | 368 | if ( FrmForm::destroy( $params['id'] ) ) { |
| 369 | - $count++; |
|
| 369 | + $count ++; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 372 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 373 | 373 | |
| 374 | 374 | self::display_forms_list( $params, $message ); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | public static function bulk_destroy( $ids ) { |
| 378 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
| 378 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
| 379 | 379 | |
| 380 | 380 | $count = 0; |
| 381 | 381 | foreach ( $ids as $id ) { |
| 382 | 382 | $d = FrmForm::destroy( $id ); |
| 383 | 383 | if ( $d ) { |
| 384 | - $count++; |
|
| 384 | + $count ++; |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 388 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 389 | 389 | |
| 390 | 390 | return $message; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | private static function delete_all() { |
| 394 | 394 | //check nonce url |
| 395 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
| 395 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
| 396 | 396 | if ( $permission_error !== false ) { |
| 397 | 397 | self::display_forms_list( array(), '', array( $permission_error ) ); |
| 398 | 398 | return; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $count = FrmForm::scheduled_delete( time() ); |
| 402 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
| 402 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
| 403 | 403 | |
| 404 | 404 | self::display_forms_list( array(), $message ); |
| 405 | 405 | } |
@@ -416,9 +416,9 @@ discard block |
||
| 416 | 416 | * @since 2.0.15 |
| 417 | 417 | */ |
| 418 | 418 | public static function insert_form_button() { |
| 419 | - if ( current_user_can('frm_view_forms') ) { |
|
| 419 | + if ( current_user_can( 'frm_view_forms' ) ) { |
|
| 420 | 420 | $frm_settings = FrmAppHelper::get_settings(); |
| 421 | - $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> '. $frm_settings->menu .'</a>'; |
|
| 421 | + $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> ' . $frm_settings->menu . '</a>'; |
|
| 422 | 422 | echo wp_kses_post( $content ); |
| 423 | 423 | } |
| 424 | 424 | } |
@@ -435,21 +435,21 @@ discard block |
||
| 435 | 435 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
| 436 | 436 | ); |
| 437 | 437 | |
| 438 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
| 438 | + $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes ); |
|
| 439 | 439 | |
| 440 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php'); |
|
| 440 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' ); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | public static function get_shortcode_opts() { |
| 444 | 444 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 445 | 445 | |
| 446 | 446 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
| 447 | - if ( empty($shortcode) ) { |
|
| 447 | + if ( empty( $shortcode ) ) { |
|
| 448 | 448 | wp_die(); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">'; |
|
| 452 | - echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />'; |
|
| 451 | + echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">'; |
|
| 452 | + echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />'; |
|
| 453 | 453 | |
| 454 | 454 | $form_id = ''; |
| 455 | 455 | $opts = array(); |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | ); |
| 465 | 465 | break; |
| 466 | 466 | } |
| 467 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
| 467 | + $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode ); |
|
| 468 | 468 | |
| 469 | 469 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
| 470 | 470 | // allow other shortcodes to use the required form id option |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | unset( $opts['form_id'] ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php'); |
|
| 475 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' ); |
|
| 476 | 476 | |
| 477 | 477 | echo '</div>'; |
| 478 | 478 | |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | die(); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php'); |
|
| 507 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' ); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | public static function get_columns( $columns ) { |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | if ( $form->parent_form_id ) { |
| 584 | - 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>' )); |
|
| 584 | + 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>' ) ); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | $frm_field_selection = FrmField::field_selection(); |
| 588 | - $fields = FrmField::get_all_for_form($form->id); |
|
| 588 | + $fields = FrmField::get_all_for_form( $form->id ); |
|
| 589 | 589 | |
| 590 | 590 | // Automatically add end section fields if they don't exist (2.0 migration) |
| 591 | 591 | $reset_fields = false; |
@@ -595,9 +595,9 @@ discard block |
||
| 595 | 595 | $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
| 598 | + unset( $end_section_values, $last_order, $open, $reset_fields ); |
|
| 599 | 599 | |
| 600 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 600 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 601 | 601 | |
| 602 | 602 | $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
| 603 | 603 | if ( $form->is_template && $message == $edit_message ) { |
@@ -607,13 +607,13 @@ discard block |
||
| 607 | 607 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
| 608 | 608 | |
| 609 | 609 | if ( $form->default_template ) { |
| 610 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 611 | - } else if ( defined('DOING_AJAX') ) { |
|
| 610 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
| 611 | + } else if ( defined( 'DOING_AJAX' ) ) { |
|
| 612 | 612 | wp_die(); |
| 613 | 613 | } else if ( $create_link ) { |
| 614 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php'); |
|
| 614 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
|
| 615 | 615 | } else { |
| 616 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php'); |
|
| 616 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' ); |
|
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | |
@@ -624,28 +624,28 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $form = FrmForm::getOne( $id ); |
| 626 | 626 | |
| 627 | - $fields = FrmField::get_all_for_form($id); |
|
| 628 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
| 627 | + $fields = FrmField::get_all_for_form( $id ); |
|
| 628 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
| 629 | 629 | |
| 630 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
| 631 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
| 630 | + if ( isset( $values['default_template'] ) && $values['default_template'] ) { |
|
| 631 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | $action_controls = FrmFormActionsController::get_form_actions(); |
| 635 | 635 | |
| 636 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
| 636 | + $sections = apply_filters( 'frm_add_form_settings_section', array(), $values ); |
|
| 637 | 637 | $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
| 638 | 638 | |
| 639 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
| 639 | + $styles = apply_filters( 'frm_get_style_opts', array() ); |
|
| 640 | 640 | |
| 641 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php'); |
|
| 641 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' ); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | public static function mb_tags_box( $form_id, $class = '' ) { |
| 645 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 645 | + $fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
| 646 | 646 | $linked_forms = array(); |
| 647 | 647 | $col = 'one'; |
| 648 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
| 648 | + $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false; |
|
| 649 | 649 | |
| 650 | 650 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
| 651 | 651 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | // Insert the form class setting into the form |
| 725 | 725 | public static function form_classes( $form ) { |
| 726 | - if ( isset($form->options['form_class']) ) { |
|
| 726 | + if ( isset( $form->options['form_class'] ) ) { |
|
| 727 | 727 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
| 728 | 728 | } |
| 729 | 729 | } |
@@ -825,11 +825,11 @@ discard block |
||
| 825 | 825 | public static function add_default_templates( $path, $default = true, $template = true ) { |
| 826 | 826 | _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
| 827 | 827 | |
| 828 | - $path = untrailingslashit(trim($path)); |
|
| 829 | - $templates = glob( $path .'/*.php' ); |
|
| 828 | + $path = untrailingslashit( trim( $path ) ); |
|
| 829 | + $templates = glob( $path . '/*.php' ); |
|
| 830 | 830 | |
| 831 | - for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
|
| 832 | - $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) ); |
|
| 831 | + for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) { |
|
| 832 | + $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) ); |
|
| 833 | 833 | $template_query = array( 'form_key' => $filename ); |
| 834 | 834 | if ( $template ) { |
| 835 | 835 | $template_query['is_template'] = 1; |
@@ -847,12 +847,12 @@ discard block |
||
| 847 | 847 | $values['default_template'] = 1; |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | - include( $templates[ $i ] ); |
|
| 850 | + include( $templates[$i] ); |
|
| 851 | 851 | |
| 852 | 852 | //get updated form |
| 853 | - if ( isset($form) && ! empty($form) ) { |
|
| 853 | + if ( isset( $form ) && ! empty( $form ) ) { |
|
| 854 | 854 | $old_id = $form->id; |
| 855 | - $form = FrmForm::getOne($form->id); |
|
| 855 | + $form = FrmForm::getOne( $form->id ); |
|
| 856 | 856 | } else { |
| 857 | 857 | $old_id = false; |
| 858 | 858 | $form = FrmForm::getAll( $template_query, '', 1 ); |
@@ -865,24 +865,24 @@ discard block |
||
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | public static function route() { |
| 868 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
| 868 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 869 | 869 | $vars = array(); |
| 870 | 870 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
| 871 | 871 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 872 | 872 | |
| 873 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
| 874 | - $json_vars = json_decode($json_vars, true); |
|
| 875 | - if ( empty($json_vars) ) { |
|
| 873 | + $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '"', '\\\"', $_POST['frm_compact_fields'] ) ) ) ); |
|
| 874 | + $json_vars = json_decode( $json_vars, true ); |
|
| 875 | + if ( empty( $json_vars ) ) { |
|
| 876 | 876 | // json decoding failed so we should return an error message |
| 877 | 877 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 878 | 878 | if ( 'edit' == $action ) { |
| 879 | 879 | $action = 'update'; |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
| 882 | + add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
|
| 883 | 883 | } else { |
| 884 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
| 885 | - $action = $vars[ $action ]; |
|
| 884 | + $vars = FrmAppHelper::json_to_array( $json_vars ); |
|
| 885 | + $action = $vars[$action]; |
|
| 886 | 886 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
| 887 | 887 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
| 888 | 888 | $_POST = array_merge( $_POST, $_REQUEST ); |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | |
| 901 | 901 | switch ( $action ) { |
| 902 | 902 | case 'new': |
| 903 | - return self::new_form($vars); |
|
| 903 | + return self::new_form( $vars ); |
|
| 904 | 904 | case 'create': |
| 905 | 905 | case 'edit': |
| 906 | 906 | case 'update': |
@@ -913,8 +913,8 @@ discard block |
||
| 913 | 913 | case 'update_settings': |
| 914 | 914 | return self::$action( $vars ); |
| 915 | 915 | default: |
| 916 | - do_action('frm_form_action_'. $action); |
|
| 917 | - if ( apply_filters('frm_form_stop_action_'. $action, false) ) { |
|
| 916 | + do_action( 'frm_form_action_' . $action ); |
|
| 917 | + if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) { |
|
| 918 | 918 | return; |
| 919 | 919 | } |
| 920 | 920 | |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
| 926 | + if ( strpos( $action, 'bulk_' ) === 0 ) { |
|
| 927 | 927 | FrmAppHelper::remove_get_action(); |
| 928 | 928 | return self::list_form(); |
| 929 | 929 | } |
@@ -950,37 +950,37 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | public static function admin_bar_configure() { |
| 952 | 952 | global $frm_vars; |
| 953 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
| 953 | + if ( empty( $frm_vars['forms_loaded'] ) ) { |
|
| 954 | 954 | return; |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | $actions = array(); |
| 958 | 958 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 959 | - if ( is_object($form) ) { |
|
| 960 | - $actions[ $form->id ] = $form->name; |
|
| 959 | + if ( is_object( $form ) ) { |
|
| 960 | + $actions[$form->id] = $form->name; |
|
| 961 | 961 | } |
| 962 | - unset($form); |
|
| 962 | + unset( $form ); |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | - if ( empty($actions) ) { |
|
| 965 | + if ( empty( $actions ) ) { |
|
| 966 | 966 | return; |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - asort($actions); |
|
| 969 | + asort( $actions ); |
|
| 970 | 970 | |
| 971 | 971 | global $wp_admin_bar; |
| 972 | 972 | |
| 973 | - if ( count($actions) == 1 ) { |
|
| 973 | + if ( count( $actions ) == 1 ) { |
|
| 974 | 974 | $wp_admin_bar->add_menu( array( |
| 975 | 975 | 'title' => 'Edit Form', |
| 976 | - 'href' => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )), |
|
| 976 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
|
| 977 | 977 | 'id' => 'frm-forms', |
| 978 | 978 | ) ); |
| 979 | 979 | } else { |
| 980 | 980 | $wp_admin_bar->add_menu( array( |
| 981 | 981 | 'id' => 'frm-forms', |
| 982 | 982 | 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
| 983 | - 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ), |
|
| 983 | + 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
|
| 984 | 984 | 'meta' => array( |
| 985 | 985 | 'title' => __( 'Edit Forms', 'formidable' ), |
| 986 | 986 | ), |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | |
| 991 | 991 | $wp_admin_bar->add_menu( array( |
| 992 | 992 | 'parent' => 'frm-forms', |
| 993 | - 'id' => 'edit_form_'. $form_id, |
|
| 994 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
| 993 | + 'id' => 'edit_form_' . $form_id, |
|
| 994 | + 'title' => empty( $name ) ? __( '(no title)' ) : $name, |
|
| 995 | 995 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
| 996 | 996 | ) ); |
| 997 | 997 | } |
@@ -1001,22 +1001,22 @@ discard block |
||
| 1001 | 1001 | //formidable shortcode |
| 1002 | 1002 | public static function get_form_shortcode( $atts ) { |
| 1003 | 1003 | global $frm_vars; |
| 1004 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
| 1004 | + if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) { |
|
| 1005 | 1005 | $sc = '[formidable'; |
| 1006 | 1006 | if ( ! empty( $atts ) ) { |
| 1007 | 1007 | foreach ( $atts as $k => $v ) { |
| 1008 | 1008 | $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | - return $sc .']'; |
|
| 1011 | + return $sc . ']'; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $shortcode_atts = shortcode_atts( array( |
| 1015 | 1015 | 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
| 1016 | 1016 | 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
| 1017 | 1017 | 'exclude_fields' => array(), 'minimize' => false, |
| 1018 | - ), $atts); |
|
| 1019 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
| 1018 | + ), $atts ); |
|
| 1019 | + do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts ); |
|
| 1020 | 1020 | |
| 1021 | 1021 | return self::show_form( |
| 1022 | 1022 | $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
@@ -1104,51 +1104,51 @@ discard block |
||
| 1104 | 1104 | |
| 1105 | 1105 | $frm_settings = FrmAppHelper::get_settings(); |
| 1106 | 1106 | |
| 1107 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1107 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
| 1108 | 1108 | |
| 1109 | 1109 | $user_ID = get_current_user_id(); |
| 1110 | 1110 | $params = FrmForm::get_params( $form ); |
| 1111 | 1111 | $message = $errors = ''; |
| 1112 | 1112 | |
| 1113 | 1113 | if ( $params['posted_form_id'] == $form->id && $_POST ) { |
| 1114 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
| 1114 | + $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array(); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 1118 | 1118 | $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
| 1119 | 1119 | |
| 1120 | 1120 | if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
| 1121 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
| 1122 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
| 1123 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
| 1124 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1121 | + do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description ); |
|
| 1122 | + if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) { |
|
| 1123 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form ); |
|
| 1124 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | return; |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | - if ( ! empty($errors) ) { |
|
| 1130 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
| 1131 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1129 | + if ( ! empty( $errors ) ) { |
|
| 1130 | + $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array(); |
|
| 1131 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1132 | 1132 | return; |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
| 1136 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
| 1135 | + do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description ); |
|
| 1136 | + if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) { |
|
| 1137 | 1137 | return; |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
| 1141 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
| 1142 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
| 1140 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true ); |
|
| 1141 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0; |
|
| 1142 | + $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' ); |
|
| 1143 | 1143 | |
| 1144 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
| 1145 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
| 1144 | + if ( $created && is_numeric( $created ) && $conf_method != 'message' ) { |
|
| 1145 | + do_action( 'frm_success_action', $conf_method, $form, $form->options, $created ); |
|
| 1146 | 1146 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
| 1147 | 1147 | return; |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | - if ( $created && is_numeric($created) ) { |
|
| 1151 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1150 | + if ( $created && is_numeric( $created ) ) { |
|
| 1151 | + $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
| 1152 | 1152 | $class = 'frm_message'; |
| 1153 | 1153 | } else { |
| 1154 | 1154 | $message = $frm_settings->failed_msg; |
@@ -1159,16 +1159,16 @@ discard block |
||
| 1159 | 1159 | 'message' => $message, 'form' => $form, |
| 1160 | 1160 | 'entry_id' => $created, 'class' => $class, |
| 1161 | 1161 | ) ); |
| 1162 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
| 1162 | + $message = apply_filters( 'frm_main_feedback', $message, $form, $created ); |
|
| 1163 | 1163 | |
| 1164 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
| 1165 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php'); |
|
| 1164 | + if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) { |
|
| 1165 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
|
| 1166 | 1166 | } else { |
| 1167 | 1167 | global $frm_vars; |
| 1168 | 1168 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 1169 | 1169 | |
| 1170 | - $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values); |
|
| 1171 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 1170 | + $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values ); |
|
| 1171 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' ); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |