@@ -145,6 +145,9 @@ discard block |
||
145 | 145 | wp_die(); |
146 | 146 | } |
147 | 147 | |
148 | + /** |
|
149 | + * @param string $field |
|
150 | + */ |
|
148 | 151 | private static function edit_in_place_value( $field ) { |
149 | 152 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
150 | 153 | FrmAppHelper::permission_check('frm_edit_forms', 'hide'); |
@@ -677,6 +680,7 @@ discard block |
||
677 | 680 | /** |
678 | 681 | * Get an array of the helper shortcodes to display in the customization panel |
679 | 682 | * @since 2.0.6 |
683 | + * @param boolean $settings_tab |
|
680 | 684 | */ |
681 | 685 | private static function get_shortcode_helpers( $settings_tab ) { |
682 | 686 | $entry_shortcodes = array( |
@@ -749,6 +753,9 @@ discard block |
||
749 | 753 | return $content; |
750 | 754 | } |
751 | 755 | |
756 | + /** |
|
757 | + * @param boolean $entry |
|
758 | + */ |
|
752 | 759 | private static function get_entry_by_param( &$entry ) { |
753 | 760 | if ( ! $entry || ! is_object( $entry ) ) { |
754 | 761 | if ( ! $entry || ! is_numeric( $entry ) ) { |
@@ -1207,6 +1214,7 @@ discard block |
||
1207 | 1214 | |
1208 | 1215 | /** |
1209 | 1216 | * @since 2.0.8 |
1217 | + * @param string $content |
|
1210 | 1218 | */ |
1211 | 1219 | private static function maybe_minimize_form( $atts, &$content ) { |
1212 | 1220 | // check if minimizing is turned on |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmFormsController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | $menu_label = __( 'Forms', 'formidable' ); |
7 | 7 | if ( ! FrmAppHelper::pro_is_installed() ) { |
8 | 8 | $menu_label .= ' (Lite)'; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | add_submenu_page('formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
11 | 11 | |
12 | 12 | self::maybe_load_listing_hooks(); |
13 | - } |
|
13 | + } |
|
14 | 14 | |
15 | 15 | public static function maybe_load_listing_hooks() { |
16 | 16 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
@@ -24,128 +24,128 @@ discard block |
||
24 | 24 | add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
25 | 25 | } |
26 | 26 | |
27 | - public static function head() { |
|
28 | - wp_enqueue_script('formidable-editinplace'); |
|
27 | + public static function head() { |
|
28 | + wp_enqueue_script('formidable-editinplace'); |
|
29 | 29 | |
30 | - if ( wp_is_mobile() ) { |
|
31 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
32 | - } |
|
33 | - } |
|
30 | + if ( wp_is_mobile() ) { |
|
31 | + wp_enqueue_script( 'jquery-touch-punch' ); |
|
32 | + } |
|
33 | + } |
|
34 | 34 | |
35 | - public static function register_widgets() { |
|
36 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
37 | - register_widget('FrmShowForm'); |
|
38 | - } |
|
35 | + public static function register_widgets() { |
|
36 | + require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
37 | + register_widget('FrmShowForm'); |
|
38 | + } |
|
39 | 39 | |
40 | - public static function list_form() { |
|
41 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
40 | + public static function list_form() { |
|
41 | + FrmAppHelper::permission_check('frm_view_forms'); |
|
42 | 42 | |
43 | 43 | $params = FrmForm::list_page_params(); |
44 | - $errors = self::process_bulk_form_actions( array()); |
|
45 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
44 | + $errors = self::process_bulk_form_actions( array()); |
|
45 | + $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
46 | 46 | |
47 | 47 | return self::display_forms_list( $params, '', $errors ); |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | 50 | public static function new_form( $values = array() ) { |
51 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
51 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
52 | 52 | |
53 | - global $frm_vars; |
|
53 | + global $frm_vars; |
|
54 | 54 | |
55 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
55 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
56 | 56 | $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
57 | 57 | |
58 | 58 | if ( $action == 'create' ) { |
59 | - return self::create($values); |
|
59 | + return self::create($values); |
|
60 | 60 | } else if ( $action == 'new' ) { |
61 | 61 | $frm_field_selection = FrmField::field_selection(); |
62 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
63 | - $id = FrmForm::create( $values ); |
|
64 | - $form = FrmForm::getOne($id); |
|
62 | + $values = FrmFormsHelper::setup_new_vars($values); |
|
63 | + $id = FrmForm::create( $values ); |
|
64 | + $form = FrmForm::getOne($id); |
|
65 | 65 | |
66 | - // add default email notification |
|
67 | - $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
68 | - $action_control->create($form->id); |
|
66 | + // add default email notification |
|
67 | + $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
|
68 | + $action_control->create($form->id); |
|
69 | 69 | |
70 | 70 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
71 | 71 | |
72 | - $values['id'] = $id; |
|
72 | + $values['id'] = $id; |
|
73 | 73 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
74 | - } |
|
75 | - } |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | public static function create( $values = array() ) { |
78 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
78 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
79 | 79 | |
80 | - global $frm_vars; |
|
81 | - if ( empty( $values ) ) { |
|
82 | - $values = $_POST; |
|
83 | - } |
|
80 | + global $frm_vars; |
|
81 | + if ( empty( $values ) ) { |
|
82 | + $values = $_POST; |
|
83 | + } |
|
84 | 84 | |
85 | - //Set radio button and checkbox meta equal to "other" value |
|
86 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
87 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
88 | - } |
|
85 | + //Set radio button and checkbox meta equal to "other" value |
|
86 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
87 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
91 | 91 | |
92 | - if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
93 | - $frm_settings = FrmAppHelper::get_settings(); |
|
94 | - $errors = array( 'form' => $frm_settings->admin_permission ); |
|
95 | - } else { |
|
96 | - $errors = FrmForm::validate($values); |
|
97 | - } |
|
92 | + if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
|
93 | + $frm_settings = FrmAppHelper::get_settings(); |
|
94 | + $errors = array( 'form' => $frm_settings->admin_permission ); |
|
95 | + } else { |
|
96 | + $errors = FrmForm::validate($values); |
|
97 | + } |
|
98 | 98 | |
99 | - if ( count($errors) > 0 ) { |
|
100 | - $hide_preview = true; |
|
99 | + if ( count($errors) > 0 ) { |
|
100 | + $hide_preview = true; |
|
101 | 101 | $frm_field_selection = FrmField::field_selection(); |
102 | - $form = FrmForm::getOne( $id ); |
|
103 | - $fields = FrmField::get_all_for_form($id); |
|
102 | + $form = FrmForm::getOne( $id ); |
|
103 | + $fields = FrmField::get_all_for_form($id); |
|
104 | 104 | |
105 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
105 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
106 | 106 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
107 | 107 | |
108 | 108 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
109 | - } else { |
|
110 | - FrmForm::update( $id, $values, true ); |
|
109 | + } else { |
|
110 | + FrmForm::update( $id, $values, true ); |
|
111 | 111 | $url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ); |
112 | 112 | die( FrmAppHelper::js_redirect( $url ) ); |
113 | - } |
|
114 | - } |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - public static function edit( $values = false ) { |
|
117 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
116 | + public static function edit( $values = false ) { |
|
117 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
118 | 118 | |
119 | 119 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
120 | - return self::get_edit_vars($id); |
|
121 | - } |
|
120 | + return self::get_edit_vars($id); |
|
121 | + } |
|
122 | 122 | |
123 | - public static function settings( $id = false, $message = '' ) { |
|
124 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
123 | + public static function settings( $id = false, $message = '' ) { |
|
124 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
125 | 125 | |
126 | - if ( ! $id || ! is_numeric($id) ) { |
|
126 | + if ( ! $id || ! is_numeric($id) ) { |
|
127 | 127 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
128 | - } |
|
128 | + } |
|
129 | 129 | return self::get_settings_vars( $id, array(), $message ); |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - public static function update_settings() { |
|
133 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
132 | + public static function update_settings() { |
|
133 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
134 | 134 | |
135 | 135 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
136 | 136 | |
137 | - $errors = FrmForm::validate($_POST); |
|
138 | - if ( count($errors) > 0 ) { |
|
139 | - return self::get_settings_vars($id, $errors); |
|
140 | - } |
|
137 | + $errors = FrmForm::validate($_POST); |
|
138 | + if ( count($errors) > 0 ) { |
|
139 | + return self::get_settings_vars($id, $errors); |
|
140 | + } |
|
141 | 141 | |
142 | - do_action('frm_before_update_form_settings', $id); |
|
142 | + do_action('frm_before_update_form_settings', $id); |
|
143 | 143 | |
144 | 144 | FrmForm::update( $id, $_POST ); |
145 | 145 | |
146 | - $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
146 | + $message = __( 'Settings Successfully Updated', 'formidable' ); |
|
147 | 147 | return self::get_settings_vars( $id, array(), $message ); |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | 150 | public static function edit_key() { |
151 | 151 | $values = self::edit_in_place_value( 'form_key' ); |
@@ -175,43 +175,43 @@ discard block |
||
175 | 175 | |
176 | 176 | public static function update( $values = array() ) { |
177 | 177 | if ( empty( $values ) ) { |
178 | - $values = $_POST; |
|
179 | - } |
|
178 | + $values = $_POST; |
|
179 | + } |
|
180 | 180 | |
181 | - //Set radio button and checkbox meta equal to "other" value |
|
182 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
183 | - $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
184 | - } |
|
181 | + //Set radio button and checkbox meta equal to "other" value |
|
182 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
183 | + $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
|
184 | + } |
|
185 | 185 | |
186 | - $errors = FrmForm::validate( $values ); |
|
187 | - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
188 | - if ( $permission_error !== false ) { |
|
189 | - $errors['form'] = $permission_error; |
|
190 | - } |
|
186 | + $errors = FrmForm::validate( $values ); |
|
187 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' ); |
|
188 | + if ( $permission_error !== false ) { |
|
189 | + $errors['form'] = $permission_error; |
|
190 | + } |
|
191 | 191 | |
192 | 192 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
193 | 193 | |
194 | 194 | if ( count( $errors ) > 0 ) { |
195 | - return self::get_edit_vars( $id, $errors ); |
|
195 | + return self::get_edit_vars( $id, $errors ); |
|
196 | 196 | } else { |
197 | - FrmForm::update( $id, $values ); |
|
198 | - $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
199 | - if ( defined( 'DOING_AJAX' ) ) { |
|
197 | + FrmForm::update( $id, $values ); |
|
198 | + $message = __( 'Form was Successfully Updated', 'formidable' ); |
|
199 | + if ( defined( 'DOING_AJAX' ) ) { |
|
200 | 200 | wp_die( $message ); |
201 | - } |
|
201 | + } |
|
202 | 202 | return self::get_edit_vars( $id, array(), $message ); |
203 | - } |
|
204 | - } |
|
203 | + } |
|
204 | + } |
|
205 | 205 | |
206 | - public static function bulk_create_template( $ids ) { |
|
207 | - FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
206 | + public static function bulk_create_template( $ids ) { |
|
207 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
208 | 208 | |
209 | - foreach ( $ids as $id ) { |
|
210 | - FrmForm::duplicate( $id, true, true ); |
|
211 | - } |
|
209 | + foreach ( $ids as $id ) { |
|
210 | + FrmForm::duplicate( $id, true, true ); |
|
211 | + } |
|
212 | 212 | |
213 | - return __( 'Form template was Successfully Created', 'formidable' ); |
|
214 | - } |
|
213 | + return __( 'Form template was Successfully Created', 'formidable' ); |
|
214 | + } |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * Redirect to the url for creating from a template |
@@ -233,45 +233,45 @@ discard block |
||
233 | 233 | wp_die(); |
234 | 234 | } |
235 | 235 | |
236 | - public static function duplicate() { |
|
237 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
236 | + public static function duplicate() { |
|
237 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
238 | 238 | |
239 | 239 | $params = FrmForm::list_page_params(); |
240 | - $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
241 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
242 | - if ( $form ) { |
|
240 | + $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
|
241 | + $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
242 | + if ( $form ) { |
|
243 | 243 | return self::get_edit_vars( $form, array(), $message, true ); |
244 | - } else { |
|
245 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
246 | - } |
|
247 | - } |
|
244 | + } else { |
|
245 | + return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
246 | + } |
|
247 | + } |
|
248 | 248 | |
249 | - public static function page_preview() { |
|
249 | + public static function page_preview() { |
|
250 | 250 | $params = FrmForm::list_page_params(); |
251 | - if ( ! $params['form'] ) { |
|
252 | - return; |
|
253 | - } |
|
254 | - |
|
255 | - $form = FrmForm::getOne( $params['form'] ); |
|
256 | - if ( ! $form ) { |
|
257 | - return; |
|
258 | - } |
|
259 | - return self::show_form( $form->id, '', true, true ); |
|
260 | - } |
|
261 | - |
|
262 | - public static function preview() { |
|
263 | - do_action( 'frm_wp' ); |
|
264 | - |
|
265 | - global $frm_vars; |
|
266 | - $frm_vars['preview'] = true; |
|
267 | - |
|
268 | - if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
269 | - global $wp; |
|
270 | - $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
251 | + if ( ! $params['form'] ) { |
|
252 | + return; |
|
253 | + } |
|
254 | + |
|
255 | + $form = FrmForm::getOne( $params['form'] ); |
|
256 | + if ( ! $form ) { |
|
257 | + return; |
|
258 | + } |
|
259 | + return self::show_form( $form->id, '', true, true ); |
|
260 | + } |
|
261 | + |
|
262 | + public static function preview() { |
|
263 | + do_action( 'frm_wp' ); |
|
264 | + |
|
265 | + global $frm_vars; |
|
266 | + $frm_vars['preview'] = true; |
|
267 | + |
|
268 | + if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) { |
|
269 | + global $wp; |
|
270 | + $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
271 | 271 | include_once( $root . '/wp-config.php' ); |
272 | - $wp->init(); |
|
273 | - $wp->register_globals(); |
|
274 | - } |
|
272 | + $wp->init(); |
|
273 | + $wp->register_globals(); |
|
274 | + } |
|
275 | 275 | |
276 | 276 | self::register_pro_scripts(); |
277 | 277 | |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 ); |
286 | 286 | if ( empty( $form ) ) { |
287 | 287 | $form = FrmForm::getAll( array(), '', 1 ); |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | 290 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' ); |
291 | - wp_die(); |
|
292 | - } |
|
291 | + wp_die(); |
|
292 | + } |
|
293 | 293 | |
294 | 294 | public static function register_pro_scripts() { |
295 | 295 | if ( FrmAppHelper::pro_is_installed() ) { |
@@ -299,22 +299,22 @@ discard block |
||
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | - public static function untrash() { |
|
302 | + public static function untrash() { |
|
303 | 303 | self::change_form_status( 'untrash' ); |
304 | - } |
|
304 | + } |
|
305 | 305 | |
306 | 306 | public static function bulk_untrash( $ids ) { |
307 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
307 | + FrmAppHelper::permission_check('frm_edit_forms'); |
|
308 | 308 | |
309 | - $count = FrmForm::set_status( $ids, 'published' ); |
|
309 | + $count = FrmForm::set_status( $ids, 'published' ); |
|
310 | 310 | |
311 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
312 | - return $message; |
|
313 | - } |
|
311 | + $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
312 | + return $message; |
|
313 | + } |
|
314 | 314 | |
315 | - public static function trash() { |
|
315 | + public static function trash() { |
|
316 | 316 | self::change_form_status( 'trash' ); |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * @param string $status |
@@ -352,68 +352,68 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | public static function bulk_trash( $ids ) { |
355 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
355 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
356 | 356 | |
357 | - $count = 0; |
|
358 | - foreach ( $ids as $id ) { |
|
359 | - if ( FrmForm::trash( $id ) ) { |
|
360 | - $count++; |
|
361 | - } |
|
362 | - } |
|
357 | + $count = 0; |
|
358 | + foreach ( $ids as $id ) { |
|
359 | + if ( FrmForm::trash( $id ) ) { |
|
360 | + $count++; |
|
361 | + } |
|
362 | + } |
|
363 | 363 | |
364 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
364 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
365 | 365 | $message = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type=' . $current_page . '&item-action[]=' . implode( 'item-action[]=', $ids ), 'bulk-toplevel_page_formidable' ) ) . '">', '</a>' ); |
366 | 366 | |
367 | - return $message; |
|
368 | - } |
|
367 | + return $message; |
|
368 | + } |
|
369 | 369 | |
370 | - public static function destroy() { |
|
371 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
370 | + public static function destroy() { |
|
371 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
372 | 372 | |
373 | 373 | $params = FrmForm::list_page_params(); |
374 | 374 | |
375 | - //check nonce url |
|
376 | - check_admin_referer('destroy_form_' . $params['id']); |
|
375 | + //check nonce url |
|
376 | + check_admin_referer('destroy_form_' . $params['id']); |
|
377 | 377 | |
378 | - $count = 0; |
|
379 | - if ( FrmForm::destroy( $params['id'] ) ) { |
|
380 | - $count++; |
|
381 | - } |
|
378 | + $count = 0; |
|
379 | + if ( FrmForm::destroy( $params['id'] ) ) { |
|
380 | + $count++; |
|
381 | + } |
|
382 | 382 | |
383 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
383 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
384 | 384 | |
385 | 385 | self::display_forms_list( $params, $message ); |
386 | - } |
|
386 | + } |
|
387 | 387 | |
388 | 388 | public static function bulk_destroy( $ids ) { |
389 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
389 | + FrmAppHelper::permission_check('frm_delete_forms'); |
|
390 | 390 | |
391 | - $count = 0; |
|
392 | - foreach ( $ids as $id ) { |
|
393 | - $d = FrmForm::destroy( $id ); |
|
394 | - if ( $d ) { |
|
395 | - $count++; |
|
396 | - } |
|
397 | - } |
|
391 | + $count = 0; |
|
392 | + foreach ( $ids as $id ) { |
|
393 | + $d = FrmForm::destroy( $id ); |
|
394 | + if ( $d ) { |
|
395 | + $count++; |
|
396 | + } |
|
397 | + } |
|
398 | 398 | |
399 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
399 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
400 | 400 | |
401 | - return $message; |
|
402 | - } |
|
401 | + return $message; |
|
402 | + } |
|
403 | 403 | |
404 | - private static function delete_all() { |
|
405 | - //check nonce url |
|
406 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
407 | - if ( $permission_error !== false ) { |
|
404 | + private static function delete_all() { |
|
405 | + //check nonce url |
|
406 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
407 | + if ( $permission_error !== false ) { |
|
408 | 408 | self::display_forms_list( array(), '', array( $permission_error ) ); |
409 | - return; |
|
410 | - } |
|
409 | + return; |
|
410 | + } |
|
411 | 411 | |
412 | 412 | $count = FrmForm::scheduled_delete( time() ); |
413 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
413 | + $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
414 | 414 | |
415 | 415 | self::display_forms_list( array(), $message ); |
416 | - } |
|
416 | + } |
|
417 | 417 | |
418 | 418 | public static function scheduled_delete( $delete_timestamp = '' ) { |
419 | 419 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' ); |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | - * Inserts Formidable button |
|
425 | - * Hook exists since 2.5.0 |
|
426 | - * |
|
427 | - * @since 2.0.15 |
|
428 | - */ |
|
424 | + * Inserts Formidable button |
|
425 | + * Hook exists since 2.5.0 |
|
426 | + * |
|
427 | + * @since 2.0.15 |
|
428 | + */ |
|
429 | 429 | public static function insert_form_button() { |
430 | 430 | if ( current_user_can('frm_view_forms') ) { |
431 | 431 | $menu_name = FrmAppHelper::get_menu_name(); |
@@ -436,49 +436,49 @@ discard block |
||
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
439 | - public static function insert_form_popup() { |
|
439 | + public static function insert_form_popup() { |
|
440 | 440 | $page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) ); |
441 | 441 | if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) { |
442 | - return; |
|
443 | - } |
|
442 | + return; |
|
443 | + } |
|
444 | 444 | |
445 | - FrmAppHelper::load_admin_wide_js(); |
|
445 | + FrmAppHelper::load_admin_wide_js(); |
|
446 | 446 | |
447 | - $shortcodes = array( |
|
447 | + $shortcodes = array( |
|
448 | 448 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
449 | - ); |
|
449 | + ); |
|
450 | 450 | |
451 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
451 | + $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
452 | 452 | |
453 | 453 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' ); |
454 | - } |
|
454 | + } |
|
455 | 455 | |
456 | - public static function get_shortcode_opts() { |
|
456 | + public static function get_shortcode_opts() { |
|
457 | 457 | FrmAppHelper::permission_check('frm_view_forms'); |
458 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
458 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
459 | 459 | |
460 | 460 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
461 | - if ( empty($shortcode) ) { |
|
462 | - wp_die(); |
|
463 | - } |
|
461 | + if ( empty($shortcode) ) { |
|
462 | + wp_die(); |
|
463 | + } |
|
464 | 464 | |
465 | 465 | echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">'; |
466 | 466 | echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />'; |
467 | 467 | |
468 | - $form_id = ''; |
|
469 | - $opts = array(); |
|
468 | + $form_id = ''; |
|
469 | + $opts = array(); |
|
470 | 470 | switch ( $shortcode ) { |
471 | - case 'formidable': |
|
472 | - $opts = array( |
|
471 | + case 'formidable': |
|
472 | + $opts = array( |
|
473 | 473 | 'form_id' => 'id', |
474 | - //'key' => ', |
|
474 | + //'key' => ', |
|
475 | 475 | 'title' => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ), |
476 | 476 | 'description' => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ), |
477 | 477 | 'minimize' => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ), |
478 | - ); |
|
479 | - break; |
|
480 | - } |
|
481 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
478 | + ); |
|
479 | + break; |
|
480 | + } |
|
481 | + $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
482 | 482 | |
483 | 483 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
484 | 484 | // allow other shortcodes to use the required form id option |
@@ -488,61 +488,61 @@ discard block |
||
488 | 488 | |
489 | 489 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' ); |
490 | 490 | |
491 | - echo '</div>'; |
|
491 | + echo '</div>'; |
|
492 | 492 | |
493 | - wp_die(); |
|
494 | - } |
|
493 | + wp_die(); |
|
494 | + } |
|
495 | 495 | |
496 | 496 | public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) { |
497 | - FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
497 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
498 | 498 | if ( ! empty( $deprecated_errors ) ) { |
499 | 499 | $errors = $deprecated_errors; |
500 | 500 | _deprecated_argument( 'errors', '2.0.8' ); |
501 | 501 | } |
502 | 502 | |
503 | - global $wpdb, $frm_vars; |
|
503 | + global $wpdb, $frm_vars; |
|
504 | 504 | |
505 | 505 | if ( empty( $params ) ) { |
506 | 506 | $params = FrmForm::list_page_params(); |
507 | - } |
|
507 | + } |
|
508 | 508 | |
509 | - $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
509 | + $wp_list_table = new FrmFormsListHelper( compact( 'params' ) ); |
|
510 | 510 | |
511 | - $pagenum = $wp_list_table->get_pagenum(); |
|
511 | + $pagenum = $wp_list_table->get_pagenum(); |
|
512 | 512 | |
513 | - $wp_list_table->prepare_items(); |
|
513 | + $wp_list_table->prepare_items(); |
|
514 | 514 | |
515 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
516 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
515 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
516 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
517 | 517 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
518 | - die(); |
|
519 | - } |
|
518 | + die(); |
|
519 | + } |
|
520 | 520 | |
521 | 521 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' ); |
522 | - } |
|
522 | + } |
|
523 | 523 | |
524 | 524 | public static function get_columns( $columns ) { |
525 | - $columns['cb'] = '<input type="checkbox" />'; |
|
526 | - $columns['id'] = 'ID'; |
|
525 | + $columns['cb'] = '<input type="checkbox" />'; |
|
526 | + $columns['id'] = 'ID'; |
|
527 | 527 | |
528 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
528 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published'; |
|
529 | 529 | |
530 | - if ( 'template' == $type ) { |
|
531 | - $columns['name'] = __( 'Template Name', 'formidable' ); |
|
532 | - $columns['type'] = __( 'Type', 'formidable' ); |
|
533 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
534 | - } else { |
|
535 | - $columns['name'] = __( 'Form Title', 'formidable' ); |
|
536 | - $columns['entries'] = __( 'Entries', 'formidable' ); |
|
537 | - $columns['form_key'] = __( 'Key', 'formidable' ); |
|
538 | - $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
539 | - } |
|
530 | + if ( 'template' == $type ) { |
|
531 | + $columns['name'] = __( 'Template Name', 'formidable' ); |
|
532 | + $columns['type'] = __( 'Type', 'formidable' ); |
|
533 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
534 | + } else { |
|
535 | + $columns['name'] = __( 'Form Title', 'formidable' ); |
|
536 | + $columns['entries'] = __( 'Entries', 'formidable' ); |
|
537 | + $columns['form_key'] = __( 'Key', 'formidable' ); |
|
538 | + $columns['shortcode'] = __( 'Shortcodes', 'formidable' ); |
|
539 | + } |
|
540 | 540 | |
541 | - $columns['created_at'] = __( 'Date', 'formidable' ); |
|
541 | + $columns['created_at'] = __( 'Date', 'formidable' ); |
|
542 | 542 | |
543 | 543 | add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) ); |
544 | 544 | |
545 | - return $columns; |
|
545 | + return $columns; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | public static function get_sortable_columns() { |
@@ -556,110 +556,110 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | public static function hidden_columns( $result ) { |
559 | - $return = false; |
|
560 | - foreach ( (array) $result as $r ) { |
|
561 | - if ( ! empty( $r ) ) { |
|
562 | - $return = true; |
|
563 | - break; |
|
564 | - } |
|
565 | - } |
|
559 | + $return = false; |
|
560 | + foreach ( (array) $result as $r ) { |
|
561 | + if ( ! empty( $r ) ) { |
|
562 | + $return = true; |
|
563 | + break; |
|
564 | + } |
|
565 | + } |
|
566 | 566 | |
567 | - if ( $return ) { |
|
568 | - return $result; |
|
567 | + if ( $return ) { |
|
568 | + return $result; |
|
569 | 569 | } |
570 | 570 | |
571 | - $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
571 | + $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
572 | 572 | |
573 | - $result[] = 'created_at'; |
|
574 | - if ( $type == 'template' ) { |
|
575 | - $result[] = 'id'; |
|
576 | - $result[] = 'form_key'; |
|
577 | - } |
|
573 | + $result[] = 'created_at'; |
|
574 | + if ( $type == 'template' ) { |
|
575 | + $result[] = 'id'; |
|
576 | + $result[] = 'form_key'; |
|
577 | + } |
|
578 | 578 | |
579 | - return $result; |
|
580 | - } |
|
579 | + return $result; |
|
580 | + } |
|
581 | 581 | |
582 | 582 | public static function save_per_page( $save, $option, $value ) { |
583 | - if ( $option == 'formidable_page_formidable_per_page' ) { |
|
584 | - $save = (int) $value; |
|
585 | - } |
|
586 | - return $save; |
|
587 | - } |
|
583 | + if ( $option == 'formidable_page_formidable_per_page' ) { |
|
584 | + $save = (int) $value; |
|
585 | + } |
|
586 | + return $save; |
|
587 | + } |
|
588 | 588 | |
589 | 589 | private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) { |
590 | - global $frm_vars; |
|
590 | + global $frm_vars; |
|
591 | 591 | |
592 | - $form = FrmForm::getOne( $id ); |
|
593 | - if ( ! $form ) { |
|
594 | - wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
595 | - } |
|
592 | + $form = FrmForm::getOne( $id ); |
|
593 | + if ( ! $form ) { |
|
594 | + wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) ); |
|
595 | + } |
|
596 | 596 | |
597 | - if ( $form->parent_form_id ) { |
|
597 | + if ( $form->parent_form_id ) { |
|
598 | 598 | wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' )); |
599 | - } |
|
599 | + } |
|
600 | 600 | |
601 | 601 | $frm_field_selection = FrmField::field_selection(); |
602 | - $fields = FrmField::get_all_for_form($form->id); |
|
602 | + $fields = FrmField::get_all_for_form($form->id); |
|
603 | 603 | |
604 | - // Automatically add end section fields if they don't exist (2.0 migration) |
|
605 | - $reset_fields = false; |
|
606 | - FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
604 | + // Automatically add end section fields if they don't exist (2.0 migration) |
|
605 | + $reset_fields = false; |
|
606 | + FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields ); |
|
607 | 607 | |
608 | - if ( $reset_fields ) { |
|
609 | - $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
610 | - } |
|
608 | + if ( $reset_fields ) { |
|
609 | + $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
|
610 | + } |
|
611 | 611 | |
612 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
612 | + unset($end_section_values, $last_order, $open, $reset_fields); |
|
613 | 613 | |
614 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
614 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
615 | 615 | |
616 | - $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
617 | - if ( $form->is_template && $message == $edit_message ) { |
|
618 | - $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
619 | - } |
|
616 | + $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
|
617 | + if ( $form->is_template && $message == $edit_message ) { |
|
618 | + $message = __( 'Template was Successfully Updated', 'formidable' ); |
|
619 | + } |
|
620 | 620 | |
621 | 621 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
622 | 622 | |
623 | - if ( $form->default_template ) { |
|
624 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
625 | - } else if ( defined('DOING_AJAX') ) { |
|
626 | - wp_die(); |
|
627 | - } else if ( $create_link ) { |
|
623 | + if ( $form->default_template ) { |
|
624 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
625 | + } else if ( defined('DOING_AJAX') ) { |
|
626 | + wp_die(); |
|
627 | + } else if ( $create_link ) { |
|
628 | 628 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
629 | - } else { |
|
629 | + } else { |
|
630 | 630 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' ); |
631 | - } |
|
632 | - } |
|
631 | + } |
|
632 | + } |
|
633 | 633 | |
634 | 634 | public static function get_settings_vars( $id, $errors = array(), $message = '' ) { |
635 | 635 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
636 | 636 | |
637 | - global $frm_vars; |
|
637 | + global $frm_vars; |
|
638 | 638 | |
639 | - $form = FrmForm::getOne( $id ); |
|
639 | + $form = FrmForm::getOne( $id ); |
|
640 | 640 | |
641 | - $fields = FrmField::get_all_for_form($id); |
|
642 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
641 | + $fields = FrmField::get_all_for_form($id); |
|
642 | + $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
643 | 643 | |
644 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
645 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
646 | - } |
|
644 | + if ( isset($values['default_template']) && $values['default_template'] ) { |
|
645 | + wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
646 | + } |
|
647 | 647 | |
648 | - $action_controls = FrmFormActionsController::get_form_actions(); |
|
648 | + $action_controls = FrmFormActionsController::get_form_actions(); |
|
649 | 649 | |
650 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
651 | - $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
650 | + $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
651 | + $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
|
652 | 652 | |
653 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
653 | + $styles = apply_filters('frm_get_style_opts', array()); |
|
654 | 654 | |
655 | 655 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' ); |
656 | - } |
|
656 | + } |
|
657 | 657 | |
658 | - public static function mb_tags_box( $form_id, $class = '' ) { |
|
659 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
660 | - $linked_forms = array(); |
|
661 | - $col = 'one'; |
|
662 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
658 | + public static function mb_tags_box( $form_id, $class = '' ) { |
|
659 | + $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
660 | + $linked_forms = array(); |
|
661 | + $col = 'one'; |
|
662 | + $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
663 | 663 | |
664 | 664 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
665 | 665 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $entry_shortcodes = self::get_shortcode_helpers( $settings_tab ); |
668 | 668 | |
669 | 669 | include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' ); |
670 | - } |
|
670 | + } |
|
671 | 671 | |
672 | 672 | /** |
673 | 673 | * Get an array of the options to display in the advanced tab |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | '' => '', |
709 | 709 | 'siteurl' => __( 'Site URL', 'formidable' ), |
710 | 710 | 'sitename' => __( 'Site Name', 'formidable' ), |
711 | - ); |
|
711 | + ); |
|
712 | 712 | |
713 | 713 | if ( ! FrmAppHelper::pro_is_installed() ) { |
714 | 714 | unset( $entry_shortcodes['post_id'] ); |
@@ -735,39 +735,39 @@ discard block |
||
735 | 735 | return $entry_shortcodes; |
736 | 736 | } |
737 | 737 | |
738 | - // Insert the form class setting into the form |
|
738 | + // Insert the form class setting into the form |
|
739 | 739 | public static function form_classes( $form ) { |
740 | - if ( isset($form->options['form_class']) ) { |
|
740 | + if ( isset($form->options['form_class']) ) { |
|
741 | 741 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
742 | - } |
|
743 | - } |
|
742 | + } |
|
743 | + } |
|
744 | 744 | |
745 | - public static function get_email_html() { |
|
745 | + public static function get_email_html() { |
|
746 | 746 | FrmAppHelper::permission_check('frm_view_forms'); |
747 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
747 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
748 | 748 | echo FrmEntryFormat::show_entry( array( |
749 | 749 | 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
750 | - 'default_email' => true, |
|
750 | + 'default_email' => true, |
|
751 | 751 | 'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ), |
752 | - ) ); |
|
753 | - wp_die(); |
|
752 | + ) ); |
|
753 | + wp_die(); |
|
754 | 754 | } |
755 | 755 | |
756 | - public static function filter_content( $content, $form, $entry = false ) { |
|
756 | + public static function filter_content( $content, $form, $entry = false ) { |
|
757 | 757 | self::get_entry_by_param( $entry ); |
758 | - if ( ! $entry ) { |
|
759 | - return $content; |
|
760 | - } |
|
758 | + if ( ! $entry ) { |
|
759 | + return $content; |
|
760 | + } |
|
761 | 761 | |
762 | - if ( is_object( $form ) ) { |
|
763 | - $form = $form->id; |
|
764 | - } |
|
762 | + if ( is_object( $form ) ) { |
|
763 | + $form = $form->id; |
|
764 | + } |
|
765 | 765 | |
766 | - $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
767 | - $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
766 | + $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form ); |
|
767 | + $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes ); |
|
768 | 768 | |
769 | - return $content; |
|
770 | - } |
|
769 | + return $content; |
|
770 | + } |
|
771 | 771 | |
772 | 772 | private static function get_entry_by_param( &$entry ) { |
773 | 773 | if ( ! $entry || ! is_object( $entry ) ) { |
@@ -779,287 +779,287 @@ discard block |
||
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
782 | - public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
783 | - return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
784 | - } |
|
782 | + public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
|
783 | + return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); |
|
784 | + } |
|
785 | 785 | |
786 | - public static function process_bulk_form_actions( $errors ) { |
|
787 | - if ( ! $_REQUEST ) { |
|
788 | - return $errors; |
|
789 | - } |
|
786 | + public static function process_bulk_form_actions( $errors ) { |
|
787 | + if ( ! $_REQUEST ) { |
|
788 | + return $errors; |
|
789 | + } |
|
790 | 790 | |
791 | 791 | $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
792 | - if ( $bulkaction == -1 ) { |
|
792 | + if ( $bulkaction == -1 ) { |
|
793 | 793 | $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
794 | - } |
|
795 | - |
|
796 | - if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
797 | - FrmAppHelper::remove_get_action(); |
|
798 | - |
|
799 | - $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
800 | - } |
|
801 | - |
|
802 | - $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
803 | - if ( empty( $ids ) ) { |
|
804 | - $errors[] = __( 'No forms were specified', 'formidable' ); |
|
805 | - return $errors; |
|
806 | - } |
|
807 | - |
|
808 | - $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
809 | - if ( $permission_error !== false ) { |
|
810 | - $errors[] = $permission_error; |
|
811 | - return $errors; |
|
812 | - } |
|
813 | - |
|
814 | - if ( ! is_array( $ids ) ) { |
|
815 | - $ids = explode( ',', $ids ); |
|
816 | - } |
|
817 | - |
|
818 | - switch ( $bulkaction ) { |
|
819 | - case 'delete': |
|
820 | - $message = self::bulk_destroy( $ids ); |
|
821 | - break; |
|
822 | - case 'trash': |
|
823 | - $message = self::bulk_trash( $ids ); |
|
824 | - break; |
|
825 | - case 'untrash': |
|
826 | - $message = self::bulk_untrash( $ids ); |
|
827 | - break; |
|
828 | - case 'create_template': |
|
829 | - $message = self::bulk_create_template( $ids ); |
|
830 | - break; |
|
831 | - } |
|
832 | - |
|
833 | - if ( isset( $message ) && ! empty( $message ) ) { |
|
794 | + } |
|
795 | + |
|
796 | + if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) { |
|
797 | + FrmAppHelper::remove_get_action(); |
|
798 | + |
|
799 | + $bulkaction = str_replace( 'bulk_', '', $bulkaction ); |
|
800 | + } |
|
801 | + |
|
802 | + $ids = FrmAppHelper::get_param( 'item-action', '' ); |
|
803 | + if ( empty( $ids ) ) { |
|
804 | + $errors[] = __( 'No forms were specified', 'formidable' ); |
|
805 | + return $errors; |
|
806 | + } |
|
807 | + |
|
808 | + $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
809 | + if ( $permission_error !== false ) { |
|
810 | + $errors[] = $permission_error; |
|
811 | + return $errors; |
|
812 | + } |
|
813 | + |
|
814 | + if ( ! is_array( $ids ) ) { |
|
815 | + $ids = explode( ',', $ids ); |
|
816 | + } |
|
817 | + |
|
818 | + switch ( $bulkaction ) { |
|
819 | + case 'delete': |
|
820 | + $message = self::bulk_destroy( $ids ); |
|
821 | + break; |
|
822 | + case 'trash': |
|
823 | + $message = self::bulk_trash( $ids ); |
|
824 | + break; |
|
825 | + case 'untrash': |
|
826 | + $message = self::bulk_untrash( $ids ); |
|
827 | + break; |
|
828 | + case 'create_template': |
|
829 | + $message = self::bulk_create_template( $ids ); |
|
830 | + break; |
|
831 | + } |
|
832 | + |
|
833 | + if ( isset( $message ) && ! empty( $message ) ) { |
|
834 | 834 | echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>'; |
835 | - } |
|
835 | + } |
|
836 | 836 | |
837 | - return $errors; |
|
838 | - } |
|
837 | + return $errors; |
|
838 | + } |
|
839 | 839 | |
840 | - public static function add_default_templates( $path, $default = true, $template = true ) { |
|
841 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
840 | + public static function add_default_templates( $path, $default = true, $template = true ) { |
|
841 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
|
842 | 842 | |
843 | - $path = untrailingslashit(trim($path)); |
|
843 | + $path = untrailingslashit(trim($path)); |
|
844 | 844 | $templates = glob( $path . '/*.php' ); |
845 | 845 | |
846 | 846 | for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
847 | 847 | $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) ); |
848 | 848 | $template_query = array( 'form_key' => $filename ); |
849 | - if ( $template ) { |
|
850 | - $template_query['is_template'] = 1; |
|
851 | - } |
|
852 | - if ( $default ) { |
|
853 | - $template_query['default_template'] = 1; |
|
854 | - } |
|
849 | + if ( $template ) { |
|
850 | + $template_query['is_template'] = 1; |
|
851 | + } |
|
852 | + if ( $default ) { |
|
853 | + $template_query['default_template'] = 1; |
|
854 | + } |
|
855 | 855 | $form = FrmForm::getAll( $template_query, '', 1 ); |
856 | 856 | |
857 | - $values = FrmFormsHelper::setup_new_vars(); |
|
858 | - $values['form_key'] = $filename; |
|
859 | - $values['is_template'] = $template; |
|
860 | - $values['status'] = 'published'; |
|
861 | - if ( $default ) { |
|
862 | - $values['default_template'] = 1; |
|
863 | - } |
|
864 | - |
|
865 | - include( $templates[ $i ] ); |
|
866 | - |
|
867 | - //get updated form |
|
868 | - if ( isset($form) && ! empty($form) ) { |
|
869 | - $old_id = $form->id; |
|
870 | - $form = FrmForm::getOne($form->id); |
|
871 | - } else { |
|
872 | - $old_id = false; |
|
857 | + $values = FrmFormsHelper::setup_new_vars(); |
|
858 | + $values['form_key'] = $filename; |
|
859 | + $values['is_template'] = $template; |
|
860 | + $values['status'] = 'published'; |
|
861 | + if ( $default ) { |
|
862 | + $values['default_template'] = 1; |
|
863 | + } |
|
864 | + |
|
865 | + include( $templates[ $i ] ); |
|
866 | + |
|
867 | + //get updated form |
|
868 | + if ( isset($form) && ! empty($form) ) { |
|
869 | + $old_id = $form->id; |
|
870 | + $form = FrmForm::getOne($form->id); |
|
871 | + } else { |
|
872 | + $old_id = false; |
|
873 | 873 | $form = FrmForm::getAll( $template_query, '', 1 ); |
874 | - } |
|
874 | + } |
|
875 | 875 | |
876 | - if ( $form ) { |
|
876 | + if ( $form ) { |
|
877 | 877 | do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) ); |
878 | - } |
|
879 | - } |
|
880 | - } |
|
878 | + } |
|
879 | + } |
|
880 | + } |
|
881 | 881 | |
882 | - public static function route() { |
|
883 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
884 | - $vars = array(); |
|
882 | + public static function route() { |
|
883 | + $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
884 | + $vars = array(); |
|
885 | 885 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
886 | 886 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
887 | 887 | |
888 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
889 | - $json_vars = json_decode($json_vars, true); |
|
890 | - if ( empty($json_vars) ) { |
|
891 | - // json decoding failed so we should return an error message |
|
888 | + $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
889 | + $json_vars = json_decode($json_vars, true); |
|
890 | + if ( empty($json_vars) ) { |
|
891 | + // json decoding failed so we should return an error message |
|
892 | 892 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
893 | - if ( 'edit' == $action ) { |
|
894 | - $action = 'update'; |
|
895 | - } |
|
896 | - |
|
897 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
898 | - } else { |
|
899 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
900 | - $action = $vars[ $action ]; |
|
893 | + if ( 'edit' == $action ) { |
|
894 | + $action = 'update'; |
|
895 | + } |
|
896 | + |
|
897 | + add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
898 | + } else { |
|
899 | + $vars = FrmAppHelper::json_to_array($json_vars); |
|
900 | + $action = $vars[ $action ]; |
|
901 | 901 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
902 | 902 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
903 | 903 | $_POST = array_merge( $_POST, $_REQUEST ); |
904 | - } |
|
905 | - } else { |
|
904 | + } |
|
905 | + } else { |
|
906 | 906 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
907 | - if ( isset( $_REQUEST['delete_all'] ) ) { |
|
908 | - // override the action for this page |
|
909 | - $action = 'delete_all'; |
|
910 | - } |
|
911 | - } |
|
907 | + if ( isset( $_REQUEST['delete_all'] ) ) { |
|
908 | + // override the action for this page |
|
909 | + $action = 'delete_all'; |
|
910 | + } |
|
911 | + } |
|
912 | 912 | |
913 | 913 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
914 | - FrmAppHelper::trigger_hook_load( 'form' ); |
|
915 | - |
|
916 | - switch ( $action ) { |
|
917 | - case 'new': |
|
918 | - return self::new_form($vars); |
|
919 | - case 'create': |
|
920 | - case 'edit': |
|
921 | - case 'update': |
|
922 | - case 'duplicate': |
|
923 | - case 'trash': |
|
924 | - case 'untrash': |
|
925 | - case 'destroy': |
|
926 | - case 'delete_all': |
|
927 | - case 'settings': |
|
928 | - case 'update_settings': |
|
914 | + FrmAppHelper::trigger_hook_load( 'form' ); |
|
915 | + |
|
916 | + switch ( $action ) { |
|
917 | + case 'new': |
|
918 | + return self::new_form($vars); |
|
919 | + case 'create': |
|
920 | + case 'edit': |
|
921 | + case 'update': |
|
922 | + case 'duplicate': |
|
923 | + case 'trash': |
|
924 | + case 'untrash': |
|
925 | + case 'destroy': |
|
926 | + case 'delete_all': |
|
927 | + case 'settings': |
|
928 | + case 'update_settings': |
|
929 | 929 | return self::$action( $vars ); |
930 | - default: |
|
930 | + default: |
|
931 | 931 | do_action( 'frm_form_action_' . $action ); |
932 | 932 | if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) { |
933 | - return; |
|
934 | - } |
|
933 | + return; |
|
934 | + } |
|
935 | 935 | |
936 | 936 | $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' ); |
937 | - if ( $action == -1 ) { |
|
937 | + if ( $action == -1 ) { |
|
938 | 938 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
939 | - } |
|
939 | + } |
|
940 | 940 | |
941 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
942 | - FrmAppHelper::remove_get_action(); |
|
943 | - return self::list_form(); |
|
944 | - } |
|
941 | + if ( strpos($action, 'bulk_') === 0 ) { |
|
942 | + FrmAppHelper::remove_get_action(); |
|
943 | + return self::list_form(); |
|
944 | + } |
|
945 | 945 | |
946 | - return self::display_forms_list(); |
|
947 | - } |
|
948 | - } |
|
946 | + return self::display_forms_list(); |
|
947 | + } |
|
948 | + } |
|
949 | 949 | |
950 | - public static function json_error( $errors ) { |
|
951 | - $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
952 | - return $errors; |
|
953 | - } |
|
950 | + public static function json_error( $errors ) { |
|
951 | + $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); |
|
952 | + return $errors; |
|
953 | + } |
|
954 | 954 | |
955 | 955 | |
956 | - /* FRONT-END FORMS */ |
|
957 | - public static function admin_bar_css() { |
|
956 | + /* FRONT-END FORMS */ |
|
957 | + public static function admin_bar_css() { |
|
958 | 958 | if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
959 | - return; |
|
960 | - } |
|
959 | + return; |
|
960 | + } |
|
961 | 961 | |
962 | 962 | add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' ); |
963 | 963 | FrmAppHelper::load_font_style(); |
964 | 964 | } |
965 | 965 | |
966 | 966 | public static function admin_bar_configure() { |
967 | - global $frm_vars; |
|
968 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
969 | - return; |
|
970 | - } |
|
971 | - |
|
972 | - $actions = array(); |
|
973 | - foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
974 | - if ( is_object($form) ) { |
|
975 | - $actions[ $form->id ] = $form->name; |
|
976 | - } |
|
977 | - unset($form); |
|
978 | - } |
|
979 | - |
|
980 | - if ( empty($actions) ) { |
|
981 | - return; |
|
982 | - } |
|
983 | - |
|
984 | - asort($actions); |
|
985 | - |
|
986 | - global $wp_admin_bar; |
|
987 | - |
|
988 | - if ( count($actions) == 1 ) { |
|
989 | - $wp_admin_bar->add_menu( array( |
|
990 | - 'title' => 'Edit Form', |
|
967 | + global $frm_vars; |
|
968 | + if ( empty($frm_vars['forms_loaded']) ) { |
|
969 | + return; |
|
970 | + } |
|
971 | + |
|
972 | + $actions = array(); |
|
973 | + foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
974 | + if ( is_object($form) ) { |
|
975 | + $actions[ $form->id ] = $form->name; |
|
976 | + } |
|
977 | + unset($form); |
|
978 | + } |
|
979 | + |
|
980 | + if ( empty($actions) ) { |
|
981 | + return; |
|
982 | + } |
|
983 | + |
|
984 | + asort($actions); |
|
985 | + |
|
986 | + global $wp_admin_bar; |
|
987 | + |
|
988 | + if ( count($actions) == 1 ) { |
|
989 | + $wp_admin_bar->add_menu( array( |
|
990 | + 'title' => 'Edit Form', |
|
991 | 991 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
992 | - 'id' => 'frm-forms', |
|
993 | - ) ); |
|
994 | - } else { |
|
995 | - $wp_admin_bar->add_menu( array( |
|
996 | - 'id' => 'frm-forms', |
|
997 | - 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
992 | + 'id' => 'frm-forms', |
|
993 | + ) ); |
|
994 | + } else { |
|
995 | + $wp_admin_bar->add_menu( array( |
|
996 | + 'id' => 'frm-forms', |
|
997 | + 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>', |
|
998 | 998 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
999 | - 'meta' => array( |
|
999 | + 'meta' => array( |
|
1000 | 1000 | 'title' => __( 'Edit Forms', 'formidable' ), |
1001 | - ), |
|
1002 | - ) ); |
|
1001 | + ), |
|
1002 | + ) ); |
|
1003 | 1003 | |
1004 | - foreach ( $actions as $form_id => $name ) { |
|
1004 | + foreach ( $actions as $form_id => $name ) { |
|
1005 | 1005 | |
1006 | - $wp_admin_bar->add_menu( array( |
|
1007 | - 'parent' => 'frm-forms', |
|
1006 | + $wp_admin_bar->add_menu( array( |
|
1007 | + 'parent' => 'frm-forms', |
|
1008 | 1008 | 'id' => 'edit_form_' . $form_id, |
1009 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
1009 | + 'title' => empty($name) ? __( '(no title)') : $name, |
|
1010 | 1010 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
1011 | - ) ); |
|
1012 | - } |
|
1013 | - } |
|
1014 | - } |
|
1011 | + ) ); |
|
1012 | + } |
|
1013 | + } |
|
1014 | + } |
|
1015 | 1015 | |
1016 | - //formidable shortcode |
|
1016 | + //formidable shortcode |
|
1017 | 1017 | public static function get_form_shortcode( $atts ) { |
1018 | - global $frm_vars; |
|
1019 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
1020 | - $sc = '[formidable'; |
|
1018 | + global $frm_vars; |
|
1019 | + if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
1020 | + $sc = '[formidable'; |
|
1021 | 1021 | if ( ! empty( $atts ) ) { |
1022 | 1022 | foreach ( $atts as $k => $v ) { |
1023 | 1023 | $sc .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | return $sc . ']'; |
1027 | - } |
|
1028 | - |
|
1029 | - $shortcode_atts = shortcode_atts( array( |
|
1030 | - 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
1031 | - 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
1032 | - 'exclude_fields' => array(), 'minimize' => false, |
|
1033 | - ), $atts); |
|
1034 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
1035 | - |
|
1036 | - return self::show_form( |
|
1037 | - $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
1038 | - $shortcode_atts['description'], $atts |
|
1039 | - ); |
|
1040 | - } |
|
1041 | - |
|
1042 | - public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
1043 | - if ( empty( $id ) ) { |
|
1044 | - $id = $key; |
|
1045 | - } |
|
1046 | - |
|
1047 | - // no form id or key set |
|
1048 | - if ( empty( $id ) ) { |
|
1049 | - return __( 'Please select a valid form', 'formidable' ); |
|
1050 | - } |
|
1051 | - |
|
1052 | - $form = FrmForm::getOne( $id ); |
|
1053 | - if ( ! $form || $form->parent_form_id ) { |
|
1054 | - return __( 'Please select a valid form', 'formidable' ); |
|
1055 | - } |
|
1027 | + } |
|
1028 | + |
|
1029 | + $shortcode_atts = shortcode_atts( array( |
|
1030 | + 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
|
1031 | + 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
|
1032 | + 'exclude_fields' => array(), 'minimize' => false, |
|
1033 | + ), $atts); |
|
1034 | + do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
1035 | + |
|
1036 | + return self::show_form( |
|
1037 | + $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
|
1038 | + $shortcode_atts['description'], $atts |
|
1039 | + ); |
|
1040 | + } |
|
1041 | + |
|
1042 | + public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) { |
|
1043 | + if ( empty( $id ) ) { |
|
1044 | + $id = $key; |
|
1045 | + } |
|
1046 | + |
|
1047 | + // no form id or key set |
|
1048 | + if ( empty( $id ) ) { |
|
1049 | + return __( 'Please select a valid form', 'formidable' ); |
|
1050 | + } |
|
1051 | + |
|
1052 | + $form = FrmForm::getOne( $id ); |
|
1053 | + if ( ! $form || $form->parent_form_id ) { |
|
1054 | + return __( 'Please select a valid form', 'formidable' ); |
|
1055 | + } |
|
1056 | 1056 | |
1057 | 1057 | add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' ); |
1058 | - FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
1058 | + FrmAppHelper::trigger_hook_load( 'form', $form ); |
|
1059 | 1059 | |
1060 | - $form = apply_filters( 'frm_pre_display_form', $form ); |
|
1060 | + $form = apply_filters( 'frm_pre_display_form', $form ); |
|
1061 | 1061 | |
1062 | - $frm_settings = FrmAppHelper::get_settings(); |
|
1062 | + $frm_settings = FrmAppHelper::get_settings(); |
|
1063 | 1063 | |
1064 | 1064 | if ( self::is_viewable_draft_form( $form ) ) { |
1065 | 1065 | // don't show a draft form on a page |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | return $form; |
1083 | - } |
|
1083 | + } |
|
1084 | 1084 | |
1085 | 1085 | private static function is_viewable_draft_form( $form ) { |
1086 | 1086 | global $post; |
@@ -1096,98 +1096,98 @@ discard block |
||
1096 | 1096 | return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] ); |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - public static function get_form( $form, $title, $description, $atts = array() ) { |
|
1100 | - ob_start(); |
|
1099 | + public static function get_form( $form, $title, $description, $atts = array() ) { |
|
1100 | + ob_start(); |
|
1101 | 1101 | |
1102 | - self::get_form_contents( $form, $title, $description, $atts ); |
|
1102 | + self::get_form_contents( $form, $title, $description, $atts ); |
|
1103 | 1103 | self::enqueue_scripts( FrmForm::get_params( $form ) ); |
1104 | 1104 | |
1105 | - $contents = ob_get_contents(); |
|
1106 | - ob_end_clean(); |
|
1105 | + $contents = ob_get_contents(); |
|
1106 | + ob_end_clean(); |
|
1107 | 1107 | |
1108 | 1108 | self::maybe_minimize_form( $atts, $contents ); |
1109 | 1109 | |
1110 | - return $contents; |
|
1111 | - } |
|
1110 | + return $contents; |
|
1111 | + } |
|
1112 | 1112 | |
1113 | 1113 | public static function enqueue_scripts( $params ) { |
1114 | 1114 | do_action( 'frm_enqueue_form_scripts', $params ); |
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | public static function get_form_contents( $form, $title, $description, $atts ) { |
1118 | - global $frm_vars; |
|
1118 | + global $frm_vars; |
|
1119 | 1119 | |
1120 | - $frm_settings = FrmAppHelper::get_settings(); |
|
1120 | + $frm_settings = FrmAppHelper::get_settings(); |
|
1121 | 1121 | |
1122 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
1122 | + $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
1123 | 1123 | |
1124 | - $user_ID = get_current_user_id(); |
|
1124 | + $user_ID = get_current_user_id(); |
|
1125 | 1125 | $params = FrmForm::get_params( $form ); |
1126 | - $message = $errors = ''; |
|
1126 | + $message = $errors = ''; |
|
1127 | 1127 | |
1128 | - if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
1129 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
1130 | - } |
|
1128 | + if ( $params['posted_form_id'] == $form->id && $_POST ) { |
|
1129 | + $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
1130 | + } |
|
1131 | 1131 | |
1132 | 1132 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
1133 | - $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
1133 | + $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
|
1134 | 1134 | |
1135 | - if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
1136 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
1137 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
1138 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
1135 | + if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
|
1136 | + do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
1137 | + if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
1138 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
1139 | 1139 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1140 | - } |
|
1141 | - return; |
|
1142 | - } |
|
1140 | + } |
|
1141 | + return; |
|
1142 | + } |
|
1143 | 1143 | |
1144 | - if ( ! empty($errors) ) { |
|
1145 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
1144 | + if ( ! empty($errors) ) { |
|
1145 | + $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
1146 | 1146 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1147 | - return; |
|
1148 | - } |
|
1147 | + return; |
|
1148 | + } |
|
1149 | 1149 | |
1150 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
1151 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
1152 | - return; |
|
1153 | - } |
|
1150 | + do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
1151 | + if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
1152 | + return; |
|
1153 | + } |
|
1154 | 1154 | |
1155 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
1156 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
1157 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
1155 | + $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
1156 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
1157 | + $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
1158 | 1158 | |
1159 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
1160 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
1159 | + if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
1160 | + do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
1161 | 1161 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
1162 | - return; |
|
1163 | - } |
|
1162 | + return; |
|
1163 | + } |
|
1164 | 1164 | |
1165 | - if ( $created && is_numeric($created) ) { |
|
1166 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
1167 | - $class = 'frm_message'; |
|
1168 | - } else { |
|
1169 | - $message = $frm_settings->failed_msg; |
|
1170 | - $class = 'frm_error_style'; |
|
1171 | - } |
|
1165 | + if ( $created && is_numeric($created) ) { |
|
1166 | + $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
1167 | + $class = 'frm_message'; |
|
1168 | + } else { |
|
1169 | + $message = $frm_settings->failed_msg; |
|
1170 | + $class = 'frm_error_style'; |
|
1171 | + } |
|
1172 | 1172 | |
1173 | 1173 | $message = FrmFormsHelper::get_success_message( array( |
1174 | 1174 | 'message' => $message, 'form' => $form, |
1175 | 1175 | 'entry_id' => $created, 'class' => $class, |
1176 | 1176 | ) ); |
1177 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
1177 | + $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
1178 | 1178 | |
1179 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
1179 | + if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
1180 | 1180 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1181 | - } else { |
|
1182 | - global $frm_vars; |
|
1181 | + } else { |
|
1182 | + global $frm_vars; |
|
1183 | 1183 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
1184 | 1184 | |
1185 | 1185 | $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values ); |
1186 | 1186 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' ); |
1187 | - } |
|
1187 | + } |
|
1188 | 1188 | |
1189 | 1189 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
1190 | - } |
|
1190 | + } |
|
1191 | 1191 | |
1192 | 1192 | public static function front_head() { |
1193 | 1193 | $version = FrmAppHelper::plugin_version(); |
@@ -1216,10 +1216,10 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | public static function defer_script_loading( $tag, $handle ) { |
1219 | - if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) { |
|
1220 | - $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag ); |
|
1219 | + if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) { |
|
1220 | + $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag ); |
|
1221 | 1221 | } |
1222 | - return $tag; |
|
1222 | + return $tag; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | public static function footer_js( $location = 'footer' ) { |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | if ( ! FrmAppHelper::pro_is_installed() ) { |
8 | 8 | $menu_label .= ' (Lite)'; |
9 | 9 | } |
10 | - add_submenu_page('formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
10 | + add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' ); |
|
11 | 11 | |
12 | 12 | self::maybe_load_listing_hooks(); |
13 | 13 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | - add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
21 | + add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' ); |
|
22 | 22 | |
23 | - add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
24 | - add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
23 | + add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 ); |
|
24 | + add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public static function head() { |
28 | - wp_enqueue_script('formidable-editinplace'); |
|
28 | + wp_enqueue_script( 'formidable-editinplace' ); |
|
29 | 29 | |
30 | 30 | if ( wp_is_mobile() ) { |
31 | 31 | wp_enqueue_script( 'jquery-touch-punch' ); |
@@ -33,39 +33,39 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function register_widgets() { |
36 | - require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php'); |
|
37 | - register_widget('FrmShowForm'); |
|
36 | + require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' ); |
|
37 | + register_widget( 'FrmShowForm' ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public static function list_form() { |
41 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
41 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
42 | 42 | |
43 | 43 | $params = FrmForm::list_page_params(); |
44 | - $errors = self::process_bulk_form_actions( array()); |
|
45 | - $errors = apply_filters('frm_admin_list_form_action', $errors); |
|
44 | + $errors = self::process_bulk_form_actions( array() ); |
|
45 | + $errors = apply_filters( 'frm_admin_list_form_action', $errors ); |
|
46 | 46 | |
47 | 47 | return self::display_forms_list( $params, '', $errors ); |
48 | 48 | } |
49 | 49 | |
50 | 50 | public static function new_form( $values = array() ) { |
51 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
51 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
52 | 52 | |
53 | 53 | global $frm_vars; |
54 | 54 | |
55 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
56 | - $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
|
55 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
56 | + $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action]; |
|
57 | 57 | |
58 | 58 | if ( $action == 'create' ) { |
59 | - return self::create($values); |
|
59 | + return self::create( $values ); |
|
60 | 60 | } else if ( $action == 'new' ) { |
61 | 61 | $frm_field_selection = FrmField::field_selection(); |
62 | - $values = FrmFormsHelper::setup_new_vars($values); |
|
62 | + $values = FrmFormsHelper::setup_new_vars( $values ); |
|
63 | 63 | $id = FrmForm::create( $values ); |
64 | - $form = FrmForm::getOne($id); |
|
64 | + $form = FrmForm::getOne( $id ); |
|
65 | 65 | |
66 | 66 | // add default email notification |
67 | 67 | $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
68 | - $action_control->create($form->id); |
|
68 | + $action_control->create( $form->id ); |
|
69 | 69 | |
70 | 70 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | public static function create( $values = array() ) { |
78 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
78 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
79 | 79 | |
80 | 80 | global $frm_vars; |
81 | 81 | if ( empty( $values ) ) { |
@@ -87,22 +87,22 @@ discard block |
||
87 | 87 | $values = FrmProEntry::mod_other_vals( $values, 'back' ); |
88 | 88 | } |
89 | 89 | |
90 | - $id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
90 | + $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
|
91 | 91 | |
92 | 92 | if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) { |
93 | 93 | $frm_settings = FrmAppHelper::get_settings(); |
94 | 94 | $errors = array( 'form' => $frm_settings->admin_permission ); |
95 | 95 | } else { |
96 | - $errors = FrmForm::validate($values); |
|
96 | + $errors = FrmForm::validate( $values ); |
|
97 | 97 | } |
98 | 98 | |
99 | - if ( count($errors) > 0 ) { |
|
99 | + if ( count( $errors ) > 0 ) { |
|
100 | 100 | $hide_preview = true; |
101 | 101 | $frm_field_selection = FrmField::field_selection(); |
102 | 102 | $form = FrmForm::getOne( $id ); |
103 | - $fields = FrmField::get_all_for_form($id); |
|
103 | + $fields = FrmField::get_all_for_form( $id ); |
|
104 | 104 | |
105 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
105 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
106 | 106 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
107 | 107 | |
108 | 108 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
@@ -114,32 +114,32 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | public static function edit( $values = false ) { |
117 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
117 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
118 | 118 | |
119 | 119 | $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
120 | - return self::get_edit_vars($id); |
|
120 | + return self::get_edit_vars( $id ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | public static function settings( $id = false, $message = '' ) { |
124 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
124 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
125 | 125 | |
126 | - if ( ! $id || ! is_numeric($id) ) { |
|
126 | + if ( ! $id || ! is_numeric( $id ) ) { |
|
127 | 127 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
128 | 128 | } |
129 | 129 | return self::get_settings_vars( $id, array(), $message ); |
130 | 130 | } |
131 | 131 | |
132 | 132 | public static function update_settings() { |
133 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
133 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
134 | 134 | |
135 | 135 | $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
136 | 136 | |
137 | - $errors = FrmForm::validate($_POST); |
|
138 | - if ( count($errors) > 0 ) { |
|
139 | - return self::get_settings_vars($id, $errors); |
|
137 | + $errors = FrmForm::validate( $_POST ); |
|
138 | + if ( count( $errors ) > 0 ) { |
|
139 | + return self::get_settings_vars( $id, $errors ); |
|
140 | 140 | } |
141 | 141 | |
142 | - do_action('frm_before_update_form_settings', $id); |
|
142 | + do_action( 'frm_before_update_form_settings', $id ); |
|
143 | 143 | |
144 | 144 | FrmForm::update( $id, $_POST ); |
145 | 145 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | private static function edit_in_place_value( $field ) { |
163 | 163 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
164 | - FrmAppHelper::permission_check('frm_edit_forms', 'hide'); |
|
164 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
165 | 165 | |
166 | 166 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
167 | 167 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' ); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @since 2.0 |
220 | 220 | */ |
221 | 221 | public static function _create_from_template() { |
222 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
222 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
223 | 223 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
224 | 224 | |
225 | 225 | $current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' ); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | public static function duplicate() { |
237 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
237 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
238 | 238 | |
239 | 239 | $params = FrmForm::list_page_params(); |
240 | 240 | $form = FrmForm::duplicate( $params['id'], $params['template'], true ); |
241 | - $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
241 | + $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' ); |
|
242 | 242 | if ( $form ) { |
243 | 243 | return self::get_edit_vars( $form, array(), $message, true ); |
244 | 244 | } else { |
245 | - return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' )); |
|
245 | + return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) ); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | public static function bulk_untrash( $ids ) { |
307 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
307 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
308 | 308 | |
309 | 309 | $count = FrmForm::set_status( $ids, 'published' ); |
310 | 310 | |
311 | - $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
311 | + $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 ); |
|
312 | 312 | return $message; |
313 | 313 | } |
314 | 314 | |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | 'trash' => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ), |
328 | 328 | ); |
329 | 329 | |
330 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
330 | + if ( ! isset( $available_status[$status] ) ) { |
|
331 | 331 | return; |
332 | 332 | } |
333 | 333 | |
334 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
334 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
335 | 335 | |
336 | 336 | $params = FrmForm::list_page_params(); |
337 | 337 | |
@@ -339,25 +339,25 @@ discard block |
||
339 | 339 | check_admin_referer( $status . '_form_' . $params['id'] ); |
340 | 340 | |
341 | 341 | $count = 0; |
342 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
343 | - $count++; |
|
342 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
343 | + $count ++; |
|
344 | 344 | } |
345 | 345 | |
346 | - $available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
346 | + $available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count ); |
|
347 | 347 | $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); |
348 | 348 | |
349 | - $message = $available_status[ $status ]['message']; |
|
349 | + $message = $available_status[$status]['message']; |
|
350 | 350 | |
351 | 351 | self::display_forms_list( $params, $message ); |
352 | 352 | } |
353 | 353 | |
354 | 354 | public static function bulk_trash( $ids ) { |
355 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
355 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
356 | 356 | |
357 | 357 | $count = 0; |
358 | 358 | foreach ( $ids as $id ) { |
359 | 359 | if ( FrmForm::trash( $id ) ) { |
360 | - $count++; |
|
360 | + $count ++; |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
@@ -368,49 +368,49 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | public static function destroy() { |
371 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
371 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
372 | 372 | |
373 | 373 | $params = FrmForm::list_page_params(); |
374 | 374 | |
375 | 375 | //check nonce url |
376 | - check_admin_referer('destroy_form_' . $params['id']); |
|
376 | + check_admin_referer( 'destroy_form_' . $params['id'] ); |
|
377 | 377 | |
378 | 378 | $count = 0; |
379 | 379 | if ( FrmForm::destroy( $params['id'] ) ) { |
380 | - $count++; |
|
380 | + $count ++; |
|
381 | 381 | } |
382 | 382 | |
383 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
383 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
384 | 384 | |
385 | 385 | self::display_forms_list( $params, $message ); |
386 | 386 | } |
387 | 387 | |
388 | 388 | public static function bulk_destroy( $ids ) { |
389 | - FrmAppHelper::permission_check('frm_delete_forms'); |
|
389 | + FrmAppHelper::permission_check( 'frm_delete_forms' ); |
|
390 | 390 | |
391 | 391 | $count = 0; |
392 | 392 | foreach ( $ids as $id ) { |
393 | 393 | $d = FrmForm::destroy( $id ); |
394 | 394 | if ( $d ) { |
395 | - $count++; |
|
395 | + $count ++; |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
399 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
400 | 400 | |
401 | 401 | return $message; |
402 | 402 | } |
403 | 403 | |
404 | 404 | private static function delete_all() { |
405 | 405 | //check nonce url |
406 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable'); |
|
406 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' ); |
|
407 | 407 | if ( $permission_error !== false ) { |
408 | 408 | self::display_forms_list( array(), '', array( $permission_error ) ); |
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | 412 | $count = FrmForm::scheduled_delete( time() ); |
413 | - $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count); |
|
413 | + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count ); |
|
414 | 414 | |
415 | 415 | self::display_forms_list( array(), $message ); |
416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @since 2.0.15 |
428 | 428 | */ |
429 | 429 | public static function insert_form_button() { |
430 | - if ( current_user_can('frm_view_forms') ) { |
|
430 | + if ( current_user_can( 'frm_view_forms' ) ) { |
|
431 | 431 | $menu_name = FrmAppHelper::get_menu_name(); |
432 | 432 | $content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"> |
433 | 433 | <span class="frm-buttons-icon wp-media-buttons-icon"></span> ' . |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | 'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ), |
449 | 449 | ); |
450 | 450 | |
451 | - $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes); |
|
451 | + $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes ); |
|
452 | 452 | |
453 | 453 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' ); |
454 | 454 | } |
455 | 455 | |
456 | 456 | public static function get_shortcode_opts() { |
457 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
457 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
458 | 458 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
459 | 459 | |
460 | 460 | $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' ); |
461 | - if ( empty($shortcode) ) { |
|
461 | + if ( empty( $shortcode ) ) { |
|
462 | 462 | wp_die(); |
463 | 463 | } |
464 | 464 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | ); |
479 | 479 | break; |
480 | 480 | } |
481 | - $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode); |
|
481 | + $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode ); |
|
482 | 482 | |
483 | 483 | if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { |
484 | 484 | // allow other shortcodes to use the required form id option |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | if ( $form->parent_form_id ) { |
598 | - wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' )); |
|
598 | + wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ) ); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | $frm_field_selection = FrmField::field_selection(); |
602 | - $fields = FrmField::get_all_for_form($form->id); |
|
602 | + $fields = FrmField::get_all_for_form( $form->id ); |
|
603 | 603 | |
604 | 604 | // Automatically add end section fields if they don't exist (2.0 migration) |
605 | 605 | $reset_fields = false; |
@@ -609,9 +609,9 @@ discard block |
||
609 | 609 | $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' ); |
610 | 610 | } |
611 | 611 | |
612 | - unset($end_section_values, $last_order, $open, $reset_fields); |
|
612 | + unset( $end_section_values, $last_order, $open, $reset_fields ); |
|
613 | 613 | |
614 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
614 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
615 | 615 | |
616 | 616 | $edit_message = __( 'Form was Successfully Updated', 'formidable' ); |
617 | 617 | if ( $form->is_template && $message == $edit_message ) { |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); |
622 | 622 | |
623 | 623 | if ( $form->default_template ) { |
624 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
625 | - } else if ( defined('DOING_AJAX') ) { |
|
624 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
625 | + } else if ( defined( 'DOING_AJAX' ) ) { |
|
626 | 626 | wp_die(); |
627 | 627 | } else if ( $create_link ) { |
628 | 628 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' ); |
@@ -638,28 +638,28 @@ discard block |
||
638 | 638 | |
639 | 639 | $form = FrmForm::getOne( $id ); |
640 | 640 | |
641 | - $fields = FrmField::get_all_for_form($id); |
|
642 | - $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); |
|
641 | + $fields = FrmField::get_all_for_form( $id ); |
|
642 | + $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true ); |
|
643 | 643 | |
644 | - if ( isset($values['default_template']) && $values['default_template'] ) { |
|
645 | - wp_die(__( 'That template cannot be edited', 'formidable' )); |
|
644 | + if ( isset( $values['default_template'] ) && $values['default_template'] ) { |
|
645 | + wp_die( __( 'That template cannot be edited', 'formidable' ) ); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | $action_controls = FrmFormActionsController::get_form_actions(); |
649 | 649 | |
650 | - $sections = apply_filters('frm_add_form_settings_section', array(), $values); |
|
650 | + $sections = apply_filters( 'frm_add_form_settings_section', array(), $values ); |
|
651 | 651 | $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; |
652 | 652 | |
653 | - $styles = apply_filters('frm_get_style_opts', array()); |
|
653 | + $styles = apply_filters( 'frm_get_style_opts', array() ); |
|
654 | 654 | |
655 | 655 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' ); |
656 | 656 | } |
657 | 657 | |
658 | 658 | public static function mb_tags_box( $form_id, $class = '' ) { |
659 | - $fields = FrmField::get_all_for_form($form_id, '', 'include'); |
|
659 | + $fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
660 | 660 | $linked_forms = array(); |
661 | 661 | $col = 'one'; |
662 | - $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false; |
|
662 | + $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false; |
|
663 | 663 | |
664 | 664 | $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() ); |
665 | 665 | $adv_shortcodes = self::get_advanced_shortcodes(); |
@@ -737,13 +737,13 @@ discard block |
||
737 | 737 | |
738 | 738 | // Insert the form class setting into the form |
739 | 739 | public static function form_classes( $form ) { |
740 | - if ( isset($form->options['form_class']) ) { |
|
740 | + if ( isset( $form->options['form_class'] ) ) { |
|
741 | 741 | echo esc_attr( sanitize_text_field( $form->options['form_class'] ) ); |
742 | 742 | } |
743 | 743 | } |
744 | 744 | |
745 | 745 | public static function get_email_html() { |
746 | - FrmAppHelper::permission_check('frm_view_forms'); |
|
746 | + FrmAppHelper::permission_check( 'frm_view_forms' ); |
|
747 | 747 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
748 | 748 | echo FrmEntryFormat::show_entry( array( |
749 | 749 | 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | public static function add_default_templates( $path, $default = true, $template = true ) { |
841 | 841 | _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' ); |
842 | 842 | |
843 | - $path = untrailingslashit(trim($path)); |
|
843 | + $path = untrailingslashit( trim( $path ) ); |
|
844 | 844 | $templates = glob( $path . '/*.php' ); |
845 | 845 | |
846 | - for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) { |
|
847 | - $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) ); |
|
846 | + for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) { |
|
847 | + $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) ); |
|
848 | 848 | $template_query = array( 'form_key' => $filename ); |
849 | 849 | if ( $template ) { |
850 | 850 | $template_query['is_template'] = 1; |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | $values['default_template'] = 1; |
863 | 863 | } |
864 | 864 | |
865 | - include( $templates[ $i ] ); |
|
865 | + include( $templates[$i] ); |
|
866 | 866 | |
867 | 867 | //get updated form |
868 | - if ( isset($form) && ! empty($form) ) { |
|
868 | + if ( isset( $form ) && ! empty( $form ) ) { |
|
869 | 869 | $old_id = $form->id; |
870 | - $form = FrmForm::getOne($form->id); |
|
870 | + $form = FrmForm::getOne( $form->id ); |
|
871 | 871 | } else { |
872 | 872 | $old_id = false; |
873 | 873 | $form = FrmForm::getAll( $template_query, '', 1 ); |
@@ -880,24 +880,24 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | public static function route() { |
883 | - $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; |
|
883 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
884 | 884 | $vars = array(); |
885 | 885 | if ( isset( $_POST['frm_compact_fields'] ) ) { |
886 | 886 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
887 | 887 | |
888 | - $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\"', $_POST['frm_compact_fields'] )))); |
|
889 | - $json_vars = json_decode($json_vars, true); |
|
890 | - if ( empty($json_vars) ) { |
|
888 | + $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '"', '\\\"', $_POST['frm_compact_fields'] ) ) ) ); |
|
889 | + $json_vars = json_decode( $json_vars, true ); |
|
890 | + if ( empty( $json_vars ) ) { |
|
891 | 891 | // json decoding failed so we should return an error message |
892 | 892 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
893 | 893 | if ( 'edit' == $action ) { |
894 | 894 | $action = 'update'; |
895 | 895 | } |
896 | 896 | |
897 | - add_filter('frm_validate_form', 'FrmFormsController::json_error'); |
|
897 | + add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
|
898 | 898 | } else { |
899 | - $vars = FrmAppHelper::json_to_array($json_vars); |
|
900 | - $action = $vars[ $action ]; |
|
899 | + $vars = FrmAppHelper::json_to_array( $json_vars ); |
|
900 | + $action = $vars[$action]; |
|
901 | 901 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); |
902 | 902 | $_REQUEST = array_merge( $_REQUEST, $vars ); |
903 | 903 | $_POST = array_merge( $_POST, $_REQUEST ); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | |
916 | 916 | switch ( $action ) { |
917 | 917 | case 'new': |
918 | - return self::new_form($vars); |
|
918 | + return self::new_form( $vars ); |
|
919 | 919 | case 'create': |
920 | 920 | case 'edit': |
921 | 921 | case 'update': |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' ); |
939 | 939 | } |
940 | 940 | |
941 | - if ( strpos($action, 'bulk_') === 0 ) { |
|
941 | + if ( strpos( $action, 'bulk_' ) === 0 ) { |
|
942 | 942 | FrmAppHelper::remove_get_action(); |
943 | 943 | return self::list_form(); |
944 | 944 | } |
@@ -965,27 +965,27 @@ discard block |
||
965 | 965 | |
966 | 966 | public static function admin_bar_configure() { |
967 | 967 | global $frm_vars; |
968 | - if ( empty($frm_vars['forms_loaded']) ) { |
|
968 | + if ( empty( $frm_vars['forms_loaded'] ) ) { |
|
969 | 969 | return; |
970 | 970 | } |
971 | 971 | |
972 | 972 | $actions = array(); |
973 | 973 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
974 | - if ( is_object($form) ) { |
|
975 | - $actions[ $form->id ] = $form->name; |
|
974 | + if ( is_object( $form ) ) { |
|
975 | + $actions[$form->id] = $form->name; |
|
976 | 976 | } |
977 | - unset($form); |
|
977 | + unset( $form ); |
|
978 | 978 | } |
979 | 979 | |
980 | - if ( empty($actions) ) { |
|
980 | + if ( empty( $actions ) ) { |
|
981 | 981 | return; |
982 | 982 | } |
983 | 983 | |
984 | - asort($actions); |
|
984 | + asort( $actions ); |
|
985 | 985 | |
986 | 986 | global $wp_admin_bar; |
987 | 987 | |
988 | - if ( count($actions) == 1 ) { |
|
988 | + if ( count( $actions ) == 1 ) { |
|
989 | 989 | $wp_admin_bar->add_menu( array( |
990 | 990 | 'title' => 'Edit Form', |
991 | 991 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ), |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | $wp_admin_bar->add_menu( array( |
1007 | 1007 | 'parent' => 'frm-forms', |
1008 | 1008 | 'id' => 'edit_form_' . $form_id, |
1009 | - 'title' => empty($name) ? __( '(no title)') : $name, |
|
1009 | + 'title' => empty( $name ) ? __( '(no title)' ) : $name, |
|
1010 | 1010 | 'href' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ), |
1011 | 1011 | ) ); |
1012 | 1012 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | //formidable shortcode |
1017 | 1017 | public static function get_form_shortcode( $atts ) { |
1018 | 1018 | global $frm_vars; |
1019 | - if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) { |
|
1019 | + if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) { |
|
1020 | 1020 | $sc = '[formidable'; |
1021 | 1021 | if ( ! empty( $atts ) ) { |
1022 | 1022 | foreach ( $atts as $k => $v ) { |
@@ -1030,8 +1030,8 @@ discard block |
||
1030 | 1030 | 'id' => '', 'key' => '', 'title' => false, 'description' => false, |
1031 | 1031 | 'readonly' => false, 'entry_id' => false, 'fields' => array(), |
1032 | 1032 | 'exclude_fields' => array(), 'minimize' => false, |
1033 | - ), $atts); |
|
1034 | - do_action('formidable_shortcode_atts', $shortcode_atts, $atts); |
|
1033 | + ), $atts ); |
|
1034 | + do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts ); |
|
1035 | 1035 | |
1036 | 1036 | return self::show_form( |
1037 | 1037 | $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], |
@@ -1119,51 +1119,51 @@ discard block |
||
1119 | 1119 | |
1120 | 1120 | $frm_settings = FrmAppHelper::get_settings(); |
1121 | 1121 | |
1122 | - $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
1122 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; |
|
1123 | 1123 | |
1124 | 1124 | $user_ID = get_current_user_id(); |
1125 | 1125 | $params = FrmForm::get_params( $form ); |
1126 | 1126 | $message = $errors = ''; |
1127 | 1127 | |
1128 | 1128 | if ( $params['posted_form_id'] == $form->id && $_POST ) { |
1129 | - $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array(); |
|
1129 | + $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array(); |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
1133 | 1133 | $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) ); |
1134 | 1134 | |
1135 | 1135 | if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) { |
1136 | - do_action('frm_display_form_action', $params, $fields, $form, $title, $description); |
|
1137 | - if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) { |
|
1138 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form); |
|
1136 | + do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description ); |
|
1137 | + if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) { |
|
1138 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form ); |
|
1139 | 1139 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1140 | 1140 | } |
1141 | 1141 | return; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - if ( ! empty($errors) ) { |
|
1145 | - $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); |
|
1144 | + if ( ! empty( $errors ) ) { |
|
1145 | + $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array(); |
|
1146 | 1146 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1147 | 1147 | return; |
1148 | 1148 | } |
1149 | 1149 | |
1150 | - do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); |
|
1151 | - if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) { |
|
1150 | + do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description ); |
|
1151 | + if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) { |
|
1152 | 1152 | return; |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); |
|
1156 | - $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0; |
|
1157 | - $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); |
|
1155 | + $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true ); |
|
1156 | + $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0; |
|
1157 | + $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' ); |
|
1158 | 1158 | |
1159 | - if ( $created && is_numeric($created) && $conf_method != 'message' ) { |
|
1160 | - do_action('frm_success_action', $conf_method, $form, $form->options, $created); |
|
1159 | + if ( $created && is_numeric( $created ) && $conf_method != 'message' ) { |
|
1160 | + do_action( 'frm_success_action', $conf_method, $form, $form->options, $created ); |
|
1161 | 1161 | do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) ); |
1162 | 1162 | return; |
1163 | 1163 | } |
1164 | 1164 | |
1165 | - if ( $created && is_numeric($created) ) { |
|
1166 | - $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
1165 | + if ( $created && is_numeric( $created ) ) { |
|
1166 | + $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg; |
|
1167 | 1167 | $class = 'frm_message'; |
1168 | 1168 | } else { |
1169 | 1169 | $message = $frm_settings->failed_msg; |
@@ -1174,9 +1174,9 @@ discard block |
||
1174 | 1174 | 'message' => $message, 'form' => $form, |
1175 | 1175 | 'entry_id' => $created, 'class' => $class, |
1176 | 1176 | ) ); |
1177 | - $message = apply_filters('frm_main_feedback', $message, $form, $created); |
|
1177 | + $message = apply_filters( 'frm_main_feedback', $message, $form, $created ); |
|
1178 | 1178 | |
1179 | - if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) { |
|
1179 | + if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) { |
|
1180 | 1180 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' ); |
1181 | 1181 | } else { |
1182 | 1182 | global $frm_vars; |
@@ -375,6 +375,9 @@ |
||
375 | 375 | $reset_fields = true; |
376 | 376 | } |
377 | 377 | |
378 | + /** |
|
379 | + * @return string |
|
380 | + */ |
|
378 | 381 | public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
379 | 382 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
380 | 383 | if ( $code == 'form_name' ) { |
@@ -12,38 +12,38 @@ discard block |
||
12 | 12 | |
13 | 13 | public static function get_direct_link( $key, $form = false ) { |
14 | 14 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
15 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
16 | - |
|
17 | - return $target_url; |
|
18 | - } |
|
19 | - |
|
20 | - public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
21 | - $defaults = array( |
|
22 | - 'blank' => true, |
|
23 | - 'field_id' => false, |
|
24 | - 'onchange' => false, |
|
25 | - 'exclude' => false, |
|
26 | - 'class' => '', |
|
15 | + $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
16 | + |
|
17 | + return $target_url; |
|
18 | + } |
|
19 | + |
|
20 | + public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
21 | + $defaults = array( |
|
22 | + 'blank' => true, |
|
23 | + 'field_id' => false, |
|
24 | + 'onchange' => false, |
|
25 | + 'exclude' => false, |
|
26 | + 'class' => '', |
|
27 | 27 | 'inc_children' => 'exclude', |
28 | - ); |
|
29 | - $args = wp_parse_args( $args, $defaults ); |
|
28 | + ); |
|
29 | + $args = wp_parse_args( $args, $defaults ); |
|
30 | 30 | |
31 | - if ( ! $args['field_id'] ) { |
|
32 | - $args['field_id'] = $field_name; |
|
33 | - } |
|
31 | + if ( ! $args['field_id'] ) { |
|
32 | + $args['field_id'] = $field_name; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | $query = array(); |
36 | - if ( $args['exclude'] ) { |
|
36 | + if ( $args['exclude'] ) { |
|
37 | 37 | $query['id !'] = $args['exclude']; |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
40 | + $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
41 | 41 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
42 | 42 | $add_html = array(); |
43 | 43 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
44 | 44 | self::add_html_attr( $args['class'], 'class', $add_html ); |
45 | 45 | |
46 | - ?> |
|
46 | + ?> |
|
47 | 47 | <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>> |
48 | 48 | <?php if ( $args['blank'] ) { ?> |
49 | 49 | <option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option> |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | <?php } ?> |
56 | 56 | </select> |
57 | 57 | <?php |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @param string $class |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - public static function form_switcher() { |
|
73 | + public static function form_switcher() { |
|
74 | 74 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
75 | 75 | $forms = FrmForm::get_published_forms( $where ); |
76 | 76 | |
@@ -79,32 +79,32 @@ discard block |
||
79 | 79 | unset( $args['form'] ); |
80 | 80 | } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
81 | 81 | unset( $args['id'] ); |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | $frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
85 | 85 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
86 | - $args['frm_action'] = 'list'; |
|
87 | - $args['form'] = 0; |
|
86 | + $args['frm_action'] = 'list'; |
|
87 | + $args['form'] = 0; |
|
88 | 88 | } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
89 | - $args['frm_action'] = 'edit'; |
|
89 | + $args['frm_action'] = 'edit'; |
|
90 | 90 | } else if ( isset( $_GET['post'] ) ) { |
91 | - $args['form'] = 0; |
|
92 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
93 | - } |
|
91 | + $args['form'] = 0; |
|
92 | + $base = admin_url('edit.php?post_type=frm_display'); |
|
93 | + } |
|
94 | 94 | |
95 | - ?> |
|
95 | + ?> |
|
96 | 96 | <li class="dropdown last" id="frm_bs_dropdown"> |
97 | 97 | <a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php _e( 'Switch Form', 'formidable' ) ?> <b class="caret"></b></a> |
98 | 98 | <ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop"> |
99 | 99 | <?php |
100 | 100 | foreach ( $forms as $form ) { |
101 | 101 | if ( isset( $args['id'] ) ) { |
102 | - $args['id'] = $form->id; |
|
102 | + $args['id'] = $form->id; |
|
103 | 103 | } |
104 | - if ( isset( $args['form'] ) ) { |
|
105 | - $args['form'] = $form->id; |
|
104 | + if ( isset( $args['form'] ) ) { |
|
105 | + $args['form'] = $form->id; |
|
106 | 106 | } |
107 | - ?> |
|
107 | + ?> |
|
108 | 108 | <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
109 | 109 | <?php |
110 | 110 | unset( $form ); |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | </ul> |
113 | 113 | </li> |
114 | 114 | <?php |
115 | - } |
|
115 | + } |
|
116 | 116 | |
117 | 117 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
118 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
119 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
120 | - } |
|
118 | + echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
119 | + echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
120 | + } |
|
121 | 121 | |
122 | 122 | public static function get_success_message( $atts ) { |
123 | 123 | $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] ); |
@@ -126,110 +126,110 @@ discard block |
||
126 | 126 | return $message; |
127 | 127 | } |
128 | 128 | |
129 | - /** |
|
130 | - * Used when a form is created |
|
131 | - */ |
|
132 | - public static function setup_new_vars( $values = array() ) { |
|
133 | - global $wpdb; |
|
129 | + /** |
|
130 | + * Used when a form is created |
|
131 | + */ |
|
132 | + public static function setup_new_vars( $values = array() ) { |
|
133 | + global $wpdb; |
|
134 | 134 | |
135 | - if ( ! empty( $values ) ) { |
|
136 | - $post_values = $values; |
|
137 | - } else { |
|
138 | - $values = array(); |
|
139 | - $post_values = isset($_POST) ? $_POST : array(); |
|
140 | - } |
|
135 | + if ( ! empty( $values ) ) { |
|
136 | + $post_values = $values; |
|
137 | + } else { |
|
138 | + $values = array(); |
|
139 | + $post_values = isset($_POST) ? $_POST : array(); |
|
140 | + } |
|
141 | 141 | |
142 | 142 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
143 | 143 | if ( ! isset( $values[ $var ] ) ) { |
144 | 144 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
145 | - } |
|
146 | - } |
|
145 | + } |
|
146 | + } |
|
147 | 147 | |
148 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
148 | + $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
149 | 149 | |
150 | 150 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
151 | - if ( ! isset( $values[ $var ] ) ) { |
|
151 | + if ( ! isset( $values[ $var ] ) ) { |
|
152 | 152 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
153 | - } |
|
154 | - } |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | - if ( ! isset( $values['form_key'] ) ) { |
|
156 | + if ( ! isset( $values['form_key'] ) ) { |
|
157 | 157 | $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | - $values = self::fill_default_opts($values, false, $post_values); |
|
160 | + $values = self::fill_default_opts($values, false, $post_values); |
|
161 | 161 | |
162 | - if ( $post_values && isset($post_values['options']['custom_style']) ) { |
|
163 | - $values['custom_style'] = $post_values['options']['custom_style']; |
|
164 | - } else { |
|
165 | - $frm_settings = FrmAppHelper::get_settings(); |
|
166 | - $values['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
167 | - } |
|
162 | + if ( $post_values && isset($post_values['options']['custom_style']) ) { |
|
163 | + $values['custom_style'] = $post_values['options']['custom_style']; |
|
164 | + } else { |
|
165 | + $frm_settings = FrmAppHelper::get_settings(); |
|
166 | + $values['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
167 | + } |
|
168 | 168 | |
169 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
170 | - } |
|
169 | + return apply_filters('frm_setup_new_form_vars', $values); |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * Used when editing a form |
|
174 | - */ |
|
175 | - public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
172 | + /** |
|
173 | + * Used when editing a form |
|
174 | + */ |
|
175 | + public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
176 | 176 | if ( empty( $post_values ) ) { |
177 | 177 | $post_values = stripslashes_deep( $_POST ); |
178 | 178 | } |
179 | 179 | |
180 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
181 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
182 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
183 | - $values['status'] = $record->status; |
|
180 | + $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
181 | + $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
182 | + $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
183 | + $values['status'] = $record->status; |
|
184 | 184 | |
185 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
185 | + $values = self::fill_default_opts($values, $record, $post_values); |
|
186 | 186 | |
187 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
188 | - } |
|
187 | + return apply_filters('frm_setup_edit_form_vars', $values); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | public static function fill_default_opts( $values, $record, $post_values ) { |
191 | 191 | |
192 | - $defaults = self::get_default_opts(); |
|
192 | + $defaults = self::get_default_opts(); |
|
193 | 193 | foreach ( $defaults as $var => $default ) { |
194 | - if ( is_array($default) ) { |
|
195 | - if ( ! isset( $values[ $var ] ) ) { |
|
194 | + if ( is_array($default) ) { |
|
195 | + if ( ! isset( $values[ $var ] ) ) { |
|
196 | 196 | $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - foreach ( $default as $k => $v ) { |
|
199 | + foreach ( $default as $k => $v ) { |
|
200 | 200 | $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
201 | 201 | |
202 | - if ( is_array( $v ) ) { |
|
203 | - foreach ( $v as $k1 => $v1 ) { |
|
202 | + if ( is_array( $v ) ) { |
|
203 | + foreach ( $v as $k1 => $v1 ) { |
|
204 | 204 | $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
205 | - unset( $k1, $v1 ); |
|
206 | - } |
|
207 | - } |
|
205 | + unset( $k1, $v1 ); |
|
206 | + } |
|
207 | + } |
|
208 | 208 | |
209 | - unset($k, $v); |
|
210 | - } |
|
211 | - } else { |
|
209 | + unset($k, $v); |
|
210 | + } |
|
211 | + } else { |
|
212 | 212 | $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - unset($var, $default); |
|
216 | - } |
|
215 | + unset($var, $default); |
|
216 | + } |
|
217 | 217 | |
218 | - return $values; |
|
219 | - } |
|
218 | + return $values; |
|
219 | + } |
|
220 | 220 | |
221 | - public static function get_default_opts() { |
|
222 | - $frm_settings = FrmAppHelper::get_settings(); |
|
221 | + public static function get_default_opts() { |
|
222 | + $frm_settings = FrmAppHelper::get_settings(); |
|
223 | 223 | |
224 | - return array( |
|
225 | - 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
226 | - 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
227 | - 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
228 | - 'before_html' => self::get_default_html('before'), |
|
229 | - 'after_html' => '', |
|
230 | - 'submit_html' => self::get_default_html('submit'), |
|
231 | - ); |
|
232 | - } |
|
224 | + return array( |
|
225 | + 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
226 | + 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
227 | + 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
228 | + 'before_html' => self::get_default_html('before'), |
|
229 | + 'after_html' => '', |
|
230 | + 'submit_html' => self::get_default_html('submit'), |
|
231 | + ); |
|
232 | + } |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * @param array $options |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | - /** |
|
248 | - * @param string $loc |
|
249 | - */ |
|
247 | + /** |
|
248 | + * @param string $loc |
|
249 | + */ |
|
250 | 250 | public static function get_default_html( $loc ) { |
251 | 251 | if ( $loc == 'submit' ) { |
252 | - $sending = __( 'Sending', 'formidable' ); |
|
253 | - $draft_link = self::get_draft_link(); |
|
254 | - $img = '[frmurl]/images/ajax_loader.gif'; |
|
255 | - $default_html = <<<SUBMIT_HTML |
|
252 | + $sending = __( 'Sending', 'formidable' ); |
|
253 | + $draft_link = self::get_draft_link(); |
|
254 | + $img = '[frmurl]/images/ajax_loader.gif'; |
|
255 | + $default_html = <<<SUBMIT_HTML |
|
256 | 256 | <div class="frm_submit"> |
257 | 257 | [if back_button]<input type="button" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook] />[/if back_button] |
258 | 258 | <input type="submit" value="[button_label]" [button_action] /> |
@@ -261,49 +261,49 @@ discard block |
||
261 | 261 | </div> |
262 | 262 | SUBMIT_HTML; |
263 | 263 | } else if ( $loc == 'before' ) { |
264 | - $default_html = <<<BEFORE_HTML |
|
264 | + $default_html = <<<BEFORE_HTML |
|
265 | 265 | <legend class="frm_hidden">[form_name]</legend> |
266 | 266 | [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name] |
267 | 267 | [if form_description]<div class="frm_description">[form_description]</div>[/if form_description] |
268 | 268 | BEFORE_HTML; |
269 | 269 | } else { |
270 | - $default_html = ''; |
|
271 | - } |
|
270 | + $default_html = ''; |
|
271 | + } |
|
272 | 272 | |
273 | - return $default_html; |
|
274 | - } |
|
273 | + return $default_html; |
|
274 | + } |
|
275 | 275 | |
276 | - public static function get_draft_link() { |
|
277 | - $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
278 | - return $link; |
|
279 | - } |
|
276 | + public static function get_draft_link() { |
|
277 | + $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
278 | + return $link; |
|
279 | + } |
|
280 | 280 | |
281 | 281 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
282 | - $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
283 | - if ( ! strpos($button, '[button_action]') ) { |
|
284 | - return; |
|
285 | - } |
|
282 | + $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
283 | + if ( ! strpos($button, '[button_action]') ) { |
|
284 | + return; |
|
285 | + } |
|
286 | 286 | |
287 | - $button_parts = explode('[button_action]', $button); |
|
288 | - echo $button_parts[0]; |
|
289 | - //echo ' id="frm_submit_"'; |
|
287 | + $button_parts = explode('[button_action]', $button); |
|
288 | + echo $button_parts[0]; |
|
289 | + //echo ' id="frm_submit_"'; |
|
290 | 290 | |
291 | - $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
292 | - if ( ! empty($classes) ) { |
|
291 | + $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
292 | + if ( ! empty($classes) ) { |
|
293 | 293 | echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"'; |
294 | - } |
|
295 | - |
|
296 | - do_action('frm_submit_button_action', $form, $form_action); |
|
297 | - echo $button_parts[1]; |
|
298 | - } |
|
299 | - |
|
300 | - /** |
|
301 | - * Automatically add end section fields if they don't exist (2.0 migration) |
|
302 | - * @since 2.0 |
|
303 | - * |
|
304 | - * @param boolean $reset_fields |
|
305 | - */ |
|
306 | - public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
294 | + } |
|
295 | + |
|
296 | + do_action('frm_submit_button_action', $form, $form_action); |
|
297 | + echo $button_parts[1]; |
|
298 | + } |
|
299 | + |
|
300 | + /** |
|
301 | + * Automatically add end section fields if they don't exist (2.0 migration) |
|
302 | + * @since 2.0 |
|
303 | + * |
|
304 | + * @param boolean $reset_fields |
|
305 | + */ |
|
306 | + public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
307 | 307 | if ( empty( $fields ) ) { |
308 | 308 | return; |
309 | 309 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $open = $prev_order = false; |
313 | 313 | $add_order = 0; |
314 | 314 | $last_field = false; |
315 | - foreach ( $fields as $field ) { |
|
315 | + foreach ( $fields as $field ) { |
|
316 | 316 | if ( $prev_order === $field->field_order ) { |
317 | 317 | $add_order++; |
318 | 318 | } |
@@ -323,48 +323,48 @@ discard block |
||
323 | 323 | FrmField::update( $field->id, array( 'field_order' => $field->field_order ) ); |
324 | 324 | } |
325 | 325 | |
326 | - switch ( $field->type ) { |
|
327 | - case 'divider': |
|
328 | - // create an end section if open |
|
326 | + switch ( $field->type ) { |
|
327 | + case 'divider': |
|
328 | + // create an end section if open |
|
329 | 329 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
330 | 330 | |
331 | - // mark it open for the next end section |
|
332 | - $open = true; |
|
333 | - break; |
|
334 | - case 'break'; |
|
331 | + // mark it open for the next end section |
|
332 | + $open = true; |
|
333 | + break; |
|
334 | + case 'break'; |
|
335 | 335 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
336 | - break; |
|
337 | - case 'end_divider': |
|
338 | - if ( ! $open ) { |
|
339 | - // the section isn't open, so this is an extra field that needs to be removed |
|
340 | - FrmField::destroy( $field->id ); |
|
341 | - $reset_fields = true; |
|
342 | - } |
|
343 | - |
|
344 | - // There is already an end section here, so there is no need to create one |
|
345 | - $open = false; |
|
346 | - } |
|
336 | + break; |
|
337 | + case 'end_divider': |
|
338 | + if ( ! $open ) { |
|
339 | + // the section isn't open, so this is an extra field that needs to be removed |
|
340 | + FrmField::destroy( $field->id ); |
|
341 | + $reset_fields = true; |
|
342 | + } |
|
343 | + |
|
344 | + // There is already an end section here, so there is no need to create one |
|
345 | + $open = false; |
|
346 | + } |
|
347 | 347 | $prev_order = $field->field_order; |
348 | 348 | |
349 | 349 | $last_field = $field; |
350 | 350 | unset( $field ); |
351 | - } |
|
351 | + } |
|
352 | 352 | |
353 | 353 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field ); |
354 | - } |
|
354 | + } |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Create end section field if it doesn't exist. This is for migration from < 2.0 |
358 | 358 | * Fix any ordering that may be messed up |
359 | 359 | */ |
360 | 360 | public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) { |
361 | - if ( ! $open ) { |
|
362 | - return; |
|
363 | - } |
|
361 | + if ( ! $open ) { |
|
362 | + return; |
|
363 | + } |
|
364 | 364 | |
365 | 365 | $end_section_values['field_order'] = $field->field_order + 1; |
366 | 366 | |
367 | - FrmField::create( $end_section_values ); |
|
367 | + FrmField::create( $end_section_values ); |
|
368 | 368 | |
369 | 369 | if ( $move == 'move' ) { |
370 | 370 | // bump the order of current field unless we're at the end of the form |
@@ -372,38 +372,38 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | $add_order += 2; |
375 | - $open = false; |
|
376 | - $reset_fields = true; |
|
377 | - } |
|
375 | + $open = false; |
|
376 | + $reset_fields = true; |
|
377 | + } |
|
378 | 378 | |
379 | - public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
379 | + public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
380 | 380 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
381 | - if ( $code == 'form_name' ) { |
|
382 | - $replace_with = $form->name; |
|
383 | - } else if ( $code == 'form_description' ) { |
|
384 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
385 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
386 | - $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
387 | - } else { |
|
388 | - $replace_with = ''; |
|
389 | - } |
|
381 | + if ( $code == 'form_name' ) { |
|
382 | + $replace_with = $form->name; |
|
383 | + } else if ( $code == 'form_description' ) { |
|
384 | + $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
385 | + } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
386 | + $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
387 | + } else { |
|
388 | + $replace_with = ''; |
|
389 | + } |
|
390 | 390 | |
391 | - FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
392 | - } |
|
391 | + FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
392 | + } |
|
393 | 393 | |
394 | - //replace [form_key] |
|
395 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
394 | + //replace [form_key] |
|
395 | + $html = str_replace('[form_key]', $form->form_key, $html); |
|
396 | 396 | |
397 | - //replace [frmurl] |
|
398 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
397 | + //replace [frmurl] |
|
398 | + $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
399 | 399 | |
400 | 400 | if ( strpos( $html, '[button_label]' ) ) { |
401 | 401 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
402 | 402 | $replace_with = apply_filters( 'frm_submit_button', $title, $form ); |
403 | 403 | $html = str_replace( '[button_label]', $replace_with, $html ); |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
406 | + $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
407 | 407 | |
408 | 408 | if ( strpos( $html, '[if back_button]' ) ) { |
409 | 409 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -417,32 +417,32 @@ discard block |
||
417 | 417 | $html = do_shortcode( $html ); |
418 | 418 | } |
419 | 419 | |
420 | - return $html; |
|
421 | - } |
|
420 | + return $html; |
|
421 | + } |
|
422 | 422 | |
423 | 423 | public static function submit_button_label( $submit ) { |
424 | - if ( ! $submit || empty($submit) ) { |
|
425 | - $frm_settings = FrmAppHelper::get_settings(); |
|
426 | - $submit = $frm_settings->submit_value; |
|
427 | - } |
|
424 | + if ( ! $submit || empty($submit) ) { |
|
425 | + $frm_settings = FrmAppHelper::get_settings(); |
|
426 | + $submit = $frm_settings->submit_value; |
|
427 | + } |
|
428 | 428 | |
429 | - return $submit; |
|
430 | - } |
|
429 | + return $submit; |
|
430 | + } |
|
431 | 431 | |
432 | 432 | public static function get_form_style_class( $form = false ) { |
433 | - $style = self::get_form_style($form); |
|
434 | - $class = ' with_frm_style'; |
|
435 | - |
|
436 | - if ( empty($style) ) { |
|
437 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
438 | - return $class; |
|
439 | - } else { |
|
440 | - return; |
|
441 | - } |
|
442 | - } |
|
443 | - |
|
444 | - //If submit button needs to be inline or centered |
|
445 | - if ( is_object($form) ) { |
|
433 | + $style = self::get_form_style($form); |
|
434 | + $class = ' with_frm_style'; |
|
435 | + |
|
436 | + if ( empty($style) ) { |
|
437 | + if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
438 | + return $class; |
|
439 | + } else { |
|
440 | + return; |
|
441 | + } |
|
442 | + } |
|
443 | + |
|
444 | + //If submit button needs to be inline or centered |
|
445 | + if ( is_object($form) ) { |
|
446 | 446 | $form = $form->options; |
447 | 447 | } |
448 | 448 | |
@@ -454,17 +454,17 @@ discard block |
||
454 | 454 | $class .= ' frm_center_submit'; |
455 | 455 | } |
456 | 456 | |
457 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
457 | + $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
458 | 458 | |
459 | - return $class; |
|
460 | - } |
|
459 | + return $class; |
|
460 | + } |
|
461 | 461 | |
462 | - /** |
|
463 | - * @param string|boolean $form |
|
464 | - * |
|
465 | - * @return string |
|
466 | - */ |
|
467 | - public static function get_form_style( $form ) { |
|
462 | + /** |
|
463 | + * @param string|boolean $form |
|
464 | + * |
|
465 | + * @return string |
|
466 | + */ |
|
467 | + public static function get_form_style( $form ) { |
|
468 | 468 | $style = 1; |
469 | 469 | if ( empty( $form ) || 'default' == 'form' ) { |
470 | 470 | return $style; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $style = ( $form && is_object( $form ) && isset( $form->options['custom_style'] ) ) ? $form->options['custom_style'] : $style; |
485 | 485 | |
486 | 486 | return $style; |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | 489 | /** |
490 | 490 | * Display the validation error messages when an entry is submitted |
@@ -538,74 +538,74 @@ discard block |
||
538 | 538 | } |
539 | 539 | |
540 | 540 | public static function get_scroll_js( $form_id ) { |
541 | - ?><script type="text/javascript">jQuery(document).ready(function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
542 | - } |
|
541 | + ?><script type="text/javascript">jQuery(document).ready(function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
542 | + } |
|
543 | 543 | |
544 | 544 | public static function edit_form_link( $form_id ) { |
545 | - if ( is_object($form_id) ) { |
|
546 | - $form = $form_id; |
|
547 | - $name = $form->name; |
|
548 | - $form_id = $form->id; |
|
549 | - } else { |
|
550 | - $name = FrmForm::getName($form_id); |
|
551 | - } |
|
552 | - |
|
553 | - if ( $form_id ) { |
|
545 | + if ( is_object($form_id) ) { |
|
546 | + $form = $form_id; |
|
547 | + $name = $form->name; |
|
548 | + $form_id = $form->id; |
|
549 | + } else { |
|
550 | + $name = FrmForm::getName($form_id); |
|
551 | + } |
|
552 | + |
|
553 | + if ( $form_id ) { |
|
554 | 554 | $val = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ) ) . '">' . ( '' == $name ? __( '(no title)' ) : FrmAppHelper::truncate( $name, 40 ) ) . '</a>'; |
555 | - } else { |
|
556 | - $val = ''; |
|
557 | - } |
|
555 | + } else { |
|
556 | + $val = ''; |
|
557 | + } |
|
558 | 558 | |
559 | - return $val; |
|
559 | + return $val; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | public static function delete_trash_link( $id, $status, $length = 'long' ) { |
563 | - $link = ''; |
|
564 | - $labels = array( |
|
565 | - 'restore' => array( |
|
566 | - 'long' => __( 'Restore from Trash', 'formidable' ), |
|
567 | - 'short' => __( 'Restore', 'formidable' ), |
|
568 | - ), |
|
569 | - 'trash' => array( |
|
570 | - 'long' => __( 'Move to Trash', 'formidable' ), |
|
571 | - 'short' => __( 'Trash', 'formidable' ), |
|
572 | - ), |
|
573 | - 'delete' => array( |
|
574 | - 'long' => __( 'Delete Permanently', 'formidable' ), |
|
575 | - 'short' => __( 'Delete', 'formidable' ), |
|
576 | - ), |
|
577 | - ); |
|
578 | - |
|
579 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
563 | + $link = ''; |
|
564 | + $labels = array( |
|
565 | + 'restore' => array( |
|
566 | + 'long' => __( 'Restore from Trash', 'formidable' ), |
|
567 | + 'short' => __( 'Restore', 'formidable' ), |
|
568 | + ), |
|
569 | + 'trash' => array( |
|
570 | + 'long' => __( 'Move to Trash', 'formidable' ), |
|
571 | + 'short' => __( 'Trash', 'formidable' ), |
|
572 | + ), |
|
573 | + 'delete' => array( |
|
574 | + 'long' => __( 'Delete Permanently', 'formidable' ), |
|
575 | + 'short' => __( 'Delete', 'formidable' ), |
|
576 | + ), |
|
577 | + ); |
|
578 | + |
|
579 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
580 | 580 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
581 | - if ( 'trash' == $status ) { |
|
581 | + if ( 'trash' == $status ) { |
|
582 | 582 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
583 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
584 | - if ( EMPTY_TRASH_DAYS ) { |
|
583 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
584 | + if ( EMPTY_TRASH_DAYS ) { |
|
585 | 585 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
586 | - } else { |
|
586 | + } else { |
|
587 | 587 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
588 | - } |
|
589 | - } |
|
588 | + } |
|
589 | + } |
|
590 | 590 | |
591 | - return $link; |
|
592 | - } |
|
591 | + return $link; |
|
592 | + } |
|
593 | 593 | |
594 | 594 | public static function status_nice_name( $status ) { |
595 | - $nice_names = array( |
|
596 | - 'draft' => __( 'Draft', 'formidable' ), |
|
597 | - 'trash' => __( 'Trash', 'formidable' ), |
|
598 | - 'publish' => __( 'Published', 'formidable' ), |
|
599 | - ); |
|
600 | - |
|
601 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
602 | - $status = 'publish'; |
|
603 | - } |
|
595 | + $nice_names = array( |
|
596 | + 'draft' => __( 'Draft', 'formidable' ), |
|
597 | + 'trash' => __( 'Trash', 'formidable' ), |
|
598 | + 'publish' => __( 'Published', 'formidable' ), |
|
599 | + ); |
|
600 | + |
|
601 | + if ( ! in_array($status, array_keys($nice_names)) ) { |
|
602 | + $status = 'publish'; |
|
603 | + } |
|
604 | 604 | |
605 | 605 | $name = $nice_names[ $status ]; |
606 | 606 | |
607 | - return $name; |
|
608 | - } |
|
607 | + return $name; |
|
608 | + } |
|
609 | 609 | |
610 | 610 | public static function get_params() { |
611 | 611 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::list_page_params' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public static function get_direct_link( $key, $form = false ) { |
14 | 14 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
15 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
15 | + $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form ); |
|
16 | 16 | |
17 | 17 | return $target_url; |
18 | 18 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $query['id !'] = $args['exclude']; |
38 | 38 | } |
39 | 39 | |
40 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
40 | + $where = apply_filters( 'frm_forms_dropdown', $query, $field_name ); |
|
41 | 41 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
42 | 42 | $add_html = array(); |
43 | 43 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <?php } ?> |
51 | 51 | <?php foreach ( $forms as $form ) { ?> |
52 | 52 | <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php |
53 | - echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ; |
|
53 | + echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ); |
|
54 | 54 | ?></option> |
55 | 55 | <?php } ?> |
56 | 56 | </select> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function add_html_attr( $class, $param, &$add_html ) { |
68 | 68 | if ( ! empty( $class ) ) { |
69 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
69 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $args = array( 'id' => 0, 'form' => 0 ); |
78 | 78 | if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) { |
79 | 79 | unset( $args['form'] ); |
80 | - } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
|
80 | + } else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) { |
|
81 | 81 | unset( $args['id'] ); |
82 | 82 | } |
83 | 83 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
86 | 86 | $args['frm_action'] = 'list'; |
87 | 87 | $args['form'] = 0; |
88 | - } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
88 | + } else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
89 | 89 | $args['frm_action'] = 'edit'; |
90 | 90 | } else if ( isset( $_GET['post'] ) ) { |
91 | 91 | $args['form'] = 0; |
92 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
92 | + $base = admin_url( 'edit.php?post_type=frm_display' ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | ?> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $args['form'] = $form->id; |
106 | 106 | } |
107 | 107 | ?> |
108 | - <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
108 | + <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
109 | 109 | <?php |
110 | 110 | unset( $form ); |
111 | 111 | } ?> |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
118 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
119 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
118 | + echo ( $sort_col == $col ) ? 'sorted' : 'sortable'; |
|
119 | + echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | public static function get_success_message( $atts ) { |
@@ -136,20 +136,20 @@ discard block |
||
136 | 136 | $post_values = $values; |
137 | 137 | } else { |
138 | 138 | $values = array(); |
139 | - $post_values = isset($_POST) ? $_POST : array(); |
|
139 | + $post_values = isset( $_POST ) ? $_POST : array(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
143 | - if ( ! isset( $values[ $var ] ) ) { |
|
144 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
143 | + if ( ! isset( $values[$var] ) ) { |
|
144 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
148 | + $values['description'] = FrmAppHelper::use_wpautop( $values['description'] ); |
|
149 | 149 | |
150 | 150 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
151 | - if ( ! isset( $values[ $var ] ) ) { |
|
152 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
151 | + if ( ! isset( $values[$var] ) ) { |
|
152 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
158 | 158 | } |
159 | 159 | |
160 | - $values = self::fill_default_opts($values, false, $post_values); |
|
160 | + $values = self::fill_default_opts( $values, false, $post_values ); |
|
161 | 161 | |
162 | - if ( $post_values && isset($post_values['options']['custom_style']) ) { |
|
162 | + if ( $post_values && isset( $post_values['options']['custom_style'] ) ) { |
|
163 | 163 | $values['custom_style'] = $post_values['options']['custom_style']; |
164 | 164 | } else { |
165 | 165 | $frm_settings = FrmAppHelper::get_settings(); |
166 | 166 | $values['custom_style'] = ( $frm_settings->load_style != 'none' ); |
167 | 167 | } |
168 | 168 | |
169 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
169 | + return apply_filters( 'frm_setup_new_form_vars', $values ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -177,42 +177,42 @@ discard block |
||
177 | 177 | $post_values = stripslashes_deep( $_POST ); |
178 | 178 | } |
179 | 179 | |
180 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
181 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
182 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
180 | + $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key; |
|
181 | + $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template; |
|
182 | + $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template; |
|
183 | 183 | $values['status'] = $record->status; |
184 | 184 | |
185 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
185 | + $values = self::fill_default_opts( $values, $record, $post_values ); |
|
186 | 186 | |
187 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
187 | + return apply_filters( 'frm_setup_edit_form_vars', $values ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public static function fill_default_opts( $values, $record, $post_values ) { |
191 | 191 | |
192 | 192 | $defaults = self::get_default_opts(); |
193 | 193 | foreach ( $defaults as $var => $default ) { |
194 | - if ( is_array($default) ) { |
|
195 | - if ( ! isset( $values[ $var ] ) ) { |
|
196 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
194 | + if ( is_array( $default ) ) { |
|
195 | + if ( ! isset( $values[$var] ) ) { |
|
196 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | foreach ( $default as $k => $v ) { |
200 | - $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
|
200 | + $values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v ); |
|
201 | 201 | |
202 | 202 | if ( is_array( $v ) ) { |
203 | 203 | foreach ( $v as $k1 => $v1 ) { |
204 | - $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
204 | + $values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
205 | 205 | unset( $k1, $v1 ); |
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | - unset($k, $v); |
|
209 | + unset( $k, $v ); |
|
210 | 210 | } |
211 | 211 | } else { |
212 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
212 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
213 | 213 | } |
214 | 214 | |
215 | - unset($var, $default); |
|
215 | + unset( $var, $default ); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return $values; |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
226 | 226 | 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
227 | 227 | 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
228 | - 'before_html' => self::get_default_html('before'), |
|
228 | + 'before_html' => self::get_default_html( 'before' ), |
|
229 | 229 | 'after_html' => '', |
230 | - 'submit_html' => self::get_default_html('submit'), |
|
230 | + 'submit_html' => self::get_default_html( 'submit' ), |
|
231 | 231 | ); |
232 | 232 | } |
233 | 233 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public static function fill_form_options( &$options, $values ) { |
240 | 240 | $defaults = self::get_default_opts(); |
241 | 241 | foreach ( $defaults as $var => $default ) { |
242 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
242 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
243 | 243 | unset( $var, $default ); |
244 | 244 | } |
245 | 245 | } |
@@ -279,21 +279,21 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
282 | - $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
283 | - if ( ! strpos($button, '[button_action]') ) { |
|
282 | + $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); |
|
283 | + if ( ! strpos( $button, '[button_action]' ) ) { |
|
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - $button_parts = explode('[button_action]', $button); |
|
287 | + $button_parts = explode( '[button_action]', $button ); |
|
288 | 288 | echo $button_parts[0]; |
289 | 289 | //echo ' id="frm_submit_"'; |
290 | 290 | |
291 | - $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
292 | - if ( ! empty($classes) ) { |
|
291 | + $classes = apply_filters( 'frm_submit_button_class', array(), $form ); |
|
292 | + if ( ! empty( $classes ) ) { |
|
293 | 293 | echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"'; |
294 | 294 | } |
295 | 295 | |
296 | - do_action('frm_submit_button_action', $form, $form_action); |
|
296 | + do_action( 'frm_submit_button_action', $form, $form_action ); |
|
297 | 297 | echo $button_parts[1]; |
298 | 298 | } |
299 | 299 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $last_field = false; |
315 | 315 | foreach ( $fields as $field ) { |
316 | 316 | if ( $prev_order === $field->field_order ) { |
317 | - $add_order++; |
|
317 | + $add_order ++; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if ( $add_order ) { |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | if ( $code == 'form_name' ) { |
382 | 382 | $replace_with = $form->name; |
383 | 383 | } else if ( $code == 'form_description' ) { |
384 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
385 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
384 | + $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
|
385 | + } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { |
|
386 | 386 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
387 | 387 | } else { |
388 | 388 | $replace_with = ''; |
389 | 389 | } |
390 | 390 | |
391 | - FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
391 | + FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | //replace [form_key] |
395 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
395 | + $html = str_replace( '[form_key]', $form->form_key, $html ); |
|
396 | 396 | |
397 | 397 | //replace [frmurl] |
398 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
398 | + $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
|
399 | 399 | |
400 | 400 | if ( strpos( $html, '[button_label]' ) ) { |
401 | 401 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $html = str_replace( '[button_label]', $replace_with, $html ); |
404 | 404 | } |
405 | 405 | |
406 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
406 | + $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values ); |
|
407 | 407 | |
408 | 408 | if ( strpos( $html, '[if back_button]' ) ) { |
409 | 409 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | public static function submit_button_label( $submit ) { |
424 | - if ( ! $submit || empty($submit) ) { |
|
424 | + if ( ! $submit || empty( $submit ) ) { |
|
425 | 425 | $frm_settings = FrmAppHelper::get_settings(); |
426 | 426 | $submit = $frm_settings->submit_value; |
427 | 427 | } |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | } |
431 | 431 | |
432 | 432 | public static function get_form_style_class( $form = false ) { |
433 | - $style = self::get_form_style($form); |
|
433 | + $style = self::get_form_style( $form ); |
|
434 | 434 | $class = ' with_frm_style'; |
435 | 435 | |
436 | - if ( empty($style) ) { |
|
437 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
436 | + if ( empty( $style ) ) { |
|
437 | + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { |
|
438 | 438 | return $class; |
439 | 439 | } else { |
440 | 440 | return; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | //If submit button needs to be inline or centered |
445 | - if ( is_object($form) ) { |
|
445 | + if ( is_object( $form ) ) { |
|
446 | 446 | $form = $form->options; |
447 | 447 | } |
448 | 448 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $class .= ' frm_center_submit'; |
455 | 455 | } |
456 | 456 | |
457 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
457 | + $class = apply_filters( 'frm_add_form_style_class', $class, $style ); |
|
458 | 458 | |
459 | 459 | return $class; |
460 | 460 | } |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | public static function edit_form_link( $form_id ) { |
545 | - if ( is_object($form_id) ) { |
|
545 | + if ( is_object( $form_id ) ) { |
|
546 | 546 | $form = $form_id; |
547 | 547 | $name = $form->name; |
548 | 548 | $form_id = $form->id; |
549 | 549 | } else { |
550 | - $name = FrmForm::getName($form_id); |
|
550 | + $name = FrmForm::getName( $form_id ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | if ( $form_id ) { |
@@ -579,12 +579,12 @@ discard block |
||
579 | 579 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
580 | 580 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
581 | 581 | if ( 'trash' == $status ) { |
582 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
|
583 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
582 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>'; |
|
583 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
584 | 584 | if ( EMPTY_TRASH_DAYS ) { |
585 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
|
585 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>'; |
|
586 | 586 | } else { |
587 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
|
587 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>'; |
|
588 | 588 | } |
589 | 589 | } |
590 | 590 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | 'publish' => __( 'Published', 'formidable' ), |
599 | 599 | ); |
600 | 600 | |
601 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
601 | + if ( ! in_array( $status, array_keys( $nice_names ) ) ) { |
|
602 | 602 | $status = 'publish'; |
603 | 603 | } |
604 | 604 | |
605 | - $name = $nice_names[ $status ]; |
|
605 | + $name = $nice_names[$status]; |
|
606 | 606 | |
607 | 607 | return $name; |
608 | 608 | } |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | protected $modes = array(); |
68 | 68 | |
69 | 69 | /** |
70 | - * |
|
71 | - * @var array |
|
72 | - */ |
|
73 | - protected $params; |
|
70 | + * |
|
71 | + * @var array |
|
72 | + */ |
|
73 | + protected $params; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Stores the value returned by ->get_column_info() |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | 'single_row_columns' ); |
88 | 88 | |
89 | 89 | /** |
90 | - * Construct the table object |
|
91 | - */ |
|
90 | + * Construct the table object |
|
91 | + */ |
|
92 | 92 | public function __construct( $args ) { |
93 | - $args = wp_parse_args( $args, array( |
|
93 | + $args = wp_parse_args( $args, array( |
|
94 | 94 | 'params' => array(), |
95 | 95 | 'plural' => '', |
96 | 96 | 'singular' => '', |
@@ -253,6 +253,9 @@ discard block |
||
253 | 253 | <?php |
254 | 254 | } |
255 | 255 | |
256 | + /** |
|
257 | + * @param string $param_name |
|
258 | + */ |
|
256 | 259 | private function hidden_search_inputs( $param_name ) { |
257 | 260 | if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
258 | 261 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
@@ -389,6 +392,9 @@ discard block |
||
389 | 392 | return $action; |
390 | 393 | } |
391 | 394 | |
395 | + /** |
|
396 | + * @param string $action_name |
|
397 | + */ |
|
392 | 398 | private static function get_bulk_action( $action_name ) { |
393 | 399 | $action = false; |
394 | 400 | if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | return $this->get_pagenum(); |
198 | 198 | } |
199 | 199 | |
200 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
201 | - return $this->_pagination_args[ $key ]; |
|
200 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
201 | + return $this->_pagination_args[$key]; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | private function hidden_search_inputs( $param_name ) { |
256 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
257 | - echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
|
256 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
257 | + echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[$param_name] ) . '" />'; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | echo "<ul class='subsubsub'>\n"; |
299 | 299 | foreach ( $views as $class => $view ) { |
300 | - $views[ $class ] = "\t<li class='$class'>$view"; |
|
300 | + $views[$class] = "\t<li class='$class'>$view"; |
|
301 | 301 | } |
302 | 302 | echo implode( " |</li>\n", $views ) . "</li>\n"; |
303 | 303 | echo '</ul>'; |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | |
391 | 391 | private static function get_bulk_action( $action_name ) { |
392 | 392 | $action = false; |
393 | - if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
|
394 | - $action = sanitize_text_field( $_REQUEST[ $action_name ] ); |
|
393 | + if ( isset( $_REQUEST[$action_name] ) && -1 != sanitize_text_field( $_REQUEST[$action_name] ) ) { |
|
394 | + $action = sanitize_text_field( $_REQUEST[$action_name] ); |
|
395 | 395 | } |
396 | 396 | return $action; |
397 | 397 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | |
417 | 417 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
418 | 418 | foreach ( $actions as $action => $link ) { |
419 | - ++$i; |
|
419 | + ++ $i; |
|
420 | 420 | ( $i == $action_count ) ? $sep = '' : $sep = ' | '; |
421 | 421 | $out .= "<span class='$action'>$link$sep</span>"; |
422 | 422 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | |
685 | 685 | // If the primary column doesn't exist fall back to the |
686 | 686 | // first non-checkbox column. |
687 | - if ( ! isset( $columns[ $default ] ) ) { |
|
687 | + if ( ! isset( $columns[$default] ) ) { |
|
688 | 688 | $default = FrmListHelper::get_default_primary_column_name(); |
689 | 689 | } |
690 | 690 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
700 | 700 | |
701 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
701 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
702 | 702 | $column = $default; |
703 | 703 | } |
704 | 704 | |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | // In 4.3, we added a fourth argument for primary column. |
721 | 721 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
722 | 722 | foreach ( $this->_column_headers as $key => $value ) { |
723 | - $column_headers[ $key ] = $value; |
|
723 | + $column_headers[$key] = $value; |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | return $column_headers; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $data[1] = false; |
754 | 754 | } |
755 | 755 | |
756 | - $sortable[ $id ] = $data; |
|
756 | + $sortable[$id] = $data; |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | $primary = $this->get_primary_column_name(); |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | static $cb_counter = 1; |
809 | 809 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>' |
810 | 810 | . '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
811 | - $cb_counter++; |
|
811 | + $cb_counter ++; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -828,8 +828,8 @@ discard block |
||
828 | 828 | $class[] = 'column-primary'; |
829 | 829 | } |
830 | 830 | |
831 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
832 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
831 | + if ( isset( $sortable[$column_key] ) ) { |
|
832 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
833 | 833 | |
834 | 834 | if ( $current_orderby == $orderby ) { |
835 | 835 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @uses api_request() |
70 | 70 | * |
71 | 71 | * @param array $_transient_data Update array build by WordPress. |
72 | - * @return array Modified update array with custom plugin data. |
|
72 | + * @return stdClass Modified update array with custom plugin data. |
|
73 | 73 | */ |
74 | 74 | public function check_update( $_transient_data ) { |
75 | 75 |
@@ -15,23 +15,23 @@ discard block |
||
15 | 15 | * @version 1.6.3 |
16 | 16 | */ |
17 | 17 | class FrmEDD_SL_Plugin_Updater { |
18 | - private $api_url = ''; |
|
19 | - private $api_data = array(); |
|
20 | - private $name = ''; |
|
21 | - private $slug = ''; |
|
22 | - private $version = ''; |
|
23 | - |
|
24 | - /** |
|
25 | - * Class constructor. |
|
26 | - * |
|
27 | - * @uses plugin_basename() |
|
28 | - * @uses hook() |
|
29 | - * |
|
30 | - * @param string $_api_url The URL pointing to the custom API endpoint. |
|
31 | - * @param string $_plugin_file Path to the plugin file. |
|
32 | - * @param array $_api_data Optional data to send with API calls. |
|
33 | - */ |
|
34 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
18 | + private $api_url = ''; |
|
19 | + private $api_data = array(); |
|
20 | + private $name = ''; |
|
21 | + private $slug = ''; |
|
22 | + private $version = ''; |
|
23 | + |
|
24 | + /** |
|
25 | + * Class constructor. |
|
26 | + * |
|
27 | + * @uses plugin_basename() |
|
28 | + * @uses hook() |
|
29 | + * |
|
30 | + * @param string $_api_url The URL pointing to the custom API endpoint. |
|
31 | + * @param string $_plugin_file Path to the plugin file. |
|
32 | + * @param array $_api_data Optional data to send with API calls. |
|
33 | + */ |
|
34 | + public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
35 | 35 | global $frm_edd_plugin_data; |
36 | 36 | |
37 | 37 | $this->api_url = trailingslashit( $_api_url ); |
@@ -44,159 +44,159 @@ discard block |
||
44 | 44 | |
45 | 45 | // Set up hooks. |
46 | 46 | $this->init(); |
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Set up WordPress filters to hook into WP's update process. |
|
51 | - * |
|
52 | - * @uses add_filter() |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function init() { |
|
57 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
58 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Set up WordPress filters to hook into WP's update process. |
|
51 | + * |
|
52 | + * @uses add_filter() |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function init() { |
|
57 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
58 | + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
59 | 59 | add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Check for Updates at the defined API endpoint and modify the update array. |
|
64 | - * |
|
65 | - * This function dives into the update API just when WordPress creates its update array, |
|
66 | - * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
67 | - * It is reassembled from parts of the native WordPress plugin update code. |
|
68 | - * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
69 | - * |
|
70 | - * @uses api_request() |
|
71 | - * |
|
72 | - * @param array $_transient_data Update array build by WordPress. |
|
73 | - * @return array Modified update array with custom plugin data. |
|
74 | - */ |
|
75 | - public function check_update( $_transient_data ) { |
|
76 | - |
|
77 | - global $pagenow; |
|
78 | - |
|
79 | - if ( ! is_object( $_transient_data ) ) { |
|
80 | - $_transient_data = new stdClass; |
|
81 | - } |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Check for Updates at the defined API endpoint and modify the update array. |
|
64 | + * |
|
65 | + * This function dives into the update API just when WordPress creates its update array, |
|
66 | + * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
67 | + * It is reassembled from parts of the native WordPress plugin update code. |
|
68 | + * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
69 | + * |
|
70 | + * @uses api_request() |
|
71 | + * |
|
72 | + * @param array $_transient_data Update array build by WordPress. |
|
73 | + * @return array Modified update array with custom plugin data. |
|
74 | + */ |
|
75 | + public function check_update( $_transient_data ) { |
|
76 | + |
|
77 | + global $pagenow; |
|
78 | + |
|
79 | + if ( ! is_object( $_transient_data ) ) { |
|
80 | + $_transient_data = new stdClass; |
|
81 | + } |
|
82 | 82 | |
83 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
83 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
84 | 84 | |
85 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
85 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
86 | 86 | |
87 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
87 | + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
88 | 88 | |
89 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
89 | + if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
90 | 90 | |
91 | 91 | if ( empty( $version_info->plugin ) ) { |
92 | 92 | $version_info->plugin = $this->name; |
93 | 93 | } |
94 | 94 | |
95 | - $_transient_data->response[ $this->name ] = $version_info; |
|
96 | - |
|
97 | - } |
|
98 | - |
|
99 | - $_transient_data->last_checked = time(); |
|
100 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
101 | - |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - return $_transient_data; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Updates information on the "View version x.x details" page with custom data. |
|
110 | - * |
|
111 | - * @uses api_request() |
|
112 | - * |
|
113 | - * @param mixed $_data |
|
114 | - * @param string $_action |
|
115 | - * @param object $_args |
|
116 | - * @return object $_data |
|
117 | - */ |
|
118 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
119 | - |
|
120 | - if ( $_action != 'plugin_information' ) { |
|
95 | + $_transient_data->response[ $this->name ] = $version_info; |
|
121 | 96 | |
122 | - return $_data; |
|
97 | + } |
|
123 | 98 | |
124 | - } |
|
99 | + $_transient_data->last_checked = time(); |
|
100 | + $_transient_data->checked[ $this->name ] = $this->version; |
|
125 | 101 | |
126 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
102 | + } |
|
103 | + } |
|
127 | 104 | |
128 | - return $_data; |
|
105 | + return $_transient_data; |
|
106 | + } |
|
129 | 107 | |
130 | - } |
|
108 | + /** |
|
109 | + * Updates information on the "View version x.x details" page with custom data. |
|
110 | + * |
|
111 | + * @uses api_request() |
|
112 | + * |
|
113 | + * @param mixed $_data |
|
114 | + * @param string $_action |
|
115 | + * @param object $_args |
|
116 | + * @return object $_data |
|
117 | + */ |
|
118 | + public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
131 | 119 | |
132 | - $to_send = array( |
|
133 | - 'slug' => $this->slug, |
|
134 | - 'is_ssl' => is_ssl(), |
|
135 | - 'fields' => array( |
|
136 | - 'banners' => false, // These will be supported soon hopefully |
|
137 | - 'reviews' => false, |
|
138 | - ), |
|
139 | - ); |
|
120 | + if ( $_action != 'plugin_information' ) { |
|
140 | 121 | |
141 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
122 | + return $_data; |
|
142 | 123 | |
143 | - if ( false !== $api_response ) { |
|
144 | - $_data = $api_response; |
|
145 | - } |
|
124 | + } |
|
146 | 125 | |
147 | - return $_data; |
|
148 | - } |
|
126 | + if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
149 | 127 | |
128 | + return $_data; |
|
150 | 129 | |
151 | - /** |
|
152 | - * Disable SSL verification in order to prevent download update failures |
|
153 | - * |
|
154 | - * @param array $args |
|
155 | - * @param string $url |
|
156 | - * @return object $array |
|
157 | - */ |
|
158 | - public function http_request_args( $args, $url ) { |
|
159 | - // If it is an https request and we are performing a package download, disable ssl verification |
|
160 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
161 | - $args['sslverify'] = false; |
|
162 | - } |
|
163 | - return $args; |
|
164 | - } |
|
130 | + } |
|
165 | 131 | |
166 | - /** |
|
167 | - * Calls the API and, if successfull, returns the object delivered by the API. |
|
168 | - * |
|
169 | - * @uses get_bloginfo() |
|
170 | - * @uses wp_remote_post() |
|
171 | - * @uses is_wp_error() |
|
172 | - * |
|
173 | - * @param string $_action The requested action. |
|
174 | - * @param array $_data Parameters for the API action. |
|
175 | - * @return false|object |
|
176 | - */ |
|
177 | - private function api_request( $_action, $_data ) { |
|
132 | + $to_send = array( |
|
133 | + 'slug' => $this->slug, |
|
134 | + 'is_ssl' => is_ssl(), |
|
135 | + 'fields' => array( |
|
136 | + 'banners' => false, // These will be supported soon hopefully |
|
137 | + 'reviews' => false, |
|
138 | + ), |
|
139 | + ); |
|
178 | 140 | |
179 | - global $wp_version; |
|
141 | + $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
180 | 142 | |
181 | - $data = array_merge( $this->api_data, $_data ); |
|
143 | + if ( false !== $api_response ) { |
|
144 | + $_data = $api_response; |
|
145 | + } |
|
182 | 146 | |
183 | - if ( $data['slug'] != $this->slug ) { |
|
184 | - return; |
|
147 | + return $_data; |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * Disable SSL verification in order to prevent download update failures |
|
153 | + * |
|
154 | + * @param array $args |
|
155 | + * @param string $url |
|
156 | + * @return object $array |
|
157 | + */ |
|
158 | + public function http_request_args( $args, $url ) { |
|
159 | + // If it is an https request and we are performing a package download, disable ssl verification |
|
160 | + if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
161 | + $args['sslverify'] = false; |
|
162 | + } |
|
163 | + return $args; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Calls the API and, if successfull, returns the object delivered by the API. |
|
168 | + * |
|
169 | + * @uses get_bloginfo() |
|
170 | + * @uses wp_remote_post() |
|
171 | + * @uses is_wp_error() |
|
172 | + * |
|
173 | + * @param string $_action The requested action. |
|
174 | + * @param array $_data Parameters for the API action. |
|
175 | + * @return false|object |
|
176 | + */ |
|
177 | + private function api_request( $_action, $_data ) { |
|
178 | + |
|
179 | + global $wp_version; |
|
180 | + |
|
181 | + $data = array_merge( $this->api_data, $_data ); |
|
182 | + |
|
183 | + if ( $data['slug'] != $this->slug ) { |
|
184 | + return; |
|
185 | 185 | } |
186 | 186 | |
187 | - if ( $this->api_url == home_url() ) { |
|
188 | - return false; // Don't allow a plugin to ping itself |
|
189 | - } |
|
187 | + if ( $this->api_url == home_url() ) { |
|
188 | + return false; // Don't allow a plugin to ping itself |
|
189 | + } |
|
190 | 190 | |
191 | - $api_params = array( |
|
192 | - 'edd_action' => 'get_version', |
|
193 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
194 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
195 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
196 | - 'slug' => $data['slug'], |
|
197 | - 'author' => $data['author'], |
|
198 | - 'url' => home_url(), |
|
199 | - ); |
|
191 | + $api_params = array( |
|
192 | + 'edd_action' => 'get_version', |
|
193 | + 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
194 | + 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
195 | + 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
196 | + 'slug' => $data['slug'], |
|
197 | + 'author' => $data['author'], |
|
198 | + 'url' => home_url(), |
|
199 | + ); |
|
200 | 200 | |
201 | 201 | $cache_key = 'edd_plugin_' . md5( sanitize_key( $api_params['license'] . $this->version ) . '_' . $api_params['edd_action'] ); |
202 | 202 | $cached_response = get_transient( $cache_key ); |
@@ -205,24 +205,24 @@ discard block |
||
205 | 205 | return $cached_response; |
206 | 206 | } |
207 | 207 | |
208 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
208 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
209 | 209 | |
210 | - if ( ! is_wp_error( $request ) ) { |
|
211 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
212 | - } |
|
210 | + if ( ! is_wp_error( $request ) ) { |
|
211 | + $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
212 | + } |
|
213 | 213 | |
214 | - if ( $request && isset( $request->sections ) ) { |
|
215 | - $request->sections = maybe_unserialize( $request->sections ); |
|
214 | + if ( $request && isset( $request->sections ) ) { |
|
215 | + $request->sections = maybe_unserialize( $request->sections ); |
|
216 | 216 | set_transient( $cache_key, $request, DAY_IN_SECONDS ); |
217 | - } else { |
|
218 | - $request = false; |
|
217 | + } else { |
|
218 | + $request = false; |
|
219 | 219 | set_transient( $cache_key, 0, DAY_IN_SECONDS ); |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - return $request; |
|
223 | - } |
|
222 | + return $request; |
|
223 | + } |
|
224 | 224 | |
225 | - public function show_changelog() { |
|
225 | + public function show_changelog() { |
|
226 | 226 | |
227 | 227 | global $frm_edd_plugin_data; |
228 | 228 | |
@@ -278,5 +278,5 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | exit; |
281 | - } |
|
281 | + } |
|
282 | 282 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->slug = basename( $_plugin_file, '.php' ); |
41 | 41 | $this->version = $_api_data['version']; |
42 | 42 | |
43 | - $frm_edd_plugin_data[ $this->slug ] = $this->api_data; |
|
43 | + $frm_edd_plugin_data[$this->slug] = $this->api_data; |
|
44 | 44 | |
45 | 45 | // Set up hooks. |
46 | 46 | $this->init(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $_transient_data = new stdClass; |
81 | 81 | } |
82 | 82 | |
83 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
83 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[$this->name] ) ) { |
|
84 | 84 | |
85 | 85 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
86 | 86 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $version_info->plugin = $this->name; |
93 | 93 | } |
94 | 94 | |
95 | - $_transient_data->response[ $this->name ] = $version_info; |
|
95 | + $_transient_data->response[$this->name] = $version_info; |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | 99 | $_transient_data->last_checked = time(); |
100 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
100 | + $_transient_data->checked[$this->name] = $this->version; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | wp_die( __( 'You do not have permission to install plugin updates', 'formidable' ), __( 'Error', 'formidable' ), array( 'response' => 403 ) ); |
243 | 243 | } |
244 | 244 | |
245 | - $data = $frm_edd_plugin_data[ $_REQUEST['slug'] ]; |
|
245 | + $data = $frm_edd_plugin_data[$_REQUEST['slug']]; |
|
246 | 246 | $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' ); |
247 | 247 | $version_info = get_transient( $cache_key ); |
248 | 248 |
@@ -17,6 +17,6 @@ |
||
17 | 17 | </ul> |
18 | 18 | |
19 | 19 | <?php if ( $form && $title == 'show' ) { ?> |
20 | - <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)') : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
20 | + <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)' ) : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
21 | 21 | <?php } ?> |
22 | 22 | </div> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -235,50 +235,50 @@ discard block |
||
235 | 235 | return $line; |
236 | 236 | } |
237 | 237 | |
238 | - $convmap = false; |
|
238 | + $convmap = false; |
|
239 | 239 | |
240 | 240 | switch ( self::$to_encoding ) { |
241 | - case 'macintosh': |
|
241 | + case 'macintosh': |
|
242 | 242 | // this map was derived from the differences between the MacRoman and UTF-8 Charsets |
243 | 243 | // Reference: |
244 | 244 | // - http://www.alanwood.net/demos/macroman.html |
245 | - $convmap = array( |
|
246 | - 256, 304, 0, 0xffff, |
|
247 | - 306, 337, 0, 0xffff, |
|
248 | - 340, 375, 0, 0xffff, |
|
249 | - 377, 401, 0, 0xffff, |
|
250 | - 403, 709, 0, 0xffff, |
|
251 | - 712, 727, 0, 0xffff, |
|
252 | - 734, 936, 0, 0xffff, |
|
253 | - 938, 959, 0, 0xffff, |
|
254 | - 961, 8210, 0, 0xffff, |
|
255 | - 8213, 8215, 0, 0xffff, |
|
256 | - 8219, 8219, 0, 0xffff, |
|
257 | - 8227, 8229, 0, 0xffff, |
|
258 | - 8231, 8239, 0, 0xffff, |
|
259 | - 8241, 8248, 0, 0xffff, |
|
260 | - 8251, 8259, 0, 0xffff, |
|
261 | - 8261, 8363, 0, 0xffff, |
|
262 | - 8365, 8481, 0, 0xffff, |
|
263 | - 8483, 8705, 0, 0xffff, |
|
264 | - 8707, 8709, 0, 0xffff, |
|
265 | - 8711, 8718, 0, 0xffff, |
|
266 | - 8720, 8720, 0, 0xffff, |
|
267 | - 8722, 8729, 0, 0xffff, |
|
268 | - 8731, 8733, 0, 0xffff, |
|
269 | - 8735, 8746, 0, 0xffff, |
|
270 | - 8748, 8775, 0, 0xffff, |
|
271 | - 8777, 8799, 0, 0xffff, |
|
272 | - 8801, 8803, 0, 0xffff, |
|
273 | - 8806, 9673, 0, 0xffff, |
|
274 | - 9675, 63742, 0, 0xffff, |
|
275 | - 63744, 64256, 0, 0xffff, |
|
276 | - ); |
|
277 | - break; |
|
278 | - case 'ISO-8859-1': |
|
279 | - $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | - break; |
|
281 | - } |
|
245 | + $convmap = array( |
|
246 | + 256, 304, 0, 0xffff, |
|
247 | + 306, 337, 0, 0xffff, |
|
248 | + 340, 375, 0, 0xffff, |
|
249 | + 377, 401, 0, 0xffff, |
|
250 | + 403, 709, 0, 0xffff, |
|
251 | + 712, 727, 0, 0xffff, |
|
252 | + 734, 936, 0, 0xffff, |
|
253 | + 938, 959, 0, 0xffff, |
|
254 | + 961, 8210, 0, 0xffff, |
|
255 | + 8213, 8215, 0, 0xffff, |
|
256 | + 8219, 8219, 0, 0xffff, |
|
257 | + 8227, 8229, 0, 0xffff, |
|
258 | + 8231, 8239, 0, 0xffff, |
|
259 | + 8241, 8248, 0, 0xffff, |
|
260 | + 8251, 8259, 0, 0xffff, |
|
261 | + 8261, 8363, 0, 0xffff, |
|
262 | + 8365, 8481, 0, 0xffff, |
|
263 | + 8483, 8705, 0, 0xffff, |
|
264 | + 8707, 8709, 0, 0xffff, |
|
265 | + 8711, 8718, 0, 0xffff, |
|
266 | + 8720, 8720, 0, 0xffff, |
|
267 | + 8722, 8729, 0, 0xffff, |
|
268 | + 8731, 8733, 0, 0xffff, |
|
269 | + 8735, 8746, 0, 0xffff, |
|
270 | + 8748, 8775, 0, 0xffff, |
|
271 | + 8777, 8799, 0, 0xffff, |
|
272 | + 8801, 8803, 0, 0xffff, |
|
273 | + 8806, 9673, 0, 0xffff, |
|
274 | + 9675, 63742, 0, 0xffff, |
|
275 | + 63744, 64256, 0, 0xffff, |
|
276 | + ); |
|
277 | + break; |
|
278 | + case 'ISO-8859-1': |
|
279 | + $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | + break; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ( is_array( $convmap ) ) { |
284 | 284 | $line = mb_encode_numericentity( $line, $convmap, self::$charset ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | return self::escape_csv( $line ); |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * Escape a " in a csv with another " |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | header( 'Content-Description: File Transfer' ); |
64 | 64 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
65 | 65 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
66 | - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' ); |
|
66 | + header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' ); |
|
67 | 67 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
68 | 68 | header( 'Cache-Control: no-cache, must-revalidate' ); |
69 | 69 | header( 'Pragma: no-cache' ); |
@@ -90,21 +90,21 @@ discard block |
||
90 | 90 | foreach ( self::$fields as $col ) { |
91 | 91 | $field_headings = array(); |
92 | 92 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
93 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
93 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
94 | 94 | } |
95 | 95 | |
96 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
96 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
97 | 97 | $field_headings = apply_filters( 'frm_csv_field_columns', $field_headings, array( 'field' => $col ) ); |
98 | 98 | $headings += $field_headings; |
99 | 99 | } |
100 | 100 | |
101 | 101 | if ( self::$comment_count ) { |
102 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
103 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
104 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
105 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
102 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
103 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
104 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
105 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
106 | 106 | } |
107 | - unset($i); |
|
107 | + unset( $i ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -151,30 +151,30 @@ discard block |
||
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
154 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
155 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
156 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
154 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
155 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
156 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
157 | 157 | // if the data is here, it should be an array but if this field has collected data |
158 | 158 | // both while inside and outside of the repeating section, it's possible this is a string |
159 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
159 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | //add the repeated values |
163 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
163 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
164 | 164 | } |
165 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
165 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | // add the embedded form id |
169 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
170 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
169 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
170 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
171 | 171 | } |
172 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
172 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | private static function add_field_values_to_csv( &$row ) { |
176 | 176 | foreach ( self::$fields as $col ) { |
177 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
177 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
178 | 178 | |
179 | 179 | $field_value = maybe_unserialize( $field_value ); |
180 | 180 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
186 | 186 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
187 | 187 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
188 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
188 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
189 | 189 | ) ); |
190 | - $row[ $col->id . '_label' ] = $sep_value; |
|
190 | + $row[$col->id . '_label'] = $sep_value; |
|
191 | 191 | unset( $sep_value ); |
192 | 192 | } |
193 | 193 | |
194 | - $row[ $col->id ] = $field_value; |
|
194 | + $row[$col->id] = $field_value; |
|
195 | 195 | |
196 | 196 | unset( $col, $field_value ); |
197 | 197 | } |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | if ( is_array( $atts['field_value'] ) ) { |
205 | 205 | foreach ( $atts['field_value'] as $key => $sub_value ) { |
206 | 206 | $column_key = $atts['col']->id . '_' . $key; |
207 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
208 | - $row[ $column_key ] = $sub_value; |
|
207 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
208 | + $row[$column_key] = $sub_value; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $sep = ''; |
227 | 227 | |
228 | 228 | foreach ( self::$headings as $k => $heading ) { |
229 | - $row = isset( $rows[ $k ] ) ? $rows[ $k ] : ''; |
|
229 | + $row = isset( $rows[$k] ) ? $rows[$k] : ''; |
|
230 | 230 | if ( is_array( $row ) ) { |
231 | 231 | // implode the repeated field values |
232 | 232 | $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) ); |
@@ -87,9 +87,9 @@ |
||
87 | 87 | } else if ( $form->is_template ) { |
88 | 88 | echo ' ' . __( '(template)', 'formidable' ); |
89 | 89 | } |
90 | - ?></option> |
|
90 | + ?></option> |
|
91 | 91 | <?php |
92 | - } ?> |
|
92 | + } ?> |
|
93 | 93 | </select> |
94 | 94 | <p class="howto"><?php _e( 'Hold down the CTRL/Command button to select multiple forms', 'formidable' ); ?></p> |
95 | 95 | </td> |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | <div class="postbox "> |
11 | 11 | <h3 class="hndle"><span><?php _e( 'Import', 'formidable' ) ?></span></h3> |
12 | 12 | <div class="inside"> |
13 | - <p class="howto"><?php echo apply_filters('frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' )) ?></p> |
|
13 | + <p class="howto"><?php echo apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ?></p> |
|
14 | 14 | <br/> |
15 | 15 | <form enctype="multipart/form-data" method="post"> |
16 | 16 | <input type="hidden" name="frm_action" value="import_xml" /> |
17 | - <?php wp_nonce_field('import-xml-nonce', 'import-xml'); ?> |
|
18 | - <p><label><?php echo apply_filters('frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' )) ?> (<?php printf(__( 'Maximum size: %s', 'formidable' ), ini_get('upload_max_filesize')) ?>)</label> |
|
17 | + <?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?> |
|
18 | + <p><label><?php echo apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ?> (<?php printf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ?>)</label> |
|
19 | 19 | <input type="file" name="frm_import_file" size="25" /> |
20 | 20 | </p> |
21 | 21 | |
22 | - <?php do_action('frm_csv_opts', $forms) ?> |
|
22 | + <?php do_action( 'frm_csv_opts', $forms ) ?> |
|
23 | 23 | |
24 | 24 | <p class="submit"> |
25 | 25 | <input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ) ?>" class="button-primary" /> |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | <div class="inside with_frm_style"> |
36 | 36 | <form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml"> |
37 | 37 | <input type="hidden" name="action" value="frm_export_xml" /> |
38 | - <?php wp_nonce_field('export-xml-nonce', 'export-xml'); ?> |
|
38 | + <?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?> |
|
39 | 39 | |
40 | 40 | <table class="form-table"> |
41 | 41 | <tr class="form-field"> |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Get the singleton instance of this class |
47 | 47 | * |
48 | - * @return object |
|
48 | + * @return FrmPointers |
|
49 | 49 | */ |
50 | 50 | public static function get_instance() { |
51 | 51 | if ( ! ( self::$instance instanceof self ) ) { |
@@ -184,7 +184,7 @@ |
||
184 | 184 | private function do_page_pointer( $page ) { |
185 | 185 | $selector = 'h2'; |
186 | 186 | |
187 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
187 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
188 | 188 | |
189 | 189 | $opt_arr = array( |
190 | 190 | 'content' => $pointer['content'], |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | |
244 | 244 | return array( |
245 | 245 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
246 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | - . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | - . '<p>' |
|
251 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
246 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | + . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | + . '<p>' |
|
251 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
252 | 252 | . '<input type="hidden" name="group[4505]" value="4" />' |
253 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | - . '</p>' |
|
255 | - . '</form>', |
|
253 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | + . '</p>' |
|
255 | + . '</form>', |
|
256 | 256 | 'next_page' => 'entries', |
257 | 257 | ); |
258 | 258 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function entries_pointer() { |
266 | 266 | return array( |
267 | 267 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
268 | - . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
268 | + . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
269 | 269 | 'prev_page' => '', |
270 | 270 | 'next_page' => 'styles', |
271 | 271 | 'selector' => '.wp-list-table', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | private function styles_pointer() { |
282 | 282 | return array( |
283 | 283 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
284 | - . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
284 | + . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
285 | 285 | 'prev_page' => 'entries', |
286 | 286 | 'next_page' => 'import', |
287 | 287 | 'selector' => '.general-style', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function import_pointer() { |
298 | 298 | return array( |
299 | 299 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
300 | - . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
300 | + . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
301 | 301 | 'prev_page' => 'styles', |
302 | 302 | 'next_page' => 'settings', |
303 | 303 | 'selector' => '.inside.with_frm_style', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | . __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' ) |
318 | 318 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
319 | 319 | . sprintf( __( 'Once you’ve purchased %1$s or any addons, you’ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' ) |
320 | - . '</p>', |
|
320 | + . '</p>', |
|
321 | 321 | 'prev_page' => 'import', |
322 | 322 | 'next_page' => 'addons', |
323 | 323 | ); |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | private function addons_pointer() { |
332 | 332 | return array( |
333 | 333 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
334 | - . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
334 | + . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
335 | 335 | . '</p>' |
336 | - . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
336 | + . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
338 | 338 | 'prev_page' => 'settings', |
339 | 339 | ); |
340 | 340 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <a href="?page=formidable-styles&page-tab=default#tabs-panel-default-color" class="nav-tab-link" data-type="tabs-panel-default-color"><?php _e( 'Default', 'formidable' ) ?></a> |
5 | 5 | </li> |
6 | 6 | <li <?php echo ( 'active-color' == $current_tab ? ' class="tabs"' : '' ); ?>> |
7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=active-color#page-active-color') ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=active-color#page-active-color' ) ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
8 | 8 | </li> |
9 | 9 | <li <?php echo ( 'active-error' == $current_tab ? ' class="tabs"' : '' ); ?>> |
10 | 10 | <a href="?page=formidable-styles&page-tab=active-error#tabs-panel-active-error" class="nav-tab-link" data-type="tabs-panel-active-error"><?php _e( 'Error', 'formidable' ) ?></a> |
@@ -19,34 +19,34 @@ discard block |
||
19 | 19 | ?>"> |
20 | 20 | <div class="field-group field-group-border clearfix"> |
21 | 21 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
22 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color') ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
22 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color' ) ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
23 | 23 | </div> |
24 | 24 | <div class="field-group clearfix"> |
25 | 25 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
26 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color') ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
26 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color' ) ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="field-group field-group-border clearfix"> |
30 | 30 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color') ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color' ) ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
32 | 32 | </div> |
33 | 33 | <div class="field-group clearfix"> |
34 | 34 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
35 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_border_width') ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
35 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_width' ) ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
36 | 36 | </div> |
37 | 37 | <div class="field-group clearfix"> |
38 | 38 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_border_style') ) ?>" id="frm_field_border_style"> |
|
40 | - <option value="solid" <?php selected($style->post_content['field_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | - <option value="dotted" <?php selected($style->post_content['field_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | - <option value="dashed" <?php selected($style->post_content['field_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | - <option value="double" <?php selected($style->post_content['field_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_style' ) ) ?>" id="frm_field_border_style"> |
|
40 | + <option value="solid" <?php selected( $style->post_content['field_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | + <option value="dotted" <?php selected( $style->post_content['field_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | + <option value="dashed" <?php selected( $style->post_content['field_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | + <option value="double" <?php selected( $style->post_content['field_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
44 | 44 | </select> |
45 | 45 | </div> |
46 | 46 | <div class="clear"></div> |
47 | 47 | <p class="frm_no_bottom_margin"> |
48 | 48 | <label> |
49 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow') ) ?>" id="frm_remove_box_shadow" value="1" <?php checked($style->post_content['remove_box_shadow'], 1) ?> /> |
|
49 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow' ) ) ?>" id="frm_remove_box_shadow" value="1" <?php checked( $style->post_content['remove_box_shadow'], 1 ) ?> /> |
|
50 | 50 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
51 | 51 | </label> |
52 | 52 | </p> |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | ?>"> |
58 | 58 | <div class="field-group field-group-border clearfix"> |
59 | 59 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
60 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_active') ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
60 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_active' ) ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
61 | 61 | </div> |
62 | 62 | <div class="field-group clearfix"> |
63 | 63 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
64 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_active') ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
64 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_active' ) ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
65 | 65 | </div> |
66 | 66 | <div class="clear"></div> |
67 | 67 | <p class="frm_no_bottom_margin"> |
68 | 68 | <label> |
69 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow_active') ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked($style->post_content['remove_box_shadow_active'], 1) ?> /> |
|
69 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow_active' ) ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked( $style->post_content['remove_box_shadow_active'], 1 ) ?> /> |
|
70 | 70 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
71 | 71 | </label> |
72 | 72 | </p> |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | ?>"> |
78 | 78 | <div class="field-group field-group-border clearfix"> |
79 | 79 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
80 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_error') ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
80 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_error' ) ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
81 | 81 | </div> |
82 | 82 | <div class="field-group clearfix"> |
83 | 83 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
84 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_error') ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
84 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_error' ) ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <div class="field-group field-group-border clearfix"> |
88 | 88 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
89 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_error') ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
89 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_error' ) ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
90 | 90 | </div> |
91 | 91 | <div class="field-group clearfix"> |
92 | 92 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
93 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_width_error') ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
93 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_width_error' ) ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
94 | 94 | </div> |
95 | 95 | <div class="field-group clearfix"> |
96 | 96 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
97 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('border_style_error') ) ?>" id="frm_border_style_error"> |
|
98 | - <option value="solid" <?php selected($style->post_content['border_style_error'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | - <option value="dotted" <?php selected($style->post_content['border_style_error'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | - <option value="dashed" <?php selected($style->post_content['border_style_error'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | - <option value="double" <?php selected($style->post_content['border_style_error'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
97 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'border_style_error' ) ) ?>" id="frm_border_style_error"> |
|
98 | + <option value="solid" <?php selected( $style->post_content['border_style_error'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | + <option value="dotted" <?php selected( $style->post_content['border_style_error'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | + <option value="dashed" <?php selected( $style->post_content['border_style_error'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | + <option value="double" <?php selected( $style->post_content['border_style_error'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
102 | 102 | </select> |
103 | 103 | </div> |
104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | ?>"> |
111 | 111 | <div class="field-group field-group-border clearfix"> |
112 | 112 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
113 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_disabled') ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
113 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_disabled' ) ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
114 | 114 | </div> |
115 | 115 | <div class="field-group clearfix"> |
116 | 116 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
117 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_disabled') ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
117 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_disabled' ) ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
118 | 118 | </div> |
119 | 119 | |
120 | 120 | <div class="field-group clearfix"> |
121 | 121 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
122 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_disabled') ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
122 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_disabled' ) ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
123 | 123 | </div> |
124 | 124 | <div class="clear"></div> |
125 | 125 | </div><!-- /.tabs-panel --> |