@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <div class="posttypediv"> |
2 | 2 | <ul class="posttype-tabs add-menu-item-tabs"> |
3 | 3 | <li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>> |
4 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-headings') ?>" class="nav-tab-link" data-type="tabs-panel-headings" ><?php _e( 'Headings', 'formidable' ) ?></a> |
|
4 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-headings' ) ?>" class="nav-tab-link" data-type="tabs-panel-headings" ><?php _e( 'Headings', 'formidable' ) ?></a> |
|
5 | 5 | </li> |
6 | 6 | <li <?php echo ( 'collapse' == $current_tab ? ' class="tabs"' : '' ); ?>> |
7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=collapse#page-collapse') ?>" class="nav-tab-link" data-type="tabs-panel-collapse" ><?php _e( 'Collapsible', 'formidable' ) ?></a> |
|
7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=collapse#page-collapse' ) ?>" class="nav-tab-link" data-type="tabs-panel-collapse" ><?php _e( 'Collapsible', 'formidable' ) ?></a> |
|
8 | 8 | </li> |
9 | 9 | <li <?php echo ( 'repeat' == $current_tab ? ' class="tabs"' : '' ); ?>> |
10 | 10 | <a href="?page=formidable-styles&page-tab=repeat#tabs-panel-repeat" class="nav-tab-link" data-type="tabs-panel-repeat"><?php _e( 'Repeatable', 'formidable' ) ?></a> |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | ?>"> |
17 | 17 | <div class="field-group field-group-background"> |
18 | 18 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
19 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_color') ) ?>" id="frm_section_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_color'] ) ?>" /> |
|
19 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_color' ) ) ?>" id="frm_section_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_color'] ) ?>" /> |
|
20 | 20 | </div> |
21 | 21 | |
22 | 22 | <div class="field-group"> |
23 | 23 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
24 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('section_weight') ) ?>" id="frm_section_weight"> |
|
24 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'section_weight' ) ) ?>" id="frm_section_weight"> |
|
25 | 25 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
26 | 26 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['section_weight'], $value ) ?>><?php echo $name ?></option> |
27 | 27 | <?php } ?> |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | |
31 | 31 | <div class="field-group"> |
32 | 32 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_font_size') ) ?>" id="frm_section_font_size" value="<?php echo esc_attr( $style->post_content['section_font_size'] ) ?>" /> |
|
33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_font_size' ) ) ?>" id="frm_section_font_size" value="<?php echo esc_attr( $style->post_content['section_font_size'] ) ?>" /> |
|
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class="field-group field-group-border frm-half"> |
37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_pad') ) ?>" id="frm_section_pad" value="<?php echo esc_attr( $style->post_content['section_pad'] ) ?>" /> |
|
38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_pad' ) ) ?>" id="frm_section_pad" value="<?php echo esc_attr( $style->post_content['section_pad'] ) ?>" /> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class="field-group frm-half"> |
42 | 42 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_bg_color') ) ?>" id="frm_section_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_bg_color'] ) ?>" /> |
|
43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_bg_color' ) ) ?>" id="frm_section_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_bg_color'] ) ?>" /> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class="field-group field-group-border frm-half"> |
47 | 47 | <label><?php _e( 'Top Margin', 'formidable' ) ?></label> |
48 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_mar_top') ) ?>" id="frm_section_mar_top" value="<?php echo esc_attr( $style->post_content['section_mar_top'] ) ?>" /> |
|
48 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_mar_top' ) ) ?>" id="frm_section_mar_top" value="<?php echo esc_attr( $style->post_content['section_mar_top'] ) ?>" /> |
|
49 | 49 | </div> |
50 | 50 | <div class="field-group frm-half"> |
51 | 51 | <label><?php _e( 'Bottom Margin', 'formidable' ) ?></label> |
52 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_mar_bottom') ) ?>" id="frm_section_mar_bottom" value="<?php echo esc_attr( $style->post_content['section_mar_bottom'] ) ?>" /> |
|
52 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_mar_bottom' ) ) ?>" id="frm_section_mar_bottom" value="<?php echo esc_attr( $style->post_content['section_mar_bottom'] ) ?>" /> |
|
53 | 53 | </div> |
54 | 54 | |
55 | 55 | <div class="field-group field-group-border"> |
56 | 56 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
57 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_border_color') ) ?>" id="frm_section_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_border_color'] ) ?>" /> |
|
57 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_border_color' ) ) ?>" id="frm_section_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['section_border_color'] ) ?>" /> |
|
58 | 58 | </div> |
59 | 59 | <div class="field-group"> |
60 | 60 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
61 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('section_border_width') ) ?>" id="frm_section_border_width" value="<?php echo esc_attr( $style->post_content['section_border_width'] ) ?>" /> |
|
61 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'section_border_width' ) ) ?>" id="frm_section_border_width" value="<?php echo esc_attr( $style->post_content['section_border_width'] ) ?>" /> |
|
62 | 62 | </div> |
63 | 63 | <div class="field-group"> |
64 | 64 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
65 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('section_border_style') ) ?>" id="frm_section_border_style"> |
|
66 | - <option value="solid" <?php selected($style->post_content['section_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
67 | - <option value="dotted" <?php selected($style->post_content['section_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
68 | - <option value="dashed" <?php selected($style->post_content['section_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
69 | - <option value="double" <?php selected($style->post_content['section_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
65 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'section_border_style' ) ) ?>" id="frm_section_border_style"> |
|
66 | + <option value="solid" <?php selected( $style->post_content['section_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
67 | + <option value="dotted" <?php selected( $style->post_content['section_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
68 | + <option value="dashed" <?php selected( $style->post_content['section_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
69 | + <option value="double" <?php selected( $style->post_content['section_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
70 | 70 | </select> |
71 | 71 | </div> |
72 | 72 | |
73 | 73 | <div class="field-group field-group-border frm-half"> |
74 | 74 | <label><?php _e( 'Border Position', 'formidable' ) ?></label> |
75 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('section_border_loc') ) ?>" id="frm_section_border_loc"> |
|
76 | - <option value="-top" <?php selected($style->post_content['section_border_loc'], '-top') ?>><?php _e( 'top', 'formidable' ) ?></option> |
|
77 | - <option value="-bottom" <?php selected($style->post_content['section_border_loc'], '-bottom') ?>><?php _e( 'bottom', 'formidable' ) ?></option> |
|
78 | - <option value="-left" <?php selected($style->post_content['section_border_loc'], '-left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
79 | - <option value="-right" <?php selected($style->post_content['section_border_loc'], '-right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
80 | - <option value="" <?php selected($style->post_content['section_border_loc'], '') ?>><?php _e( 'all', 'formidable' ) ?></option> |
|
75 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'section_border_loc' ) ) ?>" id="frm_section_border_loc"> |
|
76 | + <option value="-top" <?php selected( $style->post_content['section_border_loc'], '-top' ) ?>><?php _e( 'top', 'formidable' ) ?></option> |
|
77 | + <option value="-bottom" <?php selected( $style->post_content['section_border_loc'], '-bottom' ) ?>><?php _e( 'bottom', 'formidable' ) ?></option> |
|
78 | + <option value="-left" <?php selected( $style->post_content['section_border_loc'], '-left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
79 | + <option value="-right" <?php selected( $style->post_content['section_border_loc'], '-right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
80 | + <option value="" <?php selected( $style->post_content['section_border_loc'], '' ) ?>><?php _e( 'all', 'formidable' ) ?></option> |
|
81 | 81 | </select> |
82 | 82 | </div> |
83 | 83 | <div class="clear"></div> |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | ?>"> |
89 | 89 | <div class="field-group frm-half"> |
90 | 90 | <label><?php _e( 'Icons', 'formidable' ) ?></label> |
91 | - <?php FrmStylesHelper::bs_icon_select($style, $frm_style, 'arrow'); ?> |
|
91 | + <?php FrmStylesHelper::bs_icon_select( $style, $frm_style, 'arrow' ); ?> |
|
92 | 92 | </div> |
93 | 93 | |
94 | 94 | <div class="field-group frm-half"> |
95 | 95 | <label><?php _e( 'Icon Position', 'formidable' ) ?></label> |
96 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('collapse_pos') ) ?>" id="frm_collapse_pos"> |
|
97 | - <option value="after" <?php selected($style->post_content['collapse_pos'], 'after') ?>><?php _e( 'After Heading', 'formidable' ) ?></option> |
|
98 | - <option value="before" <?php selected($style->post_content['collapse_pos'], 'before') ?>><?php _e( 'Before Heading', 'formidable' ) ?></option> |
|
96 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'collapse_pos' ) ) ?>" id="frm_collapse_pos"> |
|
97 | + <option value="after" <?php selected( $style->post_content['collapse_pos'], 'after' ) ?>><?php _e( 'After Heading', 'formidable' ) ?></option> |
|
98 | + <option value="before" <?php selected( $style->post_content['collapse_pos'], 'before' ) ?>><?php _e( 'Before Heading', 'formidable' ) ?></option> |
|
99 | 99 | </select> |
100 | 100 | </div> |
101 | 101 | <div class="clear"></div> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ?>"> |
107 | 107 | <div class="field-group frm-half"> |
108 | 108 | <label><?php _e( 'Icons', 'formidable' ) ?></label> |
109 | - <?php FrmStylesHelper::bs_icon_select($style, $frm_style, 'minus'); ?> |
|
109 | + <?php FrmStylesHelper::bs_icon_select( $style, $frm_style, 'minus' ); ?> |
|
110 | 110 | </div> |
111 | 111 | <div class="clear"></div> |
112 | 112 | </div><!-- /.tabs-panel --> |
@@ -17,14 +17,14 @@ |
||
17 | 17 | <textarea name="<?php echo esc_attr( $frm_style->get_field_name('custom_css') ) ?>" id="frm_custom_css_box" class="hide-if-js"><?php echo FrmAppHelper::esc_textarea($style->post_content['custom_css']) ?></textarea> |
18 | 18 | |
19 | 19 | <?php |
20 | - foreach ( $style->post_content as $k => $v ) { |
|
21 | - if ( $k == 'custom_css' ) { |
|
22 | - continue; |
|
23 | - } |
|
24 | - ?> |
|
20 | + foreach ( $style->post_content as $k => $v ) { |
|
21 | + if ( $k == 'custom_css' ) { |
|
22 | + continue; |
|
23 | + } |
|
24 | + ?> |
|
25 | 25 | <input type="hidden" value="<?php echo esc_attr($v) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $k ) ) ?>" /> |
26 | 26 | <?php |
27 | - } ?> |
|
27 | + } ?> |
|
28 | 28 | <p class="button-controls"><input type="submit" name="nav-menu-locations" id="nav-menu-locations" class="button button-primary left" value="<?php esc_attr_e( 'Save Changes', 'formidable' ) ?>" /></p> |
29 | 29 | |
30 | 30 | </form> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <div class="nav-menus-php"> |
2 | 2 | <div class="wrap"> |
3 | - <?php FrmStylesHelper::style_menu('custom_css'); ?> |
|
3 | + <?php FrmStylesHelper::style_menu( 'custom_css' ); ?> |
|
4 | 4 | |
5 | 5 | <p><?php esc_html_e( 'You can add custom css here or in your theme style.css', 'formidable' ) ?></p> |
6 | 6 | |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | |
9 | 9 | <form method="post"> |
10 | 10 | <input type="hidden" name="ID" value="<?php echo esc_attr( $style->ID ) ?>" /> |
11 | - <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name('post_title', '') ); ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
12 | - <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name('menu_order', '') ); ?>" value="<?php echo esc_attr( $style->menu_order ) ?>" /> |
|
11 | + <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'post_title', '' ) ); ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
12 | + <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" value="<?php echo esc_attr( $style->menu_order ) ?>" /> |
|
13 | 13 | <input type="hidden" name="style_name" value="frm_style_<?php echo esc_attr( $style->post_name ) ?>" /> |
14 | 14 | <input type="hidden" name="frm_action" value="save_css" /> |
15 | 15 | <?php wp_nonce_field( 'frm_custom_css_nonce', 'frm_custom_css' ); ?> |
16 | 16 | |
17 | - <textarea name="<?php echo esc_attr( $frm_style->get_field_name('custom_css') ) ?>" id="frm_custom_css_box" class="hide-if-js"><?php echo FrmAppHelper::esc_textarea($style->post_content['custom_css']) ?></textarea> |
|
17 | + <textarea name="<?php echo esc_attr( $frm_style->get_field_name( 'custom_css' ) ) ?>" id="frm_custom_css_box" class="hide-if-js"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ) ?></textarea> |
|
18 | 18 | |
19 | 19 | <?php |
20 | 20 | foreach ( $style->post_content as $k => $v ) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | continue; |
23 | 23 | } |
24 | 24 | ?> |
25 | - <input type="hidden" value="<?php echo esc_attr($v) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $k ) ) ?>" /> |
|
25 | + <input type="hidden" value="<?php echo esc_attr( $v ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $k ) ) ?>" /> |
|
26 | 26 | <?php |
27 | 27 | } ?> |
28 | 28 | <p class="button-controls"><input type="submit" name="nav-menu-locations" id="nav-menu-locations" class="button button-primary left" value="<?php esc_attr_e( 'Save Changes', 'formidable' ) ?>" /></p> |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | <tbody class="menu-locations"> |
21 | 21 | <?php |
22 | - if ( $forms ) { |
|
23 | - foreach ( $forms as $form ) { |
|
24 | - $this_style = isset($form->options['custom_style']) ? (int) $form->options['custom_style'] : 1; |
|
25 | - if ( 1 == $this_style ) { |
|
26 | - // use the default style |
|
27 | - $this_style = $default_style->ID; |
|
28 | - } |
|
29 | - ?> |
|
22 | + if ( $forms ) { |
|
23 | + foreach ( $forms as $form ) { |
|
24 | + $this_style = isset($form->options['custom_style']) ? (int) $form->options['custom_style'] : 1; |
|
25 | + if ( 1 == $this_style ) { |
|
26 | + // use the default style |
|
27 | + $this_style = $default_style->ID; |
|
28 | + } |
|
29 | + ?> |
|
30 | 30 | <tr id="menu-locations-row"> |
31 | 31 | <td class="menu-location-title"><strong><?php echo empty($form->name) ? __( '(no title)') : $form->name ?></strong></td> |
32 | 32 | <td class="menu-location-menus"> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | </td><!-- .menu-location-menus --> |
42 | 42 | </tr><!-- #menu-locations-row --> |
43 | 43 | <?php |
44 | - } |
|
44 | + } |
|
45 | 45 | } else { |
46 | 46 | ?> |
47 | 47 | <tr> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <div class="nav-menus-php"> |
2 | 2 | <div class="wrap"> |
3 | - <?php FrmStylesHelper::style_menu('manage'); ?> |
|
3 | + <?php FrmStylesHelper::style_menu( 'manage' ); ?> |
|
4 | 4 | |
5 | - <p><?php printf(__( 'Easily change which template your forms are using by making changes below.', 'formidable' ), '<a href="?page=formidable-styles&frm_action=new_style">', '</a>'); ?></p> |
|
5 | + <p><?php printf( __( 'Easily change which template your forms are using by making changes below.', 'formidable' ), '<a href="?page=formidable-styles&frm_action=new_style">', '</a>' ); ?></p> |
|
6 | 6 | |
7 | 7 | <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
8 | 8 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | <?php |
22 | 22 | if ( $forms ) { |
23 | 23 | foreach ( $forms as $form ) { |
24 | - $this_style = isset($form->options['custom_style']) ? (int) $form->options['custom_style'] : 1; |
|
24 | + $this_style = isset( $form->options['custom_style'] ) ? (int) $form->options['custom_style'] : 1; |
|
25 | 25 | if ( 1 == $this_style ) { |
26 | 26 | // use the default style |
27 | 27 | $this_style = $default_style->ID; |
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <tr id="menu-locations-row"> |
31 | - <td class="menu-location-title"><strong><?php echo empty($form->name) ? __( '(no title)') : $form->name ?></strong></td> |
|
31 | + <td class="menu-location-title"><strong><?php echo empty( $form->name ) ? __( '(no title)' ) : $form->name ?></strong></td> |
|
32 | 32 | <td class="menu-location-menus"> |
33 | 33 | <input type="hidden" name="prev_style[<?php echo esc_attr( $form->id ) ?>]" value="<?php echo esc_attr( $this_style ) ?>" /> |
34 | 34 | <select name="style[<?php echo esc_attr( $form->id ) ?>]"> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | <?php echo esc_html( $s->post_title . ( empty( $s->menu_order ) ? '' : ' (' . __( 'default', 'formidable' ) . ')' ) ) ?> |
38 | 38 | </option> |
39 | 39 | <?php } ?> |
40 | - <option value="" <?php selected(0, $this_style) ?>><?php _e( 'Styling disabled', 'formidable' ) ?></option> |
|
40 | + <option value="" <?php selected( 0, $this_style ) ?>><?php _e( 'Styling disabled', 'formidable' ) ?></option> |
|
41 | 41 | </select> |
42 | 42 | |
43 | 43 | </td><!-- .menu-location-menus --> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! $item_ids ) { |
4 | - return; |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // fetch 20 posts at a time rather than loading the entire table into memory |
@@ -45,6 +45,6 @@ discard block |
||
45 | 45 | <?php } ?> |
46 | 46 | </form> |
47 | 47 | <?php |
48 | - unset( $fields ); |
|
48 | + unset( $fields ); |
|
49 | 49 | } |
50 | 50 | } |
@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | ?> |
14 | 14 | <form> |
15 | 15 | <id><?php echo $form->id ?></id> |
16 | - <form_key><?php echo FrmXMLHelper::cdata($form->form_key) ?></form_key> |
|
17 | - <name><?php echo FrmXMLHelper::cdata($form->name) ?></name> |
|
18 | - <description><?php echo FrmXMLHelper::cdata($form->description) ?></description> |
|
16 | + <form_key><?php echo FrmXMLHelper::cdata( $form->form_key ) ?></form_key> |
|
17 | + <name><?php echo FrmXMLHelper::cdata( $form->name ) ?></name> |
|
18 | + <description><?php echo FrmXMLHelper::cdata( $form->description ) ?></description> |
|
19 | 19 | <created_at><?php echo $form->created_at ?></created_at> |
20 | 20 | <logged_in><?php echo $form->logged_in ?></logged_in> |
21 | 21 | <is_template><?php echo $form->is_template ?></is_template> |
22 | 22 | <default_template><?php echo $form->default_template ?></default_template> |
23 | 23 | <editable><?php echo $form->editable ?></editable> |
24 | - <options><?php echo FrmXMLHelper::prepare_form_options_for_export($form->options) ?></options> |
|
25 | - <status><?php echo FrmXMLHelper::cdata($form->status) ?></status> |
|
24 | + <options><?php echo FrmXMLHelper::prepare_form_options_for_export( $form->options ) ?></options> |
|
25 | + <status><?php echo FrmXMLHelper::cdata( $form->status ) ?></status> |
|
26 | 26 | <parent_form_id><?php echo $form->parent_form_id ?></parent_form_id> |
27 | 27 | <?php |
28 | 28 | |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | foreach ( $fields as $field ) { ?> |
32 | 32 | <field> |
33 | 33 | <id><?php echo $field->id ?></id> |
34 | - <field_key><?php echo FrmXMLHelper::cdata($field->field_key) ?></field_key> |
|
35 | - <name><?php echo FrmXMLHelper::cdata($field->name) ?></name> |
|
36 | - <description><?php echo FrmXMLHelper::cdata($field->description) ?></description> |
|
37 | - <type><?php echo FrmXMLHelper::cdata($field->type) ?></type> |
|
38 | - <default_value><?php echo FrmXMLHelper::cdata($field->default_value) ?></default_value> |
|
34 | + <field_key><?php echo FrmXMLHelper::cdata( $field->field_key ) ?></field_key> |
|
35 | + <name><?php echo FrmXMLHelper::cdata( $field->name ) ?></name> |
|
36 | + <description><?php echo FrmXMLHelper::cdata( $field->description ) ?></description> |
|
37 | + <type><?php echo FrmXMLHelper::cdata( $field->type ) ?></type> |
|
38 | + <default_value><?php echo FrmXMLHelper::cdata( $field->default_value ) ?></default_value> |
|
39 | 39 | <field_order><?php echo $field->field_order ?></field_order> |
40 | 40 | <form_id><?php echo $field->form_id ?></form_id> |
41 | 41 | <required><?php echo (bool) $field->required ?></required> |
42 | - <options><?php echo FrmXMLHelper::cdata($field->options) ?></options> |
|
43 | - <field_options><?php echo FrmXMLHelper::cdata($field->field_options) ?></field_options> |
|
42 | + <options><?php echo FrmXMLHelper::cdata( $field->options ) ?></options> |
|
43 | + <field_options><?php echo FrmXMLHelper::cdata( $field->field_options ) ?></field_options> |
|
44 | 44 | </field> |
45 | 45 | <?php } ?> |
46 | 46 | </form> |
@@ -79,7 +79,7 @@ |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | $frm_inc_tax[] = $term->term_id; |
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
82 | + $label = ( $term->taxonomy == 'category' || $term->taxonomy == 'tag' ) ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo $term->term_id ?></term_id><term_taxonomy><?php echo $term->taxonomy; ?></term_taxonomy><?php |
84 | 84 | if ( ! empty( $term->name ) ) { |
85 | 85 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! $item_ids ) { |
4 | - return; |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | global $wp_query; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ( empty( $taxonomies ) ) { |
68 | - return; |
|
68 | + return; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | global $frm_inc_tax; |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | foreach ( (array) $terms as $term ) { |
77 | 77 | if ( in_array( $term->term_id, $frm_inc_tax ) ) { |
78 | - return; |
|
78 | + return; |
|
79 | 79 | } |
80 | 80 | |
81 | - $frm_inc_tax[] = $term->term_id; |
|
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
81 | + $frm_inc_tax[] = $term->term_id; |
|
82 | + $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo esc_html( $term->term_id ) ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
84 | - if ( ! empty( $term->name ) ) { |
|
85 | - echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | - } |
|
87 | - if ( ! empty( $term->description ) ) { |
|
88 | - ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | - } |
|
90 | - ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
84 | + if ( ! empty( $term->name ) ) { |
|
85 | + echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | + } |
|
87 | + if ( ! empty( $term->description ) ) { |
|
88 | + ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | + } |
|
90 | + ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
91 | 91 | <?php |
92 | 92 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | public function widget( $args, $instance ) { |
11 | - if ( empty($instance['title']) ) { |
|
12 | - $title = FrmForm::getName( $instance['form'] ); |
|
13 | - } else { |
|
14 | - $title = $instance['title']; |
|
15 | - } |
|
16 | - $title = apply_filters('widget_title', $title); |
|
11 | + if ( empty($instance['title']) ) { |
|
12 | + $title = FrmForm::getName( $instance['form'] ); |
|
13 | + } else { |
|
14 | + $title = $instance['title']; |
|
15 | + } |
|
16 | + $title = apply_filters('widget_title', $title); |
|
17 | 17 | |
18 | - $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
18 | + $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
19 | 19 | |
20 | 20 | echo $args['before_widget']; |
21 | 21 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function form( $instance ) { |
38 | - //Defaults |
|
38 | + //Defaults |
|
39 | 39 | $instance = wp_parse_args( (array) $instance, array( |
40 | - 'title' => false, 'form' => false, 'description' => false, |
|
40 | + 'title' => false, 'form' => false, 'description' => false, |
|
41 | 41 | ) ); |
42 | 42 | ?> |
43 | 43 | <p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | <p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
47 | 47 | <?php |
48 | - FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
49 | - 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
50 | - 'class' => 'widefat', |
|
51 | - ) ); |
|
48 | + FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
49 | + 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
50 | + 'class' => 'widefat', |
|
51 | + ) ); |
|
52 | 52 | ?> |
53 | 53 | </p> |
54 | 54 |
@@ -4,27 +4,27 @@ discard block |
||
4 | 4 | |
5 | 5 | public function __construct() { |
6 | 6 | $widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) ); |
7 | - parent::__construct('frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops); |
|
7 | + parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops ); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | public function widget( $args, $instance ) { |
11 | - if ( empty($instance['title']) ) { |
|
11 | + if ( empty( $instance['title'] ) ) { |
|
12 | 12 | $title = FrmForm::getName( $instance['form'] ); |
13 | 13 | } else { |
14 | 14 | $title = $instance['title']; |
15 | 15 | } |
16 | - $title = apply_filters('widget_title', $title); |
|
16 | + $title = apply_filters( 'widget_title', $title ); |
|
17 | 17 | |
18 | - $instance['description'] = isset($instance['description']) ? $instance['description'] : false; |
|
18 | + $instance['description'] = isset( $instance['description'] ) ? $instance['description'] : false; |
|
19 | 19 | |
20 | 20 | echo $args['before_widget']; |
21 | 21 | |
22 | 22 | echo '<div class="frm_form_widget">'; |
23 | 23 | if ( $title ) { |
24 | - echo $args['before_title'] . stripslashes($title) . $args['after_title']; |
|
24 | + echo $args['before_title'] . stripslashes( $title ) . $args['after_title']; |
|
25 | 25 | } |
26 | 26 | |
27 | - echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']); |
|
27 | + echo FrmFormsController::show_form( $instance['form'], '', false, $instance['description'] ); |
|
28 | 28 | |
29 | 29 | echo '</div>'; |
30 | 30 | echo $args['after_widget']; |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | 'title' => false, 'form' => false, 'description' => false, |
41 | 41 | ) ); |
42 | 42 | ?> |
43 | - <p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
|
44 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" value="<?php echo esc_attr( stripslashes($instance['title']) ); ?>" /></p> |
|
43 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/> |
|
44 | + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>" /></p> |
|
45 | 45 | |
46 | - <p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
|
46 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/> |
|
47 | 47 | <?php |
48 | - FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array( |
|
49 | - 'blank' => false, 'field_id' => $this->get_field_id('form'), |
|
48 | + FrmFormsHelper::forms_dropdown( $this->get_field_name( 'form' ), $instance['form'], array( |
|
49 | + 'blank' => false, 'field_id' => $this->get_field_id( 'form' ), |
|
50 | 50 | 'class' => 'widefat', |
51 | 51 | ) ); |
52 | 52 | ?> |
53 | 53 | </p> |
54 | 54 | |
55 | - <p><label for="<?php echo esc_attr( $this->get_field_id('description') ); ?>"><input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo esc_attr( $this->get_field_id('description') ); ?>" name="<?php echo esc_attr( $this->get_field_name('description') ); ?>" value="1" /> |
|
55 | + <p><label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" /> |
|
56 | 56 | <?php _e( 'Show Description', 'formidable' ) ?></label></p> |
57 | 57 | <?php |
58 | 58 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | // 2.0 |
4 | 4 | if ( ! isset($frm_vars['pro_is_installed']) ) { |
5 | - $frm_vars['pro_is_installed'] = false; |
|
5 | + $frm_vars['pro_is_installed'] = false; |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | // Instansiate Models |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // 2.0 |
4 | -if ( ! isset($frm_vars['pro_is_installed']) ) { |
|
4 | +if ( ! isset( $frm_vars['pro_is_installed'] ) ) { |
|
5 | 5 | $frm_vars['pro_is_installed'] = false; |
6 | 6 | } |
7 | 7 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 |
@@ -375,6 +375,9 @@ |
||
375 | 375 | $reset_fields = true; |
376 | 376 | } |
377 | 377 | |
378 | + /** |
|
379 | + * @return string |
|
380 | + */ |
|
378 | 381 | public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
379 | 382 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
380 | 383 | if ( $code == 'form_name' ) { |
@@ -19,38 +19,38 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function get_direct_link( $key, $form = false ) { |
21 | 21 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
22 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
23 | - |
|
24 | - return $target_url; |
|
25 | - } |
|
26 | - |
|
27 | - public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
28 | - $defaults = array( |
|
29 | - 'blank' => true, |
|
30 | - 'field_id' => false, |
|
31 | - 'onchange' => false, |
|
32 | - 'exclude' => false, |
|
33 | - 'class' => '', |
|
22 | + $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
23 | + |
|
24 | + return $target_url; |
|
25 | + } |
|
26 | + |
|
27 | + public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
28 | + $defaults = array( |
|
29 | + 'blank' => true, |
|
30 | + 'field_id' => false, |
|
31 | + 'onchange' => false, |
|
32 | + 'exclude' => false, |
|
33 | + 'class' => '', |
|
34 | 34 | 'inc_children' => 'exclude', |
35 | - ); |
|
36 | - $args = wp_parse_args( $args, $defaults ); |
|
35 | + ); |
|
36 | + $args = wp_parse_args( $args, $defaults ); |
|
37 | 37 | |
38 | - if ( ! $args['field_id'] ) { |
|
39 | - $args['field_id'] = $field_name; |
|
40 | - } |
|
38 | + if ( ! $args['field_id'] ) { |
|
39 | + $args['field_id'] = $field_name; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | $query = array(); |
43 | - if ( $args['exclude'] ) { |
|
43 | + if ( $args['exclude'] ) { |
|
44 | 44 | $query['id !'] = $args['exclude']; |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
47 | + $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
48 | 48 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
49 | 49 | $add_html = array(); |
50 | 50 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
51 | 51 | self::add_html_attr( $args['class'], 'class', $add_html ); |
52 | 52 | |
53 | - ?> |
|
53 | + ?> |
|
54 | 54 | <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>> |
55 | 55 | <?php if ( $args['blank'] ) { ?> |
56 | 56 | <option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | <?php } ?> |
63 | 63 | </select> |
64 | 64 | <?php |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @param string $class |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | - public static function form_switcher() { |
|
80 | + public static function form_switcher() { |
|
81 | 81 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
82 | 82 | $forms = FrmForm::get_published_forms( $where ); |
83 | 83 | |
@@ -86,32 +86,32 @@ discard block |
||
86 | 86 | unset( $args['form'] ); |
87 | 87 | } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
88 | 88 | unset( $args['id'] ); |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | $frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
92 | 92 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
93 | - $args['frm_action'] = 'list'; |
|
94 | - $args['form'] = 0; |
|
93 | + $args['frm_action'] = 'list'; |
|
94 | + $args['form'] = 0; |
|
95 | 95 | } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
96 | - $args['frm_action'] = 'edit'; |
|
96 | + $args['frm_action'] = 'edit'; |
|
97 | 97 | } else if ( isset( $_GET['post'] ) ) { |
98 | - $args['form'] = 0; |
|
99 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
100 | - } |
|
98 | + $args['form'] = 0; |
|
99 | + $base = admin_url('edit.php?post_type=frm_display'); |
|
100 | + } |
|
101 | 101 | |
102 | - ?> |
|
102 | + ?> |
|
103 | 103 | <li class="dropdown last" id="frm_bs_dropdown"> |
104 | 104 | <a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php _e( 'Switch Form', 'formidable' ) ?> <b class="caret"></b></a> |
105 | 105 | <ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop"> |
106 | 106 | <?php |
107 | 107 | foreach ( $forms as $form ) { |
108 | 108 | if ( isset( $args['id'] ) ) { |
109 | - $args['id'] = $form->id; |
|
109 | + $args['id'] = $form->id; |
|
110 | 110 | } |
111 | - if ( isset( $args['form'] ) ) { |
|
112 | - $args['form'] = $form->id; |
|
111 | + if ( isset( $args['form'] ) ) { |
|
112 | + $args['form'] = $form->id; |
|
113 | 113 | } |
114 | - ?> |
|
114 | + ?> |
|
115 | 115 | <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
116 | 116 | <?php |
117 | 117 | unset( $form ); |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | </ul> |
120 | 120 | </li> |
121 | 121 | <?php |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
125 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
126 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
127 | - } |
|
125 | + echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
126 | + echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Get the invalid form error message |
@@ -148,104 +148,104 @@ discard block |
||
148 | 148 | return $message; |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * Used when a form is created |
|
153 | - */ |
|
154 | - public static function setup_new_vars( $values = array() ) { |
|
155 | - global $wpdb; |
|
151 | + /** |
|
152 | + * Used when a form is created |
|
153 | + */ |
|
154 | + public static function setup_new_vars( $values = array() ) { |
|
155 | + global $wpdb; |
|
156 | 156 | |
157 | - if ( ! empty( $values ) ) { |
|
158 | - $post_values = $values; |
|
159 | - } else { |
|
160 | - $values = array(); |
|
161 | - $post_values = isset($_POST) ? $_POST : array(); |
|
162 | - } |
|
157 | + if ( ! empty( $values ) ) { |
|
158 | + $post_values = $values; |
|
159 | + } else { |
|
160 | + $values = array(); |
|
161 | + $post_values = isset($_POST) ? $_POST : array(); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
165 | 165 | if ( ! isset( $values[ $var ] ) ) { |
166 | 166 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
167 | - } |
|
168 | - } |
|
167 | + } |
|
168 | + } |
|
169 | 169 | |
170 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
170 | + $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
171 | 171 | |
172 | 172 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
173 | - if ( ! isset( $values[ $var ] ) ) { |
|
173 | + if ( ! isset( $values[ $var ] ) ) { |
|
174 | 174 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
175 | - } |
|
176 | - } |
|
175 | + } |
|
176 | + } |
|
177 | 177 | |
178 | - if ( ! isset( $values['form_key'] ) ) { |
|
178 | + if ( ! isset( $values['form_key'] ) ) { |
|
179 | 179 | $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | 182 | $values = self::fill_default_opts( $values, false, $post_values ); |
183 | 183 | $values['custom_style'] = FrmAppHelper::custom_style_value( $values, $post_values ); |
184 | 184 | |
185 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
186 | - } |
|
185 | + return apply_filters('frm_setup_new_form_vars', $values); |
|
186 | + } |
|
187 | 187 | |
188 | - /** |
|
189 | - * Used when editing a form |
|
190 | - */ |
|
191 | - public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
188 | + /** |
|
189 | + * Used when editing a form |
|
190 | + */ |
|
191 | + public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
192 | 192 | if ( empty( $post_values ) ) { |
193 | 193 | $post_values = stripslashes_deep( $_POST ); |
194 | 194 | } |
195 | 195 | |
196 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
197 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
198 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
199 | - $values['status'] = $record->status; |
|
196 | + $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
197 | + $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
198 | + $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
199 | + $values['status'] = $record->status; |
|
200 | 200 | |
201 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
201 | + $values = self::fill_default_opts($values, $record, $post_values); |
|
202 | 202 | |
203 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
204 | - } |
|
203 | + return apply_filters('frm_setup_edit_form_vars', $values); |
|
204 | + } |
|
205 | 205 | |
206 | 206 | public static function fill_default_opts( $values, $record, $post_values ) { |
207 | 207 | |
208 | - $defaults = self::get_default_opts(); |
|
208 | + $defaults = self::get_default_opts(); |
|
209 | 209 | foreach ( $defaults as $var => $default ) { |
210 | - if ( is_array($default) ) { |
|
211 | - if ( ! isset( $values[ $var ] ) ) { |
|
210 | + if ( is_array($default) ) { |
|
211 | + if ( ! isset( $values[ $var ] ) ) { |
|
212 | 212 | $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - foreach ( $default as $k => $v ) { |
|
215 | + foreach ( $default as $k => $v ) { |
|
216 | 216 | $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
217 | 217 | |
218 | - if ( is_array( $v ) ) { |
|
219 | - foreach ( $v as $k1 => $v1 ) { |
|
218 | + if ( is_array( $v ) ) { |
|
219 | + foreach ( $v as $k1 => $v1 ) { |
|
220 | 220 | $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
221 | - unset( $k1, $v1 ); |
|
222 | - } |
|
223 | - } |
|
221 | + unset( $k1, $v1 ); |
|
222 | + } |
|
223 | + } |
|
224 | 224 | |
225 | - unset($k, $v); |
|
226 | - } |
|
227 | - } else { |
|
225 | + unset($k, $v); |
|
226 | + } |
|
227 | + } else { |
|
228 | 228 | $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | - unset($var, $default); |
|
232 | - } |
|
231 | + unset($var, $default); |
|
232 | + } |
|
233 | 233 | |
234 | - return $values; |
|
235 | - } |
|
234 | + return $values; |
|
235 | + } |
|
236 | 236 | |
237 | - public static function get_default_opts() { |
|
238 | - $frm_settings = FrmAppHelper::get_settings(); |
|
237 | + public static function get_default_opts() { |
|
238 | + $frm_settings = FrmAppHelper::get_settings(); |
|
239 | 239 | |
240 | - return array( |
|
241 | - 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
242 | - 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
243 | - 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
244 | - 'before_html' => self::get_default_html('before'), |
|
245 | - 'after_html' => '', |
|
246 | - 'submit_html' => self::get_default_html('submit'), |
|
247 | - ); |
|
248 | - } |
|
240 | + return array( |
|
241 | + 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
242 | + 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
243 | + 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
244 | + 'before_html' => self::get_default_html('before'), |
|
245 | + 'after_html' => '', |
|
246 | + 'submit_html' => self::get_default_html('submit'), |
|
247 | + ); |
|
248 | + } |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * @param array $options |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - /** |
|
264 | - * @param string $loc |
|
265 | - */ |
|
263 | + /** |
|
264 | + * @param string $loc |
|
265 | + */ |
|
266 | 266 | public static function get_default_html( $loc ) { |
267 | 267 | if ( $loc == 'submit' ) { |
268 | - $sending = __( 'Sending', 'formidable' ); |
|
269 | - $draft_link = self::get_draft_link(); |
|
270 | - $img = '[frmurl]/images/ajax_loader.gif'; |
|
271 | - $default_html = <<<SUBMIT_HTML |
|
268 | + $sending = __( 'Sending', 'formidable' ); |
|
269 | + $draft_link = self::get_draft_link(); |
|
270 | + $img = '[frmurl]/images/ajax_loader.gif'; |
|
271 | + $default_html = <<<SUBMIT_HTML |
|
272 | 272 | <div class="frm_submit"> |
273 | 273 | [if back_button]<input type="button" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook] />[/if back_button] |
274 | 274 | <input type="submit" value="[button_label]" [button_action] /> |
@@ -277,49 +277,49 @@ discard block |
||
277 | 277 | </div> |
278 | 278 | SUBMIT_HTML; |
279 | 279 | } else if ( $loc == 'before' ) { |
280 | - $default_html = <<<BEFORE_HTML |
|
280 | + $default_html = <<<BEFORE_HTML |
|
281 | 281 | <legend class="frm_hidden">[form_name]</legend> |
282 | 282 | [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name] |
283 | 283 | [if form_description]<div class="frm_description">[form_description]</div>[/if form_description] |
284 | 284 | BEFORE_HTML; |
285 | 285 | } else { |
286 | - $default_html = ''; |
|
287 | - } |
|
286 | + $default_html = ''; |
|
287 | + } |
|
288 | 288 | |
289 | - return $default_html; |
|
290 | - } |
|
289 | + return $default_html; |
|
290 | + } |
|
291 | 291 | |
292 | - public static function get_draft_link() { |
|
293 | - $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
294 | - return $link; |
|
295 | - } |
|
292 | + public static function get_draft_link() { |
|
293 | + $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
294 | + return $link; |
|
295 | + } |
|
296 | 296 | |
297 | 297 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
298 | - $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
299 | - if ( ! strpos($button, '[button_action]') ) { |
|
300 | - return; |
|
301 | - } |
|
298 | + $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
299 | + if ( ! strpos($button, '[button_action]') ) { |
|
300 | + return; |
|
301 | + } |
|
302 | 302 | |
303 | - $button_parts = explode('[button_action]', $button); |
|
304 | - echo $button_parts[0]; |
|
305 | - //echo ' id="frm_submit_"'; |
|
303 | + $button_parts = explode('[button_action]', $button); |
|
304 | + echo $button_parts[0]; |
|
305 | + //echo ' id="frm_submit_"'; |
|
306 | 306 | |
307 | - $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
308 | - if ( ! empty($classes) ) { |
|
307 | + $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
308 | + if ( ! empty($classes) ) { |
|
309 | 309 | echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"'; |
310 | - } |
|
311 | - |
|
312 | - do_action('frm_submit_button_action', $form, $form_action); |
|
313 | - echo $button_parts[1]; |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * Automatically add end section fields if they don't exist (2.0 migration) |
|
318 | - * @since 2.0 |
|
319 | - * |
|
320 | - * @param boolean $reset_fields |
|
321 | - */ |
|
322 | - public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
310 | + } |
|
311 | + |
|
312 | + do_action('frm_submit_button_action', $form, $form_action); |
|
313 | + echo $button_parts[1]; |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * Automatically add end section fields if they don't exist (2.0 migration) |
|
318 | + * @since 2.0 |
|
319 | + * |
|
320 | + * @param boolean $reset_fields |
|
321 | + */ |
|
322 | + public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
323 | 323 | if ( empty( $fields ) ) { |
324 | 324 | return; |
325 | 325 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $open = $prev_order = false; |
329 | 329 | $add_order = 0; |
330 | 330 | $last_field = false; |
331 | - foreach ( $fields as $field ) { |
|
331 | + foreach ( $fields as $field ) { |
|
332 | 332 | if ( $prev_order === $field->field_order ) { |
333 | 333 | $add_order++; |
334 | 334 | } |
@@ -339,48 +339,48 @@ discard block |
||
339 | 339 | FrmField::update( $field->id, array( 'field_order' => $field->field_order ) ); |
340 | 340 | } |
341 | 341 | |
342 | - switch ( $field->type ) { |
|
343 | - case 'divider': |
|
344 | - // create an end section if open |
|
342 | + switch ( $field->type ) { |
|
343 | + case 'divider': |
|
344 | + // create an end section if open |
|
345 | 345 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
346 | 346 | |
347 | - // mark it open for the next end section |
|
348 | - $open = true; |
|
349 | - break; |
|
350 | - case 'break'; |
|
347 | + // mark it open for the next end section |
|
348 | + $open = true; |
|
349 | + break; |
|
350 | + case 'break'; |
|
351 | 351 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
352 | - break; |
|
353 | - case 'end_divider': |
|
354 | - if ( ! $open ) { |
|
355 | - // the section isn't open, so this is an extra field that needs to be removed |
|
356 | - FrmField::destroy( $field->id ); |
|
357 | - $reset_fields = true; |
|
358 | - } |
|
359 | - |
|
360 | - // There is already an end section here, so there is no need to create one |
|
361 | - $open = false; |
|
362 | - } |
|
352 | + break; |
|
353 | + case 'end_divider': |
|
354 | + if ( ! $open ) { |
|
355 | + // the section isn't open, so this is an extra field that needs to be removed |
|
356 | + FrmField::destroy( $field->id ); |
|
357 | + $reset_fields = true; |
|
358 | + } |
|
359 | + |
|
360 | + // There is already an end section here, so there is no need to create one |
|
361 | + $open = false; |
|
362 | + } |
|
363 | 363 | $prev_order = $field->field_order; |
364 | 364 | |
365 | 365 | $last_field = $field; |
366 | 366 | unset( $field ); |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | 369 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field ); |
370 | - } |
|
370 | + } |
|
371 | 371 | |
372 | 372 | /** |
373 | 373 | * Create end section field if it doesn't exist. This is for migration from < 2.0 |
374 | 374 | * Fix any ordering that may be messed up |
375 | 375 | */ |
376 | 376 | public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) { |
377 | - if ( ! $open ) { |
|
378 | - return; |
|
379 | - } |
|
377 | + if ( ! $open ) { |
|
378 | + return; |
|
379 | + } |
|
380 | 380 | |
381 | 381 | $end_section_values['field_order'] = $field->field_order + 1; |
382 | 382 | |
383 | - FrmField::create( $end_section_values ); |
|
383 | + FrmField::create( $end_section_values ); |
|
384 | 384 | |
385 | 385 | if ( $move == 'move' ) { |
386 | 386 | // bump the order of current field unless we're at the end of the form |
@@ -388,39 +388,39 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | $add_order += 2; |
391 | - $open = false; |
|
392 | - $reset_fields = true; |
|
393 | - } |
|
391 | + $open = false; |
|
392 | + $reset_fields = true; |
|
393 | + } |
|
394 | 394 | |
395 | - public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
395 | + public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
396 | 396 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
397 | - if ( $code == 'form_name' ) { |
|
398 | - $replace_with = $form->name; |
|
399 | - } else if ( $code == 'form_description' ) { |
|
400 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
401 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
402 | - $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
403 | - } else { |
|
404 | - $replace_with = ''; |
|
405 | - } |
|
397 | + if ( $code == 'form_name' ) { |
|
398 | + $replace_with = $form->name; |
|
399 | + } else if ( $code == 'form_description' ) { |
|
400 | + $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
401 | + } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
402 | + $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
403 | + } else { |
|
404 | + $replace_with = ''; |
|
405 | + } |
|
406 | 406 | |
407 | - FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
408 | - } |
|
407 | + FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
408 | + } |
|
409 | 409 | |
410 | - //replace [form_key] |
|
411 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
410 | + //replace [form_key] |
|
411 | + $html = str_replace('[form_key]', $form->form_key, $html); |
|
412 | 412 | |
413 | - //replace [frmurl] |
|
414 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
413 | + //replace [frmurl] |
|
414 | + $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
415 | 415 | |
416 | 416 | if ( strpos( $html, '[button_label]' ) ) { |
417 | 417 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
418 | 418 | $submit_label = apply_filters( 'frm_submit_button', $title, $form ); |
419 | 419 | $submit_label = esc_attr( do_shortcode( $submit_label ) ); |
420 | 420 | $html = str_replace( '[button_label]', $submit_label, $html ); |
421 | - } |
|
421 | + } |
|
422 | 422 | |
423 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
423 | + $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
424 | 424 | |
425 | 425 | if ( strpos( $html, '[if back_button]' ) ) { |
426 | 426 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -434,32 +434,32 @@ discard block |
||
434 | 434 | $html = do_shortcode( $html ); |
435 | 435 | } |
436 | 436 | |
437 | - return $html; |
|
438 | - } |
|
437 | + return $html; |
|
438 | + } |
|
439 | 439 | |
440 | 440 | public static function submit_button_label( $submit ) { |
441 | - if ( ! $submit || empty($submit) ) { |
|
442 | - $frm_settings = FrmAppHelper::get_settings(); |
|
443 | - $submit = $frm_settings->submit_value; |
|
444 | - } |
|
441 | + if ( ! $submit || empty($submit) ) { |
|
442 | + $frm_settings = FrmAppHelper::get_settings(); |
|
443 | + $submit = $frm_settings->submit_value; |
|
444 | + } |
|
445 | 445 | |
446 | - return $submit; |
|
447 | - } |
|
446 | + return $submit; |
|
447 | + } |
|
448 | 448 | |
449 | 449 | public static function get_form_style_class( $form = false ) { |
450 | - $style = self::get_form_style($form); |
|
451 | - $class = ' with_frm_style'; |
|
452 | - |
|
453 | - if ( empty($style) ) { |
|
454 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
455 | - return $class; |
|
456 | - } else { |
|
457 | - return; |
|
458 | - } |
|
459 | - } |
|
460 | - |
|
461 | - //If submit button needs to be inline or centered |
|
462 | - if ( is_object($form) ) { |
|
450 | + $style = self::get_form_style($form); |
|
451 | + $class = ' with_frm_style'; |
|
452 | + |
|
453 | + if ( empty($style) ) { |
|
454 | + if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
455 | + return $class; |
|
456 | + } else { |
|
457 | + return; |
|
458 | + } |
|
459 | + } |
|
460 | + |
|
461 | + //If submit button needs to be inline or centered |
|
462 | + if ( is_object($form) ) { |
|
463 | 463 | $form = $form->options; |
464 | 464 | } |
465 | 465 | |
@@ -471,17 +471,17 @@ discard block |
||
471 | 471 | $class .= ' frm_center_submit'; |
472 | 472 | } |
473 | 473 | |
474 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
474 | + $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
475 | 475 | |
476 | - return $class; |
|
477 | - } |
|
476 | + return $class; |
|
477 | + } |
|
478 | 478 | |
479 | - /** |
|
480 | - * @param string|boolean $form |
|
481 | - * |
|
482 | - * @return string |
|
483 | - */ |
|
484 | - public static function get_form_style( $form ) { |
|
479 | + /** |
|
480 | + * @param string|boolean $form |
|
481 | + * |
|
482 | + * @return string |
|
483 | + */ |
|
484 | + public static function get_form_style( $form ) { |
|
485 | 485 | $style = 1; |
486 | 486 | if ( empty( $form ) || 'default' == 'form' ) { |
487 | 487 | return $style; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $style = ( $form && is_object( $form ) && isset( $form->options['custom_style'] ) ) ? $form->options['custom_style'] : $style; |
502 | 502 | |
503 | 503 | return $style; |
504 | - } |
|
504 | + } |
|
505 | 505 | |
506 | 506 | /** |
507 | 507 | * Display the validation error messages when an entry is submitted |
@@ -556,74 +556,74 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | public static function get_scroll_js( $form_id ) { |
559 | - ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
560 | - } |
|
559 | + ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
560 | + } |
|
561 | 561 | |
562 | 562 | public static function edit_form_link( $form_id ) { |
563 | - if ( is_object($form_id) ) { |
|
564 | - $form = $form_id; |
|
565 | - $name = $form->name; |
|
566 | - $form_id = $form->id; |
|
567 | - } else { |
|
568 | - $name = FrmForm::getName($form_id); |
|
569 | - } |
|
570 | - |
|
571 | - if ( $form_id ) { |
|
563 | + if ( is_object($form_id) ) { |
|
564 | + $form = $form_id; |
|
565 | + $name = $form->name; |
|
566 | + $form_id = $form->id; |
|
567 | + } else { |
|
568 | + $name = FrmForm::getName($form_id); |
|
569 | + } |
|
570 | + |
|
571 | + if ( $form_id ) { |
|
572 | 572 | $val = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ) ) . '">' . ( '' == $name ? __( '(no title)' ) : FrmAppHelper::truncate( $name, 40 ) ) . '</a>'; |
573 | - } else { |
|
574 | - $val = ''; |
|
575 | - } |
|
573 | + } else { |
|
574 | + $val = ''; |
|
575 | + } |
|
576 | 576 | |
577 | - return $val; |
|
577 | + return $val; |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | public static function delete_trash_link( $id, $status, $length = 'long' ) { |
581 | - $link = ''; |
|
582 | - $labels = array( |
|
583 | - 'restore' => array( |
|
584 | - 'long' => __( 'Restore from Trash', 'formidable' ), |
|
585 | - 'short' => __( 'Restore', 'formidable' ), |
|
586 | - ), |
|
587 | - 'trash' => array( |
|
588 | - 'long' => __( 'Move to Trash', 'formidable' ), |
|
589 | - 'short' => __( 'Trash', 'formidable' ), |
|
590 | - ), |
|
591 | - 'delete' => array( |
|
592 | - 'long' => __( 'Delete Permanently', 'formidable' ), |
|
593 | - 'short' => __( 'Delete', 'formidable' ), |
|
594 | - ), |
|
595 | - ); |
|
596 | - |
|
597 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
581 | + $link = ''; |
|
582 | + $labels = array( |
|
583 | + 'restore' => array( |
|
584 | + 'long' => __( 'Restore from Trash', 'formidable' ), |
|
585 | + 'short' => __( 'Restore', 'formidable' ), |
|
586 | + ), |
|
587 | + 'trash' => array( |
|
588 | + 'long' => __( 'Move to Trash', 'formidable' ), |
|
589 | + 'short' => __( 'Trash', 'formidable' ), |
|
590 | + ), |
|
591 | + 'delete' => array( |
|
592 | + 'long' => __( 'Delete Permanently', 'formidable' ), |
|
593 | + 'short' => __( 'Delete', 'formidable' ), |
|
594 | + ), |
|
595 | + ); |
|
596 | + |
|
597 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
598 | 598 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
599 | - if ( 'trash' == $status ) { |
|
599 | + if ( 'trash' == $status ) { |
|
600 | 600 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
601 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
602 | - if ( EMPTY_TRASH_DAYS ) { |
|
601 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
602 | + if ( EMPTY_TRASH_DAYS ) { |
|
603 | 603 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
604 | - } else { |
|
604 | + } else { |
|
605 | 605 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
606 | - } |
|
607 | - } |
|
606 | + } |
|
607 | + } |
|
608 | 608 | |
609 | - return $link; |
|
610 | - } |
|
609 | + return $link; |
|
610 | + } |
|
611 | 611 | |
612 | 612 | public static function status_nice_name( $status ) { |
613 | - $nice_names = array( |
|
614 | - 'draft' => __( 'Draft', 'formidable' ), |
|
615 | - 'trash' => __( 'Trash', 'formidable' ), |
|
616 | - 'publish' => __( 'Published', 'formidable' ), |
|
617 | - ); |
|
618 | - |
|
619 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
620 | - $status = 'publish'; |
|
621 | - } |
|
613 | + $nice_names = array( |
|
614 | + 'draft' => __( 'Draft', 'formidable' ), |
|
615 | + 'trash' => __( 'Trash', 'formidable' ), |
|
616 | + 'publish' => __( 'Published', 'formidable' ), |
|
617 | + ); |
|
618 | + |
|
619 | + if ( ! in_array($status, array_keys($nice_names)) ) { |
|
620 | + $status = 'publish'; |
|
621 | + } |
|
622 | 622 | |
623 | 623 | $name = $nice_names[ $status ]; |
624 | 624 | |
625 | - return $name; |
|
626 | - } |
|
625 | + return $name; |
|
626 | + } |
|
627 | 627 | |
628 | 628 | public static function get_params() { |
629 | 629 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::list_page_params' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function get_direct_link( $key, $form = false ) { |
21 | 21 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
22 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
22 | + $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form ); |
|
23 | 23 | |
24 | 24 | return $target_url; |
25 | 25 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $query['id !'] = $args['exclude']; |
45 | 45 | } |
46 | 46 | |
47 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
47 | + $where = apply_filters( 'frm_forms_dropdown', $query, $field_name ); |
|
48 | 48 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
49 | 49 | $add_html = array(); |
50 | 50 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | <?php } ?> |
58 | 58 | <?php foreach ( $forms as $form ) { ?> |
59 | 59 | <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php |
60 | - echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ; |
|
60 | + echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ); |
|
61 | 61 | ?></option> |
62 | 62 | <?php } ?> |
63 | 63 | </select> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function add_html_attr( $class, $param, &$add_html ) { |
75 | 75 | if ( ! empty( $class ) ) { |
76 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
76 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $args = array( 'id' => 0, 'form' => 0 ); |
85 | 85 | if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) { |
86 | 86 | unset( $args['form'] ); |
87 | - } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
|
87 | + } else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) { |
|
88 | 88 | unset( $args['id'] ); |
89 | 89 | } |
90 | 90 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
93 | 93 | $args['frm_action'] = 'list'; |
94 | 94 | $args['form'] = 0; |
95 | - } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
95 | + } else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
96 | 96 | $args['frm_action'] = 'edit'; |
97 | 97 | } else if ( isset( $_GET['post'] ) ) { |
98 | 98 | $args['form'] = 0; |
99 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
99 | + $base = admin_url( 'edit.php?post_type=frm_display' ); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | ?> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $args['form'] = $form->id; |
113 | 113 | } |
114 | 114 | ?> |
115 | - <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
115 | + <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
116 | 116 | <?php |
117 | 117 | unset( $form ); |
118 | 118 | } ?> |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
125 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
126 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
125 | + echo ( $sort_col == $col ) ? 'sorted' : 'sortable'; |
|
126 | + echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | $post_values = $values; |
159 | 159 | } else { |
160 | 160 | $values = array(); |
161 | - $post_values = isset($_POST) ? $_POST : array(); |
|
161 | + $post_values = isset( $_POST ) ? $_POST : array(); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
165 | - if ( ! isset( $values[ $var ] ) ) { |
|
166 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
165 | + if ( ! isset( $values[$var] ) ) { |
|
166 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
170 | + $values['description'] = FrmAppHelper::use_wpautop( $values['description'] ); |
|
171 | 171 | |
172 | 172 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
173 | - if ( ! isset( $values[ $var ] ) ) { |
|
174 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
173 | + if ( ! isset( $values[$var] ) ) { |
|
174 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $values = self::fill_default_opts( $values, false, $post_values ); |
183 | 183 | $values['custom_style'] = FrmAppHelper::custom_style_value( $values, $post_values ); |
184 | 184 | |
185 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
185 | + return apply_filters( 'frm_setup_new_form_vars', $values ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -193,42 +193,42 @@ discard block |
||
193 | 193 | $post_values = stripslashes_deep( $_POST ); |
194 | 194 | } |
195 | 195 | |
196 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
197 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
198 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
196 | + $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key; |
|
197 | + $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template; |
|
198 | + $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template; |
|
199 | 199 | $values['status'] = $record->status; |
200 | 200 | |
201 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
201 | + $values = self::fill_default_opts( $values, $record, $post_values ); |
|
202 | 202 | |
203 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
203 | + return apply_filters( 'frm_setup_edit_form_vars', $values ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | public static function fill_default_opts( $values, $record, $post_values ) { |
207 | 207 | |
208 | 208 | $defaults = self::get_default_opts(); |
209 | 209 | foreach ( $defaults as $var => $default ) { |
210 | - if ( is_array($default) ) { |
|
211 | - if ( ! isset( $values[ $var ] ) ) { |
|
212 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
210 | + if ( is_array( $default ) ) { |
|
211 | + if ( ! isset( $values[$var] ) ) { |
|
212 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | foreach ( $default as $k => $v ) { |
216 | - $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
|
216 | + $values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v ); |
|
217 | 217 | |
218 | 218 | if ( is_array( $v ) ) { |
219 | 219 | foreach ( $v as $k1 => $v1 ) { |
220 | - $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
220 | + $values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
221 | 221 | unset( $k1, $v1 ); |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - unset($k, $v); |
|
225 | + unset( $k, $v ); |
|
226 | 226 | } |
227 | 227 | } else { |
228 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
228 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
229 | 229 | } |
230 | 230 | |
231 | - unset($var, $default); |
|
231 | + unset( $var, $default ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $values; |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
242 | 242 | 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
243 | 243 | 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
244 | - 'before_html' => self::get_default_html('before'), |
|
244 | + 'before_html' => self::get_default_html( 'before' ), |
|
245 | 245 | 'after_html' => '', |
246 | - 'submit_html' => self::get_default_html('submit'), |
|
246 | + 'submit_html' => self::get_default_html( 'submit' ), |
|
247 | 247 | ); |
248 | 248 | } |
249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public static function fill_form_options( &$options, $values ) { |
256 | 256 | $defaults = self::get_default_opts(); |
257 | 257 | foreach ( $defaults as $var => $default ) { |
258 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
258 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
259 | 259 | unset( $var, $default ); |
260 | 260 | } |
261 | 261 | } |
@@ -295,21 +295,21 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
298 | - $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
299 | - if ( ! strpos($button, '[button_action]') ) { |
|
298 | + $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); |
|
299 | + if ( ! strpos( $button, '[button_action]' ) ) { |
|
300 | 300 | return; |
301 | 301 | } |
302 | 302 | |
303 | - $button_parts = explode('[button_action]', $button); |
|
303 | + $button_parts = explode( '[button_action]', $button ); |
|
304 | 304 | echo $button_parts[0]; |
305 | 305 | //echo ' id="frm_submit_"'; |
306 | 306 | |
307 | - $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
308 | - if ( ! empty($classes) ) { |
|
307 | + $classes = apply_filters( 'frm_submit_button_class', array(), $form ); |
|
308 | + if ( ! empty( $classes ) ) { |
|
309 | 309 | echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"'; |
310 | 310 | } |
311 | 311 | |
312 | - do_action('frm_submit_button_action', $form, $form_action); |
|
312 | + do_action( 'frm_submit_button_action', $form, $form_action ); |
|
313 | 313 | echo $button_parts[1]; |
314 | 314 | } |
315 | 315 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $last_field = false; |
331 | 331 | foreach ( $fields as $field ) { |
332 | 332 | if ( $prev_order === $field->field_order ) { |
333 | - $add_order++; |
|
333 | + $add_order ++; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if ( $add_order ) { |
@@ -397,21 +397,21 @@ discard block |
||
397 | 397 | if ( $code == 'form_name' ) { |
398 | 398 | $replace_with = $form->name; |
399 | 399 | } else if ( $code == 'form_description' ) { |
400 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
401 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
400 | + $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
|
401 | + } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { |
|
402 | 402 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
403 | 403 | } else { |
404 | 404 | $replace_with = ''; |
405 | 405 | } |
406 | 406 | |
407 | - FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
407 | + FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | //replace [form_key] |
411 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
411 | + $html = str_replace( '[form_key]', $form->form_key, $html ); |
|
412 | 412 | |
413 | 413 | //replace [frmurl] |
414 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
414 | + $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
|
415 | 415 | |
416 | 416 | if ( strpos( $html, '[button_label]' ) ) { |
417 | 417 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $html = str_replace( '[button_label]', $submit_label, $html ); |
421 | 421 | } |
422 | 422 | |
423 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
423 | + $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values ); |
|
424 | 424 | |
425 | 425 | if ( strpos( $html, '[if back_button]' ) ) { |
426 | 426 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | public static function submit_button_label( $submit ) { |
441 | - if ( ! $submit || empty($submit) ) { |
|
441 | + if ( ! $submit || empty( $submit ) ) { |
|
442 | 442 | $frm_settings = FrmAppHelper::get_settings(); |
443 | 443 | $submit = $frm_settings->submit_value; |
444 | 444 | } |
@@ -447,11 +447,11 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | public static function get_form_style_class( $form = false ) { |
450 | - $style = self::get_form_style($form); |
|
450 | + $style = self::get_form_style( $form ); |
|
451 | 451 | $class = ' with_frm_style'; |
452 | 452 | |
453 | - if ( empty($style) ) { |
|
454 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
453 | + if ( empty( $style ) ) { |
|
454 | + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { |
|
455 | 455 | return $class; |
456 | 456 | } else { |
457 | 457 | return; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | |
461 | 461 | //If submit button needs to be inline or centered |
462 | - if ( is_object($form) ) { |
|
462 | + if ( is_object( $form ) ) { |
|
463 | 463 | $form = $form->options; |
464 | 464 | } |
465 | 465 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $class .= ' frm_center_submit'; |
472 | 472 | } |
473 | 473 | |
474 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
474 | + $class = apply_filters( 'frm_add_form_style_class', $class, $style ); |
|
475 | 475 | |
476 | 476 | return $class; |
477 | 477 | } |
@@ -560,12 +560,12 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | public static function edit_form_link( $form_id ) { |
563 | - if ( is_object($form_id) ) { |
|
563 | + if ( is_object( $form_id ) ) { |
|
564 | 564 | $form = $form_id; |
565 | 565 | $name = $form->name; |
566 | 566 | $form_id = $form->id; |
567 | 567 | } else { |
568 | - $name = FrmForm::getName($form_id); |
|
568 | + $name = FrmForm::getName( $form_id ); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | if ( $form_id ) { |
@@ -597,12 +597,12 @@ discard block |
||
597 | 597 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
598 | 598 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
599 | 599 | if ( 'trash' == $status ) { |
600 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
|
601 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
600 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>'; |
|
601 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
602 | 602 | if ( EMPTY_TRASH_DAYS ) { |
603 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
|
603 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>'; |
|
604 | 604 | } else { |
605 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
|
605 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>'; |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | 'publish' => __( 'Published', 'formidable' ), |
617 | 617 | ); |
618 | 618 | |
619 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
619 | + if ( ! in_array( $status, array_keys( $nice_names ) ) ) { |
|
620 | 620 | $status = 'publish'; |
621 | 621 | } |
622 | 622 | |
623 | - $name = $nice_names[ $status ]; |
|
623 | + $name = $nice_names[$status]; |
|
624 | 624 | |
625 | 625 | return $name; |
626 | 626 | } |