@@ -1,42 +1,42 @@ |
||
1 | 1 | <div class="field-group clearfix frm-first-row"> |
2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_font_size') ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_font_size' ) ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <div class="field-group clearfix frm-first-row"> |
7 | 7 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_height') ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_height' ) ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
9 | 9 | </div> |
10 | 10 | |
11 | 11 | <div class="field-group clearfix frm-first-row"> |
12 | 12 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
13 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_width') ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
13 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_width' ) ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="clear"></div> |
17 | 17 | <p class="frm_no_bottom_margin"> |
18 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('auto_width') ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
18 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'auto_width' ) ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
19 | 19 | <?php _e( 'Automatic Width for drop-down fields', 'formidable' ) ?></label> |
20 | 20 | </p> |
21 | 21 | |
22 | 22 | <div class="field-group clearfix"> |
23 | 23 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
24 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_pad') ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
24 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_pad' ) ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | <div class="field-group clearfix"> |
28 | 28 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_margin') ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_margin' ) ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
30 | 30 | </div> |
31 | 31 | |
32 | 32 | <div class="field-group clearfix"> |
33 | 33 | <label><?php _e( 'Corners', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Formidable uses CSS3 border-radius for corner rounding, which is not currently supported by Internet Explorer.', 'formidable' ) ?>" ></span></label> |
34 | - <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('border_radius') ) ?>" id="frm_border_radius" /> |
|
34 | + <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_radius' ) ) ?>" id="frm_border_radius" /> |
|
35 | 35 | </div> |
36 | 36 | |
37 | 37 | <div class="field-group clearfix frm-first-row"> |
38 | 38 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_weight') ) ?>" id="frm_field_weight"> |
|
39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_weight' ) ) ?>" id="frm_field_weight"> |
|
40 | 40 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
41 | 41 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['field_weight'], $value ) ?>><?php echo $name ?></option> |
42 | 42 | <?php } ?> |
@@ -1,59 +1,59 @@ |
||
1 | 1 | <p> |
2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
4 | 4 | </label> |
5 | 5 | </p> |
6 | 6 | |
7 | 7 | <div class="field-group clearfix frm-first-row"> |
8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
13 | 13 | </select> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="field-group clearfix frm-first-row"> |
17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class="field-group clearfix frm-first-row"> |
22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="field-group field-group-border clearfix"> |
27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <div class="field-group clearfix"> |
32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class="field-group clearfix"> |
37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class="field-group clearfix frm-half"> |
47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
51 | 51 | </select> |
52 | 52 | </div> |
53 | 53 | |
54 | 54 | <div class="clear"></div> |
55 | 55 | <p class="frm_no_bottom_margin"> |
56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
58 | 58 | </label> |
59 | 59 | </p> |
@@ -121,6 +121,9 @@ |
||
121 | 121 | $stylesheet_urls['formidable'] = $url; |
122 | 122 | } |
123 | 123 | |
124 | + /** |
|
125 | + * @param string $version |
|
126 | + */ |
|
124 | 127 | private static function get_css_version( $css_key, $version ) { |
125 | 128 | if ( 'formidable' == $css_key ) { |
126 | 129 | $this_version = get_option( 'frm_last_style_update' ); |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FrmStylesController { |
4 | - public static $post_type = 'frm_styles'; |
|
5 | - public static $screen = 'formidable_page_formidable-styles'; |
|
6 | - |
|
7 | - public static function load_pro_hooks() { |
|
8 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
9 | - FrmProStylesController::load_pro_hooks(); |
|
10 | - } |
|
11 | - } |
|
12 | - |
|
13 | - public static function register_post_types() { |
|
14 | - register_post_type( self::$post_type, array( |
|
15 | - 'label' => __( 'Styles', 'formidable' ), |
|
16 | - 'public' => false, |
|
17 | - 'show_ui' => false, |
|
18 | - 'capability_type' => 'page', |
|
4 | + public static $post_type = 'frm_styles'; |
|
5 | + public static $screen = 'formidable_page_formidable-styles'; |
|
6 | + |
|
7 | + public static function load_pro_hooks() { |
|
8 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
9 | + FrmProStylesController::load_pro_hooks(); |
|
10 | + } |
|
11 | + } |
|
12 | + |
|
13 | + public static function register_post_types() { |
|
14 | + register_post_type( self::$post_type, array( |
|
15 | + 'label' => __( 'Styles', 'formidable' ), |
|
16 | + 'public' => false, |
|
17 | + 'show_ui' => false, |
|
18 | + 'capability_type' => 'page', |
|
19 | 19 | 'capabilities' => array( |
20 | 20 | 'edit_post' => 'frm_change_settings', |
21 | 21 | 'edit_posts' => 'frm_change_settings', |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | 'delete_posts' => 'frm_change_settings', |
26 | 26 | 'read_private_posts' => 'read_private_posts', |
27 | 27 | ), |
28 | - 'supports' => array( |
|
28 | + 'supports' => array( |
|
29 | 29 | 'title', |
30 | - ), |
|
31 | - 'has_archive' => false, |
|
32 | - 'labels' => array( |
|
30 | + ), |
|
31 | + 'has_archive' => false, |
|
32 | + 'labels' => array( |
|
33 | 33 | 'name' => __( 'Styles', 'formidable' ), |
34 | 34 | 'singular_name' => __( 'Style', 'formidable' ), |
35 | 35 | 'menu_name' => __( 'Style', 'formidable' ), |
@@ -37,31 +37,31 @@ discard block |
||
37 | 37 | 'add_new_item' => __( 'Create a New Style', 'formidable' ), |
38 | 38 | 'edit_item' => __( 'Edit Style', 'formidable' ), |
39 | 39 | ), |
40 | - ) ); |
|
41 | - } |
|
40 | + ) ); |
|
41 | + } |
|
42 | 42 | |
43 | - public static function menu() { |
|
43 | + public static function menu() { |
|
44 | 44 | add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - public static function admin_init() { |
|
48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
49 | - return; |
|
50 | - } |
|
47 | + public static function admin_init() { |
|
48 | + if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
49 | + return; |
|
50 | + } |
|
51 | 51 | |
52 | - self::load_pro_hooks(); |
|
53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
52 | + self::load_pro_hooks(); |
|
53 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
54 | 54 | |
55 | - $version = FrmAppHelper::plugin_version(); |
|
55 | + $version = FrmAppHelper::plugin_version(); |
|
56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
57 | 57 | |
58 | 58 | wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
59 | 59 | |
60 | - $style = apply_filters('frm_style_head', false); |
|
61 | - if ( $style ) { |
|
60 | + $style = apply_filters('frm_style_head', false); |
|
61 | + if ( $style ) { |
|
62 | 62 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public static function enqueue_css( $register = 'enqueue' ) { |
67 | 67 | global $frm_vars; |
@@ -143,230 +143,230 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public static function new_style( $return = '' ) { |
146 | - self::load_styler('default'); |
|
147 | - } |
|
146 | + self::load_styler('default'); |
|
147 | + } |
|
148 | 148 | |
149 | 149 | public static function duplicate() { |
150 | 150 | self::load_styler('default'); |
151 | 151 | } |
152 | 152 | |
153 | 153 | public static function edit( $style_id = false, $message = '' ) { |
154 | - if ( ! $style_id ) { |
|
154 | + if ( ! $style_id ) { |
|
155 | 155 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
156 | - if ( empty($style_id) ) { |
|
157 | - $style_id = 'default'; |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - if ( 'default' == $style_id ) { |
|
162 | - $style = 'default'; |
|
163 | - } else { |
|
164 | - $frm_style = new FrmStyle($style_id); |
|
165 | - $style = $frm_style->get_one(); |
|
166 | - $style = $style->ID; |
|
167 | - } |
|
168 | - |
|
169 | - self::load_styler($style, $message); |
|
170 | - } |
|
171 | - |
|
172 | - public static function save() { |
|
173 | - $frm_style = new FrmStyle(); |
|
174 | - $message = ''; |
|
156 | + if ( empty($style_id) ) { |
|
157 | + $style_id = 'default'; |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + if ( 'default' == $style_id ) { |
|
162 | + $style = 'default'; |
|
163 | + } else { |
|
164 | + $frm_style = new FrmStyle($style_id); |
|
165 | + $style = $frm_style->get_one(); |
|
166 | + $style = $style->ID; |
|
167 | + } |
|
168 | + |
|
169 | + self::load_styler($style, $message); |
|
170 | + } |
|
171 | + |
|
172 | + public static function save() { |
|
173 | + $frm_style = new FrmStyle(); |
|
174 | + $message = ''; |
|
175 | 175 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' ); |
176 | 176 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
177 | 177 | |
178 | 178 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
179 | - $id = $frm_style->update($post_id); |
|
180 | - if ( empty($post_id) && ! empty($id) ) { |
|
181 | - // set the post id to the new style so it will be loaded for editing |
|
182 | - $post_id = reset($id); |
|
183 | - } |
|
184 | - // include the CSS that includes this style |
|
179 | + $id = $frm_style->update($post_id); |
|
180 | + if ( empty($post_id) && ! empty($id) ) { |
|
181 | + // set the post id to the new style so it will be loaded for editing |
|
182 | + $post_id = reset($id); |
|
183 | + } |
|
184 | + // include the CSS that includes this style |
|
185 | 185 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
186 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
187 | - } |
|
186 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
187 | + } |
|
188 | 188 | |
189 | - return self::edit($post_id, $message); |
|
190 | - } |
|
189 | + return self::edit($post_id, $message); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | public static function load_styler( $style, $message = '' ) { |
193 | - global $frm_settings; |
|
193 | + global $frm_settings; |
|
194 | 194 | |
195 | - $frm_style = new FrmStyle(); |
|
196 | - $styles = $frm_style->get_all(); |
|
195 | + $frm_style = new FrmStyle(); |
|
196 | + $styles = $frm_style->get_all(); |
|
197 | 197 | |
198 | - if ( is_numeric($style) ) { |
|
199 | - $style = $styles[ $style ]; |
|
200 | - } else if ( 'default' == $style ) { |
|
201 | - $style = $frm_style->get_default_style($styles); |
|
202 | - } |
|
198 | + if ( is_numeric($style) ) { |
|
199 | + $style = $styles[ $style ]; |
|
200 | + } else if ( 'default' == $style ) { |
|
201 | + $style = $frm_style->get_default_style($styles); |
|
202 | + } |
|
203 | 203 | |
204 | - self::add_meta_boxes(); |
|
204 | + self::add_meta_boxes(); |
|
205 | 205 | |
206 | 206 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * @param string $message |
211 | 211 | * @param array|object $forms |
212 | 212 | */ |
213 | 213 | private static function manage( $message = '', $forms = array() ) { |
214 | - $frm_style = new FrmStyle(); |
|
215 | - $styles = $frm_style->get_all(); |
|
216 | - $default_style = $frm_style->get_default_style($styles); |
|
214 | + $frm_style = new FrmStyle(); |
|
215 | + $styles = $frm_style->get_all(); |
|
216 | + $default_style = $frm_style->get_default_style($styles); |
|
217 | 217 | |
218 | - if ( empty($forms) ) { |
|
219 | - $forms = FrmForm::get_published_forms(); |
|
220 | - } |
|
218 | + if ( empty($forms) ) { |
|
219 | + $forms = FrmForm::get_published_forms(); |
|
220 | + } |
|
221 | 221 | |
222 | 222 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
223 | - } |
|
223 | + } |
|
224 | 224 | |
225 | - private static function manage_styles() { |
|
225 | + private static function manage_styles() { |
|
226 | 226 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
227 | 227 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
228 | - return self::manage(); |
|
229 | - } |
|
228 | + return self::manage(); |
|
229 | + } |
|
230 | 230 | |
231 | - global $wpdb; |
|
231 | + global $wpdb; |
|
232 | 232 | |
233 | 233 | $forms = FrmForm::get_published_forms(); |
234 | - foreach ( $forms as $form ) { |
|
235 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
236 | - continue; |
|
237 | - } |
|
234 | + foreach ( $forms as $form ) { |
|
235 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
236 | + continue; |
|
237 | + } |
|
238 | 238 | |
239 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
239 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
240 | 240 | |
241 | 241 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
242 | - unset($form); |
|
243 | - } |
|
242 | + unset($form); |
|
243 | + } |
|
244 | 244 | |
245 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
246 | - return self::manage($message, $forms); |
|
247 | - } |
|
245 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
246 | + return self::manage($message, $forms); |
|
247 | + } |
|
248 | 248 | |
249 | - public static function custom_css( $message = '', $style = null ) { |
|
250 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
251 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
252 | - wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
249 | + public static function custom_css( $message = '', $style = null ) { |
|
250 | + wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
251 | + wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
252 | + wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
253 | 253 | |
254 | - if ( ! isset($style) ) { |
|
255 | - $frm_style = new FrmStyle(); |
|
256 | - $style = $frm_style->get_default_style(); |
|
257 | - } |
|
254 | + if ( ! isset($style) ) { |
|
255 | + $frm_style = new FrmStyle(); |
|
256 | + $style = $frm_style->get_default_style(); |
|
257 | + } |
|
258 | 258 | |
259 | 259 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' ); |
260 | - } |
|
260 | + } |
|
261 | 261 | |
262 | - public static function save_css() { |
|
263 | - $frm_style = new FrmStyle(); |
|
262 | + public static function save_css() { |
|
263 | + $frm_style = new FrmStyle(); |
|
264 | 264 | |
265 | - $message = ''; |
|
265 | + $message = ''; |
|
266 | 266 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
267 | 267 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
268 | 268 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
269 | - $frm_style->update($post_id); |
|
270 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
271 | - } |
|
269 | + $frm_style->update($post_id); |
|
270 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
271 | + } |
|
272 | 272 | |
273 | - return self::custom_css($message); |
|
274 | - } |
|
273 | + return self::custom_css($message); |
|
274 | + } |
|
275 | 275 | |
276 | - public static function route() { |
|
276 | + public static function route() { |
|
277 | 277 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
278 | 278 | |
279 | - switch ( $action ) { |
|
280 | - case 'edit': |
|
281 | - case 'save': |
|
282 | - case 'manage': |
|
283 | - case 'manage_styles': |
|
284 | - case 'custom_css': |
|
285 | - case 'save_css': |
|
279 | + switch ( $action ) { |
|
280 | + case 'edit': |
|
281 | + case 'save': |
|
282 | + case 'manage': |
|
283 | + case 'manage_styles': |
|
284 | + case 'custom_css': |
|
285 | + case 'save_css': |
|
286 | 286 | return self::$action(); |
287 | - default: |
|
288 | - do_action( 'frm_style_action_route', $action ); |
|
289 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
290 | - return; |
|
291 | - } |
|
287 | + default: |
|
288 | + do_action( 'frm_style_action_route', $action ); |
|
289 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
290 | + return; |
|
291 | + } |
|
292 | 292 | |
293 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
294 | - return self::$action(); |
|
295 | - } |
|
293 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
294 | + return self::$action(); |
|
295 | + } |
|
296 | 296 | |
297 | - return self::edit(); |
|
298 | - } |
|
299 | - } |
|
297 | + return self::edit(); |
|
298 | + } |
|
299 | + } |
|
300 | 300 | |
301 | - public static function reset_styling() { |
|
301 | + public static function reset_styling() { |
|
302 | 302 | FrmAppHelper::permission_check('frm_change_settings'); |
303 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
303 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
304 | 304 | |
305 | - $frm_style = new FrmStyle(); |
|
306 | - $defaults = $frm_style->get_defaults(); |
|
305 | + $frm_style = new FrmStyle(); |
|
306 | + $defaults = $frm_style->get_defaults(); |
|
307 | 307 | |
308 | - echo json_encode( $defaults ); |
|
309 | - wp_die(); |
|
310 | - } |
|
308 | + echo json_encode( $defaults ); |
|
309 | + wp_die(); |
|
310 | + } |
|
311 | 311 | |
312 | - public static function change_styling() { |
|
313 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
312 | + public static function change_styling() { |
|
313 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
314 | 314 | |
315 | - $frm_style = new FrmStyle(); |
|
316 | - $defaults = $frm_style->get_defaults(); |
|
315 | + $frm_style = new FrmStyle(); |
|
316 | + $defaults = $frm_style->get_defaults(); |
|
317 | 317 | |
318 | - // remove the # from the colors |
|
319 | - foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
320 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
321 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
322 | - } |
|
323 | - } |
|
318 | + // remove the # from the colors |
|
319 | + foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
320 | + if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
321 | + $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
322 | + } |
|
323 | + } |
|
324 | 324 | |
325 | - echo '<style type="text/css">'; |
|
325 | + echo '<style type="text/css">'; |
|
326 | 326 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
327 | - echo '</style>'; |
|
328 | - wp_die(); |
|
329 | - } |
|
330 | - |
|
331 | - private static function add_meta_boxes() { |
|
332 | - |
|
333 | - // setup meta boxes |
|
334 | - $meta_boxes = array( |
|
335 | - 'general' => __( 'General', 'formidable' ), |
|
336 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
337 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
338 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
339 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
340 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
341 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
342 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
343 | - 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
344 | - 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
345 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
346 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
347 | - ); |
|
348 | - |
|
349 | - foreach ( $meta_boxes as $nicename => $name ) { |
|
327 | + echo '</style>'; |
|
328 | + wp_die(); |
|
329 | + } |
|
330 | + |
|
331 | + private static function add_meta_boxes() { |
|
332 | + |
|
333 | + // setup meta boxes |
|
334 | + $meta_boxes = array( |
|
335 | + 'general' => __( 'General', 'formidable' ), |
|
336 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
337 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
338 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
339 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
340 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
341 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
342 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
343 | + 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
344 | + 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
345 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
346 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
347 | + ); |
|
348 | + |
|
349 | + foreach ( $meta_boxes as $nicename => $name ) { |
|
350 | 350 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
351 | - unset($nicename, $name); |
|
352 | - } |
|
353 | - } |
|
351 | + unset($nicename, $name); |
|
352 | + } |
|
353 | + } |
|
354 | 354 | |
355 | 355 | public static function include_style_section( $atts, $sec ) { |
356 | - extract($atts); |
|
356 | + extract($atts); |
|
357 | 357 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
358 | 358 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
359 | - } |
|
359 | + } |
|
360 | 360 | |
361 | - public static function load_css() { |
|
362 | - header('Content-type: text/css'); |
|
361 | + public static function load_css() { |
|
362 | + header('Content-type: text/css'); |
|
363 | 363 | |
364 | - $frm_style = new FrmStyle(); |
|
365 | - $defaults = $frm_style->get_defaults(); |
|
364 | + $frm_style = new FrmStyle(); |
|
365 | + $defaults = $frm_style->get_defaults(); |
|
366 | 366 | |
367 | 367 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
368 | - wp_die(); |
|
369 | - } |
|
368 | + wp_die(); |
|
369 | + } |
|
370 | 370 | |
371 | 371 | public static function load_saved_css() { |
372 | 372 | $css = get_transient( 'frmpro_css' ); |
@@ -375,142 +375,142 @@ discard block |
||
375 | 375 | wp_die(); |
376 | 376 | } |
377 | 377 | |
378 | - /** |
|
379 | - * Check if the Formidable styling should be loaded, |
|
380 | - * then enqueue it for the footer |
|
381 | - * @since 2.0 |
|
382 | - */ |
|
383 | - public static function enqueue_style() { |
|
384 | - global $frm_vars; |
|
385 | - |
|
386 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
387 | - // the CSS has already been loaded |
|
388 | - return; |
|
389 | - } |
|
390 | - |
|
391 | - $frm_settings = FrmAppHelper::get_settings(); |
|
392 | - if ( $frm_settings->load_style != 'none' ) { |
|
393 | - wp_enqueue_style( 'formidable' ); |
|
394 | - $frm_vars['css_loaded'] = true; |
|
395 | - } |
|
396 | - } |
|
397 | - |
|
398 | - // Get the stylesheets for the form settings page |
|
399 | - public static function get_style_opts() { |
|
400 | - $frm_style = new FrmStyle(); |
|
401 | - $styles = $frm_style->get_all(); |
|
402 | - |
|
403 | - return $styles; |
|
404 | - } |
|
405 | - |
|
406 | - public static function get_form_style( $form = 'default' ) { |
|
407 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
408 | - |
|
409 | - if ( empty( $style ) || 1 == $style ) { |
|
410 | - $style = 'default'; |
|
411 | - } |
|
412 | - |
|
413 | - $frm_style = new FrmStyle( $style ); |
|
414 | - return $frm_style->get_one(); |
|
415 | - } |
|
416 | - |
|
417 | - /** |
|
418 | - * @param string $class |
|
419 | - * @param string $style |
|
420 | - */ |
|
378 | + /** |
|
379 | + * Check if the Formidable styling should be loaded, |
|
380 | + * then enqueue it for the footer |
|
381 | + * @since 2.0 |
|
382 | + */ |
|
383 | + public static function enqueue_style() { |
|
384 | + global $frm_vars; |
|
385 | + |
|
386 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
387 | + // the CSS has already been loaded |
|
388 | + return; |
|
389 | + } |
|
390 | + |
|
391 | + $frm_settings = FrmAppHelper::get_settings(); |
|
392 | + if ( $frm_settings->load_style != 'none' ) { |
|
393 | + wp_enqueue_style( 'formidable' ); |
|
394 | + $frm_vars['css_loaded'] = true; |
|
395 | + } |
|
396 | + } |
|
397 | + |
|
398 | + // Get the stylesheets for the form settings page |
|
399 | + public static function get_style_opts() { |
|
400 | + $frm_style = new FrmStyle(); |
|
401 | + $styles = $frm_style->get_all(); |
|
402 | + |
|
403 | + return $styles; |
|
404 | + } |
|
405 | + |
|
406 | + public static function get_form_style( $form = 'default' ) { |
|
407 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
408 | + |
|
409 | + if ( empty( $style ) || 1 == $style ) { |
|
410 | + $style = 'default'; |
|
411 | + } |
|
412 | + |
|
413 | + $frm_style = new FrmStyle( $style ); |
|
414 | + return $frm_style->get_one(); |
|
415 | + } |
|
416 | + |
|
417 | + /** |
|
418 | + * @param string $class |
|
419 | + * @param string $style |
|
420 | + */ |
|
421 | 421 | public static function get_form_style_class( $class, $style ) { |
422 | - if ( 1 == $style ) { |
|
423 | - $style = 'default'; |
|
424 | - } |
|
422 | + if ( 1 == $style ) { |
|
423 | + $style = 'default'; |
|
424 | + } |
|
425 | 425 | |
426 | - $frm_style = new FrmStyle($style); |
|
427 | - $style = $frm_style->get_one(); |
|
426 | + $frm_style = new FrmStyle($style); |
|
427 | + $style = $frm_style->get_one(); |
|
428 | 428 | |
429 | - if ( $style ) { |
|
429 | + if ( $style ) { |
|
430 | 430 | $class .= ' frm_style_' . $style->post_name; |
431 | - } |
|
431 | + } |
|
432 | 432 | |
433 | - return $class; |
|
434 | - } |
|
433 | + return $class; |
|
434 | + } |
|
435 | 435 | |
436 | - /** |
|
437 | - * @param string $val |
|
438 | - */ |
|
436 | + /** |
|
437 | + * @param string $val |
|
438 | + */ |
|
439 | 439 | public static function get_style_val( $val, $form = 'default' ) { |
440 | - $style = self::get_form_style($form); |
|
441 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
442 | - return $style->post_content[ $val ]; |
|
443 | - } |
|
444 | - } |
|
440 | + $style = self::get_form_style($form); |
|
441 | + if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
442 | + return $style->post_content[ $val ]; |
|
443 | + } |
|
444 | + } |
|
445 | 445 | |
446 | 446 | public static function show_entry_styles( $default_styles ) { |
447 | - $frm_style = new FrmStyle('default'); |
|
448 | - $style = $frm_style->get_one(); |
|
449 | - |
|
450 | - if ( ! $style ) { |
|
451 | - return $default_styles; |
|
452 | - } |
|
453 | - |
|
454 | - foreach ( $default_styles as $name => $val ) { |
|
455 | - $setting = $name; |
|
456 | - if ( 'border_width' == $name ) { |
|
457 | - $setting = 'field_border_width'; |
|
458 | - } else if ( 'alt_bg_color' == $name ) { |
|
459 | - $setting = 'bg_color_active'; |
|
460 | - } |
|
461 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
462 | - unset($name, $val); |
|
463 | - } |
|
464 | - |
|
465 | - return $default_styles; |
|
466 | - } |
|
447 | + $frm_style = new FrmStyle('default'); |
|
448 | + $style = $frm_style->get_one(); |
|
449 | + |
|
450 | + if ( ! $style ) { |
|
451 | + return $default_styles; |
|
452 | + } |
|
453 | + |
|
454 | + foreach ( $default_styles as $name => $val ) { |
|
455 | + $setting = $name; |
|
456 | + if ( 'border_width' == $name ) { |
|
457 | + $setting = 'field_border_width'; |
|
458 | + } else if ( 'alt_bg_color' == $name ) { |
|
459 | + $setting = 'bg_color_active'; |
|
460 | + } |
|
461 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
462 | + unset($name, $val); |
|
463 | + } |
|
464 | + |
|
465 | + return $default_styles; |
|
466 | + } |
|
467 | 467 | |
468 | 468 | public static function &important_style( $important, $field ) { |
469 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
470 | - return $important; |
|
471 | - } |
|
469 | + $important = self::get_style_val('important_style', $field['form_id']); |
|
470 | + return $important; |
|
471 | + } |
|
472 | 472 | |
473 | - /** |
|
474 | - * Fallback for WP < 3.6 |
|
475 | - */ |
|
476 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
477 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
478 | - return do_accordion_sections( $screen, $context, $object ); |
|
479 | - } |
|
473 | + /** |
|
474 | + * Fallback for WP < 3.6 |
|
475 | + */ |
|
476 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
477 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
478 | + return do_accordion_sections( $screen, $context, $object ); |
|
479 | + } |
|
480 | 480 | |
481 | - global $wp_meta_boxes; |
|
481 | + global $wp_meta_boxes; |
|
482 | 482 | |
483 | - $screen = 'formidable_page_formidable-styles'; |
|
484 | - $screen = convert_to_screen( $screen ); |
|
483 | + $screen = 'formidable_page_formidable-styles'; |
|
484 | + $screen = convert_to_screen( $screen ); |
|
485 | 485 | |
486 | - $page = $screen->id; |
|
486 | + $page = $screen->id; |
|
487 | 487 | |
488 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
489 | - ?> |
|
488 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
489 | + ?> |
|
490 | 490 | <div id="side-sortables" class="accordion-container"> |
491 | 491 | <?php |
492 | - $i = 0; |
|
493 | - $first_open = false; |
|
494 | - do { |
|
492 | + $i = 0; |
|
493 | + $first_open = false; |
|
494 | + do { |
|
495 | 495 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
496 | 496 | break; |
497 | 497 | } |
498 | 498 | |
499 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
500 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
501 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
502 | - if ( false == $box || ! $box['title'] ) { |
|
503 | - continue; |
|
499 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
500 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
501 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
502 | + if ( false == $box || ! $box['title'] ) { |
|
503 | + continue; |
|
504 | 504 | } |
505 | 505 | |
506 | - $i++; |
|
507 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
506 | + $i++; |
|
507 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
508 | 508 | |
509 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
510 | - $first_open = true; |
|
511 | - } |
|
509 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
510 | + $first_open = true; |
|
511 | + } |
|
512 | 512 | |
513 | - ?> |
|
513 | + ?> |
|
514 | 514 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
515 | 515 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div> |
516 | 516 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -521,13 +521,13 @@ discard block |
||
521 | 521 | </div><!-- .accordion-section-content --> |
522 | 522 | </div><!-- .postbox --> |
523 | 523 | <?php |
524 | - } |
|
525 | - } |
|
526 | - } |
|
527 | - } while ( 0 ); |
|
528 | - ?> |
|
524 | + } |
|
525 | + } |
|
526 | + } |
|
527 | + } while ( 0 ); |
|
528 | + ?> |
|
529 | 529 | </div><!-- .accordion-container --> |
530 | 530 | <?php |
531 | - return $i; |
|
532 | - } |
|
531 | + return $i; |
|
532 | + } |
|
533 | 533 | } |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public static function menu() { |
44 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
44 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public static function admin_init() { |
48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
48 | + if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | self::load_pro_hooks(); |
53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
53 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
54 | 54 | |
55 | 55 | $version = FrmAppHelper::plugin_version(); |
56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
57 | 57 | |
58 | - wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
|
58 | + wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
|
59 | 59 | |
60 | - $style = apply_filters('frm_style_head', false); |
|
60 | + $style = apply_filters( 'frm_style_head', false ); |
|
61 | 61 | if ( $style ) { |
62 | 62 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
63 | 63 | } |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public static function new_style( $return = '' ) { |
146 | - self::load_styler('default'); |
|
146 | + self::load_styler( 'default' ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public static function duplicate() { |
150 | - self::load_styler('default'); |
|
150 | + self::load_styler( 'default' ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public static function edit( $style_id = false, $message = '' ) { |
154 | 154 | if ( ! $style_id ) { |
155 | 155 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
156 | - if ( empty($style_id) ) { |
|
156 | + if ( empty( $style_id ) ) { |
|
157 | 157 | $style_id = 'default'; |
158 | 158 | } |
159 | 159 | } |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | if ( 'default' == $style_id ) { |
162 | 162 | $style = 'default'; |
163 | 163 | } else { |
164 | - $frm_style = new FrmStyle($style_id); |
|
164 | + $frm_style = new FrmStyle( $style_id ); |
|
165 | 165 | $style = $frm_style->get_one(); |
166 | 166 | $style = $style->ID; |
167 | 167 | } |
168 | 168 | |
169 | - self::load_styler($style, $message); |
|
169 | + self::load_styler( $style, $message ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | public static function save() { |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
177 | 177 | |
178 | 178 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
179 | - $id = $frm_style->update($post_id); |
|
180 | - if ( empty($post_id) && ! empty($id) ) { |
|
179 | + $id = $frm_style->update( $post_id ); |
|
180 | + if ( empty( $post_id ) && ! empty( $id ) ) { |
|
181 | 181 | // set the post id to the new style so it will be loaded for editing |
182 | - $post_id = reset($id); |
|
182 | + $post_id = reset( $id ); |
|
183 | 183 | } |
184 | 184 | // include the CSS that includes this style |
185 | 185 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
186 | 186 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
187 | 187 | } |
188 | 188 | |
189 | - return self::edit($post_id, $message); |
|
189 | + return self::edit( $post_id, $message ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | public static function load_styler( $style, $message = '' ) { |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | $frm_style = new FrmStyle(); |
196 | 196 | $styles = $frm_style->get_all(); |
197 | 197 | |
198 | - if ( is_numeric($style) ) { |
|
199 | - $style = $styles[ $style ]; |
|
198 | + if ( is_numeric( $style ) ) { |
|
199 | + $style = $styles[$style]; |
|
200 | 200 | } else if ( 'default' == $style ) { |
201 | - $style = $frm_style->get_default_style($styles); |
|
201 | + $style = $frm_style->get_default_style( $styles ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | self::add_meta_boxes(); |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | private static function manage( $message = '', $forms = array() ) { |
214 | 214 | $frm_style = new FrmStyle(); |
215 | 215 | $styles = $frm_style->get_all(); |
216 | - $default_style = $frm_style->get_default_style($styles); |
|
216 | + $default_style = $frm_style->get_default_style( $styles ); |
|
217 | 217 | |
218 | - if ( empty($forms) ) { |
|
218 | + if ( empty( $forms ) ) { |
|
219 | 219 | $forms = FrmForm::get_published_forms(); |
220 | 220 | } |
221 | 221 | |
@@ -232,26 +232,26 @@ discard block |
||
232 | 232 | |
233 | 233 | $forms = FrmForm::get_published_forms(); |
234 | 234 | foreach ( $forms as $form ) { |
235 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
235 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
236 | 236 | continue; |
237 | 237 | } |
238 | 238 | |
239 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
239 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
240 | 240 | |
241 | 241 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
242 | - unset($form); |
|
242 | + unset( $form ); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $message = __( 'Your form styles have been saved.', 'formidable' ); |
246 | - return self::manage($message, $forms); |
|
246 | + return self::manage( $message, $forms ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | public static function custom_css( $message = '', $style = null ) { |
250 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
251 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
250 | + wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' ); |
|
251 | + wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' ); |
|
252 | 252 | wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
253 | 253 | |
254 | - if ( ! isset($style) ) { |
|
254 | + if ( ! isset( $style ) ) { |
|
255 | 255 | $frm_style = new FrmStyle(); |
256 | 256 | $style = $frm_style->get_default_style(); |
257 | 257 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
267 | 267 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
268 | 268 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
269 | - $frm_style->update($post_id); |
|
269 | + $frm_style->update( $post_id ); |
|
270 | 270 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
271 | 271 | } |
272 | 272 | |
273 | - return self::custom_css($message); |
|
273 | + return self::custom_css( $message ); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | public static function route() { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | public static function reset_styling() { |
302 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
302 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
303 | 303 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
304 | 304 | |
305 | 305 | $frm_style = new FrmStyle(); |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | |
318 | 318 | // remove the # from the colors |
319 | 319 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
320 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
321 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
320 | + if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
|
321 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -348,18 +348,18 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $meta_boxes as $nicename => $name ) { |
350 | 350 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
351 | - unset($nicename, $name); |
|
351 | + unset( $nicename, $name ); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | public static function include_style_section( $atts, $sec ) { |
356 | - extract($atts); |
|
356 | + extract( $atts ); |
|
357 | 357 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
358 | 358 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
359 | 359 | } |
360 | 360 | |
361 | 361 | public static function load_css() { |
362 | - header('Content-type: text/css'); |
|
362 | + header( 'Content-type: text/css' ); |
|
363 | 363 | |
364 | 364 | $frm_style = new FrmStyle(); |
365 | 365 | $defaults = $frm_style->get_defaults(); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $style = 'default'; |
424 | 424 | } |
425 | 425 | |
426 | - $frm_style = new FrmStyle($style); |
|
426 | + $frm_style = new FrmStyle( $style ); |
|
427 | 427 | $style = $frm_style->get_one(); |
428 | 428 | |
429 | 429 | if ( $style ) { |
@@ -437,14 +437,14 @@ discard block |
||
437 | 437 | * @param string $val |
438 | 438 | */ |
439 | 439 | public static function get_style_val( $val, $form = 'default' ) { |
440 | - $style = self::get_form_style($form); |
|
441 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
442 | - return $style->post_content[ $val ]; |
|
440 | + $style = self::get_form_style( $form ); |
|
441 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
442 | + return $style->post_content[$val]; |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | 446 | public static function show_entry_styles( $default_styles ) { |
447 | - $frm_style = new FrmStyle('default'); |
|
447 | + $frm_style = new FrmStyle( 'default' ); |
|
448 | 448 | $style = $frm_style->get_one(); |
449 | 449 | |
450 | 450 | if ( ! $style ) { |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | } else if ( 'alt_bg_color' == $name ) { |
459 | 459 | $setting = 'bg_color_active'; |
460 | 460 | } |
461 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
462 | - unset($name, $val); |
|
461 | + $default_styles[$name] = $style->post_content[$setting]; |
|
462 | + unset( $name, $val ); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | return $default_styles; |
466 | 466 | } |
467 | 467 | |
468 | 468 | public static function &important_style( $important, $field ) { |
469 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
469 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); |
|
470 | 470 | return $important; |
471 | 471 | } |
472 | 472 | |
@@ -492,18 +492,18 @@ discard block |
||
492 | 492 | $i = 0; |
493 | 493 | $first_open = false; |
494 | 494 | do { |
495 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
495 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
496 | 496 | break; |
497 | 497 | } |
498 | 498 | |
499 | 499 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
500 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
501 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
500 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
501 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
502 | 502 | if ( false == $box || ! $box['title'] ) { |
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | |
506 | - $i++; |
|
506 | + $i ++; |
|
507 | 507 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
508 | 508 | |
509 | 509 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -7,10 +7,10 @@ |
||
7 | 7 | continue; |
8 | 8 | } |
9 | 9 | |
10 | - if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) { |
|
11 | - $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] ); |
|
10 | + if ( isset( $plugin_names[$addon['info']['slug']] ) ) { |
|
11 | + $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] ); |
|
12 | 12 | } else { |
13 | - $installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
13 | + $installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
14 | 14 | } |
15 | 15 | $has_thumbnail = ! empty( $addon['info']['thumbnail'] ); |
16 | 16 | if ( $addon['info']['slug'] == 'formidable-pro' ) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | <tr> |
7 | 7 | <th></th> |
8 | 8 | <?php foreach ( $pro['pricing'] as $name => $price ) { |
9 | - $price_id++; |
|
9 | + $price_id ++; |
|
10 | 10 | if ( $name == 'smallbusiness' ) { |
11 | 11 | $name = 'Small Business'; |
12 | 12 | } ?> |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | <tr> |
51 | 51 | <th>Included AddOns</th> |
52 | 52 | <td>None</td> |
53 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Basic Addons</a></td> |
|
54 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td> |
|
55 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td> |
|
53 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Basic Addons</a></td> |
|
54 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Advanced Addons</a></td> |
|
55 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Enterprise Addons</a></td> |
|
56 | 56 | </tr> |
57 | 57 | </tbody> |
58 | 58 | </table> |
@@ -275,7 +275,7 @@ |
||
275 | 275 | return $message; |
276 | 276 | } |
277 | 277 | |
278 | - public function manually_queue_update() { |
|
279 | - set_site_transient( 'update_plugins', null ); |
|
280 | - } |
|
278 | + public function manually_queue_update() { |
|
279 | + set_site_transient( 'update_plugins', null ); |
|
280 | + } |
|
281 | 281 | } |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | public function insert_installed_addon( $plugins ) { |
41 | - $plugins[ $this->plugin_slug ] = $this; |
|
41 | + $plugins[$this->plugin_slug] = $this; |
|
42 | 42 | return $plugins; |
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function get_addon( $plugin_slug ) { |
46 | 46 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
47 | 47 | $plugin = false; |
48 | - if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
49 | - $plugin = $plugins[ $plugin_slug ]; |
|
48 | + if ( isset( $plugins[$plugin_slug] ) ) { |
|
49 | + $plugin = $plugins[$plugin_slug]; |
|
50 | 50 | } |
51 | 51 | return $plugin; |
52 | 52 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function show_license_message( $file, $plugin ) { |
99 | 99 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
100 | 100 | echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">'; |
101 | - echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
101 | + echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
102 | 102 | $id = sanitize_title( $plugin['Name'] ); |
103 | 103 | echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>'; |
104 | 104 | echo '</div></td></tr>'; |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | if ( $this->is_current_version( $transient ) ) { |
113 | 113 | //make sure it doesn't show there is an update if plugin is up-to-date |
114 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
115 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
114 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
115 | + unset( $transient->response[$this->plugin_folder] ); |
|
116 | 116 | } |
117 | - } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
117 | + } else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
118 | 118 | $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' ); |
119 | 119 | $version_info = get_transient( $cache_key ); |
120 | 120 | if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) { |
121 | - $transient->response[ $this->plugin_folder ] = $version_info; |
|
121 | + $transient->response[$this->plugin_folder] = $version_info; |
|
122 | 122 | } else { |
123 | 123 | delete_transient( $cache_key ); |
124 | 124 | if ( ! $this->has_been_cleared() ) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->manually_queue_update(); |
128 | 128 | } |
129 | 129 | |
130 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
130 | + unset( $transient->response[$this->plugin_folder] ); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | private function is_current_version( $transient ) { |
138 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
138 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | return true; |
145 | 145 | } |
146 | 146 | |
147 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version; |
|
147 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | private function has_been_cleared() { |
151 | 151 | $last_cleared = get_option( 'frm_last_cleared' ); |
152 | - return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) ); |
|
152 | + return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | private function cleared_plugins() { |
156 | - update_option( 'frm_last_cleared', date('Y-m-d H:i:s') ); |
|
156 | + update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) ); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public static function activate() { |
160 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
160 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
161 | 161 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
162 | 162 | |
163 | 163 | if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | public static function deactivate() { |
208 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
208 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
209 | 209 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
210 | 210 | |
211 | 211 | $plugin_slug = sanitize_text_field( $_POST['plugin'] ); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | |
256 | 256 | $message = __( 'Your License Key was invalid', 'formidable' ); |
257 | 257 | if ( is_wp_error( $resp ) ) { |
258 | - $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>'); |
|
258 | + $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' ); |
|
259 | 259 | if ( is_wp_error( $resp ) ) { |
260 | - $message .= ' '. $resp->get_error_message(); |
|
260 | + $message .= ' ' . $resp->get_error_message(); |
|
261 | 261 | } |
262 | 262 | } else if ( $body == 'error' || is_wp_error( $body ) ) { |
263 | 263 | $message = __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' ); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $message = $json_res; |
271 | 271 | } |
272 | 272 | } else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) { |
273 | - $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] ); |
|
273 | + $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] . ' ' . $resp['body'] ); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
9 | 9 | </div> |
10 | 10 | <div class="field-group clearfix frm-half"> |
11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
13 | 13 | </div> |
14 | 14 | <div class="field-group clearfix frm-half"> |
15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
17 | 17 | </div> |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
9 | 9 | </div> |
10 | 10 | <div class="field-group clearfix frm-half"> |
11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
13 | 13 | </div> |
14 | 14 | <div class="field-group clearfix frm-half"> |
15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
17 | 17 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | class FrmFormsListHelper extends FrmListHelper { |
7 | - var $status = ''; |
|
7 | + var $status = ''; |
|
8 | 8 | |
9 | 9 | public function __construct( $args ) { |
10 | 10 | $this->status = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function prepare_items() { |
16 | - global $wpdb, $per_page, $mode; |
|
16 | + global $wpdb, $per_page, $mode; |
|
17 | 17 | |
18 | - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
18 | + $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
19 | 19 | |
20 | 20 | $default_orderby = 'name'; |
21 | 21 | $default_order = 'ASC'; |
22 | 22 | |
23 | - $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby; |
|
23 | + $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby; |
|
24 | 24 | $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : $default_order; |
25 | 25 | |
26 | 26 | $page = $this->get_pagenum(); |
@@ -28,40 +28,40 @@ discard block |
||
28 | 28 | |
29 | 29 | $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page); |
30 | 30 | |
31 | - $s_query = array(); |
|
32 | - $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
|
31 | + $s_query = array(); |
|
32 | + $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
|
33 | 33 | switch ( $this->status ) { |
34 | - case 'template': |
|
35 | - $s_query['is_template'] = 1; |
|
36 | - $s_query['status !'] = 'trash'; |
|
37 | - break; |
|
38 | - case 'draft': |
|
39 | - $s_query['is_template'] = 0; |
|
40 | - $s_query['status'] = 'draft'; |
|
41 | - break; |
|
42 | - case 'trash': |
|
43 | - $s_query['status'] = 'trash'; |
|
44 | - break; |
|
45 | - default: |
|
46 | - $s_query['is_template'] = 0; |
|
47 | - $s_query['status !'] = 'trash'; |
|
48 | - break; |
|
34 | + case 'template': |
|
35 | + $s_query['is_template'] = 1; |
|
36 | + $s_query['status !'] = 'trash'; |
|
37 | + break; |
|
38 | + case 'draft': |
|
39 | + $s_query['is_template'] = 0; |
|
40 | + $s_query['status'] = 'draft'; |
|
41 | + break; |
|
42 | + case 'trash': |
|
43 | + $s_query['status'] = 'trash'; |
|
44 | + break; |
|
45 | + default: |
|
46 | + $s_query['is_template'] = 0; |
|
47 | + $s_query['status !'] = 'trash'; |
|
48 | + break; |
|
49 | 49 | } |
50 | 50 | |
51 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
52 | - if ( $s != '' ) { |
|
53 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | - $search_terms = array_map('trim', $matches[0]); |
|
55 | - foreach ( (array) $search_terms as $term ) { |
|
56 | - $s_query[] = array( |
|
57 | - 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
|
58 | - ); |
|
59 | - unset($term); |
|
60 | - } |
|
61 | - } |
|
62 | - |
|
63 | - $this->items = FrmForm::getAll($s_query, $orderby .' '. $order, $start .','. $per_page); |
|
64 | - $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
51 | + $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
52 | + if ( $s != '' ) { |
|
53 | + preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | + $search_terms = array_map('trim', $matches[0]); |
|
55 | + foreach ( (array) $search_terms as $term ) { |
|
56 | + $s_query[] = array( |
|
57 | + 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
|
58 | + ); |
|
59 | + unset($term); |
|
60 | + } |
|
61 | + } |
|
62 | + |
|
63 | + $this->items = FrmForm::getAll($s_query, $orderby .' '. $order, $start .','. $per_page); |
|
64 | + $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
65 | 65 | |
66 | 66 | $this->set_pagination_args( array( |
67 | 67 | 'total_items' => $total_items, |
@@ -70,69 +70,69 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | public function no_items() { |
73 | - if ( 'template' == $this->status ) { |
|
74 | - _e( 'No Templates Found.', 'formidable' ) ?> |
|
73 | + if ( 'template' == $this->status ) { |
|
74 | + _e( 'No Templates Found.', 'formidable' ) ?> |
|
75 | 75 | <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?> |
76 | 76 | <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
77 | 77 | <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li> |
78 | 78 | <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li> |
79 | 79 | </ol> |
80 | 80 | <?php } else { |
81 | - _e( 'No Forms Found.', 'formidable' ) ?> |
|
81 | + _e( 'No Forms Found.', 'formidable' ) ?> |
|
82 | 82 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable&frm_action=new' ) ) ?>"><?php _e( 'Add New', 'formidable' ); ?></a> |
83 | 83 | <?php } |
84 | 84 | } |
85 | 85 | |
86 | 86 | public function get_bulk_actions() { |
87 | - $actions = array(); |
|
87 | + $actions = array(); |
|
88 | 88 | |
89 | 89 | if ( in_array( $this->status, array( '', 'published' ) ) ) { |
90 | - $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
91 | - } |
|
92 | - |
|
93 | - if ( 'trash' == $this->status ) { |
|
94 | - if ( current_user_can('frm_edit_forms') ) { |
|
95 | - $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
96 | - } |
|
97 | - |
|
98 | - if ( current_user_can('frm_delete_forms') ) { |
|
99 | - $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
100 | - } |
|
101 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
102 | - $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
103 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | - $actions['bulk_delete'] = __( 'Delete'); |
|
105 | - } |
|
106 | - |
|
107 | - return $actions; |
|
108 | - } |
|
90 | + $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
91 | + } |
|
92 | + |
|
93 | + if ( 'trash' == $this->status ) { |
|
94 | + if ( current_user_can('frm_edit_forms') ) { |
|
95 | + $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
96 | + } |
|
97 | + |
|
98 | + if ( current_user_can('frm_delete_forms') ) { |
|
99 | + $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
100 | + } |
|
101 | + } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
102 | + $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
103 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | + $actions['bulk_delete'] = __( 'Delete'); |
|
105 | + } |
|
106 | + |
|
107 | + return $actions; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | public function extra_tablenav( $which ) { |
111 | - if ( 'top' != $which ) { |
|
112 | - return; |
|
113 | - } |
|
111 | + if ( 'top' != $which ) { |
|
112 | + return; |
|
113 | + } |
|
114 | 114 | |
115 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
115 | + if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
116 | 116 | ?> |
117 | 117 | <div class="alignleft actions frm_visible_overflow"> |
118 | 118 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
119 | 119 | </div> |
120 | 120 | <?php |
121 | - return; |
|
122 | - } |
|
121 | + return; |
|
122 | + } |
|
123 | 123 | |
124 | - if ( 'template' != $this->status ) { |
|
125 | - return; |
|
126 | - } |
|
124 | + if ( 'template' != $this->status ) { |
|
125 | + return; |
|
126 | + } |
|
127 | 127 | |
128 | 128 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
129 | 129 | $forms = FrmForm::get_published_forms( $where ); |
130 | 130 | |
131 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
132 | - $args = array( |
|
133 | - 'frm_action' => 'duplicate', |
|
134 | - 'template' => true, |
|
135 | - ); |
|
131 | + $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
132 | + $args = array( |
|
133 | + 'frm_action' => 'duplicate', |
|
134 | + 'template' => true, |
|
135 | + ); |
|
136 | 136 | |
137 | 137 | ?> |
138 | 138 | <div class="alignleft actions frm_visible_overflow"> |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | <a href="#" id="frm-templateDrop" class="frm-dropdown-toggle button" data-toggle="dropdown"><?php _e( 'Create New Template', 'formidable' ) ?> <b class="caret"></b></a> |
141 | 141 | <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-templateDrop"> |
142 | 142 | <?php |
143 | - if ( empty( $forms ) ) { ?> |
|
143 | + if ( empty( $forms ) ) { ?> |
|
144 | 144 | <li class="frm_dropdown_li"><?php _e( 'You have not created any forms yet. <br/>You must create a form before you can make a template.', 'formidable' ) ?></li> |
145 | 145 | <?php |
146 | - } else { |
|
147 | - foreach ( $forms as $form ) { |
|
148 | - $args['id'] = $form->id; ?> |
|
146 | + } else { |
|
147 | + foreach ( $forms as $form ) { |
|
148 | + $args['id'] = $form->id; ?> |
|
149 | 149 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
150 | 150 | <?php |
151 | - unset($form); |
|
151 | + unset($form); |
|
152 | 152 | } |
153 | - } |
|
154 | - ?> |
|
153 | + } |
|
154 | + ?> |
|
155 | 155 | </ul> |
156 | 156 | </div> |
157 | 157 | </div> |
@@ -161,30 +161,30 @@ discard block |
||
161 | 161 | public function get_views() { |
162 | 162 | |
163 | 163 | $statuses = array( |
164 | - 'published' => __( 'My Forms', 'formidable' ), |
|
165 | - 'template' => __( 'Templates', 'formidable' ), |
|
166 | - 'draft' => __( 'Drafts', 'formidable' ), |
|
167 | - 'trash' => __( 'Trash', 'formidable' ), |
|
164 | + 'published' => __( 'My Forms', 'formidable' ), |
|
165 | + 'template' => __( 'Templates', 'formidable' ), |
|
166 | + 'draft' => __( 'Drafts', 'formidable' ), |
|
167 | + 'trash' => __( 'Trash', 'formidable' ), |
|
168 | 168 | ); |
169 | 169 | |
170 | - $links = array(); |
|
171 | - $counts = FrmForm::get_count(); |
|
172 | - $form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published'; |
|
170 | + $links = array(); |
|
171 | + $counts = FrmForm::get_count(); |
|
172 | + $form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published'; |
|
173 | 173 | |
174 | - foreach ( $statuses as $status => $name ) { |
|
174 | + foreach ( $statuses as $status => $name ) { |
|
175 | 175 | |
176 | - if ( $status == $form_type ) { |
|
177 | - $class = ' class="current"'; |
|
178 | - } else { |
|
179 | - $class = ''; |
|
180 | - } |
|
176 | + if ( $status == $form_type ) { |
|
177 | + $class = ' class="current"'; |
|
178 | + } else { |
|
179 | + $class = ''; |
|
180 | + } |
|
181 | 181 | |
182 | - if ( $counts->{$status} || 'published' == $status ) { |
|
182 | + if ( $counts->{$status} || 'published' == $status ) { |
|
183 | 183 | $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - unset($status, $name); |
|
187 | - } |
|
186 | + unset($status, $name); |
|
187 | + } |
|
188 | 188 | |
189 | 189 | return $links; |
190 | 190 | } |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | public function single_row( $item, $style = '' ) { |
203 | - global $frm_vars, $mode; |
|
203 | + global $frm_vars, $mode; |
|
204 | 204 | |
205 | 205 | // Set up the hover actions for this user |
206 | 206 | $actions = array(); |
207 | - $edit_link = '?page=formidable&frm_action=edit&id='. $item->id; |
|
208 | - $duplicate_link = '?page=formidable&frm_action=duplicate&id='. $item->id; |
|
207 | + $edit_link = '?page=formidable&frm_action=edit&id='. $item->id; |
|
208 | + $duplicate_link = '?page=formidable&frm_action=duplicate&id='. $item->id; |
|
209 | 209 | |
210 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
210 | + $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
211 | 211 | |
212 | - $action_links = $this->row_actions( $actions ); |
|
212 | + $action_links = $this->row_actions( $actions ); |
|
213 | 213 | |
214 | 214 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
215 | 215 | $checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />'; |
@@ -218,17 +218,17 @@ discard block |
||
218 | 218 | |
219 | 219 | list( $columns, $hidden ) = $this->get_column_info(); |
220 | 220 | |
221 | - $format = 'Y/m/d'; |
|
222 | - if ( 'list' != $mode ) { |
|
223 | - $format .= ' \<\b\r \/\> g:i:s a'; |
|
221 | + $format = 'Y/m/d'; |
|
222 | + if ( 'list' != $mode ) { |
|
223 | + $format .= ' \<\b\r \/\> g:i:s a'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | foreach ( $columns as $column_name => $column_display_name ) { |
227 | - $class = $column_name .' column-'. $column_name . ( ('name' == $column_name) ? ' post-title page-title column-title' : '' ); |
|
227 | + $class = $column_name .' column-'. $column_name . ( ('name' == $column_name) ? ' post-title page-title column-title' : '' ); |
|
228 | 228 | |
229 | 229 | $style = ''; |
230 | 230 | if ( in_array( $column_name, $hidden ) ) { |
231 | - $class .= ' frm_hidden'; |
|
231 | + $class .= ' frm_hidden'; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $class = 'class="' . esc_attr( $class ) . '"'; |
@@ -241,41 +241,41 @@ discard block |
||
241 | 241 | break; |
242 | 242 | case 'id': |
243 | 243 | case 'form_key': |
244 | - $val = $item->{$column_name}; |
|
245 | - break; |
|
244 | + $val = $item->{$column_name}; |
|
245 | + break; |
|
246 | 246 | case 'name': |
247 | - $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
248 | - $val .= $action_links; |
|
247 | + $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
248 | + $val .= $action_links; |
|
249 | 249 | |
250 | - break; |
|
250 | + break; |
|
251 | 251 | case 'created_at': |
252 | - $date = date($format, strtotime($item->created_at)); |
|
252 | + $date = date($format, strtotime($item->created_at)); |
|
253 | 253 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
254 | 254 | break; |
255 | 255 | case 'shortcode': |
256 | 256 | $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id .']' ) . '" /><br/>'; |
257 | - if ( 'excerpt' == $mode ) { |
|
257 | + if ( 'excerpt' == $mode ) { |
|
258 | 258 | $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; |
259 | - } |
|
260 | - break; |
|
261 | - case 'entries': |
|
259 | + } |
|
260 | + break; |
|
261 | + case 'entries': |
|
262 | 262 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
263 | - $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="'. esc_attr('Entries are not being saved', 'formidable' ) .'"></i>'; |
|
264 | - } else { |
|
265 | - $text = FrmEntry::getRecordCount($item->id); |
|
263 | + $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="'. esc_attr('Entries are not being saved', 'formidable' ) .'"></i>'; |
|
264 | + } else { |
|
265 | + $text = FrmEntry::getRecordCount($item->id); |
|
266 | 266 | $val = current_user_can('frm_view_entries') ? '<a href="'. esc_url( admin_url( 'admin.php?page=formidable-entries&form='. $item->id ) ) . '">' . $text . '</a>' : $text; |
267 | - unset($text); |
|
268 | - } |
|
269 | - break; |
|
270 | - case 'type': |
|
271 | - $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
272 | - break; |
|
267 | + unset($text); |
|
268 | + } |
|
269 | + break; |
|
270 | + case 'type': |
|
271 | + $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
272 | + break; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | if ( isset($val) ) { |
276 | - $r .= "<td $attributes>"; |
|
277 | - $r .= $val; |
|
278 | - $r .= '</td>'; |
|
276 | + $r .= "<td $attributes>"; |
|
277 | + $r .= $val; |
|
278 | + $r .= '</td>'; |
|
279 | 279 | } |
280 | 280 | unset($val); |
281 | 281 | } |
@@ -284,37 +284,37 @@ discard block |
||
284 | 284 | return $r; |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * @param string $edit_link |
|
289 | - * @param string $duplicate_link |
|
290 | - */ |
|
291 | - private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
287 | + /** |
|
288 | + * @param string $edit_link |
|
289 | + * @param string $duplicate_link |
|
290 | + */ |
|
291 | + private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
292 | 292 | if ( 'trash' == $this->status ) { |
293 | 293 | if ( current_user_can('frm_edit_forms') ) { |
294 | 294 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
295 | 295 | } |
296 | 296 | |
297 | - if ( current_user_can('frm_delete_forms') ) { |
|
298 | - $actions['trash'] = '<a href="' . esc_url(wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id='. $item->id, 'destroy_form_'. $item->id )) .'" class="submitdelete" onclick="return confirm(\''. __( 'Are you sure you want to permanently delete that?', 'formidable' ) .'\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
299 | - } |
|
300 | - return; |
|
297 | + if ( current_user_can('frm_delete_forms') ) { |
|
298 | + $actions['trash'] = '<a href="' . esc_url(wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id='. $item->id, 'destroy_form_'. $item->id )) .'" class="submitdelete" onclick="return confirm(\''. __( 'Are you sure you want to permanently delete that?', 'formidable' ) .'\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
299 | + } |
|
300 | + return; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | if ( current_user_can('frm_edit_forms') ) { |
304 | - if ( ! $item->is_template || ! $item->default_template ) { |
|
305 | - $actions['frm_edit'] = '<a href="'. esc_url( $edit_link ) . '">'. __( 'Edit') .'</a>'; |
|
306 | - } |
|
304 | + if ( ! $item->is_template || ! $item->default_template ) { |
|
305 | + $actions['frm_edit'] = '<a href="'. esc_url( $edit_link ) . '">'. __( 'Edit') .'</a>'; |
|
306 | + } |
|
307 | 307 | |
308 | - if ( $item->is_template ) { |
|
308 | + if ( $item->is_template ) { |
|
309 | 309 | $actions['frm_duplicate'] = '<a href="'. esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
310 | - } else { |
|
311 | - $actions['frm_settings'] = '<a href="'. esc_url('?page=formidable&frm_action=settings&id='. $item->id ) . '">'. __( 'Settings', 'formidable' ) .'</a>'; |
|
310 | + } else { |
|
311 | + $actions['frm_settings'] = '<a href="'. esc_url('?page=formidable&frm_action=settings&id='. $item->id ) . '">'. __( 'Settings', 'formidable' ) .'</a>'; |
|
312 | 312 | |
313 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
313 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
314 | 314 | $actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>'; |
315 | - } |
|
316 | - } |
|
317 | - } |
|
315 | + } |
|
316 | + } |
|
317 | + } |
|
318 | 318 | |
319 | 319 | $actions['trash'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
320 | 320 | if ( empty( $actions['trash'] ) ) { |
@@ -323,52 +323,52 @@ discard block |
||
323 | 323 | } |
324 | 324 | |
325 | 325 | $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | - /** |
|
329 | - * @param string $edit_link |
|
330 | - */ |
|
328 | + /** |
|
329 | + * @param string $edit_link |
|
330 | + */ |
|
331 | 331 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
332 | - $form_name = $item->name; |
|
333 | - if ( trim($form_name) == '' ) { |
|
334 | - $form_name = __( '(no title)'); |
|
335 | - } |
|
332 | + $form_name = $item->name; |
|
333 | + if ( trim($form_name) == '' ) { |
|
334 | + $form_name = __( '(no title)'); |
|
335 | + } |
|
336 | 336 | $form_name = FrmAppHelper::kses( $form_name ); |
337 | 337 | if ( 'excerpt' != $mode ) { |
338 | 338 | $form_name = FrmAppHelper::truncate( $form_name, 50 ); |
339 | 339 | } |
340 | 340 | |
341 | - $val = '<strong>'; |
|
342 | - if ( 'trash' == $this->status ) { |
|
343 | - $val .= $form_name; |
|
344 | - } else { |
|
341 | + $val = '<strong>'; |
|
342 | + if ( 'trash' == $this->status ) { |
|
343 | + $val .= $form_name; |
|
344 | + } else { |
|
345 | 345 | $val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> '; |
346 | - } |
|
347 | - |
|
348 | - $this->add_draft_label( $item, $val ); |
|
349 | - $val .= '</strong>'; |
|
350 | - |
|
351 | - $this->add_form_description( $item, $val ); |
|
352 | - |
|
353 | - return $val; |
|
354 | - } |
|
355 | - |
|
356 | - /** |
|
357 | - * @param string $val |
|
358 | - */ |
|
359 | - private function add_draft_label( $item, &$val ) { |
|
360 | - if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
361 | - $val .= ' - <span class="post-state">'. __( 'Draft', 'formidable' ) .'</span>'; |
|
362 | - } |
|
363 | - } |
|
364 | - |
|
365 | - /** |
|
366 | - * @param string $val |
|
367 | - */ |
|
368 | - private function add_form_description( $item, &$val ) { |
|
369 | - global $mode; |
|
370 | - if ( 'excerpt' == $mode ) { |
|
371 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
372 | - } |
|
373 | - } |
|
346 | + } |
|
347 | + |
|
348 | + $this->add_draft_label( $item, $val ); |
|
349 | + $val .= '</strong>'; |
|
350 | + |
|
351 | + $this->add_form_description( $item, $val ); |
|
352 | + |
|
353 | + return $val; |
|
354 | + } |
|
355 | + |
|
356 | + /** |
|
357 | + * @param string $val |
|
358 | + */ |
|
359 | + private function add_draft_label( $item, &$val ) { |
|
360 | + if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
361 | + $val .= ' - <span class="post-state">'. __( 'Draft', 'formidable' ) .'</span>'; |
|
362 | + } |
|
363 | + } |
|
364 | + |
|
365 | + /** |
|
366 | + * @param string $val |
|
367 | + */ |
|
368 | + private function add_form_description( $item, &$val ) { |
|
369 | + global $mode; |
|
370 | + if ( 'excerpt' == $mode ) { |
|
371 | + $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
372 | + } |
|
373 | + } |
|
374 | 374 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $page = $this->get_pagenum(); |
27 | 27 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
28 | 28 | |
29 | - $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page); |
|
29 | + $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : ( ( $page - 1 ) * $per_page ); |
|
30 | 30 | |
31 | 31 | $s_query = array(); |
32 | 32 | $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
@@ -48,19 +48,19 @@ discard block |
||
48 | 48 | break; |
49 | 49 | } |
50 | 50 | |
51 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
51 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
52 | 52 | if ( $s != '' ) { |
53 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | - $search_terms = array_map('trim', $matches[0]); |
|
53 | + preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches ); |
|
54 | + $search_terms = array_map( 'trim', $matches[0] ); |
|
55 | 55 | foreach ( (array) $search_terms as $term ) { |
56 | 56 | $s_query[] = array( |
57 | 57 | 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
58 | 58 | ); |
59 | - unset($term); |
|
59 | + unset( $term ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $this->items = FrmForm::getAll($s_query, $orderby .' '. $order, $start .','. $per_page); |
|
63 | + $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); |
|
64 | 64 | $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
65 | 65 | |
66 | 66 | $this->set_pagination_args( array( |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | if ( 'template' == $this->status ) { |
74 | 74 | _e( 'No Templates Found.', 'formidable' ) ?> |
75 | 75 | <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?> |
76 | - <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
|
77 | - <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li> |
|
76 | + <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
|
77 | + <li><?php printf( __( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>' ) ?></li> |
|
78 | 78 | <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li> |
79 | 79 | </ol> |
80 | 80 | <?php } else { |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if ( 'trash' == $this->status ) { |
94 | - if ( current_user_can('frm_edit_forms') ) { |
|
94 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
95 | 95 | $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
96 | 96 | } |
97 | 97 | |
98 | - if ( current_user_can('frm_delete_forms') ) { |
|
98 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
99 | 99 | $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
100 | 100 | } |
101 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
101 | + } else if ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) { |
|
102 | 102 | $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
103 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | - $actions['bulk_delete'] = __( 'Delete'); |
|
103 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
104 | + $actions['bulk_delete'] = __( 'Delete' ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $actions; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
115 | + if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) { |
|
116 | 116 | ?> |
117 | 117 | <div class="alignleft actions frm_visible_overflow"> |
118 | 118 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
129 | 129 | $forms = FrmForm::get_published_forms( $where ); |
130 | 130 | |
131 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
131 | + $base = admin_url( 'admin.php?page=formidable&form_type=template' ); |
|
132 | 132 | $args = array( |
133 | 133 | 'frm_action' => 'duplicate', |
134 | 134 | 'template' => true, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $args['id'] = $form->id; ?> |
149 | 149 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
150 | 150 | <?php |
151 | - unset($form); |
|
151 | + unset( $form ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | ?> |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if ( $counts->{$status} || 'published' == $status ) { |
183 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
183 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
184 | 184 | } |
185 | 185 | |
186 | - unset($status, $name); |
|
186 | + unset( $status, $name ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $links; |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | |
205 | 205 | // Set up the hover actions for this user |
206 | 206 | $actions = array(); |
207 | - $edit_link = '?page=formidable&frm_action=edit&id='. $item->id; |
|
208 | - $duplicate_link = '?page=formidable&frm_action=duplicate&id='. $item->id; |
|
207 | + $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
|
208 | + $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
|
209 | 209 | |
210 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
210 | + $this->get_actions( $actions, $item, $edit_link, $duplicate_link ); |
|
211 | 211 | |
212 | 212 | $action_links = $this->row_actions( $actions ); |
213 | 213 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | foreach ( $columns as $column_name => $column_display_name ) { |
227 | - $class = $column_name .' column-'. $column_name . ( ('name' == $column_name) ? ' post-title page-title column-title' : '' ); |
|
227 | + $class = $column_name . ' column-' . $column_name . ( ( 'name' == $column_name ) ? ' post-title page-title column-title' : '' ); |
|
228 | 228 | |
229 | 229 | $style = ''; |
230 | 230 | if ( in_array( $column_name, $hidden ) ) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | switch ( $column_name ) { |
239 | 239 | case 'cb': |
240 | - $r .= '<th scope="row" class="check-column">'. $checkbox .'</th>'; |
|
240 | + $r .= '<th scope="row" class="check-column">' . $checkbox . '</th>'; |
|
241 | 241 | break; |
242 | 242 | case 'id': |
243 | 243 | case 'form_key': |
@@ -249,22 +249,22 @@ discard block |
||
249 | 249 | |
250 | 250 | break; |
251 | 251 | case 'created_at': |
252 | - $date = date($format, strtotime($item->created_at)); |
|
252 | + $date = date( $format, strtotime( $item->created_at ) ); |
|
253 | 253 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
254 | 254 | break; |
255 | 255 | case 'shortcode': |
256 | - $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id .']' ) . '" /><br/>'; |
|
256 | + $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>'; |
|
257 | 257 | if ( 'excerpt' == $mode ) { |
258 | 258 | $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'entries': |
262 | 262 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
263 | - $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="'. esc_attr('Entries are not being saved', 'formidable' ) .'"></i>'; |
|
263 | + $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Entries are not being saved', 'formidable' ) . '"></i>'; |
|
264 | 264 | } else { |
265 | - $text = FrmEntry::getRecordCount($item->id); |
|
266 | - $val = current_user_can('frm_view_entries') ? '<a href="'. esc_url( admin_url( 'admin.php?page=formidable-entries&form='. $item->id ) ) . '">' . $text . '</a>' : $text; |
|
267 | - unset($text); |
|
265 | + $text = FrmEntry::getRecordCount( $item->id ); |
|
266 | + $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
|
267 | + unset( $text ); |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | case 'type': |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | break; |
273 | 273 | } |
274 | 274 | |
275 | - if ( isset($val) ) { |
|
275 | + if ( isset( $val ) ) { |
|
276 | 276 | $r .= "<td $attributes>"; |
277 | 277 | $r .= $val; |
278 | 278 | $r .= '</td>'; |
279 | 279 | } |
280 | - unset($val); |
|
280 | + unset( $val ); |
|
281 | 281 | } |
282 | 282 | $r .= '</tr>'; |
283 | 283 | |
@@ -290,25 +290,25 @@ discard block |
||
290 | 290 | */ |
291 | 291 | private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
292 | 292 | if ( 'trash' == $this->status ) { |
293 | - if ( current_user_can('frm_edit_forms') ) { |
|
293 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
294 | 294 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
295 | 295 | } |
296 | 296 | |
297 | - if ( current_user_can('frm_delete_forms') ) { |
|
298 | - $actions['trash'] = '<a href="' . esc_url(wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id='. $item->id, 'destroy_form_'. $item->id )) .'" class="submitdelete" onclick="return confirm(\''. __( 'Are you sure you want to permanently delete that?', 'formidable' ) .'\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
297 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
298 | + $actions['trash'] = '<a href="' . esc_url( wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ) ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
299 | 299 | } |
300 | 300 | return; |
301 | 301 | } |
302 | 302 | |
303 | - if ( current_user_can('frm_edit_forms') ) { |
|
303 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
304 | 304 | if ( ! $item->is_template || ! $item->default_template ) { |
305 | - $actions['frm_edit'] = '<a href="'. esc_url( $edit_link ) . '">'. __( 'Edit') .'</a>'; |
|
305 | + $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | if ( $item->is_template ) { |
309 | - $actions['frm_duplicate'] = '<a href="'. esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
|
309 | + $actions['frm_duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
|
310 | 310 | } else { |
311 | - $actions['frm_settings'] = '<a href="'. esc_url('?page=formidable&frm_action=settings&id='. $item->id ) . '">'. __( 'Settings', 'formidable' ) .'</a>'; |
|
311 | + $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
|
312 | 312 | |
313 | 313 | if ( FrmAppHelper::pro_is_installed() ) { |
314 | 314 | $actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>'; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | unset( $actions['trash'] ); |
323 | 323 | } |
324 | 324 | |
325 | - $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
|
325 | + $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
332 | 332 | $form_name = $item->name; |
333 | - if ( trim($form_name) == '' ) { |
|
334 | - $form_name = __( '(no title)'); |
|
333 | + if ( trim( $form_name ) == '' ) { |
|
334 | + $form_name = __( '(no title)' ); |
|
335 | 335 | } |
336 | 336 | $form_name = FrmAppHelper::kses( $form_name ); |
337 | 337 | if ( 'excerpt' != $mode ) { |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | private function add_draft_label( $item, &$val ) { |
360 | 360 | if ( 'draft' == $item->status && 'draft' != $this->status ) { |
361 | - $val .= ' - <span class="post-state">'. __( 'Draft', 'formidable' ) .'</span>'; |
|
361 | + $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | private function add_form_description( $item, &$val ) { |
369 | 369 | global $mode; |
370 | 370 | if ( 'excerpt' == $mode ) { |
371 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
371 | + $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 ); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | } |