@@ -8,12 +8,12 @@ |
||
8 | 8 | <div id="post-body" class="metabox-holder columns-2"> |
9 | 9 | <div id="post-body-content"> |
10 | 10 | <?php |
11 | - if ( ! $values['is_template'] ) { |
|
12 | - FrmAppController::get_form_nav($id, true, 'hide'); |
|
13 | - } |
|
11 | + if ( ! $values['is_template'] ) { |
|
12 | + FrmAppController::get_form_nav($id, true, 'hide'); |
|
13 | + } |
|
14 | 14 | require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); |
15 | 15 | |
16 | - ?> |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div class="frm_form_builder with_frm_style"> |
19 | 19 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | <div id="post-body-content"> |
10 | 10 | <?php |
11 | 11 | if ( ! $values['is_template'] ) { |
12 | - FrmAppController::get_form_nav($id, true, 'hide'); |
|
12 | + FrmAppController::get_form_nav( $id, true, 'hide' ); |
|
13 | 13 | } |
14 | 14 | require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); |
15 | 15 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | <option value="message" <?php selected($values['success_action'], 'message') ?>><?php _e( 'Show Message', 'formidable' )?></option> |
62 | 62 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
63 | 63 | <option value="redirect" <?php selected($values['success_action'], 'redirect'); |
64 | - ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
|
64 | + ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
|
65 | 65 | <option value="page" <?php selected($values['success_action'], 'page'); |
66 | 66 | ?>><?php _e( 'Show Page Content', 'formidable' ) ?></option> |
67 | 67 | <?php } else { ?> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
72 | 72 | </option> |
73 | 73 | <option value="page" disabled="disabled" <?php selected($values['success_action'], 'page'); |
74 | - ?>> |
|
74 | + ?>> |
|
75 | 75 | <?php _e( 'Show Page Content', 'formidable' ); ?> |
76 | 76 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
77 | 77 | </option> |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | <ul class="frm_actions_list"> |
194 | 194 | <?php |
195 | 195 | |
196 | - //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
197 | - foreach ( $action_controls as $action_control ) { |
|
198 | - ?> |
|
196 | + //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
197 | + foreach ( $action_controls as $action_control ) { |
|
198 | + ?> |
|
199 | 199 | <li><a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php |
200 | - echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
201 | - echo esc_attr( $action_control->action_options['classes'] ); |
|
202 | - ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
200 | + echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
201 | + echo esc_attr( $action_control->action_options['classes'] ); |
|
202 | + ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
203 | 203 | <?php |
204 | - unset($actions_icon); |
|
205 | - } |
|
206 | - ?> |
|
204 | + unset($actions_icon); |
|
205 | + } |
|
206 | + ?> |
|
207 | 207 | </ul> |
208 | 208 | </div> |
209 | 209 | <div class="frm_no_actions"> |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | <p><label><?php echo esc_html( $field['name'] ) ?></label> |
236 | 236 | <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea($field['custom_html']) ?></textarea></p> |
237 | 237 | <?php } |
238 | - unset($field); |
|
239 | - } |
|
240 | - } ?> |
|
238 | + unset($field); |
|
239 | + } |
|
240 | + } ?> |
|
241 | 241 | </div> |
242 | 242 | |
243 | 243 | <p><label><?php _e( 'After Fields', 'formidable' ) ?></label> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | call_user_func( array( $section['class'], $section['function'] ), $values ); |
260 | 260 | } else { |
261 | 261 | call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ), $values ); |
262 | - } ?> |
|
262 | + } ?> |
|
263 | 263 | </div> |
264 | 264 | <?php } ?> |
265 | 265 |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | <div class="contextual-help-tabs"> |
27 | 27 | <ul class="frm-category-tabs frm-form-setting-tabs"> |
28 | 28 | <?php $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'advanced_settings' ); ?> |
29 | - <li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li> |
|
30 | - <li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li> |
|
31 | - <li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li> |
|
29 | + <li <?php echo ( $a == 'advanced_settings' ) ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li> |
|
30 | + <li <?php echo ( $a == 'email_settings' ) ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li> |
|
31 | + <li <?php echo ( $a == 'html_settings' ) ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li> |
|
32 | 32 | <?php foreach ( $sections as $key => $section ) { |
33 | 33 | if ( isset( $section['name'] ) ) { |
34 | 34 | $sec_name = $section['name']; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <?php } ?> |
44 | 44 | </ul> |
45 | 45 | </div> |
46 | - <div class="advanced_settings tabs-panel <?php echo ($a == 'advanced_settings') ? 'frm_block' : 'frm_hidden' ?>"> |
|
46 | + <div class="advanced_settings tabs-panel <?php echo ( $a == 'advanced_settings' ) ? 'frm_block' : 'frm_hidden' ?>"> |
|
47 | 47 | <?php FrmTipsHelper::pro_tip( 'get_form_settings_tip', 'p' ); ?> |
48 | 48 | |
49 | 49 | <h3 class="frm_first_h3"><?php _e( 'On Submit', 'formidable' ); ?> |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | <tr> |
59 | 59 | <td class="frm_175_width"> |
60 | 60 | <select name="options[success_action]" id="success_action"> |
61 | - <option value="message" <?php selected($values['success_action'], 'message') ?>><?php _e( 'Show Message', 'formidable' )?></option> |
|
61 | + <option value="message" <?php selected( $values['success_action'], 'message' ) ?>><?php _e( 'Show Message', 'formidable' )?></option> |
|
62 | 62 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
63 | - <option value="redirect" <?php selected($values['success_action'], 'redirect'); |
|
63 | + <option value="redirect" <?php selected( $values['success_action'], 'redirect' ); |
|
64 | 64 | ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
65 | - <option value="page" <?php selected($values['success_action'], 'page'); |
|
65 | + <option value="page" <?php selected( $values['success_action'], 'page' ); |
|
66 | 66 | ?>><?php _e( 'Show Page Content', 'formidable' ) ?></option> |
67 | 67 | <?php } else { ?> |
68 | - <option value="redirect" disabled="disabled" <?php selected($values['success_action'], 'redirect'); |
|
68 | + <option value="redirect" disabled="disabled" <?php selected( $values['success_action'], 'redirect' ); |
|
69 | 69 | ?>> |
70 | 70 | <?php _e( 'Redirect to URL', 'formidable' ); ?> |
71 | 71 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
72 | 72 | </option> |
73 | - <option value="page" disabled="disabled" <?php selected($values['success_action'], 'page'); |
|
73 | + <option value="page" disabled="disabled" <?php selected( $values['success_action'], 'page' ); |
|
74 | 74 | ?>> |
75 | 75 | <?php _e( 'Show Page Content', 'formidable' ); ?> |
76 | 76 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | </select> |
80 | 80 | </td> |
81 | 81 | <td> |
82 | - <span class="success_action_redirect_box success_action_box<?php echo ($values['success_action'] == 'redirect') ? '' : ' frm_hidden'; ?>"> |
|
82 | + <span class="success_action_redirect_box success_action_box<?php echo ( $values['success_action'] == 'redirect' ) ? '' : ' frm_hidden'; ?>"> |
|
83 | 83 | <input type="text" name="options[success_url]" id="success_url" value="<?php |
84 | 84 | if ( isset( $values['success_url'] ) ) { |
85 | 85 | echo esc_attr( $values['success_url'] ); |
@@ -87,23 +87,23 @@ discard block |
||
87 | 87 | </span> |
88 | 88 | |
89 | 89 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
90 | - <span class="success_action_page_box success_action_box<?php echo ($values['success_action'] == 'page') ? '' : ' frm_hidden'; ?>"> |
|
90 | + <span class="success_action_page_box success_action_box<?php echo ( $values['success_action'] == 'page' ) ? '' : ' frm_hidden'; ?>"> |
|
91 | 91 | <label><?php _e( 'Use Content from Page', 'formidable' ) ?></label> |
92 | 92 | <?php FrmAppHelper::wp_pages_dropdown( 'options[success_page_id]', $values['success_page_id'] ) ?> |
93 | 93 | </span> |
94 | 94 | <?php } ?> |
95 | 95 | </td> |
96 | 96 | </tr> |
97 | - <tr class="frm_show_form_opt success_action_message_box success_action_box<?php echo ($values['success_action'] == 'message') ? '' : ' frm_hidden'; ?>"> |
|
97 | + <tr class="frm_show_form_opt success_action_message_box success_action_box<?php echo ( $values['success_action'] == 'message' ) ? '' : ' frm_hidden'; ?>"> |
|
98 | 98 | <td colspan="2"> |
99 | 99 | <label for="show_form"><input type="checkbox" name="options[show_form]" id="show_form" value="1" <?php checked( $values['show_form'], 1 ) ?> /> <?php _e( 'Show the form with the confirmation message', 'formidable' ) ?></label> |
100 | 100 | </td> |
101 | 101 | </tr> |
102 | 102 | <tr> |
103 | - <td colspan="2"><label for="no_save"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked($values['no_save'], 1); ?> /> <?php _e( 'Do not store entries submitted from this form', 'formidable' ) ?></label> |
|
103 | + <td colspan="2"><label for="no_save"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked( $values['no_save'], 1 ); ?> /> <?php _e( 'Do not store entries submitted from this form', 'formidable' ) ?></label> |
|
104 | 104 | </td> |
105 | 105 | </tr> |
106 | - <?php if ( function_exists( 'akismet_http_post') ) { ?> |
|
106 | + <?php if ( function_exists( 'akismet_http_post' ) ) { ?> |
|
107 | 107 | <tr> |
108 | 108 | <td colspan="2"><?php _e( 'Use Akismet to check entries for spam for', 'formidable' ) ?> |
109 | 109 | <select name="options[akismet]"> |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Recommended for long forms.', 'formidable' ) ?>" ></span> |
130 | 130 | </td> |
131 | 131 | </tr> |
132 | - <?php do_action('frm_add_form_ajax_options', $values); ?> |
|
132 | + <?php do_action( 'frm_add_form_ajax_options', $values ); ?> |
|
133 | 133 | </table> |
134 | 134 | |
135 | 135 | <!--Permissions Section--> |
136 | - <?php do_action('frm_add_form_perm_options', $values); ?> |
|
136 | + <?php do_action( 'frm_add_form_perm_options', $values ); ?> |
|
137 | 137 | |
138 | 138 | <!--Styling & Buttons Section--> |
139 | 139 | <h3><?php _e( 'Styling & Buttons', 'formidable' ) ?> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | </tr> |
155 | 155 | <tr> |
156 | 156 | <td><label><?php _e( 'Submit Button Text', 'formidable' ) ?></label></td> |
157 | - <td><input type="text" name="options[submit_value]" value="<?php echo esc_attr($values['submit_value']); ?>" /></td> |
|
157 | + <td><input type="text" name="options[submit_value]" value="<?php echo esc_attr( $values['submit_value'] ); ?>" /></td> |
|
158 | 158 | </tr> |
159 | 159 | <?php do_action( 'frm_add_form_button_options', $values ); ?> |
160 | 160 | </table> |
@@ -164,27 +164,27 @@ discard block |
||
164 | 164 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set up your confirmation messages.', 'formidable' ) ?>" ></span> |
165 | 165 | </h3> |
166 | 166 | <table class="form-table"> |
167 | - <tr class="success_action_message_box success_action_box<?php echo ($values['success_action'] == 'message') ? '' : ' frm_hidden'; ?>"> |
|
167 | + <tr class="success_action_message_box success_action_box<?php echo ( $values['success_action'] == 'message' ) ? '' : ' frm_hidden'; ?>"> |
|
168 | 168 | <td> |
169 | 169 | <div><?php _e( 'On Submit', 'formidable' ) ?></div> |
170 | - <textarea id="success_msg" name="options[success_msg]" cols="50" rows="2" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['success_msg']); ?></textarea> |
|
170 | + <textarea id="success_msg" name="options[success_msg]" cols="50" rows="2" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['success_msg'] ); ?></textarea> |
|
171 | 171 | </td> |
172 | 172 | </tr> |
173 | - <?php do_action('frm_add_form_msg_options', $values); ?> |
|
173 | + <?php do_action( 'frm_add_form_msg_options', $values ); ?> |
|
174 | 174 | </table> |
175 | 175 | |
176 | 176 | <!--Misc Section--> |
177 | 177 | <?php if ( has_action( 'frm_additional_form_options' ) ) { ?> |
178 | 178 | <h3><?php _e( 'Miscellaneous', 'formidable' ); ?></h3> |
179 | 179 | <table class="form-table"> |
180 | - <?php do_action('frm_additional_form_options', $values); ?> |
|
180 | + <?php do_action( 'frm_additional_form_options', $values ); ?> |
|
181 | 181 | </table> |
182 | 182 | <?php } ?> |
183 | 183 | |
184 | 184 | </div> |
185 | 185 | |
186 | 186 | |
187 | - <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ($a == 'email_settings') ? ' frm_block' : ' frm_hidden'; ?>"> |
|
187 | + <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ( $a == 'email_settings' ) ? ' frm_block' : ' frm_hidden'; ?>"> |
|
188 | 188 | <?php FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' ); ?> |
189 | 189 | <div id="frm_email_addon_menu" class="manage-menus"> |
190 | 190 | <h3><?php _e( 'Add New Action', 'formidable' ) ?></h3> |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | foreach ( $action_controls as $action_control ) { |
196 | 196 | ?> |
197 | 197 | <li><a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php |
198 | - echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
198 | + echo ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
199 | 199 | echo esc_attr( $action_control->action_options['classes'] ); |
200 | - ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
200 | + ?>" title="<?php echo esc_attr( $action_control->action_options['tooltip'] ) ?>" data-limit="<?php echo isset( $action_control->action_options['limit'] ) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr( $action_control->id_base ) ?>"></a></li> |
|
201 | 201 | <?php |
202 | - unset($actions_icon); |
|
202 | + unset( $actions_icon ); |
|
203 | 203 | } |
204 | 204 | ?> |
205 | 205 | </ul> |
@@ -211,19 +211,19 @@ discard block |
||
211 | 211 | <?php _e( 'Click an action to add it to this form', 'formidable' ) ?> |
212 | 212 | </div> |
213 | 213 | </div> |
214 | - <?php FrmFormActionsController::list_actions($form, $values); ?> |
|
214 | + <?php FrmFormActionsController::list_actions( $form, $values ); ?> |
|
215 | 215 | </div> |
216 | 216 | |
217 | - <div id="html_settings" class="tabs-panel <?php echo ($a == 'html_settings') ? ' frm_block' : ' frm_hidden'; ?>"> |
|
217 | + <div id="html_settings" class="tabs-panel <?php echo ( $a == 'html_settings' ) ? ' frm_block' : ' frm_hidden'; ?>"> |
|
218 | 218 | |
219 | 219 | <div class="frm_field_html_box frm_top_container"> |
220 | 220 | <p><label><?php _e( 'Form Classes', 'formidable' ) ?></label> |
221 | - <input type="text" name="options[form_class]" value="<?php echo esc_attr($values['form_class']) ?>" /> |
|
221 | + <input type="text" name="options[form_class]" value="<?php echo esc_attr( $values['form_class'] ) ?>" /> |
|
222 | 222 | </p> |
223 | 223 | <div class="clear"></div> |
224 | 224 | |
225 | 225 | <p><label><?php _e( 'Before Fields', 'formidable' ) ?></label> |
226 | - <textarea name="options[before_html]" rows="4" id="before_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['before_html']) ?></textarea></p> |
|
226 | + <textarea name="options[before_html]" rows="4" id="before_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['before_html'] ) ?></textarea></p> |
|
227 | 227 | |
228 | 228 | <div id="add_html_fields"> |
229 | 229 | <?php |
@@ -231,18 +231,18 @@ discard block |
||
231 | 231 | foreach ( $values['fields'] as $field ) { |
232 | 232 | if ( FrmFieldFactory::field_has_html( $field['type'] ) ) { ?> |
233 | 233 | <p><label><?php echo esc_html( $field['name'] ) ?></label> |
234 | - <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea($field['custom_html']) ?></textarea></p> |
|
234 | + <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea( $field['custom_html'] ) ?></textarea></p> |
|
235 | 235 | <?php } |
236 | - unset($field); |
|
236 | + unset( $field ); |
|
237 | 237 | } |
238 | 238 | } ?> |
239 | 239 | </div> |
240 | 240 | |
241 | 241 | <p><label><?php _e( 'After Fields', 'formidable' ) ?></label> |
242 | - <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['after_html']) ?></textarea></p> |
|
242 | + <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['after_html'] ) ?></textarea></p> |
|
243 | 243 | |
244 | 244 | <p><label><?php _e( 'Submit Button', 'formidable' ) ?></label> |
245 | - <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['submit_html']) ?></textarea></p> |
|
245 | + <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['submit_html'] ) ?></textarea></p> |
|
246 | 246 | </div> |
247 | 247 | </div> |
248 | 248 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | </div> |
262 | 262 | <?php } ?> |
263 | 263 | |
264 | - <?php do_action('frm_add_form_option_section', $values); ?> |
|
264 | + <?php do_action( 'frm_add_form_option_section', $values ); ?> |
|
265 | 265 | <div class="clear"></div> |
266 | 266 | </div> |
267 | 267 | </div> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | - } |
|
6 | + } |
|
7 | 7 | |
8 | 8 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_insert_fields.php' ); |
9 | 9 | |
10 | - ?> |
|
10 | + ?> |
|
11 | 11 | </div> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset( $hide_preview ) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | 6 | } |
7 | 7 |
@@ -21,13 +21,13 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
24 | + if ( defined( 'DOING_AJAX' ) || ! $action_control->action_options['ajax_load'] ) { |
|
25 | 25 | // only load settings if they are just added or are open |
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | 27 | } else { |
28 | 28 | // include hidden settings so action won't get lost on update ?> |
29 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
29 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'ID', '' ) ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
31 | 31 | <?php |
32 | 32 | } ?> |
33 | 33 | </div> |
@@ -21,14 +21,14 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | - // only load settings if they are just added or are open |
|
24 | + if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | + // only load settings if they are just added or are open |
|
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | - } else { |
|
28 | - // include hidden settings so action won't get lost on update ?> |
|
27 | + } else { |
|
28 | + // include hidden settings so action won't get lost on update ?> |
|
29 | 29 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
30 | 30 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
31 | 31 | <?php |
32 | - } ?> |
|
32 | + } ?> |
|
33 | 33 | </div> |
34 | 34 | </div> |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | |
5 | 5 | public function __construct() { |
6 | 6 | $action_ops = array( |
7 | - 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | - 'active' => true, |
|
7 | + 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | + 'active' => true, |
|
9 | 9 | 'event' => array( 'create' ), |
10 | - 'limit' => 99, |
|
11 | - 'priority' => 10, |
|
12 | - 'ajax_load' => false, |
|
10 | + 'limit' => 99, |
|
11 | + 'priority' => 10, |
|
12 | + 'ajax_load' => false, |
|
13 | 13 | ); |
14 | 14 | $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
15 | 15 | |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract($args); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function get_defaults() { |
26 | - return array( |
|
27 | - 'email_to' => '[admin_email]', |
|
28 | - 'cc' => '', |
|
29 | - 'bcc' => '', |
|
30 | - 'from' => '[sitename] <[admin_email]>', |
|
31 | - 'reply_to' => '', |
|
32 | - 'email_subject' => '', |
|
33 | - 'email_message' => '[default-message]', |
|
34 | - 'inc_user_info' => 0, |
|
35 | - 'plain_text' => 0, |
|
26 | + return array( |
|
27 | + 'email_to' => '[admin_email]', |
|
28 | + 'cc' => '', |
|
29 | + 'bcc' => '', |
|
30 | + 'from' => '[sitename] <[admin_email]>', |
|
31 | + 'reply_to' => '', |
|
32 | + 'email_subject' => '', |
|
33 | + 'email_message' => '[default-message]', |
|
34 | + 'inc_user_info' => 0, |
|
35 | + 'plain_text' => 0, |
|
36 | 36 | 'event' => array( 'create' ), |
37 | - ); |
|
37 | + ); |
|
38 | 38 | } |
39 | 39 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | 'priority' => 10, |
12 | 12 | 'ajax_load' => false, |
13 | 13 | ); |
14 | - $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
|
14 | + $action_ops = apply_filters( 'frm_email_control_settings', $action_ops ); |
|
15 | 15 | |
16 | - parent::__construct('email', __( 'Email Notification', 'formidable' ), $action_ops); |
|
16 | + parent::__construct( 'email', __( 'Email Notification', 'formidable' ), $action_ops ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract( $args ); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! isset($saving) ) { |
3 | - header( 'Content-type: text/css' ); |
|
3 | + header( 'Content-type: text/css' ); |
|
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
6 | - echo $css; |
|
7 | - die(); |
|
8 | - } |
|
5 | + if ( isset($css) && $css ) { |
|
6 | + echo $css; |
|
7 | + die(); |
|
8 | + } |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | if ( ! isset($frm_style) ) { |
12 | - $frm_style = new FrmStyle(); |
|
12 | + $frm_style = new FrmStyle(); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | <?php |
188 | 188 | foreach ( $styles as $style ) { |
189 | 189 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
190 | - unset($style); |
|
190 | + unset($style); |
|
191 | 191 | } |
192 | 192 | ?> |
193 | 193 |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! isset($saving) ) { |
|
2 | +if ( ! isset( $saving ) ) { |
|
3 | 3 | header( 'Content-type: text/css' ); |
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
5 | + if ( isset( $css ) && $css ) { |
|
6 | 6 | echo $css; |
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | } |
10 | 10 | |
11 | -if ( ! isset($frm_style) ) { |
|
11 | +if ( ! isset( $frm_style ) ) { |
|
12 | 12 | $frm_style = new FrmStyle(); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
16 | -$default_style = $frm_style->get_default_style($styles); |
|
16 | +$default_style = $frm_style->get_default_style( $styles ); |
|
17 | 17 | $defaults = FrmStylesHelper::get_settings_for_output( $default_style ); |
18 | 18 | |
19 | 19 | ?> |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | <?php |
268 | 268 | foreach ( $styles as $style ) { |
269 | 269 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
270 | - unset($style); |
|
270 | + unset( $style ); |
|
271 | 271 | } |
272 | 272 | ?> |
273 | 273 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | color: transparent !important; |
511 | 511 | } |
512 | 512 | |
513 | -<?php include( dirname(__FILE__) . '/frm_grids.css' ); ?> |
|
513 | +<?php include( dirname( __FILE__ ) . '/frm_grids.css' ); ?> |
|
514 | 514 | |
515 | 515 | /* Left and right label styling for non-Formidable styling - very basic, not responsive */ |
516 | 516 | .frm_form_field.frm_left_container label.frm_primary_label{ |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
7 | - * @param int|string $id The id of the stylsheet or 'default' |
|
7 | + * @param integer $id The id of the stylsheet or 'default' |
|
8 | 8 | */ |
9 | 9 | public function __construct( $id = 0 ) { |
10 | 10 | $this->id = $id; |
@@ -120,6 +120,9 @@ discard block |
||
120 | 120 | set_transient('frmpro_css', $css); |
121 | 121 | } |
122 | 122 | |
123 | + /** |
|
124 | + * @param string $filename |
|
125 | + */ |
|
123 | 126 | private function get_css_content( $filename ) { |
124 | 127 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
125 | 128 |
@@ -1,52 +1,52 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class FrmStyle { |
3 | - public $number = false; // Unique ID number of the current instance. |
|
3 | + public $number = false; // Unique ID number of the current instance. |
|
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @param int|string $id The id of the stylsheet or 'default' |
8 | 8 | */ |
9 | 9 | public function __construct( $id = 0 ) { |
10 | - $this->id = $id; |
|
11 | - } |
|
10 | + $this->id = $id; |
|
11 | + } |
|
12 | 12 | |
13 | - public function get_new() { |
|
13 | + public function get_new() { |
|
14 | 14 | $this->id = 0; |
15 | 15 | |
16 | - $max_slug_value = 2147483647; |
|
17 | - $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
18 | - $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
19 | - |
|
20 | - $style = array( |
|
21 | - 'post_type' => FrmStylesController::$post_type, |
|
22 | - 'ID' => '', |
|
23 | - 'post_title' => __( 'New Style', 'formidable' ), |
|
24 | - 'post_name' => $key, |
|
25 | - 'post_content' => $this->get_defaults(), |
|
26 | - 'menu_order' => '', |
|
27 | - 'post_status' => 'publish', |
|
28 | - ); |
|
16 | + $max_slug_value = 2147483647; |
|
17 | + $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
18 | + $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
19 | + |
|
20 | + $style = array( |
|
21 | + 'post_type' => FrmStylesController::$post_type, |
|
22 | + 'ID' => '', |
|
23 | + 'post_title' => __( 'New Style', 'formidable' ), |
|
24 | + 'post_name' => $key, |
|
25 | + 'post_content' => $this->get_defaults(), |
|
26 | + 'menu_order' => '', |
|
27 | + 'post_status' => 'publish', |
|
28 | + ); |
|
29 | 29 | |
30 | - return (object) $style; |
|
31 | - } |
|
30 | + return (object) $style; |
|
31 | + } |
|
32 | 32 | |
33 | 33 | public function save( $settings ) { |
34 | 34 | return FrmAppHelper::save_settings( $settings, 'frm_styles' ); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | 37 | public function duplicate( $id ) { |
38 | - // duplicating is a pro feature |
|
39 | - } |
|
38 | + // duplicating is a pro feature |
|
39 | + } |
|
40 | 40 | |
41 | - public function update( $id = 'default' ) { |
|
41 | + public function update( $id = 'default' ) { |
|
42 | 42 | $all_instances = $this->get_all(); |
43 | 43 | |
44 | 44 | if ( empty($id) ) { |
45 | - $new_style = (array) $this->get_new(); |
|
46 | - $all_instances[] = $new_style; |
|
45 | + $new_style = (array) $this->get_new(); |
|
46 | + $all_instances[] = $new_style; |
|
47 | 47 | } |
48 | 48 | |
49 | - $action_ids = array(); |
|
49 | + $action_ids = array(); |
|
50 | 50 | |
51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance); |
@@ -54,46 +54,46 @@ discard block |
||
54 | 54 | if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) { |
55 | 55 | $all_instances[ $number ] = $new_instance; |
56 | 56 | |
57 | - if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
58 | - // this style was set to default, so remove default setting on previous default style |
|
59 | - $new_instance['menu_order'] = 0; |
|
60 | - $action_ids[] = $this->save($new_instance); |
|
61 | - } |
|
57 | + if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
58 | + // this style was set to default, so remove default setting on previous default style |
|
59 | + $new_instance['menu_order'] = 0; |
|
60 | + $action_ids[] = $this->save($new_instance); |
|
61 | + } |
|
62 | 62 | |
63 | - // don't continue if not saving this style |
|
64 | - continue; |
|
63 | + // don't continue if not saving this style |
|
64 | + continue; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
70 | - $new_instance['post_status'] = 'publish'; |
|
70 | + $new_instance['post_status'] = 'publish'; |
|
71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
72 | 72 | |
73 | - if ( empty($id) ) { |
|
74 | - $new_instance['post_name'] = $new_instance['post_title']; |
|
75 | - } |
|
73 | + if ( empty($id) ) { |
|
74 | + $new_instance['post_name'] = $new_instance['post_title']; |
|
75 | + } |
|
76 | 76 | |
77 | - $default_settings = $this->get_defaults(); |
|
77 | + $default_settings = $this->get_defaults(); |
|
78 | 78 | |
79 | - foreach ( $default_settings as $setting => $default ) { |
|
79 | + foreach ( $default_settings as $setting => $default ) { |
|
80 | 80 | if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
81 | 81 | $new_instance['post_content'][ $setting ] = $default; |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
85 | - //if is a color |
|
85 | + //if is a color |
|
86 | 86 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
87 | 87 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
88 | 88 | $new_instance['post_content'][ $setting ] = 0; |
89 | - } else if ( $setting == 'font' ) { |
|
90 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
91 | - } |
|
92 | - } |
|
89 | + } else if ( $setting == 'font' ) { |
|
90 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | $all_instances[ $number ] = $new_instance; |
95 | 95 | |
96 | - $action_ids[] = $this->save($new_instance); |
|
96 | + $action_ids[] = $this->save($new_instance); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | return $action_ids; |
103 | 103 | } |
104 | 104 | |
105 | - /** |
|
106 | - * Create static css file |
|
107 | - */ |
|
105 | + /** |
|
106 | + * Create static css file |
|
107 | + */ |
|
108 | 108 | public function save_settings() { |
109 | 109 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
110 | 110 | update_option( 'frm_last_style_update', date('njGi') ); |
111 | 111 | |
112 | - if ( ! is_file($filename) ) { |
|
113 | - return; |
|
114 | - } |
|
112 | + if ( ! is_file($filename) ) { |
|
113 | + return; |
|
114 | + } |
|
115 | 115 | |
116 | 116 | $this->clear_cache(); |
117 | 117 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
121 | 121 | $create_file->create_file( $css ); |
122 | 122 | |
123 | - update_option('frmpro_css', $css); |
|
123 | + update_option('frmpro_css', $css); |
|
124 | 124 | |
125 | - set_transient('frmpro_css', $css); |
|
125 | + set_transient('frmpro_css', $css); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | private function get_css_content( $filename ) { |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | $saving = true; |
132 | 132 | $frm_style = $this; |
133 | 133 | |
134 | - ob_start(); |
|
135 | - include( $filename ); |
|
134 | + ob_start(); |
|
135 | + include( $filename ); |
|
136 | 136 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
137 | - ob_end_clean(); |
|
137 | + ob_end_clean(); |
|
138 | 138 | |
139 | 139 | return $css; |
140 | 140 | } |
@@ -154,269 +154,269 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | public function destroy( $id ) { |
157 | - return wp_delete_post($id); |
|
158 | - } |
|
157 | + return wp_delete_post($id); |
|
158 | + } |
|
159 | 159 | |
160 | - public function get_one() { |
|
161 | - if ( 'default' == $this->id ) { |
|
162 | - $style = $this->get_default_style(); |
|
163 | - if ( $style ) { |
|
164 | - $this->id = $style->ID; |
|
165 | - } else { |
|
166 | - $this->id = 0; |
|
167 | - } |
|
168 | - return $style; |
|
169 | - } |
|
160 | + public function get_one() { |
|
161 | + if ( 'default' == $this->id ) { |
|
162 | + $style = $this->get_default_style(); |
|
163 | + if ( $style ) { |
|
164 | + $this->id = $style->ID; |
|
165 | + } else { |
|
166 | + $this->id = 0; |
|
167 | + } |
|
168 | + return $style; |
|
169 | + } |
|
170 | 170 | |
171 | - $style = get_post($this->id); |
|
171 | + $style = get_post($this->id); |
|
172 | 172 | |
173 | - if ( ! $style ) { |
|
174 | - return $style; |
|
175 | - } |
|
173 | + if ( ! $style ) { |
|
174 | + return $style; |
|
175 | + } |
|
176 | 176 | |
177 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
177 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
178 | 178 | |
179 | - $default_values = $this->get_defaults(); |
|
179 | + $default_values = $this->get_defaults(); |
|
180 | 180 | |
181 | - // fill default values |
|
182 | - $style->post_content = $this->override_defaults($style->post_content); |
|
183 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
181 | + // fill default values |
|
182 | + $style->post_content = $this->override_defaults($style->post_content); |
|
183 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
184 | 184 | |
185 | - return $style; |
|
186 | - } |
|
185 | + return $style; |
|
186 | + } |
|
187 | 187 | |
188 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
189 | - $post_atts = array( |
|
188 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
189 | + $post_atts = array( |
|
190 | 190 | 'post_type' => FrmStylesController::$post_type, |
191 | 191 | 'post_status' => 'publish', |
192 | 192 | 'numberposts' => $limit, |
193 | 193 | 'orderby' => $orderby, |
194 | 194 | 'order' => $order, |
195 | - ); |
|
195 | + ); |
|
196 | 196 | |
197 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
197 | + $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
198 | 198 | |
199 | - if ( empty($temp_styles) ) { |
|
200 | - global $wpdb; |
|
201 | - // make sure there wasn't a conflict with the query |
|
199 | + if ( empty($temp_styles) ) { |
|
200 | + global $wpdb; |
|
201 | + // make sure there wasn't a conflict with the query |
|
202 | 202 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
203 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
203 | + $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
204 | 204 | |
205 | - if ( empty($temp_styles) ) { |
|
206 | - // create a new style if there are none |
|
207 | - $new = $this->get_new(); |
|
205 | + if ( empty($temp_styles) ) { |
|
206 | + // create a new style if there are none |
|
207 | + $new = $this->get_new(); |
|
208 | 208 | $new->post_title = __( 'Formidable Style', 'formidable' ); |
209 | 209 | $new->post_name = $new->post_title; |
210 | - $new->menu_order = 1; |
|
211 | - $new = $this->save( (array) $new); |
|
212 | - $this->update('default'); |
|
213 | - |
|
214 | - $post_atts['include'] = $new; |
|
215 | - |
|
216 | - $temp_styles = get_posts( $post_atts ); |
|
217 | - } |
|
218 | - } |
|
219 | - |
|
220 | - $default_values = $this->get_defaults(); |
|
221 | - $default_style = false; |
|
222 | - |
|
223 | - $styles = array(); |
|
224 | - foreach ( $temp_styles as $style ) { |
|
225 | - $this->id = $style->ID; |
|
226 | - if ( $style->menu_order ) { |
|
227 | - if ( $default_style ) { |
|
228 | - // only return one default |
|
229 | - $style->menu_order = 0; |
|
230 | - } else { |
|
231 | - // check for a default style |
|
232 | - $default_style = $style->ID; |
|
233 | - } |
|
234 | - } |
|
235 | - |
|
236 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
237 | - |
|
238 | - // fill default values |
|
239 | - $style->post_content = $this->override_defaults($style->post_content); |
|
240 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
210 | + $new->menu_order = 1; |
|
211 | + $new = $this->save( (array) $new); |
|
212 | + $this->update('default'); |
|
213 | + |
|
214 | + $post_atts['include'] = $new; |
|
215 | + |
|
216 | + $temp_styles = get_posts( $post_atts ); |
|
217 | + } |
|
218 | + } |
|
219 | + |
|
220 | + $default_values = $this->get_defaults(); |
|
221 | + $default_style = false; |
|
222 | + |
|
223 | + $styles = array(); |
|
224 | + foreach ( $temp_styles as $style ) { |
|
225 | + $this->id = $style->ID; |
|
226 | + if ( $style->menu_order ) { |
|
227 | + if ( $default_style ) { |
|
228 | + // only return one default |
|
229 | + $style->menu_order = 0; |
|
230 | + } else { |
|
231 | + // check for a default style |
|
232 | + $default_style = $style->ID; |
|
233 | + } |
|
234 | + } |
|
235 | + |
|
236 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
237 | + |
|
238 | + // fill default values |
|
239 | + $style->post_content = $this->override_defaults($style->post_content); |
|
240 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
241 | 241 | |
242 | 242 | $styles[ $style->ID ] = $style; |
243 | - } |
|
243 | + } |
|
244 | 244 | |
245 | - if ( ! $default_style ) { |
|
246 | - $default_style = reset($styles); |
|
245 | + if ( ! $default_style ) { |
|
246 | + $default_style = reset($styles); |
|
247 | 247 | $styles[ $default_style->ID ]->menu_order = 1; |
248 | - } |
|
248 | + } |
|
249 | 249 | |
250 | - return $styles; |
|
251 | - } |
|
250 | + return $styles; |
|
251 | + } |
|
252 | 252 | |
253 | 253 | public function get_default_style( $styles = null ) { |
254 | - if ( ! isset($styles) ) { |
|
254 | + if ( ! isset($styles) ) { |
|
255 | 255 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
256 | - } |
|
256 | + } |
|
257 | 257 | |
258 | - foreach ( $styles as $style ) { |
|
259 | - if ( $style->menu_order ) { |
|
260 | - return $style; |
|
261 | - } |
|
262 | - } |
|
263 | - } |
|
258 | + foreach ( $styles as $style ) { |
|
259 | + if ( $style->menu_order ) { |
|
260 | + return $style; |
|
261 | + } |
|
262 | + } |
|
263 | + } |
|
264 | 264 | |
265 | 265 | public function override_defaults( $settings ) { |
266 | - if ( ! is_array($settings) ) { |
|
267 | - return $settings; |
|
268 | - } |
|
269 | - |
|
270 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
271 | - |
|
272 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
273 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
274 | - $settings['form_desc_color'] = $settings['description_color']; |
|
275 | - $settings['title_color'] = $settings['label_color']; |
|
276 | - } |
|
277 | - |
|
278 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
279 | - $settings['section_color'] = $settings['label_color']; |
|
280 | - $settings['section_border_color'] = $settings['border_color']; |
|
281 | - } |
|
282 | - |
|
283 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
284 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
285 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
286 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
287 | - |
|
288 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
289 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
290 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
291 | - } |
|
292 | - |
|
293 | - return $settings; |
|
266 | + if ( ! is_array($settings) ) { |
|
267 | + return $settings; |
|
268 | + } |
|
269 | + |
|
270 | + $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
271 | + |
|
272 | + if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
273 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
274 | + $settings['form_desc_color'] = $settings['description_color']; |
|
275 | + $settings['title_color'] = $settings['label_color']; |
|
276 | + } |
|
277 | + |
|
278 | + if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
279 | + $settings['section_color'] = $settings['label_color']; |
|
280 | + $settings['section_border_color'] = $settings['border_color']; |
|
281 | + } |
|
282 | + |
|
283 | + if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
284 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
285 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
286 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
287 | + |
|
288 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
289 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
290 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
291 | + } |
|
292 | + |
|
293 | + return $settings; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | public function get_defaults() { |
297 | - return array( |
|
298 | - 'theme_css' => 'ui-lightness', |
|
299 | - 'theme_name' => 'UI Lightness', |
|
297 | + return array( |
|
298 | + 'theme_css' => 'ui-lightness', |
|
299 | + 'theme_name' => 'UI Lightness', |
|
300 | 300 | |
301 | 301 | 'center_form' => '', |
302 | - 'form_width' => '100%', |
|
303 | - 'form_align' => 'left', |
|
304 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
305 | - 'fieldset' => '0px', |
|
306 | - 'fieldset_color' => '000000', |
|
307 | - 'fieldset_padding' => '0 0 15px 0', |
|
308 | - 'fieldset_bg_color' => '', |
|
309 | - |
|
310 | - 'title_size' => '20px', |
|
311 | - 'title_color' => '444444', |
|
302 | + 'form_width' => '100%', |
|
303 | + 'form_align' => 'left', |
|
304 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
305 | + 'fieldset' => '0px', |
|
306 | + 'fieldset_color' => '000000', |
|
307 | + 'fieldset_padding' => '0 0 15px 0', |
|
308 | + 'fieldset_bg_color' => '', |
|
309 | + |
|
310 | + 'title_size' => '20px', |
|
311 | + 'title_color' => '444444', |
|
312 | 312 | 'title_margin_top' => '10px', |
313 | 313 | 'title_margin_bottom' => '10px', |
314 | - 'form_desc_size' => '14px', |
|
315 | - 'form_desc_color' => '666666', |
|
314 | + 'form_desc_size' => '14px', |
|
315 | + 'form_desc_color' => '666666', |
|
316 | 316 | 'form_desc_margin_top' => '10px', |
317 | 317 | 'form_desc_margin_bottom' => '25px', |
318 | 318 | |
319 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
320 | - 'font_size' => '14px', |
|
321 | - 'label_color' => '444444', |
|
322 | - 'weight' => 'bold', |
|
323 | - 'position' => 'none', |
|
324 | - 'align' => 'left', |
|
325 | - 'width' => '150px', |
|
326 | - 'required_color' => 'B94A48', |
|
327 | - 'required_weight' => 'bold', |
|
328 | - 'label_padding' => '0 0 3px 0', |
|
329 | - |
|
330 | - 'description_font_size' => '12px', |
|
331 | - 'description_color' => '666666', |
|
332 | - 'description_weight' => 'normal', |
|
333 | - 'description_style' => 'normal', |
|
334 | - 'description_align' => 'left', |
|
319 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
320 | + 'font_size' => '14px', |
|
321 | + 'label_color' => '444444', |
|
322 | + 'weight' => 'bold', |
|
323 | + 'position' => 'none', |
|
324 | + 'align' => 'left', |
|
325 | + 'width' => '150px', |
|
326 | + 'required_color' => 'B94A48', |
|
327 | + 'required_weight' => 'bold', |
|
328 | + 'label_padding' => '0 0 3px 0', |
|
329 | + |
|
330 | + 'description_font_size' => '12px', |
|
331 | + 'description_color' => '666666', |
|
332 | + 'description_weight' => 'normal', |
|
333 | + 'description_style' => 'normal', |
|
334 | + 'description_align' => 'left', |
|
335 | 335 | 'description_margin' => '0', |
336 | 336 | |
337 | - 'field_font_size' => '14px', |
|
338 | - 'field_height' => '32px', |
|
339 | - 'line_height' => 'normal', |
|
340 | - 'field_width' => '100%', |
|
341 | - 'auto_width' => false, |
|
342 | - 'field_pad' => '6px 10px', |
|
343 | - 'field_margin' => '20px', |
|
337 | + 'field_font_size' => '14px', |
|
338 | + 'field_height' => '32px', |
|
339 | + 'line_height' => 'normal', |
|
340 | + 'field_width' => '100%', |
|
341 | + 'auto_width' => false, |
|
342 | + 'field_pad' => '6px 10px', |
|
343 | + 'field_margin' => '20px', |
|
344 | 344 | 'field_weight' => 'normal', |
345 | - 'text_color' => '555555', |
|
346 | - //'border_color_hv' => 'cccccc', |
|
347 | - 'border_color' => 'cccccc', |
|
348 | - 'field_border_width' => '1px', |
|
349 | - 'field_border_style' => 'solid', |
|
350 | - |
|
351 | - 'bg_color' => 'ffffff', |
|
352 | - //'bg_color_hv' => 'ffffff', |
|
345 | + 'text_color' => '555555', |
|
346 | + //'border_color_hv' => 'cccccc', |
|
347 | + 'border_color' => 'cccccc', |
|
348 | + 'field_border_width' => '1px', |
|
349 | + 'field_border_style' => 'solid', |
|
350 | + |
|
351 | + 'bg_color' => 'ffffff', |
|
352 | + //'bg_color_hv' => 'ffffff', |
|
353 | 353 | 'remove_box_shadow' => '', |
354 | - 'bg_color_active' => 'ffffff', |
|
354 | + 'bg_color_active' => 'ffffff', |
|
355 | 355 | 'border_color_active' => '66afe9', |
356 | 356 | 'remove_box_shadow_active' => '', |
357 | - 'text_color_error' => '444444', |
|
358 | - 'bg_color_error' => 'ffffff', |
|
357 | + 'text_color_error' => '444444', |
|
358 | + 'bg_color_error' => 'ffffff', |
|
359 | 359 | 'border_color_error' => 'B94A48', |
360 | 360 | 'border_width_error' => '1px', |
361 | 361 | 'border_style_error' => 'solid', |
362 | - 'bg_color_disabled' => 'ffffff', |
|
363 | - 'border_color_disabled' => 'E5E5E5', |
|
364 | - 'text_color_disabled' => 'A1A1A1', |
|
365 | - |
|
366 | - 'radio_align' => 'block', |
|
367 | - 'check_align' => 'block', |
|
368 | - 'check_font_size' => '13px', |
|
369 | - 'check_label_color' => '444444', |
|
370 | - 'check_weight' => 'normal', |
|
371 | - |
|
372 | - 'section_font_size' => '18px', |
|
373 | - 'section_color' => '444444', |
|
374 | - 'section_weight' => 'bold', |
|
375 | - 'section_pad' => '15px 0 3px 0', |
|
376 | - 'section_mar_top' => '15px', |
|
362 | + 'bg_color_disabled' => 'ffffff', |
|
363 | + 'border_color_disabled' => 'E5E5E5', |
|
364 | + 'text_color_disabled' => 'A1A1A1', |
|
365 | + |
|
366 | + 'radio_align' => 'block', |
|
367 | + 'check_align' => 'block', |
|
368 | + 'check_font_size' => '13px', |
|
369 | + 'check_label_color' => '444444', |
|
370 | + 'check_weight' => 'normal', |
|
371 | + |
|
372 | + 'section_font_size' => '18px', |
|
373 | + 'section_color' => '444444', |
|
374 | + 'section_weight' => 'bold', |
|
375 | + 'section_pad' => '15px 0 3px 0', |
|
376 | + 'section_mar_top' => '15px', |
|
377 | 377 | 'section_mar_bottom' => '12px', |
378 | - 'section_bg_color' => '', |
|
379 | - 'section_border_color' => 'e8e8e8', |
|
380 | - 'section_border_width' => '2px', |
|
381 | - 'section_border_style' => 'solid', |
|
382 | - 'section_border_loc' => '-top', |
|
383 | - 'collapse_icon' => '6', |
|
384 | - 'collapse_pos' => 'after', |
|
385 | - 'repeat_icon' => '1', |
|
386 | - |
|
387 | - 'submit_style' => false, |
|
388 | - 'submit_font_size' => '14px', |
|
389 | - 'submit_width' => 'auto', |
|
390 | - 'submit_height' => 'auto', |
|
391 | - 'submit_bg_color' => 'ffffff', |
|
392 | - 'submit_border_color' => 'cccccc', |
|
393 | - 'submit_border_width' => '1px', |
|
394 | - 'submit_text_color' => '444444', |
|
395 | - 'submit_weight' => 'normal', |
|
396 | - 'submit_border_radius' => '4px', |
|
397 | - 'submit_bg_img' => '', |
|
398 | - 'submit_margin' => '10px', |
|
399 | - 'submit_padding' => '6px 11px', |
|
400 | - 'submit_shadow_color' => 'eeeeee', |
|
401 | - 'submit_hover_bg_color' => 'efefef', |
|
402 | - 'submit_hover_color' => '444444', |
|
403 | - 'submit_hover_border_color' => 'cccccc', |
|
404 | - 'submit_active_bg_color' => 'efefef', |
|
405 | - 'submit_active_color' => '444444', |
|
406 | - 'submit_active_border_color' => 'cccccc', |
|
407 | - |
|
408 | - 'border_radius' => '4px', |
|
409 | - 'error_bg' => 'F2DEDE', |
|
410 | - 'error_border' => 'EBCCD1', |
|
411 | - 'error_text' => 'B94A48', |
|
412 | - 'error_font_size' => '14px', |
|
413 | - |
|
414 | - 'success_bg_color' => 'DFF0D8', |
|
415 | - 'success_border_color' => 'D6E9C6', |
|
416 | - 'success_text_color' => '468847', |
|
417 | - 'success_font_size' => '14px', |
|
418 | - |
|
419 | - 'important_style' => false, |
|
378 | + 'section_bg_color' => '', |
|
379 | + 'section_border_color' => 'e8e8e8', |
|
380 | + 'section_border_width' => '2px', |
|
381 | + 'section_border_style' => 'solid', |
|
382 | + 'section_border_loc' => '-top', |
|
383 | + 'collapse_icon' => '6', |
|
384 | + 'collapse_pos' => 'after', |
|
385 | + 'repeat_icon' => '1', |
|
386 | + |
|
387 | + 'submit_style' => false, |
|
388 | + 'submit_font_size' => '14px', |
|
389 | + 'submit_width' => 'auto', |
|
390 | + 'submit_height' => 'auto', |
|
391 | + 'submit_bg_color' => 'ffffff', |
|
392 | + 'submit_border_color' => 'cccccc', |
|
393 | + 'submit_border_width' => '1px', |
|
394 | + 'submit_text_color' => '444444', |
|
395 | + 'submit_weight' => 'normal', |
|
396 | + 'submit_border_radius' => '4px', |
|
397 | + 'submit_bg_img' => '', |
|
398 | + 'submit_margin' => '10px', |
|
399 | + 'submit_padding' => '6px 11px', |
|
400 | + 'submit_shadow_color' => 'eeeeee', |
|
401 | + 'submit_hover_bg_color' => 'efefef', |
|
402 | + 'submit_hover_color' => '444444', |
|
403 | + 'submit_hover_border_color' => 'cccccc', |
|
404 | + 'submit_active_bg_color' => 'efefef', |
|
405 | + 'submit_active_color' => '444444', |
|
406 | + 'submit_active_border_color' => 'cccccc', |
|
407 | + |
|
408 | + 'border_radius' => '4px', |
|
409 | + 'error_bg' => 'F2DEDE', |
|
410 | + 'error_border' => 'EBCCD1', |
|
411 | + 'error_text' => 'B94A48', |
|
412 | + 'error_font_size' => '14px', |
|
413 | + |
|
414 | + 'success_bg_color' => 'DFF0D8', |
|
415 | + 'success_border_color' => 'D6E9C6', |
|
416 | + 'success_text_color' => '468847', |
|
417 | + 'success_font_size' => '14px', |
|
418 | + |
|
419 | + 'important_style' => false, |
|
420 | 420 | |
421 | 421 | 'progress_bg_color' => 'dddddd', |
422 | 422 | 'progress_active_color' => 'ffffff', |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | 'progress_border_size' => '2px', |
427 | 427 | 'progress_size' => '30px', |
428 | 428 | |
429 | - 'custom_css' => '', |
|
430 | - ); |
|
431 | - } |
|
429 | + 'custom_css' => '', |
|
430 | + ); |
|
431 | + } |
|
432 | 432 | |
433 | 433 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
434 | 434 | return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']'; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class FrmStyle { |
3 | - public $number = false; // Unique ID number of the current instance. |
|
3 | + public $number = false; // Unique ID number of the current instance. |
|
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $max_slug_value = 2147483647; |
17 | 17 | $min_slug_value = 37; // we want to have at least 2 characters in the slug |
18 | - $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
18 | + $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); |
|
19 | 19 | |
20 | 20 | $style = array( |
21 | 21 | 'post_type' => FrmStylesController::$post_type, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function update( $id = 'default' ) { |
42 | 42 | $all_instances = $this->get_all(); |
43 | 43 | |
44 | - if ( empty($id) ) { |
|
44 | + if ( empty( $id ) ) { |
|
45 | 45 | $new_style = (array) $this->get_new(); |
46 | 46 | $all_instances[] = $new_style; |
47 | 47 | } |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | $action_ids = array(); |
50 | 50 | |
51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
52 | - $new_instance = stripslashes_deep( (array) $new_instance); |
|
52 | + $new_instance = stripslashes_deep( (array) $new_instance ); |
|
53 | 53 | $this->id = $new_instance['ID']; |
54 | - if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) { |
|
55 | - $all_instances[ $number ] = $new_instance; |
|
54 | + if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
|
55 | + $all_instances[$number] = $new_instance; |
|
56 | 56 | |
57 | - if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
57 | + if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
|
58 | 58 | // this style was set to default, so remove default setting on previous default style |
59 | 59 | $new_instance['menu_order'] = 0; |
60 | - $action_ids[] = $this->save($new_instance); |
|
60 | + $action_ids[] = $this->save( $new_instance ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // don't continue if not saving this style |
@@ -67,33 +67,33 @@ discard block |
||
67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
70 | - $new_instance['post_status'] = 'publish'; |
|
70 | + $new_instance['post_status'] = 'publish'; |
|
71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
72 | 72 | |
73 | - if ( empty($id) ) { |
|
73 | + if ( empty( $id ) ) { |
|
74 | 74 | $new_instance['post_name'] = $new_instance['post_title']; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $default_settings = $this->get_defaults(); |
78 | 78 | |
79 | 79 | foreach ( $default_settings as $setting => $default ) { |
80 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
81 | - $new_instance['post_content'][ $setting ] = $default; |
|
80 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
81 | + $new_instance['post_content'][$setting] = $default; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
85 | 85 | //if is a color |
86 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
87 | - } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
88 | - $new_instance['post_content'][ $setting ] = 0; |
|
86 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
87 | + } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
88 | + $new_instance['post_content'][$setting] = 0; |
|
89 | 89 | } else if ( $setting == 'font' ) { |
90 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
90 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - $all_instances[ $number ] = $new_instance; |
|
94 | + $all_instances[$number] = $new_instance; |
|
95 | 95 | |
96 | - $action_ids[] = $this->save($new_instance); |
|
96 | + $action_ids[] = $this->save( $new_instance ); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function save_settings() { |
109 | 109 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
110 | - update_option( 'frm_last_style_update', date('njGi') ); |
|
110 | + update_option( 'frm_last_style_update', date( 'njGi' ) ); |
|
111 | 111 | |
112 | - if ( ! is_file($filename) ) { |
|
112 | + if ( ! is_file( $filename ) ) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | 115 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
121 | 121 | $create_file->create_file( $css ); |
122 | 122 | |
123 | - update_option('frmpro_css', $css); |
|
123 | + update_option( 'frmpro_css', $css ); |
|
124 | 124 | |
125 | - set_transient('frmpro_css', $css); |
|
125 | + set_transient( 'frmpro_css', $css ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | private function get_css_content( $filename ) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | public function destroy( $id ) { |
157 | - return wp_delete_post($id); |
|
157 | + return wp_delete_post( $id ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | public function get_one() { |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | return $style; |
169 | 169 | } |
170 | 170 | |
171 | - $style = get_post($this->id); |
|
171 | + $style = get_post( $this->id ); |
|
172 | 172 | |
173 | 173 | if ( ! $style ) { |
174 | 174 | return $style; |
175 | 175 | } |
176 | 176 | |
177 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
177 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
178 | 178 | |
179 | 179 | $default_values = $this->get_defaults(); |
180 | 180 | |
181 | 181 | // fill default values |
182 | - $style->post_content = $this->override_defaults($style->post_content); |
|
183 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
182 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
183 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
184 | 184 | |
185 | 185 | return $style; |
186 | 186 | } |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | 'order' => $order, |
195 | 195 | ); |
196 | 196 | |
197 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
197 | + $temp_styles = FrmAppHelper::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' ); |
|
198 | 198 | |
199 | - if ( empty($temp_styles) ) { |
|
199 | + if ( empty( $temp_styles ) ) { |
|
200 | 200 | global $wpdb; |
201 | 201 | // make sure there wasn't a conflict with the query |
202 | 202 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
203 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
203 | + $temp_styles = FrmAppHelper::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); |
|
204 | 204 | |
205 | - if ( empty($temp_styles) ) { |
|
205 | + if ( empty( $temp_styles ) ) { |
|
206 | 206 | // create a new style if there are none |
207 | 207 | $new = $this->get_new(); |
208 | 208 | $new->post_title = __( 'Formidable Style', 'formidable' ); |
209 | 209 | $new->post_name = $new->post_title; |
210 | 210 | $new->menu_order = 1; |
211 | - $new = $this->save( (array) $new); |
|
212 | - $this->update('default'); |
|
211 | + $new = $this->save( (array) $new ); |
|
212 | + $this->update( 'default' ); |
|
213 | 213 | |
214 | 214 | $post_atts['include'] = $new; |
215 | 215 | |
@@ -233,25 +233,25 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
236 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
237 | 237 | |
238 | 238 | // fill default values |
239 | - $style->post_content = $this->override_defaults($style->post_content); |
|
240 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
239 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
240 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
241 | 241 | |
242 | - $styles[ $style->ID ] = $style; |
|
242 | + $styles[$style->ID] = $style; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if ( ! $default_style ) { |
246 | - $default_style = reset($styles); |
|
247 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
246 | + $default_style = reset( $styles ); |
|
247 | + $styles[$default_style->ID]->menu_order = 1; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $styles; |
251 | 251 | } |
252 | 252 | |
253 | 253 | public function get_default_style( $styles = null ) { |
254 | - if ( ! isset($styles) ) { |
|
254 | + if ( ! isset( $styles ) ) { |
|
255 | 255 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
256 | 256 | } |
257 | 257 | |
@@ -263,24 +263,24 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | public function override_defaults( $settings ) { |
266 | - if ( ! is_array($settings) ) { |
|
266 | + if ( ! is_array( $settings ) ) { |
|
267 | 267 | return $settings; |
268 | 268 | } |
269 | 269 | |
270 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
270 | + $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
|
271 | 271 | |
272 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
272 | + if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
|
273 | 273 | $settings['form_desc_size'] = $settings['description_font_size']; |
274 | 274 | $settings['form_desc_color'] = $settings['description_color']; |
275 | 275 | $settings['title_color'] = $settings['label_color']; |
276 | 276 | } |
277 | 277 | |
278 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
278 | + if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
|
279 | 279 | $settings['section_color'] = $settings['label_color']; |
280 | 280 | $settings['section_border_color'] = $settings['border_color']; |
281 | 281 | } |
282 | 282 | |
283 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
283 | + if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
|
284 | 284 | $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
285 | 285 | $settings['submit_hover_color'] = $settings['submit_text_color']; |
286 | 286 | $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | <a href="javascript:void(0)" class="show_field_custom_html frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="<?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
23 | 23 | </li> |
24 | 24 | <?php |
25 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | - unset($skey, $sname); |
|
25 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
26 | + unset( $skey, $sname ); |
|
27 | 27 | } |
28 | 28 | ?> |
29 | 29 | </ul> |
@@ -36,18 +36,18 @@ discard block |
||
36 | 36 | 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
37 | 37 | ) as $skey => $sname ) { ?> |
38 | 38 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
39 | - <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
|
39 | + <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ); ?></a> |
|
40 | 40 | </li> |
41 | 41 | <?php |
42 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
42 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
46 | 46 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
47 | - <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
|
47 | + <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ); ?></a> |
|
48 | 48 | </li> |
49 | 49 | <?php |
50 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
50 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
51 | 51 | } ?> |
52 | 52 | </ul> |
53 | 53 | </div> |
@@ -1,53 +1,53 @@ |
||
1 | 1 | <div id="frm-html-tags" class="tabs-panel"> |
2 | 2 | <ul class="frm_code_list"> |
3 | 3 | <?php |
4 | - $col = 'one'; |
|
5 | - $entry_shortcodes = array( |
|
6 | - 'id' => __( 'Field ID', 'formidable' ), |
|
7 | - 'key' => __( 'Field Key', 'formidable' ), |
|
8 | - 'field_name' => __( 'Field Name', 'formidable' ), |
|
9 | - 'description' => __( 'Field Description', 'formidable' ), |
|
10 | - 'label_position' => __( 'Label Position', 'formidable' ), |
|
11 | - 'required_label' => __( 'Required Label', 'formidable' ), |
|
12 | - 'input' => __( 'Input Field', 'formidable' ), |
|
4 | + $col = 'one'; |
|
5 | + $entry_shortcodes = array( |
|
6 | + 'id' => __( 'Field ID', 'formidable' ), |
|
7 | + 'key' => __( 'Field Key', 'formidable' ), |
|
8 | + 'field_name' => __( 'Field Name', 'formidable' ), |
|
9 | + 'description' => __( 'Field Description', 'formidable' ), |
|
10 | + 'label_position' => __( 'Label Position', 'formidable' ), |
|
11 | + 'required_label' => __( 'Required Label', 'formidable' ), |
|
12 | + 'input' => __( 'Input Field', 'formidable' ), |
|
13 | 13 | 'input opt=1' => array( 'label' => __( 'Single Option', 'formidable' ), 'title' => __( 'Show a single radio or checkbox option by replacing 1 with the order of the option', 'formidable' ) ), |
14 | - 'input label=0' => __( 'Hide Option Label', 'formidable' ), |
|
14 | + 'input label=0' => __( 'Hide Option Label', 'formidable' ), |
|
15 | 15 | 'required_class' => array( 'label' => __( 'Required Class', 'formidable' ), 'title' => __( 'Add class name if field is required', 'formidable' ) ), |
16 | 16 | 'error_class' => array( 'label' => __( 'Error Class', 'formidable' ), 'title' => __( 'Add class name if field has an error on form submit', 'formidable' ) ), |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | 19 | foreach ( $entry_shortcodes as $skey => $sname ) { |
20 | - ?> |
|
20 | + ?> |
|
21 | 21 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
22 | 22 | <a href="javascript:void(0)" class="show_field_custom_html frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="<?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
23 | 23 | </li> |
24 | 24 | <?php |
25 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | - unset($skey, $sname); |
|
27 | - } |
|
28 | - ?> |
|
25 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | + unset($skey, $sname); |
|
27 | + } |
|
28 | + ?> |
|
29 | 29 | </ul> |
30 | 30 | |
31 | 31 | <ul class="frm_code_list frm_clear"> |
32 | 32 | <?php |
33 | - $col = 'one'; |
|
33 | + $col = 'one'; |
|
34 | 34 | foreach ( array( |
35 | - 'form_name' => __( 'Form Name', 'formidable' ), 'form_description' => __( 'Form Description', 'formidable' ), |
|
36 | - 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
|
35 | + 'form_name' => __( 'Form Name', 'formidable' ), 'form_description' => __( 'Form Description', 'formidable' ), |
|
36 | + 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
|
37 | 37 | ) as $skey => $sname ) { ?> |
38 | 38 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
39 | 39 | <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
40 | 40 | </li> |
41 | 41 | <?php |
42 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
43 | - } |
|
42 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
43 | + } |
|
44 | 44 | |
45 | - foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
|
45 | + foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
|
46 | 46 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
47 | 47 | <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
48 | 48 | </li> |
49 | 49 | <?php |
50 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
51 | - } ?> |
|
50 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
51 | + } ?> |
|
52 | 52 | </ul> |
53 | 53 | </div> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! $item_ids ) { |
4 | - return; |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | global $wp_query; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ( empty( $taxonomies ) ) { |
68 | - return; |
|
68 | + return; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | global $frm_inc_tax; |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | foreach ( (array) $terms as $term ) { |
77 | 77 | if ( in_array( $term->term_id, $frm_inc_tax ) ) { |
78 | - return; |
|
78 | + return; |
|
79 | 79 | } |
80 | 80 | |
81 | - $frm_inc_tax[] = $term->term_id; |
|
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
81 | + $frm_inc_tax[] = $term->term_id; |
|
82 | + $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo esc_html( $term->term_id ) ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
84 | - if ( ! empty( $term->name ) ) { |
|
85 | - echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | - } |
|
87 | - if ( ! empty( $term->description ) ) { |
|
88 | - ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | - } |
|
90 | - ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
84 | + if ( ! empty( $term->name ) ) { |
|
85 | + echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | + } |
|
87 | + if ( ! empty( $term->description ) ) { |
|
88 | + ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | + } |
|
90 | + ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
91 | 91 | <?php |
92 | 92 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | $frm_inc_tax[] = $term->term_id; |
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
82 | + $label = ( $term->taxonomy == 'category' || $term->taxonomy == 'tag' ) ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo esc_html( $term->term_id ) ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
84 | 84 | if ( ! empty( $term->name ) ) { |
85 | 85 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |