@@ -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-success-msg') ?>" class="nav-tab-link" data-type="tabs-panel-success-msg" ><?php _e( 'Success', 'formidable' ) ?></a> |
|
4 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-success-msg' ) ?>" class="nav-tab-link" data-type="tabs-panel-success-msg" ><?php _e( 'Success', 'formidable' ) ?></a> |
|
5 | 5 | </li> |
6 | 6 | <li <?php echo ( 'error-msg' == $current_tab ? ' class="tabs"' : '' ); ?>> |
7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=error-msge#page-error-msg') ?>" class="nav-tab-link" data-type="tabs-panel-error-msg" ><?php _e( 'Error', 'formidable' ) ?></a> |
|
7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=error-msge#page-error-msg' ) ?>" class="nav-tab-link" data-type="tabs-panel-error-msg" ><?php _e( 'Error', 'formidable' ) ?></a> |
|
8 | 8 | </li> |
9 | 9 | </ul><!-- .posttype-tabs --> |
10 | 10 | |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | <div class="field-group field-group-border clearfix"> |
15 | 15 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
16 | 16 | <div class="hasPicker"> |
17 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('success_bg_color') ) ?>" id="frm_success_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_bg_color'] ) ?>" type="text" /></div> |
|
17 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'success_bg_color' ) ) ?>" id="frm_success_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_bg_color'] ) ?>" type="text" /></div> |
|
18 | 18 | </div> |
19 | 19 | <div class="field-group clearfix"> |
20 | 20 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
21 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('success_border_color') ) ?>" id="frm_success_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_border_color'] ) ?>" /> |
|
21 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'success_border_color' ) ) ?>" id="frm_success_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_border_color'] ) ?>" /> |
|
22 | 22 | </div> |
23 | 23 | <div class="field-group clearfix"> |
24 | 24 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
25 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('success_text_color') ) ?>" id="frm_success_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_text_color'] ) ?>" type="text" /> |
|
25 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'success_text_color' ) ) ?>" id="frm_success_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_text_color'] ) ?>" type="text" /> |
|
26 | 26 | </div> |
27 | 27 | <div class="field-group clearfix"> |
28 | 28 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('success_font_size') ) ?>" id="frm_success_font_size" value="<?php echo esc_attr( $style->post_content['success_font_size'] ) ?>" size="3" /> |
|
29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'success_font_size' ) ) ?>" id="frm_success_font_size" value="<?php echo esc_attr( $style->post_content['success_font_size'] ) ?>" size="3" /> |
|
30 | 30 | </div> |
31 | 31 | <div class="clear"></div> |
32 | 32 | </div><!-- /.tabs-panel --> |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | <div class="field-group field-group-border clearfix"> |
38 | 38 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
39 | 39 | <div class="hasPicker"> |
40 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_bg') ) ?>" id="frm_error_bg" class="hex" value="<?php echo esc_attr($style->post_content['error_bg']) ?>" /></div> |
|
40 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_bg' ) ) ?>" id="frm_error_bg" class="hex" value="<?php echo esc_attr( $style->post_content['error_bg'] ) ?>" /></div> |
|
41 | 41 | </div> |
42 | 42 | <div class="field-group clearfix"> |
43 | 43 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
44 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_border') ) ?>" id="frm_error_border" class="hex" value="<?php echo esc_attr( $style->post_content['error_border'] ) ?>" /> |
|
44 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_border' ) ) ?>" id="frm_error_border" class="hex" value="<?php echo esc_attr( $style->post_content['error_border'] ) ?>" /> |
|
45 | 45 | </div> |
46 | 46 | <div class="field-group clearfix"> |
47 | 47 | |
48 | 48 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
49 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_text') ) ?>" id="frm_error_text" class="hex" value="<?php echo esc_attr( $style->post_content['error_text'] ) ?>" /> |
|
49 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_text' ) ) ?>" id="frm_error_text" class="hex" value="<?php echo esc_attr( $style->post_content['error_text'] ) ?>" /> |
|
50 | 50 | </div> |
51 | 51 | |
52 | 52 | <div class="field-group clearfix"> |
53 | 53 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
54 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_font_size') ) ?>" id="frm_error_font_size" value="<?php echo esc_attr( $style->post_content['error_font_size'] ) ?>" size="3" /> |
|
54 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_font_size' ) ) ?>" id="frm_error_font_size" value="<?php echo esc_attr( $style->post_content['error_font_size'] ) ?>" size="3" /> |
|
55 | 55 | </div> |
56 | 56 | <div class="clear"></div> |
57 | 57 | </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 esc_attr( $name ) ?></option> |
42 | 42 | <?php } ?> |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
2 | 2 | <label><?php _e( 'Radio', 'formidable' ) ?></label> |
3 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('radio_align') ) ?>" id="frm_radio_align"> |
|
4 | - <option value="block" <?php selected($style->post_content['radio_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
5 | - <option value="inline" <?php selected($style->post_content['radio_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
3 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'radio_align' ) ) ?>" id="frm_radio_align"> |
|
4 | + <option value="block" <?php selected( $style->post_content['radio_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
5 | + <option value="inline" <?php selected( $style->post_content['radio_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
6 | 6 | </select> |
7 | 7 | </div> |
8 | 8 | |
9 | 9 | <div class="field-group clearfix frm-half frm-first-row"> |
10 | 10 | <label><?php _e( 'Check Box', 'formidable' ) ?></label> |
11 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_align') ) ?>" id="frm_check_align"> |
|
12 | - <option value="block" <?php selected($style->post_content['check_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
13 | - <option value="inline" <?php selected($style->post_content['check_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
11 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_align' ) ) ?>" id="frm_check_align"> |
|
12 | + <option value="block" <?php selected( $style->post_content['check_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
13 | + <option value="inline" <?php selected( $style->post_content['check_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
14 | 14 | </select> |
15 | 15 | </div> |
16 | 16 | |
17 | 17 | <div class="field-group field-group-background clearfix"> |
18 | 18 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
19 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_label_color') ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
19 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_label_color' ) ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
20 | 20 | </div> |
21 | 21 | <div class="field-group clearfix"> |
22 | 22 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
23 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_weight') ) ?>" id="frm_check_weight"> |
|
23 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_weight' ) ) ?>" id="frm_check_weight"> |
|
24 | 24 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
25 | 25 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['check_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
26 | 26 | <?php } ?> |
@@ -28,5 +28,5 @@ discard block |
||
28 | 28 | </div> |
29 | 29 | <div class="field-group clearfix"> |
30 | 30 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_font_size') ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_font_size' ) ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
32 | 32 | </div> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <p class="frm_no_top_margin"> |
2 | 2 | <label for="frm_submit_style"> |
3 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('submit_style') ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
3 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_style' ) ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
4 | 4 | <?php esc_html_e( 'Disable submit button styling', 'formidable' ); ?> |
5 | 5 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Note: If disabled, you may not see the change take effect until you make 2 more styling changes or click "Update Options".', 'formidable' ) ?>"></span> |
6 | 6 | </label> |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | <div class="posttypediv"> |
10 | 10 | <ul class="posttype-tabs add-menu-item-tabs"> |
11 | 11 | <li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>> |
12 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-button-default') ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
12 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-button-default' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
13 | 13 | </li> |
14 | 14 | <li <?php echo ( 'button-hover' == $current_tab ? ' class="tabs"' : '' ); ?>> |
15 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=button-hover#page-button-hover') ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
15 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=button-hover#page-button-hover' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
16 | 16 | </li> |
17 | 17 | <li <?php echo ( 'button-click' == $current_tab ? ' class="tabs"' : '' ); ?>> |
18 | 18 | <a href="?page=formidable-styles&page-tab=button-click#tabs-panel-button-click" class="nav-tab-link" data-type="tabs-panel-button-click"><?php _e( 'Click', 'formidable' ) ?></a> |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | ?>"> |
25 | 25 | <div class="field-group field-group-border clearfix"> |
26 | 26 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
27 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_font_size') ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
27 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_font_size' ) ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <div class="field-group clearfix"> |
31 | 31 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
32 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_width') ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
32 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_width' ) ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
33 | 33 | </div> |
34 | 34 | |
35 | 35 | <div class="field-group clearfix"> |
36 | 36 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
37 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_height') ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
37 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_height' ) ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="field-group clearfix"> |
41 | 41 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
42 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('submit_weight') ) ?>" id="frm_submit_weight"> |
|
42 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_weight' ) ) ?>" id="frm_submit_weight"> |
|
43 | 43 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
44 | 44 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['submit_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
45 | 45 | <?php } ?> |
@@ -48,48 +48,48 @@ discard block |
||
48 | 48 | |
49 | 49 | <div class="field-group clearfix"> |
50 | 50 | <label><?php _e( 'Corners', 'formidable' ) ?></label> |
51 | - <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_radius') ) ?>" id="frm_submit_border_radius" size="4"/> |
|
51 | + <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_radius' ) ) ?>" id="frm_submit_border_radius" size="4"/> |
|
52 | 52 | </div> |
53 | 53 | |
54 | 54 | <div class="field-group field-group-border clearfix"> |
55 | 55 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
56 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_color') ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
56 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_color' ) ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
57 | 57 | </div> |
58 | 58 | |
59 | 59 | <div class="field-group clearfix"> |
60 | 60 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
61 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_text_color') ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
61 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_text_color' ) ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
62 | 62 | </div> |
63 | 63 | |
64 | 64 | <div class="field-group field-group-border clearfix"> |
65 | 65 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
66 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_color') ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
66 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_color' ) ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <div class="field-group clearfix"> |
70 | 70 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
71 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_width') ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
71 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_width' ) ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
72 | 72 | </div> |
73 | 73 | |
74 | 74 | <div class="field-group clearfix"> |
75 | 75 | <label><?php _e( 'Shadow', 'formidable' ) ?></label> |
76 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_shadow_color') ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
76 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_shadow_color' ) ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
77 | 77 | </div> |
78 | 78 | |
79 | 79 | <div class="clear"></div> |
80 | 80 | <div class="field-group field-group-border frm-full"> |
81 | 81 | <label><?php _e( 'BG Image', 'formidable' ) ?></label> |
82 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_img') ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
82 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_img' ) ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
83 | 83 | </div> |
84 | 84 | |
85 | 85 | <div class="field-group field-group-border clearfix"> |
86 | 86 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
87 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_margin') ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
87 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_margin' ) ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
88 | 88 | </div> |
89 | 89 | |
90 | 90 | <div class="field-group clearfix"> |
91 | 91 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
92 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_padding') ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
92 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_padding' ) ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
93 | 93 | </div> |
94 | 94 | <div class="clear"></div> |
95 | 95 | </div><!-- /.tabs-panel --> |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | ?>"> |
100 | 100 | <div class="field-group clearfix"> |
101 | 101 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
102 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_bg_color') ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
102 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_bg_color' ) ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
103 | 103 | </div> |
104 | 104 | |
105 | 105 | <div class="field-group clearfix"> |
106 | 106 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
107 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_color') ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
107 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_color' ) ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
108 | 108 | </div> |
109 | 109 | |
110 | 110 | <div class="field-group clearfix"> |
111 | 111 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
112 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_border_color') ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
112 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_border_color' ) ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
113 | 113 | </div> |
114 | 114 | |
115 | 115 | <div class="clear"></div> |
@@ -120,17 +120,17 @@ discard block |
||
120 | 120 | ?>"> |
121 | 121 | <div class="field-group clearfix"> |
122 | 122 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
123 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_bg_color') ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
123 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_bg_color' ) ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
124 | 124 | </div> |
125 | 125 | |
126 | 126 | <div class="field-group clearfix"> |
127 | 127 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
128 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_color') ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
128 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_color' ) ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div class="field-group clearfix"> |
132 | 132 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
133 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_border_color') ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
133 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_border_color' ) ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
134 | 134 | </div> |
135 | 135 | |
136 | 136 | <div class="clear"></div> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <div id="form_entries_page" class="wrap"> |
2 | 2 | <h1><?php _e( 'Entries', 'formidable' ); ?> |
3 | - <?php do_action('frm_entry_inside_h2', $form); ?> |
|
3 | + <?php do_action( 'frm_entry_inside_h2', $form ); ?> |
|
4 | 4 | </h1> |
5 | 5 | |
6 | 6 | <?php require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <div id="poststuff"> |
10 | 10 | <div id="post-body" class="metabox-holder columns-2"> |
11 | 11 | <div id="post-body-content"> |
12 | - <?php FrmAppController::get_form_nav($form, true, 'hide'); ?> |
|
12 | + <?php FrmAppController::get_form_nav( $form, true, 'hide' ); ?> |
|
13 | 13 | </div> |
14 | 14 | <div id="postbox-container-1" class="postbox-container"> |
15 | 15 | <input type="hidden" name="page" value="formidable-entries" /> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | - $filepath = dirname(__FILE__); |
|
37 | + $filepath = dirname( __FILE__ ); |
|
38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
39 | 39 | $filepath .= '/pro'; |
40 | 40 | } |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | |
51 | 51 | $filepath .= $class_name . '.php'; |
52 | 52 | |
53 | - if ( file_exists($filepath) ) { |
|
54 | - include($filepath); |
|
53 | + if ( file_exists( $filepath ) ) { |
|
54 | + include( $filepath ); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
59 | -if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
|
60 | - spl_autoload_register('__autoload'); |
|
59 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
|
60 | + spl_autoload_register( '__autoload' ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Add the autoloader |
64 | -spl_autoload_register('frm_forms_autoloader'); |
|
64 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
65 | 65 | |
66 | -$frm_path = dirname(__FILE__); |
|
67 | -if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
66 | +$frm_path = dirname( __FILE__ ); |
|
67 | +if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
68 | 68 | include( $frm_path . '/pro/formidable-pro.php' ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | FrmHooksController::trigger_load_hook(); |
72 | 72 | |
73 | 73 | include_once( $frm_path . '/deprecated.php' ); |
74 | -unset($frm_path); |
|
74 | +unset( $frm_path ); |
@@ -23,43 +23,43 @@ |
||
23 | 23 | |
24 | 24 | global $frm_vars; |
25 | 25 | $frm_vars = array( |
26 | - 'load_css' => false, 'forms_loaded' => array(), |
|
27 | - 'created_entries' => array(), |
|
28 | - 'pro_is_authorized' => false, |
|
26 | + 'load_css' => false, 'forms_loaded' => array(), |
|
27 | + 'created_entries' => array(), |
|
28 | + 'pro_is_authorized' => false, |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | function frm_forms_autoloader( $class_name ) { |
32 | - // Only load Frm classes here |
|
32 | + // Only load Frm classes here |
|
33 | 33 | if ( ! preg_match( '/^Frm.+$/', $class_name ) ) { |
34 | - return; |
|
35 | - } |
|
34 | + return; |
|
35 | + } |
|
36 | 36 | |
37 | - $filepath = dirname(__FILE__); |
|
37 | + $filepath = dirname(__FILE__); |
|
38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
39 | - $filepath .= '/pro'; |
|
40 | - } |
|
41 | - $filepath .= '/classes'; |
|
39 | + $filepath .= '/pro'; |
|
40 | + } |
|
41 | + $filepath .= '/classes'; |
|
42 | 42 | |
43 | 43 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
44 | - $filepath .= '/helpers/'; |
|
44 | + $filepath .= '/helpers/'; |
|
45 | 45 | } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { |
46 | - $filepath .= '/controllers/'; |
|
46 | + $filepath .= '/controllers/'; |
|
47 | 47 | } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { |
48 | 48 | $filepath .= '/factories/'; |
49 | - } else { |
|
50 | - $filepath .= '/models/'; |
|
51 | - } |
|
49 | + } else { |
|
50 | + $filepath .= '/models/'; |
|
51 | + } |
|
52 | 52 | |
53 | 53 | $filepath .= $class_name . '.php'; |
54 | 54 | |
55 | - if ( file_exists($filepath) ) { |
|
56 | - include($filepath); |
|
57 | - } |
|
55 | + if ( file_exists($filepath) ) { |
|
56 | + include($filepath); |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // if __autoload is active, put it on the spl_autoload stack |
61 | 61 | if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
62 | - spl_autoload_register('__autoload'); |
|
62 | + spl_autoload_register('__autoload'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Add the autoloader |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'entry' => $this->entry, |
96 | 96 | 'form' => $this->form, |
97 | 97 | ); |
98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
99 | 99 | |
100 | 100 | $this->to = array_unique( (array) $to ); |
101 | 101 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @return array |
434 | 434 | */ |
435 | 435 | private function package_header() { |
436 | - $header = array(); |
|
436 | + $header = array(); |
|
437 | 437 | |
438 | 438 | if ( ! empty( $this->cc ) ) { |
439 | 439 | $header[] = 'CC: ' . implode( ',', $this->cc ); |
@@ -546,12 +546,12 @@ discard block |
||
546 | 546 | $name = trim( str_replace( $email, '', $val ) ); |
547 | 547 | } else { |
548 | 548 | // If user enters a name without an email |
549 | - unset( $recipients[ $key ] ); |
|
549 | + unset( $recipients[$key] ); |
|
550 | 550 | continue; |
551 | 551 | } |
552 | 552 | } |
553 | 553 | |
554 | - $recipients[ $key ] = $name . ' <' . $email . '>'; |
|
554 | + $recipients[$key] = $name . ' <' . $email . '>'; |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | return $recipients; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | ) ); |
669 | 669 | |
670 | 670 | // Remove phone number from to addresses |
671 | - unset( $this->to[ $key ] ); |
|
671 | + unset( $this->to[$key] ); |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | } |
@@ -281,6 +281,7 @@ |
||
281 | 281 | * @param string|array $where |
282 | 282 | * @param string $order_by |
283 | 283 | * @param string $limit |
284 | + * @param boolean $unique |
|
284 | 285 | */ |
285 | 286 | private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
286 | 287 | global $wpdb; |
@@ -5,25 +5,25 @@ discard block |
||
5 | 5 | |
6 | 6 | class FrmEntryMeta { |
7 | 7 | |
8 | - /** |
|
9 | - * @param string $meta_key |
|
10 | - */ |
|
8 | + /** |
|
9 | + * @param string $meta_key |
|
10 | + */ |
|
11 | 11 | public static function add_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) { |
12 | - global $wpdb; |
|
12 | + global $wpdb; |
|
13 | 13 | |
14 | - if ( FrmAppHelper::is_empty_value( $meta_value ) ) { |
|
15 | - // don't save blank fields |
|
16 | - return 0; |
|
17 | - } |
|
14 | + if ( FrmAppHelper::is_empty_value( $meta_value ) ) { |
|
15 | + // don't save blank fields |
|
16 | + return 0; |
|
17 | + } |
|
18 | 18 | |
19 | - $new_values = array( |
|
19 | + $new_values = array( |
|
20 | 20 | 'meta_value' => is_array( $meta_value ) ? serialize( array_filter( $meta_value, 'FrmAppHelper::is_not_empty_value' ) ) : trim( $meta_value ), |
21 | - 'item_id' => $entry_id, |
|
22 | - 'field_id' => $field_id, |
|
23 | - 'created_at' => current_time('mysql', 1), |
|
24 | - ); |
|
21 | + 'item_id' => $entry_id, |
|
22 | + 'field_id' => $field_id, |
|
23 | + 'created_at' => current_time('mysql', 1), |
|
24 | + ); |
|
25 | 25 | |
26 | - $new_values = apply_filters('frm_add_entry_meta', $new_values); |
|
26 | + $new_values = apply_filters('frm_add_entry_meta', $new_values); |
|
27 | 27 | |
28 | 28 | $query_results = $wpdb->insert( $wpdb->prefix . 'frm_item_metas', $new_values ); |
29 | 29 | |
@@ -34,40 +34,40 @@ discard block |
||
34 | 34 | $id = 0; |
35 | 35 | } |
36 | 36 | |
37 | - return $id; |
|
38 | - } |
|
37 | + return $id; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $meta_key |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @param string $meta_key |
|
42 | + */ |
|
43 | 43 | public static function update_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) { |
44 | - if ( ! $field_id ) { |
|
45 | - return false; |
|
46 | - } |
|
44 | + if ( ! $field_id ) { |
|
45 | + return false; |
|
46 | + } |
|
47 | 47 | |
48 | - global $wpdb; |
|
48 | + global $wpdb; |
|
49 | 49 | |
50 | 50 | $values = array( 'item_id' => $entry_id, 'field_id' => $field_id ); |
51 | 51 | $where_values = $values; |
52 | - $values['meta_value'] = $meta_value; |
|
53 | - $values = apply_filters('frm_update_entry_meta', $values); |
|
52 | + $values['meta_value'] = $meta_value; |
|
53 | + $values = apply_filters('frm_update_entry_meta', $values); |
|
54 | 54 | if ( is_array($values['meta_value']) ) { |
55 | 55 | $values['meta_value'] = array_filter( $values['meta_value'], 'FrmAppHelper::is_not_empty_value' ); |
56 | 56 | } |
57 | - $meta_value = maybe_serialize($values['meta_value']); |
|
57 | + $meta_value = maybe_serialize($values['meta_value']); |
|
58 | 58 | |
59 | - wp_cache_delete( $entry_id, 'frm_entry'); |
|
59 | + wp_cache_delete( $entry_id, 'frm_entry'); |
|
60 | 60 | self::clear_cache(); |
61 | 61 | |
62 | 62 | return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values ); |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | public static function update_entry_metas( $entry_id, $values ) { |
66 | - global $wpdb; |
|
66 | + global $wpdb; |
|
67 | 67 | |
68 | 68 | $prev_values = FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id, 'field_id !' => 0 ), 'field_id' ); |
69 | 69 | |
70 | - foreach ( $values as $field_id => $meta_value ) { |
|
70 | + foreach ( $values as $field_id => $meta_value ) { |
|
71 | 71 | $field = false; |
72 | 72 | if ( ! empty( $field_id ) ) { |
73 | 73 | $field = FrmField::getOne( $field_id ); |
@@ -91,39 +91,39 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - if ( empty($prev_values) ) { |
|
95 | - return; |
|
96 | - } |
|
94 | + if ( empty($prev_values) ) { |
|
95 | + return; |
|
96 | + } |
|
97 | 97 | |
98 | - $prev_values = array_diff($prev_values, array_keys($values)); |
|
98 | + $prev_values = array_diff($prev_values, array_keys($values)); |
|
99 | 99 | |
100 | - if ( empty($prev_values) ) { |
|
101 | - return; |
|
102 | - } |
|
100 | + if ( empty($prev_values) ) { |
|
101 | + return; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | // prepare the query |
105 | 105 | $where = array( 'item_id' => $entry_id, 'field_id' => $prev_values ); |
106 | 106 | FrmDb::get_where_clause_and_values( $where ); |
107 | 107 | |
108 | - // Delete any leftovers |
|
109 | - $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values'] ) ); |
|
108 | + // Delete any leftovers |
|
109 | + $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values'] ) ); |
|
110 | 110 | self::clear_cache(); |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | 113 | public static function duplicate_entry_metas( $old_id, $new_id ) { |
114 | - $metas = self::get_entry_meta_info($old_id); |
|
115 | - foreach ( $metas as $meta ) { |
|
116 | - self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value); |
|
117 | - unset($meta); |
|
118 | - } |
|
114 | + $metas = self::get_entry_meta_info($old_id); |
|
115 | + foreach ( $metas as $meta ) { |
|
116 | + self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value); |
|
117 | + unset($meta); |
|
118 | + } |
|
119 | 119 | self::clear_cache(); |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | public static function delete_entry_meta( $entry_id, $field_id ) { |
123 | - global $wpdb; |
|
123 | + global $wpdb; |
|
124 | 124 | self::clear_cache(); |
125 | - return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id)); |
|
126 | - } |
|
125 | + return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id)); |
|
126 | + } |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Clear entry meta caching |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | public static function get_entry_meta_by_field( $entry_id, $field_id ) { |
151 | - global $wpdb; |
|
151 | + global $wpdb; |
|
152 | 152 | |
153 | 153 | if ( is_object( $entry_id ) ) { |
154 | 154 | $entry = $entry_id; |
@@ -161,130 +161,130 @@ discard block |
||
161 | 161 | |
162 | 162 | if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
163 | 163 | $result = $cached->metas[ $field_id ]; |
164 | - return stripslashes_deep($result); |
|
165 | - } |
|
164 | + return stripslashes_deep($result); |
|
165 | + } |
|
166 | 166 | |
167 | 167 | $get_table = $wpdb->prefix . 'frm_item_metas'; |
168 | 168 | $query = array( 'item_id' => $entry_id ); |
169 | - if ( is_numeric($field_id) ) { |
|
169 | + if ( is_numeric($field_id) ) { |
|
170 | 170 | $query['field_id'] = $field_id; |
171 | - } else { |
|
171 | + } else { |
|
172 | 172 | $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
173 | 173 | $query['fi.field_key'] = $field_id; |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | 176 | $result = FrmDb::get_var( $get_table, $query, 'meta_value' ); |
177 | - $result = maybe_unserialize($result); |
|
178 | - $result = stripslashes_deep($result); |
|
177 | + $result = maybe_unserialize($result); |
|
178 | + $result = stripslashes_deep($result); |
|
179 | 179 | |
180 | - return $result; |
|
181 | - } |
|
180 | + return $result; |
|
181 | + } |
|
182 | 182 | |
183 | - public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) { |
|
183 | + public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) { |
|
184 | 184 | $defaults = array( 'value' => false, 'unique' => false, 'stripslashes' => true, 'is_draft' => false ); |
185 | - $args = wp_parse_args( $args, $defaults ); |
|
185 | + $args = wp_parse_args( $args, $defaults ); |
|
186 | 186 | |
187 | - $query = array(); |
|
188 | - self::meta_field_query($field_id, $order, $limit, $args, $query); |
|
189 | - $query = implode(' ', $query); |
|
187 | + $query = array(); |
|
188 | + self::meta_field_query($field_id, $order, $limit, $args, $query); |
|
189 | + $query = implode(' ', $query); |
|
190 | 190 | |
191 | 191 | $cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args ); |
192 | - $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col'); |
|
192 | + $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col'); |
|
193 | 193 | |
194 | - if ( ! $args['stripslashes'] ) { |
|
195 | - return $values; |
|
196 | - } |
|
194 | + if ( ! $args['stripslashes'] ) { |
|
195 | + return $values; |
|
196 | + } |
|
197 | 197 | |
198 | 198 | foreach ( $values as $k => $v ) { |
199 | 199 | $values[ $k ] = maybe_unserialize( $v ); |
200 | - unset($k, $v); |
|
201 | - } |
|
200 | + unset($k, $v); |
|
201 | + } |
|
202 | 202 | |
203 | - return stripslashes_deep($values); |
|
204 | - } |
|
203 | + return stripslashes_deep($values); |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * @param string $order |
|
208 | - * @param string $limit |
|
209 | - */ |
|
206 | + /** |
|
207 | + * @param string $order |
|
208 | + * @param string $limit |
|
209 | + */ |
|
210 | 210 | private static function meta_field_query( $field_id, $order, $limit, $args, array &$query ) { |
211 | - global $wpdb; |
|
212 | - $query[] = 'SELECT'; |
|
213 | - $query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value'; |
|
211 | + global $wpdb; |
|
212 | + $query[] = 'SELECT'; |
|
213 | + $query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value'; |
|
214 | 214 | $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas em '; |
215 | 215 | |
216 | - if ( ! $args['is_draft'] ) { |
|
216 | + if ( ! $args['is_draft'] ) { |
|
217 | 217 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)'; |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - if ( is_numeric($field_id) ) { |
|
221 | - $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id); |
|
222 | - } else { |
|
220 | + if ( is_numeric($field_id) ) { |
|
221 | + $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id); |
|
222 | + } else { |
|
223 | 223 | $query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id ); |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | - if ( ! $args['is_draft'] ) { |
|
227 | - $query[] = 'AND e.is_draft=0'; |
|
228 | - } |
|
226 | + if ( ! $args['is_draft'] ) { |
|
227 | + $query[] = 'AND e.is_draft=0'; |
|
228 | + } |
|
229 | 229 | |
230 | - if ( $args['value'] ) { |
|
231 | - $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']); |
|
232 | - } |
|
233 | - $query[] = $order . $limit; |
|
234 | - } |
|
230 | + if ( $args['value'] ) { |
|
231 | + $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']); |
|
232 | + } |
|
233 | + $query[] = $order . $limit; |
|
234 | + } |
|
235 | 235 | |
236 | 236 | public static function get_entry_meta_info( $entry_id ) { |
237 | 237 | return FrmDb::get_results( 'frm_item_metas', array( 'item_id' => $entry_id ) ); |
238 | - } |
|
238 | + } |
|
239 | 239 | |
240 | 240 | public static function getAll( $where = array(), $order_by = '', $limit = '', $stripslashes = false ) { |
241 | - global $wpdb; |
|
242 | - $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key, |
|
241 | + global $wpdb; |
|
242 | + $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key, |
|
243 | 243 | fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options |
244 | 244 | FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' . |
245 | - FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
245 | + FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
246 | 246 | |
247 | 247 | $cache_key = 'all_' . maybe_serialize( $where ) . $order_by . $limit; |
248 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results')); |
|
248 | + $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results')); |
|
249 | 249 | |
250 | - if ( ! $results || ! $stripslashes ) { |
|
251 | - return $results; |
|
252 | - } |
|
250 | + if ( ! $results || ! $stripslashes ) { |
|
251 | + return $results; |
|
252 | + } |
|
253 | 253 | |
254 | - foreach ( $results as $k => $result ) { |
|
254 | + foreach ( $results as $k => $result ) { |
|
255 | 255 | $results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) ); |
256 | - unset($k, $result); |
|
257 | - } |
|
256 | + unset($k, $result); |
|
257 | + } |
|
258 | 258 | |
259 | - return $results; |
|
260 | - } |
|
259 | + return $results; |
|
260 | + } |
|
261 | 261 | |
262 | - public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) { |
|
262 | + public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) { |
|
263 | 263 | $defaults = array( |
264 | 264 | 'is_draft' => false, |
265 | 265 | 'user_id' => '', |
266 | 266 | 'group_by' => '', |
267 | 267 | ); |
268 | - $args = wp_parse_args($args, $defaults); |
|
268 | + $args = wp_parse_args($args, $defaults); |
|
269 | 269 | |
270 | - $query = array(); |
|
271 | - self::get_ids_query($where, $order_by, $limit, $unique, $args, $query ); |
|
272 | - $query = implode(' ', $query); |
|
270 | + $query = array(); |
|
271 | + self::get_ids_query($where, $order_by, $limit, $unique, $args, $query ); |
|
272 | + $query = implode(' ', $query); |
|
273 | 273 | |
274 | 274 | $cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args ); |
275 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col')); |
|
275 | + $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col')); |
|
276 | 276 | |
277 | - return $results; |
|
278 | - } |
|
277 | + return $results; |
|
278 | + } |
|
279 | 279 | |
280 | - /** |
|
281 | - * @param string|array $where |
|
282 | - * @param string $order_by |
|
283 | - * @param string $limit |
|
284 | - */ |
|
280 | + /** |
|
281 | + * @param string|array $where |
|
282 | + * @param string $order_by |
|
283 | + * @param string $limit |
|
284 | + */ |
|
285 | 285 | private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
286 | - global $wpdb; |
|
287 | - $query[] = 'SELECT'; |
|
286 | + global $wpdb; |
|
287 | + $query[] = 'SELECT'; |
|
288 | 288 | |
289 | 289 | $defaults = array( 'return_parent_id' => false ); |
290 | 290 | $args = array_merge( $defaults, $args ); |
@@ -298,89 +298,89 @@ discard block |
||
298 | 298 | $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
299 | 299 | |
300 | 300 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)'; |
301 | - if ( is_array($where) ) { |
|
302 | - if ( ! $args['is_draft'] ) { |
|
303 | - $where['e.is_draft'] = 0; |
|
304 | - } else if ( $args['is_draft'] == 1 ) { |
|
305 | - $where['e.is_draft'] = 1; |
|
306 | - } |
|
307 | - |
|
308 | - if ( ! empty($args['user_id']) ) { |
|
309 | - $where['e.user_id'] = $args['user_id']; |
|
310 | - } |
|
311 | - $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
301 | + if ( is_array($where) ) { |
|
302 | + if ( ! $args['is_draft'] ) { |
|
303 | + $where['e.is_draft'] = 0; |
|
304 | + } else if ( $args['is_draft'] == 1 ) { |
|
305 | + $where['e.is_draft'] = 1; |
|
306 | + } |
|
307 | + |
|
308 | + if ( ! empty($args['user_id']) ) { |
|
309 | + $where['e.user_id'] = $args['user_id']; |
|
310 | + } |
|
311 | + $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
312 | 312 | |
313 | 313 | if ( $args['group_by'] ) { |
314 | 314 | $query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] ); |
315 | 315 | } |
316 | - return; |
|
317 | - } |
|
316 | + return; |
|
317 | + } |
|
318 | 318 | |
319 | 319 | $draft_where = ''; |
320 | 320 | $user_where = ''; |
321 | - if ( ! $args['is_draft'] ) { |
|
321 | + if ( ! $args['is_draft'] ) { |
|
322 | 322 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 0 ); |
323 | - } else if ( $args['is_draft'] == 1 ) { |
|
323 | + } else if ( $args['is_draft'] == 1 ) { |
|
324 | 324 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 ); |
325 | - } |
|
325 | + } |
|
326 | 326 | |
327 | - if ( ! empty($args['user_id']) ) { |
|
328 | - $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']); |
|
329 | - } |
|
327 | + if ( ! empty($args['user_id']) ) { |
|
328 | + $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']); |
|
329 | + } |
|
330 | 330 | |
331 | - if ( strpos($where, ' GROUP BY ') ) { |
|
332 | - // don't inject WHERE filtering after GROUP BY |
|
333 | - $parts = explode(' GROUP BY ', $where); |
|
334 | - $where = $parts[0]; |
|
335 | - $where .= $draft_where . $user_where; |
|
331 | + if ( strpos($where, ' GROUP BY ') ) { |
|
332 | + // don't inject WHERE filtering after GROUP BY |
|
333 | + $parts = explode(' GROUP BY ', $where); |
|
334 | + $where = $parts[0]; |
|
335 | + $where .= $draft_where . $user_where; |
|
336 | 336 | $where .= ' GROUP BY ' . $parts[1]; |
337 | - } else { |
|
338 | - $where .= $draft_where . $user_where; |
|
339 | - } |
|
337 | + } else { |
|
338 | + $where .= $draft_where . $user_where; |
|
339 | + } |
|
340 | 340 | |
341 | 341 | // The query has already been prepared |
342 | 342 | $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
343 | - } |
|
343 | + } |
|
344 | 344 | |
345 | - public static function search_entry_metas( $search, $field_id = '', $operator ) { |
|
345 | + public static function search_entry_metas( $search, $field_id = '', $operator ) { |
|
346 | 346 | $cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator; |
347 | - $results = wp_cache_get($cache_key, 'frm_entry'); |
|
348 | - if ( false !== $results ) { |
|
349 | - return $results; |
|
350 | - } |
|
347 | + $results = wp_cache_get($cache_key, 'frm_entry'); |
|
348 | + if ( false !== $results ) { |
|
349 | + return $results; |
|
350 | + } |
|
351 | 351 | |
352 | - global $wpdb; |
|
352 | + global $wpdb; |
|
353 | 353 | if ( is_array( $search ) ) { |
354 | - $where = ''; |
|
354 | + $where = ''; |
|
355 | 355 | foreach ( $search as $field => $value ) { |
356 | 356 | if ( $value <= 0 || ! in_array( $field, array( 'year', 'month', 'day' ) ) ) { |
357 | - continue; |
|
358 | - } |
|
357 | + continue; |
|
358 | + } |
|
359 | 359 | |
360 | - switch ( $field ) { |
|
361 | - case 'year': |
|
360 | + switch ( $field ) { |
|
361 | + case 'year': |
|
362 | 362 | $value = '%' . $value; |
363 | - break; |
|
364 | - case 'month': |
|
365 | - $value .= '%'; |
|
366 | - break; |
|
367 | - case 'day': |
|
363 | + break; |
|
364 | + case 'month': |
|
365 | + $value .= '%'; |
|
366 | + break; |
|
367 | + case 'day': |
|
368 | 368 | $value = '%' . $value . '%'; |
369 | - } |
|
369 | + } |
|
370 | 370 | $where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value ); |
371 | - } |
|
372 | - $where .= $wpdb->prepare(' field_id=%d', $field_id); |
|
371 | + } |
|
372 | + $where .= $wpdb->prepare(' field_id=%d', $field_id); |
|
373 | 373 | $query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ); |
374 | - } else { |
|
374 | + } else { |
|
375 | 375 | if ( $operator == 'LIKE' ) { |
376 | - $search = '%' . $search . '%'; |
|
376 | + $search = '%' . $search . '%'; |
|
377 | 377 | } |
378 | - $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id); |
|
379 | - } |
|
378 | + $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id); |
|
379 | + } |
|
380 | 380 | |
381 | - $results = $wpdb->get_col($query, 0); |
|
381 | + $results = $wpdb->get_col($query, 0); |
|
382 | 382 | FrmAppHelper::set_cache( $cache_key, $results, 'frm_entry' ); |
383 | 383 | |
384 | - return $results; |
|
385 | - } |
|
384 | + return $results; |
|
385 | + } |
|
386 | 386 | } |
@@ -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 | |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | 'meta_value' => is_array( $meta_value ) ? serialize( array_filter( $meta_value, 'FrmAppHelper::is_not_empty_value' ) ) : trim( $meta_value ), |
21 | 21 | 'item_id' => $entry_id, |
22 | 22 | 'field_id' => $field_id, |
23 | - 'created_at' => current_time('mysql', 1), |
|
23 | + 'created_at' => current_time( 'mysql', 1 ), |
|
24 | 24 | ); |
25 | 25 | |
26 | - $new_values = apply_filters('frm_add_entry_meta', $new_values); |
|
26 | + $new_values = apply_filters( 'frm_add_entry_meta', $new_values ); |
|
27 | 27 | |
28 | 28 | $query_results = $wpdb->insert( $wpdb->prefix . 'frm_item_metas', $new_values ); |
29 | 29 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | $values = array( 'item_id' => $entry_id, 'field_id' => $field_id ); |
51 | 51 | $where_values = $values; |
52 | 52 | $values['meta_value'] = $meta_value; |
53 | - $values = apply_filters('frm_update_entry_meta', $values); |
|
54 | - if ( is_array($values['meta_value']) ) { |
|
53 | + $values = apply_filters( 'frm_update_entry_meta', $values ); |
|
54 | + if ( is_array( $values['meta_value'] ) ) { |
|
55 | 55 | $values['meta_value'] = array_filter( $values['meta_value'], 'FrmAppHelper::is_not_empty_value' ); |
56 | 56 | } |
57 | - $meta_value = maybe_serialize($values['meta_value']); |
|
57 | + $meta_value = maybe_serialize( $values['meta_value'] ); |
|
58 | 58 | |
59 | - wp_cache_delete( $entry_id, 'frm_entry'); |
|
59 | + wp_cache_delete( $entry_id, 'frm_entry' ); |
|
60 | 60 | self::clear_cache(); |
61 | 61 | |
62 | 62 | return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values ); |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | // set the value for the file upload field and add new tags (in Pro version) |
77 | 77 | $meta_value = apply_filters( 'frm_prepare_data_before_db', $meta_value, $field_id, $entry_id, compact( 'field' ) ); |
78 | 78 | |
79 | - if ( $prev_values && in_array($field_id, $prev_values) ) { |
|
79 | + if ( $prev_values && in_array( $field_id, $prev_values ) ) { |
|
80 | 80 | |
81 | 81 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) { |
82 | 82 | // remove blank fields |
83 | - unset( $values[ $field_id ] ); |
|
83 | + unset( $values[$field_id] ); |
|
84 | 84 | } else { |
85 | 85 | // if value exists, then update it |
86 | 86 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - if ( empty($prev_values) ) { |
|
94 | + if ( empty( $prev_values ) ) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | - $prev_values = array_diff($prev_values, array_keys($values)); |
|
98 | + $prev_values = array_diff( $prev_values, array_keys( $values ) ); |
|
99 | 99 | |
100 | - if ( empty($prev_values) ) { |
|
100 | + if ( empty( $prev_values ) ) { |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | public static function duplicate_entry_metas( $old_id, $new_id ) { |
114 | - $metas = self::get_entry_meta_info($old_id); |
|
114 | + $metas = self::get_entry_meta_info( $old_id ); |
|
115 | 115 | foreach ( $metas as $meta ) { |
116 | - self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value); |
|
117 | - unset($meta); |
|
116 | + self::add_entry_meta( $new_id, $meta->field_id, null, $meta->meta_value ); |
|
117 | + unset( $meta ); |
|
118 | 118 | } |
119 | 119 | self::clear_cache(); |
120 | 120 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public static function delete_entry_meta( $entry_id, $field_id ) { |
123 | 123 | global $wpdb; |
124 | 124 | self::clear_cache(); |
125 | - return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id)); |
|
125 | + return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id ) ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public static function get_meta_value( $entry, $field_id ) { |
143 | 143 | if ( isset( $entry->metas ) ) { |
144 | - return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false; |
|
144 | + return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false; |
|
145 | 145 | } else { |
146 | 146 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
147 | 147 | } |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $cached = FrmAppHelper::check_cache( $entry_id, 'frm_entry' ); |
160 | 160 | } |
161 | 161 | |
162 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
163 | - $result = $cached->metas[ $field_id ]; |
|
164 | - return stripslashes_deep($result); |
|
162 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
163 | + $result = $cached->metas[$field_id]; |
|
164 | + return stripslashes_deep( $result ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $get_table = $wpdb->prefix . 'frm_item_metas'; |
168 | 168 | $query = array( 'item_id' => $entry_id ); |
169 | - if ( is_numeric($field_id) ) { |
|
169 | + if ( is_numeric( $field_id ) ) { |
|
170 | 170 | $query['field_id'] = $field_id; |
171 | 171 | } else { |
172 | 172 | $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | $result = FrmDb::get_var( $get_table, $query, 'meta_value' ); |
177 | - $result = maybe_unserialize($result); |
|
178 | - $result = stripslashes_deep($result); |
|
177 | + $result = maybe_unserialize( $result ); |
|
178 | + $result = stripslashes_deep( $result ); |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | $args = wp_parse_args( $args, $defaults ); |
186 | 186 | |
187 | 187 | $query = array(); |
188 | - self::meta_field_query($field_id, $order, $limit, $args, $query); |
|
189 | - $query = implode(' ', $query); |
|
188 | + self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
|
189 | + $query = implode( ' ', $query ); |
|
190 | 190 | |
191 | 191 | $cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args ); |
192 | - $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col'); |
|
192 | + $values = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, 'get_col' ); |
|
193 | 193 | |
194 | 194 | if ( ! $args['stripslashes'] ) { |
195 | 195 | return $values; |
196 | 196 | } |
197 | 197 | |
198 | 198 | foreach ( $values as $k => $v ) { |
199 | - $values[ $k ] = maybe_unserialize( $v ); |
|
200 | - unset($k, $v); |
|
199 | + $values[$k] = maybe_unserialize( $v ); |
|
200 | + unset( $k, $v ); |
|
201 | 201 | } |
202 | 202 | |
203 | - return stripslashes_deep($values); |
|
203 | + return stripslashes_deep( $values ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)'; |
218 | 218 | } |
219 | 219 | |
220 | - if ( is_numeric($field_id) ) { |
|
221 | - $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id); |
|
220 | + if ( is_numeric( $field_id ) ) { |
|
221 | + $query[] = $wpdb->prepare( 'WHERE em.field_id=%d', $field_id ); |
|
222 | 222 | } else { |
223 | 223 | $query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id ); |
224 | 224 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | if ( $args['value'] ) { |
231 | - $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']); |
|
231 | + $query[] = $wpdb->prepare( ' AND meta_value=%s', $args['value'] ); |
|
232 | 232 | } |
233 | 233 | $query[] = $order . $limit; |
234 | 234 | } |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key, |
243 | 243 | fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options |
244 | 244 | FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' . |
245 | - FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
245 | + FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
246 | 246 | |
247 | 247 | $cache_key = 'all_' . maybe_serialize( $where ) . $order_by . $limit; |
248 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results')); |
|
248 | + $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_row' : 'get_results' ) ); |
|
249 | 249 | |
250 | 250 | if ( ! $results || ! $stripslashes ) { |
251 | 251 | return $results; |
252 | 252 | } |
253 | 253 | |
254 | 254 | foreach ( $results as $k => $result ) { |
255 | - $results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) ); |
|
256 | - unset($k, $result); |
|
255 | + $results[$k]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) ); |
|
256 | + unset( $k, $result ); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $results; |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | 'user_id' => '', |
266 | 266 | 'group_by' => '', |
267 | 267 | ); |
268 | - $args = wp_parse_args($args, $defaults); |
|
268 | + $args = wp_parse_args( $args, $defaults ); |
|
269 | 269 | |
270 | 270 | $query = array(); |
271 | - self::get_ids_query($where, $order_by, $limit, $unique, $args, $query ); |
|
272 | - $query = implode(' ', $query); |
|
271 | + self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
|
272 | + $query = implode( ' ', $query ); |
|
273 | 273 | |
274 | 274 | $cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args ); |
275 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col')); |
|
275 | + $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_var' : 'get_col' ) ); |
|
276 | 276 | |
277 | 277 | return $results; |
278 | 278 | } |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
299 | 299 | |
300 | 300 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)'; |
301 | - if ( is_array($where) ) { |
|
301 | + if ( is_array( $where ) ) { |
|
302 | 302 | if ( ! $args['is_draft'] ) { |
303 | 303 | $where['e.is_draft'] = 0; |
304 | 304 | } else if ( $args['is_draft'] == 1 ) { |
305 | 305 | $where['e.is_draft'] = 1; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! empty($args['user_id']) ) { |
|
308 | + if ( ! empty( $args['user_id'] ) ) { |
|
309 | 309 | $where['e.user_id'] = $args['user_id']; |
310 | 310 | } |
311 | - $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
311 | + $query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
312 | 312 | |
313 | 313 | if ( $args['group_by'] ) { |
314 | 314 | $query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] ); |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 ); |
325 | 325 | } |
326 | 326 | |
327 | - if ( ! empty($args['user_id']) ) { |
|
328 | - $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']); |
|
327 | + if ( ! empty( $args['user_id'] ) ) { |
|
328 | + $user_where = $wpdb->prepare( ' AND e.user_id=%d', $args['user_id'] ); |
|
329 | 329 | } |
330 | 330 | |
331 | - if ( strpos($where, ' GROUP BY ') ) { |
|
331 | + if ( strpos( $where, ' GROUP BY ' ) ) { |
|
332 | 332 | // don't inject WHERE filtering after GROUP BY |
333 | - $parts = explode(' GROUP BY ', $where); |
|
333 | + $parts = explode( ' GROUP BY ', $where ); |
|
334 | 334 | $where = $parts[0]; |
335 | 335 | $where .= $draft_where . $user_where; |
336 | 336 | $where .= ' GROUP BY ' . $parts[1]; |
@@ -339,12 +339,12 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | // The query has already been prepared |
342 | - $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
342 | + $query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | public static function search_entry_metas( $search, $field_id = '', $operator ) { |
346 | 346 | $cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator; |
347 | - $results = wp_cache_get($cache_key, 'frm_entry'); |
|
347 | + $results = wp_cache_get( $cache_key, 'frm_entry' ); |
|
348 | 348 | if ( false !== $results ) { |
349 | 349 | return $results; |
350 | 350 | } |
@@ -367,18 +367,18 @@ discard block |
||
367 | 367 | case 'day': |
368 | 368 | $value = '%' . $value . '%'; |
369 | 369 | } |
370 | - $where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value ); |
|
370 | + $where .= $wpdb->prepare( ' meta_value ' . $operator . ' %s and', $value ); |
|
371 | 371 | } |
372 | - $where .= $wpdb->prepare(' field_id=%d', $field_id); |
|
372 | + $where .= $wpdb->prepare( ' field_id=%d', $field_id ); |
|
373 | 373 | $query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ); |
374 | 374 | } else { |
375 | 375 | if ( $operator == 'LIKE' ) { |
376 | 376 | $search = '%' . $search . '%'; |
377 | 377 | } |
378 | - $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id); |
|
378 | + $query = $wpdb->prepare( "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id ); |
|
379 | 379 | } |
380 | 380 | |
381 | - $results = $wpdb->get_col($query, 0); |
|
381 | + $results = $wpdb->get_col( $query, 0 ); |
|
382 | 382 | FrmAppHelper::set_cache( $cache_key, $results, 'frm_entry' ); |
383 | 383 | |
384 | 384 | return $results; |
@@ -31,6 +31,10 @@ |
||
31 | 31 | */ |
32 | 32 | protected $option_label = ''; |
33 | 33 | |
34 | + /** |
|
35 | + * @param string $option_key |
|
36 | + * @param string $option |
|
37 | + */ |
|
34 | 38 | public function __construct( $option_key, $option, $args = array() ) { |
35 | 39 | $this->option_key = $option_key; |
36 | 40 | $this->option = $option; |