@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | 'highrise' => 'FrmDefHrsAction', |
49 | 49 | ) ); |
50 | 50 | |
51 | - include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php'); |
|
52 | - include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php'); |
|
51 | + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' ); |
|
52 | + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' ); |
|
53 | 53 | |
54 | 54 | foreach ( $action_classes as $action_class ) { |
55 | - self::$registered_actions->register($action_class); |
|
55 | + self::$registered_actions->register( $action_class ); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function get_form_actions( $action = 'all' ) { |
60 | 60 | $temp_actions = self::$registered_actions; |
61 | - if ( empty($temp_actions) ) { |
|
61 | + if ( empty( $temp_actions ) ) { |
|
62 | 62 | self::actions_init(); |
63 | 63 | $temp_actions = self::$registered_actions->actions; |
64 | 64 | } else { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return $a; |
73 | 73 | } |
74 | 74 | |
75 | - $actions[ $a->id_base ] = $a; |
|
75 | + $actions[$a->id_base] = $a; |
|
76 | 76 | } |
77 | 77 | unset( $temp_actions, $a ); |
78 | 78 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | arsort( $temp_actions ); |
87 | 87 | foreach ( $temp_actions as $type => $a ) { |
88 | 88 | if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) { |
89 | - unset( $actions[ $type ] ); |
|
89 | + unset( $actions[$type] ); |
|
90 | 90 | if ( count( $actions ) <= $action_limit ) { |
91 | 91 | break; |
92 | 92 | } |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | $action_map = array(); |
119 | 119 | |
120 | 120 | foreach ( $action_controls as $key => $control ) { |
121 | - $action_map[ $control->id_base ] = $key; |
|
121 | + $action_map[$control->id_base] = $key; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | foreach ( $form_actions as $action ) { |
125 | - if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { |
|
125 | + if ( ! isset( $action_map[$action->post_excerpt] ) ) { |
|
126 | 126 | // don't try and show settings if action no longer exists |
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
130 | - self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values ); |
|
130 | + self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values ); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | public static function action_control( $form_action, $form, $action_key, $action_control, $values ) { |
135 | - $action_control->_set($action_key); |
|
136 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php'); |
|
135 | + $action_control->_set( $action_key ); |
|
136 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | public static function add_form_action() { |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | $action_type = sanitize_text_field( $_POST['type'] ); |
146 | 146 | |
147 | 147 | $action_control = self::get_form_actions( $action_type ); |
148 | - $action_control->_set($action_key); |
|
148 | + $action_control->_set( $action_key ); |
|
149 | 149 | |
150 | 150 | $form_id = absint( $_POST['form_id'] ); |
151 | 151 | |
152 | - $form_action = $action_control->prepare_new($form_id); |
|
152 | + $form_action = $action_control->prepare_new( $form_id ); |
|
153 | 153 | |
154 | 154 | $values = array(); |
155 | - $form = self::fields_to_values($form_id, $values); |
|
155 | + $form = self::fields_to_values( $form_id, $values ); |
|
156 | 156 | |
157 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php'); |
|
157 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); |
|
158 | 158 | wp_die(); |
159 | 159 | } |
160 | 160 | |
@@ -165,34 +165,34 @@ discard block |
||
165 | 165 | $action_type = sanitize_text_field( $_POST['action_type'] ); |
166 | 166 | |
167 | 167 | $action_control = self::get_form_actions( $action_type ); |
168 | - if ( empty($action_control) ) { |
|
168 | + if ( empty( $action_control ) ) { |
|
169 | 169 | wp_die(); |
170 | 170 | } |
171 | 171 | |
172 | 172 | $form_action = $action_control->get_single_action( $action_key ); |
173 | 173 | |
174 | 174 | $values = array(); |
175 | - $form = self::fields_to_values($form_action->menu_order, $values); |
|
175 | + $form = self::fields_to_values( $form_action->menu_order, $values ); |
|
176 | 176 | |
177 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php'); |
|
177 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' ); |
|
178 | 178 | wp_die(); |
179 | 179 | } |
180 | 180 | |
181 | 181 | private static function fields_to_values( $form_id, array &$values ) { |
182 | - $form = FrmForm::getOne($form_id); |
|
182 | + $form = FrmForm::getOne( $form_id ); |
|
183 | 183 | |
184 | 184 | $values = array( 'fields' => array(), 'id' => $form->id ); |
185 | 185 | |
186 | - $fields = FrmField::get_all_for_form($form->id); |
|
186 | + $fields = FrmField::get_all_for_form( $form->id ); |
|
187 | 187 | foreach ( $fields as $k => $f ) { |
188 | 188 | $f = (array) $f; |
189 | 189 | $opts = (array) $f['field_options']; |
190 | - $f = array_merge($opts, $f); |
|
190 | + $f = array_merge( $opts, $f ); |
|
191 | 191 | if ( ! isset( $f['post_field'] ) ) { |
192 | 192 | $f['post_field'] = ''; |
193 | 193 | } |
194 | 194 | $values['fields'][] = $f; |
195 | - unset($k, $f); |
|
195 | + unset( $k, $f ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $form; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $new_actions = array(); |
208 | 208 | |
209 | 209 | foreach ( $registered_actions as $registered_action ) { |
210 | - $action_ids = $registered_action->update_callback($form_id); |
|
210 | + $action_ids = $registered_action->update_callback( $form_id ); |
|
211 | 211 | if ( ! empty( $action_ids ) ) { |
212 | 212 | $new_actions[] = $action_ids; |
213 | 213 | } |
@@ -284,33 +284,33 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | // store actions so they can be triggered with the correct priority |
287 | - $stored_actions[ $action->ID ] = $action; |
|
288 | - $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
|
287 | + $stored_actions[$action->ID] = $action; |
|
288 | + $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority']; |
|
289 | 289 | |
290 | - unset($action); |
|
290 | + unset( $action ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | if ( ! empty( $stored_actions ) ) { |
294 | - asort($action_priority); |
|
294 | + asort( $action_priority ); |
|
295 | 295 | |
296 | 296 | // make sure hooks are loaded |
297 | 297 | new FrmNotification(); |
298 | 298 | |
299 | 299 | foreach ( $action_priority as $action_id => $priority ) { |
300 | - $action = $stored_actions[ $action_id ]; |
|
301 | - do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event); |
|
302 | - do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form); |
|
300 | + $action = $stored_actions[$action_id]; |
|
301 | + do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event ); |
|
302 | + do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form ); |
|
303 | 303 | |
304 | 304 | // If post is created, get updated $entry object |
305 | 305 | if ( $action->post_excerpt == 'wppost' && $event == 'create' ) { |
306 | - $entry = FrmEntry::getOne($entry->id, true); |
|
306 | + $entry = FrmEntry::getOne( $entry->id, true ); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | 311 | |
312 | 312 | public static function duplicate_form_actions( $form_id, $values, $args = array() ) { |
313 | - if ( ! isset($args['old_id']) || empty($args['old_id']) ) { |
|
313 | + if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) { |
|
314 | 314 | // continue if we know which actions to copy |
315 | 315 | return; |
316 | 316 | } |
@@ -344,22 +344,22 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | public function register( $action_class ) { |
347 | - $this->actions[ $action_class ] = new $action_class(); |
|
347 | + $this->actions[$action_class] = new $action_class(); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | public function unregister( $action_class ) { |
351 | - if ( isset( $this->actions[ $action_class ] ) ) { |
|
352 | - unset($this->actions[ $action_class ]); |
|
351 | + if ( isset( $this->actions[$action_class] ) ) { |
|
352 | + unset( $this->actions[$action_class] ); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | public function _register_actions() { |
357 | - $keys = array_keys($this->actions); |
|
357 | + $keys = array_keys( $this->actions ); |
|
358 | 358 | |
359 | 359 | foreach ( $keys as $key ) { |
360 | 360 | // don't register new action if old action with the same id is already registered |
361 | - if ( ! isset( $this->actions[ $key ] ) ) { |
|
362 | - $this->actions[ $key ]->_register(); |
|
361 | + if ( ! isset( $this->actions[$key] ) ) { |
|
362 | + $this->actions[$key]->_register(); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |
@@ -143,8 +143,8 @@ |
||
143 | 143 | add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' ); |
144 | 144 | |
145 | 145 | // Addons Controller |
146 | - add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' ); |
|
147 | - add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' ); |
|
146 | + add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' ); |
|
147 | + add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' ); |
|
148 | 148 | |
149 | 149 | // Fields Controller |
150 | 150 | add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' ); |
@@ -41,25 +41,25 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public static function menu() { |
44 | - add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route'); |
|
44 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public static function admin_init() { |
48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
48 | + if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | self::load_pro_hooks(); |
53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
53 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
54 | 54 | |
55 | 55 | $version = FrmAppHelper::plugin_version(); |
56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
57 | 57 | |
58 | - wp_enqueue_style('frm-custom-theme', admin_url('admin-ajax.php') .'?action=frmpro_css'); |
|
58 | + wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php' ) . '?action=frmpro_css' ); |
|
59 | 59 | |
60 | - $style = apply_filters('frm_style_head', false); |
|
60 | + $style = apply_filters( 'frm_style_head', false ); |
|
61 | 61 | if ( $style ) { |
62 | - wp_enqueue_style('frm-single-custom-theme', admin_url('admin-ajax.php') .'?action=frmpro_load_css&flat=1&'. http_build_query($style->post_content)); |
|
62 | + wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php' ) . '?action=frmpro_load_css&flat=1&' . http_build_query( $style->post_content ) ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | |
130 | 130 | public static function new_style( $return = '' ) { |
131 | 131 | FrmAppHelper::update_message( __( 'create multiple styling templates', 'formidable' ), 'wrap' ); |
132 | - self::load_styler('default'); |
|
132 | + self::load_styler( 'default' ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public static function duplicate() { |
136 | 136 | FrmAppHelper::update_message( __( 'duplicate styling templates', 'formidable' ), 'wrap' ); |
137 | - self::load_styler('default'); |
|
137 | + self::load_styler( 'default' ); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | public static function edit( $style_id = false, $message = '' ) { |
141 | 141 | if ( ! $style_id ) { |
142 | 142 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
143 | - if ( empty($style_id) ) { |
|
143 | + if ( empty( $style_id ) ) { |
|
144 | 144 | $style_id = 'default'; |
145 | 145 | } |
146 | 146 | } |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | if ( 'default' == $style_id ) { |
149 | 149 | $style = 'default'; |
150 | 150 | } else { |
151 | - $frm_style = new FrmStyle($style_id); |
|
151 | + $frm_style = new FrmStyle( $style_id ); |
|
152 | 152 | $style = $frm_style->get_one(); |
153 | 153 | $style = $style->ID; |
154 | 154 | } |
155 | 155 | |
156 | - self::load_styler($style, $message); |
|
156 | + self::load_styler( $style, $message ); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public static function save() { |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
164 | 164 | |
165 | 165 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
166 | - $id = $frm_style->update($post_id); |
|
167 | - if ( empty($post_id) && ! empty($id) ) { |
|
166 | + $id = $frm_style->update( $post_id ); |
|
167 | + if ( empty( $post_id ) && ! empty( $id ) ) { |
|
168 | 168 | // set the post id to the new style so it will be loaded for editing |
169 | - $post_id = reset($id); |
|
169 | + $post_id = reset( $id ); |
|
170 | 170 | } |
171 | 171 | // include the CSS that includes this style |
172 | 172 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php' ) . '?action=frmpro_css' ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
173 | 173 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
174 | 174 | } |
175 | 175 | |
176 | - return self::edit($post_id, $message); |
|
176 | + return self::edit( $post_id, $message ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | public static function load_styler( $style, $message = '' ) { |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | $frm_style = new FrmStyle(); |
183 | 183 | $styles = $frm_style->get_all(); |
184 | 184 | |
185 | - if ( is_numeric($style) ) { |
|
186 | - $style = $styles[ $style ]; |
|
185 | + if ( is_numeric( $style ) ) { |
|
186 | + $style = $styles[$style]; |
|
187 | 187 | } else if ( 'default' == $style ) { |
188 | - $style = $frm_style->get_default_style($styles); |
|
188 | + $style = $frm_style->get_default_style( $styles ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | self::add_meta_boxes(); |
192 | 192 | |
193 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php'); |
|
193 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | private static function manage( $message = '', $forms = array() ) { |
201 | 201 | $frm_style = new FrmStyle(); |
202 | 202 | $styles = $frm_style->get_all(); |
203 | - $default_style = $frm_style->get_default_style($styles); |
|
203 | + $default_style = $frm_style->get_default_style( $styles ); |
|
204 | 204 | |
205 | - if ( empty($forms) ) { |
|
205 | + if ( empty( $forms ) ) { |
|
206 | 206 | $forms = FrmForm::get_published_forms(); |
207 | 207 | } |
208 | 208 | |
209 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php'); |
|
209 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | private static function manage_styles() { |
@@ -219,31 +219,31 @@ discard block |
||
219 | 219 | |
220 | 220 | $forms = FrmForm::get_published_forms(); |
221 | 221 | foreach ( $forms as $form ) { |
222 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
222 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
226 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
227 | 227 | |
228 | 228 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
229 | - unset($form); |
|
229 | + unset( $form ); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $message = __( 'Your form styles have been saved.', 'formidable' ); |
233 | - return self::manage($message, $forms); |
|
233 | + return self::manage( $message, $forms ); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | public static function custom_css( $message = '', $style = null ) { |
237 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
238 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
237 | + wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' ); |
|
238 | + wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' ); |
|
239 | 239 | wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
240 | 240 | |
241 | - if ( ! isset($style) ) { |
|
241 | + if ( ! isset( $style ) ) { |
|
242 | 242 | $frm_style = new FrmStyle(); |
243 | 243 | $style = $frm_style->get_default_style(); |
244 | 244 | } |
245 | 245 | |
246 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php'); |
|
246 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | public static function save_css() { |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
254 | 254 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
255 | 255 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
256 | - $frm_style->update($post_id); |
|
256 | + $frm_style->update( $post_id ); |
|
257 | 257 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
258 | 258 | } |
259 | 259 | |
260 | - return self::custom_css($message); |
|
260 | + return self::custom_css( $message ); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public static function route() { |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | |
304 | 304 | // remove the # from the colors |
305 | 305 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
306 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
307 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
306 | + if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
|
307 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | echo '<style type="text/css">'; |
312 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
312 | + include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
|
313 | 313 | echo '</style>'; |
314 | 314 | wp_die(); |
315 | 315 | } |
@@ -331,24 +331,24 @@ discard block |
||
331 | 331 | ); |
332 | 332 | |
333 | 333 | foreach ( $meta_boxes as $nicename => $name ) { |
334 | - add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
335 | - unset($nicename, $name); |
|
334 | + add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
335 | + unset( $nicename, $name ); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | 339 | public static function include_style_section( $atts, $sec ) { |
340 | - extract($atts); |
|
340 | + extract( $atts ); |
|
341 | 341 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
342 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php'); |
|
342 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | public static function load_css() { |
346 | - header('Content-type: text/css'); |
|
346 | + header( 'Content-type: text/css' ); |
|
347 | 347 | |
348 | 348 | $frm_style = new FrmStyle(); |
349 | 349 | $defaults = $frm_style->get_defaults(); |
350 | 350 | |
351 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
351 | + include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
|
352 | 352 | wp_die(); |
353 | 353 | } |
354 | 354 | |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | $style = 'default'; |
408 | 408 | } |
409 | 409 | |
410 | - $frm_style = new FrmStyle($style); |
|
410 | + $frm_style = new FrmStyle( $style ); |
|
411 | 411 | $style = $frm_style->get_one(); |
412 | 412 | |
413 | 413 | if ( $style ) { |
414 | - $class .= ' frm_style_'. $style->post_name; |
|
414 | + $class .= ' frm_style_' . $style->post_name; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | return $class; |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | * @param string $val |
422 | 422 | */ |
423 | 423 | public static function get_style_val( $val, $form = 'default' ) { |
424 | - $style = self::get_form_style($form); |
|
425 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
426 | - return $style->post_content[ $val ]; |
|
424 | + $style = self::get_form_style( $form ); |
|
425 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
426 | + return $style->post_content[$val]; |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | 430 | public static function show_entry_styles( $default_styles ) { |
431 | - $frm_style = new FrmStyle('default'); |
|
431 | + $frm_style = new FrmStyle( 'default' ); |
|
432 | 432 | $style = $frm_style->get_one(); |
433 | 433 | |
434 | 434 | if ( ! $style ) { |
@@ -442,15 +442,15 @@ discard block |
||
442 | 442 | } else if ( 'alt_bg_color' == $name ) { |
443 | 443 | $setting = 'bg_color_active'; |
444 | 444 | } |
445 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
446 | - unset($name, $val); |
|
445 | + $default_styles[$name] = $style->post_content[$setting]; |
|
446 | + unset( $name, $val ); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | return $default_styles; |
450 | 450 | } |
451 | 451 | |
452 | 452 | public static function &important_style( $important, $field ) { |
453 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
453 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); |
|
454 | 454 | return $important; |
455 | 455 | } |
456 | 456 | |
@@ -476,18 +476,18 @@ discard block |
||
476 | 476 | $i = 0; |
477 | 477 | $first_open = false; |
478 | 478 | do { |
479 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
479 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
480 | 480 | break; |
481 | 481 | } |
482 | 482 | |
483 | 483 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
484 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
485 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
484 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
485 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
486 | 486 | if ( false == $box || ! $box['title'] ) { |
487 | 487 | continue; |
488 | 488 | } |
489 | 489 | |
490 | - $i++; |
|
490 | + $i ++; |
|
491 | 491 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
492 | 492 | |
493 | 493 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -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 | |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | global $frm_vars; |
10 | 10 | $values = array(); |
11 | 11 | foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) { |
12 | - $values[ $var ] = FrmAppHelper::get_post_param( $var, $default ); |
|
12 | + $values[$var] = FrmAppHelper::get_post_param( $var, $default ); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $values['fields'] = array(); |
16 | - if ( empty($fields) ) { |
|
17 | - return apply_filters('frm_setup_new_entry', $values); |
|
16 | + if ( empty( $fields ) ) { |
|
17 | + return apply_filters( 'frm_setup_new_entry', $values ); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | foreach ( (array) $fields as $field ) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'default_value' => $field->default_value, |
27 | 27 | 'name' => $field->name, |
28 | 28 | 'description' => $field->description, |
29 | - 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
29 | + 'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ), |
|
30 | 30 | 'options' => $field->options, |
31 | 31 | 'required' => $field->required, |
32 | 32 | 'field_key' => $field->field_key, |
@@ -35,43 +35,43 @@ discard block |
||
35 | 35 | 'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id, |
36 | 36 | ); |
37 | 37 | |
38 | - $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
38 | + $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true ); |
|
39 | 39 | $opt_defaults['required_indicator'] = ''; |
40 | 40 | $opt_defaults['original_type'] = $field->type; |
41 | 41 | |
42 | 42 | foreach ( $opt_defaults as $opt => $default_opt ) { |
43 | - $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
44 | - unset($opt, $default_opt); |
|
43 | + $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt; |
|
44 | + unset( $opt, $default_opt ); |
|
45 | 45 | } |
46 | 46 | |
47 | - unset($opt_defaults); |
|
47 | + unset( $opt_defaults ); |
|
48 | 48 | |
49 | 49 | if ( $field_array['custom_html'] == '' ) { |
50 | - $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
50 | + $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type ); |
|
51 | 51 | } |
52 | 52 | |
53 | - $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field); |
|
53 | + $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field ); |
|
54 | 54 | $field_array = array_merge( $field->field_options, $field_array ); |
55 | 55 | |
56 | 56 | $values['fields'][] = $field_array; |
57 | 57 | |
58 | - if ( ! $form || ! isset($form->id) ) { |
|
59 | - $form = FrmForm::getOne($field->form_id); |
|
58 | + if ( ! $form || ! isset( $form->id ) ) { |
|
59 | + $form = FrmForm::getOne( $field->form_id ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $form->options = maybe_unserialize($form->options); |
|
64 | - if ( is_array($form->options) ) { |
|
63 | + $form->options = maybe_unserialize( $form->options ); |
|
64 | + if ( is_array( $form->options ) ) { |
|
65 | 65 | foreach ( $form->options as $opt => $value ) { |
66 | - $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
67 | - unset($opt, $value); |
|
66 | + $values[$opt] = FrmAppHelper::get_post_param( $opt, $value ); |
|
67 | + unset( $opt, $value ); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | $form_defaults = FrmFormsHelper::get_default_opts(); |
72 | 72 | |
73 | 73 | $frm_settings = FrmAppHelper::get_settings(); |
74 | - $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
74 | + $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
75 | 75 | |
76 | 76 | $values = array_merge( $form_defaults, $values ); |
77 | 77 | |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $return_array = FrmField::is_field_with_multiple_values( $field ); |
94 | 94 | |
95 | 95 | // Do any shortcodes in default value and allow customization of default value |
96 | - $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array); |
|
96 | + $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array ); |
|
97 | 97 | // Calls FrmProFieldsHelper::get_default_value |
98 | 98 | |
99 | 99 | $new_value = $field->default_value; |
100 | 100 | |
101 | - if ( ! $reset && $_POST && isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
101 | + if ( ! $reset && $_POST && isset( $_POST['item_meta'][$field->id] ) ) { |
|
102 | 102 | // If value was posted, get it |
103 | 103 | |
104 | - $new_value = stripslashes_deep( $_POST['item_meta'][ $field->id ] ); |
|
104 | + $new_value = stripslashes_deep( $_POST['item_meta'][$field->id] ); |
|
105 | 105 | |
106 | 106 | } else if ( FrmField::is_option_true( $field, 'clear_on_focus' ) ) { |
107 | 107 | // If clear on focus is selected, the value should be blank (unless it was posted, of course) |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | if ( ! is_array( $new_value ) ) { |
113 | - $new_value = str_replace('"', '"', $new_value); |
|
113 | + $new_value = str_replace( '"', '"', $new_value ); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return $new_value; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' ); |
121 | 121 | $values['form_id'] = $record->form_id; |
122 | 122 | $values['is_draft'] = $record->is_draft; |
123 | - return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
123 | + return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public static function get_admin_params( $form = null ) { |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | public static function replace_default_message( $message, $atts ) { |
152 | - if ( strpos($message, '[default-message') === false && |
|
153 | - strpos($message, '[default_message') === false && |
|
152 | + if ( strpos( $message, '[default-message' ) === false && |
|
153 | + strpos( $message, '[default_message' ) === false && |
|
154 | 154 | ! empty( $message ) ) { |
155 | 155 | return $message; |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty($message) ) { |
|
158 | + if ( empty( $message ) ) { |
|
159 | 159 | $message = '[default-message]'; |
160 | 160 | } |
161 | 161 | |
162 | - preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
162 | + preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
|
163 | 163 | |
164 | 164 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
165 | - $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
165 | + $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] ); |
|
166 | 166 | if ( $add_atts ) { |
167 | - $this_atts = array_merge($atts, $add_atts); |
|
167 | + $this_atts = array_merge( $atts, $add_atts ); |
|
168 | 168 | } else { |
169 | 169 | $this_atts = $atts; |
170 | 170 | } |
@@ -172,31 +172,31 @@ discard block |
||
172 | 172 | $default = FrmEntryFormat::show_entry( $this_atts ); |
173 | 173 | |
174 | 174 | // Add the default message |
175 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
175 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return $message; |
179 | 179 | } |
180 | 180 | |
181 | 181 | public static function prepare_display_value( $entry, $field, $atts ) { |
182 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
182 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
183 | 183 | if ( FrmAppHelper::pro_is_installed() ) { |
184 | 184 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
185 | 185 | } |
186 | 186 | |
187 | - if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
188 | - return self::display_value($field_value, $field, $atts); |
|
187 | + if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) { |
|
188 | + return self::display_value( $field_value, $field, $atts ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // this is an embeded form |
192 | 192 | $val = ''; |
193 | 193 | |
194 | - if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
194 | + if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) { |
|
195 | 195 | //this is a repeating section |
196 | 196 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
197 | 197 | } else { |
198 | 198 | // get all values for this field |
199 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
199 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
200 | 200 | |
201 | 201 | if ( $child_values ) { |
202 | 202 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | $field_value = array(); |
207 | 207 | |
208 | - if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
208 | + if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
209 | 209 | return $val; |
210 | 210 | } |
211 | 211 | |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | $atts['post_id'] = $child_entry->post_id; |
215 | 215 | |
216 | 216 | // get the value for this field -- check for post values as well |
217 | - $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
217 | + $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field ); |
|
218 | 218 | |
219 | 219 | if ( $entry_val ) { |
220 | 220 | // foreach entry get display_value |
221 | - $field_value[] = self::display_value($entry_val, $field, $atts); |
|
221 | + $field_value[] = self::display_value( $entry_val, $field, $atts ); |
|
222 | 222 | } |
223 | 223 | |
224 | - unset($child_entry); |
|
224 | + unset( $child_entry ); |
|
225 | 225 | } |
226 | 226 | |
227 | - $val = implode(', ', (array) $field_value ); |
|
227 | + $val = implode( ', ', (array) $field_value ); |
|
228 | 228 | $val = wp_kses_post( $val ); |
229 | 229 | |
230 | 230 | return $val; |
@@ -244,22 +244,22 @@ discard block |
||
244 | 244 | ); |
245 | 245 | |
246 | 246 | $atts = wp_parse_args( $atts, $defaults ); |
247 | - $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
247 | + $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value ); |
|
248 | 248 | |
249 | - if ( ! isset($field->field_options['post_field']) ) { |
|
249 | + if ( ! isset( $field->field_options['post_field'] ) ) { |
|
250 | 250 | $field->field_options['post_field'] = ''; |
251 | 251 | } |
252 | 252 | |
253 | - if ( ! isset($field->field_options['custom_field']) ) { |
|
253 | + if ( ! isset( $field->field_options['custom_field'] ) ) { |
|
254 | 254 | $field->field_options['custom_field'] = ''; |
255 | 255 | } |
256 | 256 | |
257 | 257 | if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
258 | 258 | $atts['pre_truncate'] = $atts['truncate']; |
259 | 259 | $atts['truncate'] = true; |
260 | - $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
260 | + $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0; |
|
261 | 261 | |
262 | - $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
262 | + $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts ); |
|
263 | 263 | $atts['truncate'] = $atts['pre_truncate']; |
264 | 264 | } |
265 | 265 | |
@@ -267,38 +267,38 @@ discard block |
||
267 | 267 | return $value; |
268 | 268 | } |
269 | 269 | |
270 | - $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
270 | + $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts ); |
|
271 | 271 | |
272 | 272 | $new_value = ''; |
273 | 273 | |
274 | - if ( is_array($value) && $atts['type'] != 'file' ) { |
|
274 | + if ( is_array( $value ) && $atts['type'] != 'file' ) { |
|
275 | 275 | foreach ( $value as $val ) { |
276 | - if ( is_array($val) ) { |
|
276 | + if ( is_array( $val ) ) { |
|
277 | 277 | //TODO: add options for display (li or ,) |
278 | - $new_value .= implode($atts['sep'], $val); |
|
278 | + $new_value .= implode( $atts['sep'], $val ); |
|
279 | 279 | if ( $atts['type'] != 'data' ) { |
280 | 280 | $new_value .= '<br/>'; |
281 | 281 | } |
282 | 282 | } |
283 | - unset($val); |
|
283 | + unset( $val ); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | - if ( ! empty($new_value) ) { |
|
287 | + if ( ! empty( $new_value ) ) { |
|
288 | 288 | $value = $new_value; |
289 | - } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
290 | - $value = implode($atts['sep'], $value); |
|
289 | + } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
290 | + $value = implode( $atts['sep'], $value ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
294 | - $value = FrmAppHelper::truncate($value, 50); |
|
294 | + $value = FrmAppHelper::truncate( $value, 50 ); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | if ( ! $atts['keepjs'] && ! is_array( $value ) ) { |
298 | 298 | $value = wp_kses_post( $value ); |
299 | 299 | } |
300 | 300 | |
301 | - return apply_filters('frm_display_value', $value, $field, $atts); |
|
301 | + return apply_filters( 'frm_display_value', $value, $field, $atts ); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | public static function set_posted_value( $field, $value, $args ) { |
@@ -306,20 +306,20 @@ discard block |
||
306 | 306 | if ( isset( $args['other'] ) && $args['other'] ) { |
307 | 307 | $value = $args['temp_value']; |
308 | 308 | } |
309 | - if ( empty($args['parent_field_id']) ) { |
|
310 | - $_POST['item_meta'][ $field->id ] = $value; |
|
309 | + if ( empty( $args['parent_field_id'] ) ) { |
|
310 | + $_POST['item_meta'][$field->id] = $value; |
|
311 | 311 | } else { |
312 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
312 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | 316 | public static function get_posted_value( $field, &$value, $args ) { |
317 | 317 | $field_id = is_object( $field ) ? $field->id : $field; |
318 | 318 | |
319 | - if ( empty($args['parent_field_id']) ) { |
|
320 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
319 | + if ( empty( $args['parent_field_id'] ) ) { |
|
320 | + $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : ''; |
|
321 | 321 | } else { |
322 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : ''; |
|
322 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : ''; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | self::set_other_repeating_vals( $field, $value, $args ); |
343 | 343 | |
344 | 344 | // Check if there are any posted "Other" values |
345 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
345 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
346 | 346 | |
347 | 347 | // Save original value |
348 | 348 | $args['temp_value'] = $value; |
349 | 349 | $args['other'] = true; |
350 | - $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
350 | + $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] ); |
|
351 | 351 | |
352 | 352 | // Set the validation value now |
353 | 353 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | // Check if there are any other posted "other" values for this field |
372 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
372 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
373 | 373 | // Save original value |
374 | 374 | $args['temp_value'] = $value; |
375 | 375 | $args['other'] = true; |
376 | 376 | |
377 | - $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
377 | + $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id]; |
|
378 | 378 | |
379 | 379 | // Set the validation value now |
380 | 380 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -406,27 +406,27 @@ discard block |
||
406 | 406 | } |
407 | 407 | } else { |
408 | 408 | // Radio and dropdowns |
409 | - $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
409 | + $other_key = array_filter( array_keys( $field->options ), 'is_string' ); |
|
410 | 410 | $other_key = reset( $other_key ); |
411 | 411 | |
412 | 412 | // Multi-select dropdown |
413 | 413 | if ( is_array( $value ) ) { |
414 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
414 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
415 | 415 | |
416 | 416 | if ( $o_key !== false ) { |
417 | 417 | // Modify the original value so other key will be preserved |
418 | - $value[ $other_key ] = $value[ $o_key ]; |
|
418 | + $value[$other_key] = $value[$o_key]; |
|
419 | 419 | |
420 | 420 | // By default, the array keys will be numeric for multi-select dropdowns |
421 | 421 | // If going backwards and forwards between pages, the array key will match the other key |
422 | 422 | if ( $o_key != $other_key ) { |
423 | - unset( $value[ $o_key ] ); |
|
423 | + unset( $value[$o_key] ); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | $args['temp_value'] = $value; |
427 | - $value[ $other_key ] = reset( $other_vals ); |
|
427 | + $value[$other_key] = reset( $other_vals ); |
|
428 | 428 | } |
429 | - } else if ( $field->options[ $other_key ] == $value ) { |
|
429 | + } else if ( $field->options[$other_key] == $value ) { |
|
430 | 430 | $value = $other_vals; |
431 | 431 | } |
432 | 432 | } |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | $content .= "\n\n"; |
446 | 446 | } |
447 | 447 | |
448 | - if ( is_array($val) ) { |
|
448 | + if ( is_array( $val ) ) { |
|
449 | 449 | $val = FrmAppHelper::array_flatten( $val ); |
450 | - $val = implode(',', $val); |
|
450 | + $val = implode( ',', $val ); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | $content .= $val; |
@@ -492,6 +492,6 @@ discard block |
||
492 | 492 | } |
493 | 493 | |
494 | 494 | public static function entries_dropdown() { |
495 | - _deprecated_function( __FUNCTION__, '1.07.09'); |
|
495 | + _deprecated_function( __FUNCTION__, '1.07.09' ); |
|
496 | 496 | } |
497 | 497 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | $s_query = array( 'it.form_id' => $form_id ); |
27 | 27 | |
28 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
28 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
29 | 29 | |
30 | 30 | if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
31 | 31 | $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
32 | - $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid); |
|
32 | + $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
36 | - if ( strpos($orderby, 'meta') !== false ) { |
|
36 | + if ( strpos( $orderby, 'meta' ) !== false ) { |
|
37 | 37 | $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
38 | 38 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
39 | 39 | } |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $page = $this->get_pagenum(); |
45 | 45 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
46 | 46 | |
47 | - $this->items = FrmEntry::getAll($s_query, $order, ' LIMIT '. $start .','. $per_page, true, false); |
|
48 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
47 | + $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false ); |
|
48 | + $total_items = FrmEntry::getRecordCount( $s_query ); |
|
49 | 49 | |
50 | 50 | $this->set_pagination_args( array( |
51 | 51 | 'total_items' => $total_items, |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | |
56 | 56 | public function no_items() { |
57 | 57 | $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
58 | - if ( ! empty($s) ) { |
|
58 | + if ( ! empty( $s ) ) { |
|
59 | 59 | _e( 'No Entries Found', 'formidable' ); |
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $form_id = $form = $this->params['form']; |
64 | 64 | if ( $form_id ) { |
65 | - $form = FrmForm::getOne($form_id); |
|
65 | + $form = FrmForm::getOne( $form_id ); |
|
66 | 66 | } |
67 | 67 | $colspan = $this->get_column_count(); |
68 | 68 | |
69 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/no_entries.php'); |
|
69 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function search_box( $text, $input_id ) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function single_row( $item, $style = '' ) { |
100 | 100 | // Set up the hover actions for this user |
101 | 101 | $actions = array(); |
102 | - $view_link = '?page=formidable-entries&frm_action=show&id='. $item->id; |
|
102 | + $view_link = '?page=formidable-entries&frm_action=show&id=' . $item->id; |
|
103 | 103 | |
104 | 104 | $this->get_actions( $actions, $item, $view_link ); |
105 | 105 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | |
111 | 111 | $r = "<tr id='item-action-{$item->id}'$style>"; |
112 | 112 | |
113 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
113 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
114 | 114 | $action_col = false; |
115 | 115 | |
116 | 116 | foreach ( $columns as $column_name => $column_display_name ) { |
117 | - $class = $column_name .' column-'. $column_name; |
|
117 | + $class = $column_name . ' column-' . $column_name; |
|
118 | 118 | |
119 | 119 | if ( $column_name === $primary ) { |
120 | 120 | $class .= ' column-primary'; |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
130 | - unset($class); |
|
131 | - $attributes .= ' data-colname="' . $column_display_name . '"'; |
|
130 | + unset( $class ); |
|
131 | + $attributes .= ' data-colname="' . $column_display_name . '"'; |
|
132 | 132 | |
133 | - $col_name = preg_replace('/^('. $this->params['form'] .'_)/', '', $column_name); |
|
133 | + $col_name = preg_replace( '/^(' . $this->params['form'] . '_)/', '', $column_name ); |
|
134 | 134 | $this->column_name = $col_name; |
135 | 135 | |
136 | 136 | switch ( $col_name ) { |
@@ -144,24 +144,24 @@ discard block |
||
144 | 144 | break; |
145 | 145 | case 'name': |
146 | 146 | case 'description': |
147 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
147 | + $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 ); |
|
148 | 148 | break; |
149 | 149 | case 'created_at': |
150 | 150 | case 'updated_at': |
151 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
151 | + $date = FrmAppHelper::get_formatted_time( $item->{$col_name}); |
|
152 | 152 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
153 | 153 | break; |
154 | 154 | case 'is_draft': |
155 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
155 | + $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' ); |
|
156 | 156 | break; |
157 | 157 | case 'form_id': |
158 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
158 | + $val = FrmFormsHelper::edit_form_link( $item->form_id ); |
|
159 | 159 | break; |
160 | 160 | case 'post_id': |
161 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
161 | + $val = FrmAppHelper::post_edit_link( $item->post_id ); |
|
162 | 162 | break; |
163 | 163 | case 'user_id': |
164 | - $user = get_userdata($item->user_id); |
|
164 | + $user = get_userdata( $item->user_id ); |
|
165 | 165 | $val = $user->user_login; |
166 | 166 | break; |
167 | 167 | default: |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if ( isset( $val ) ) { |
176 | 176 | $r .= "<td $attributes>"; |
177 | 177 | if ( $column_name == $action_col ) { |
178 | - $edit_link = '?page=formidable-entries&frm_action=edit&id='. $item->id; |
|
178 | + $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; |
|
179 | 179 | $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> '; |
180 | 180 | $r .= $action_links; |
181 | 181 | } else { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | $r .= '</td>'; |
185 | 185 | } |
186 | - unset($val); |
|
186 | + unset( $val ); |
|
187 | 187 | } |
188 | 188 | $r .= '</tr>'; |
189 | 189 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * @param string $view_link |
195 | 195 | */ |
196 | 196 | private function get_actions( &$actions, $item, $view_link ) { |
197 | - $actions['view'] = '<a href="' . esc_url( $view_link ) . '">'. __( 'View', 'formidable' ) .'</a>'; |
|
197 | + $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
|
198 | 198 | |
199 | - if ( current_user_can('frm_delete_entries') ) { |
|
200 | - $delete_link = '?page=formidable-entries&frm_action=destroy&id='. $item->id .'&form='. $this->params['form']; |
|
199 | + if ( current_user_can( 'frm_delete_entries' ) ) { |
|
200 | + $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
|
201 | 201 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
202 | 202 | } |
203 | 203 | |
204 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
204 | + $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | private function get_column_value( $item, &$val ) { |
@@ -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 | |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | public static function get_direct_link( $key, $form = false ) { |
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); |
|
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 | 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, 33 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ; |
|
53 | + echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) ) . ( $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, 33 ) ); ?></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, 33 ) ); ?></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 ) { |
@@ -135,37 +135,37 @@ discard block |
||
135 | 135 | $post_values = $values; |
136 | 136 | } else { |
137 | 137 | $values = array(); |
138 | - $post_values = isset($_POST) ? $_POST : array(); |
|
138 | + $post_values = isset( $_POST ) ? $_POST : array(); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
142 | - if ( ! isset( $values[ $var ] ) ) { |
|
143 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
142 | + if ( ! isset( $values[$var] ) ) { |
|
143 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
147 | + $values['description'] = FrmAppHelper::use_wpautop( $values['description'] ); |
|
148 | 148 | |
149 | 149 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
150 | - if ( ! isset( $values[ $var ] ) ) { |
|
151 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
150 | + if ( ! isset( $values[$var] ) ) { |
|
151 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | if ( ! isset( $values['form_key'] ) ) { |
156 | - $values['form_key'] = ($post_values && isset($post_values['form_key'])) ? $post_values['form_key'] : FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_forms', 'form_key'); |
|
156 | + $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
|
157 | 157 | } |
158 | 158 | |
159 | - $values = self::fill_default_opts($values, false, $post_values); |
|
159 | + $values = self::fill_default_opts( $values, false, $post_values ); |
|
160 | 160 | |
161 | - if ( $post_values && isset($post_values['options']['custom_style']) ) { |
|
161 | + if ( $post_values && isset( $post_values['options']['custom_style'] ) ) { |
|
162 | 162 | $values['custom_style'] = $post_values['options']['custom_style']; |
163 | 163 | } else { |
164 | 164 | $frm_settings = FrmAppHelper::get_settings(); |
165 | 165 | $values['custom_style'] = ( $frm_settings->load_style != 'none' ); |
166 | 166 | } |
167 | 167 | |
168 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
168 | + return apply_filters( 'frm_setup_new_form_vars', $values ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,42 +176,42 @@ discard block |
||
176 | 176 | $post_values = stripslashes_deep( $_POST ); |
177 | 177 | } |
178 | 178 | |
179 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
180 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
181 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
179 | + $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key; |
|
180 | + $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template; |
|
181 | + $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template; |
|
182 | 182 | $values['status'] = $record->status; |
183 | 183 | |
184 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
184 | + $values = self::fill_default_opts( $values, $record, $post_values ); |
|
185 | 185 | |
186 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
186 | + return apply_filters( 'frm_setup_edit_form_vars', $values ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | public static function fill_default_opts( $values, $record, $post_values ) { |
190 | 190 | |
191 | 191 | $defaults = self::get_default_opts(); |
192 | 192 | foreach ( $defaults as $var => $default ) { |
193 | - if ( is_array($default) ) { |
|
194 | - if ( ! isset( $values[ $var ] ) ) { |
|
195 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
193 | + if ( is_array( $default ) ) { |
|
194 | + if ( ! isset( $values[$var] ) ) { |
|
195 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | foreach ( $default as $k => $v ) { |
199 | - $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); |
|
199 | + $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 | 200 | |
201 | 201 | if ( is_array( $v ) ) { |
202 | 202 | foreach ( $v as $k1 => $v1 ) { |
203 | - $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 ); |
|
203 | + $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 | 204 | unset( $k1, $v1 ); |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - unset($k, $v); |
|
208 | + unset( $k, $v ); |
|
209 | 209 | } |
210 | 210 | } else { |
211 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
211 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
212 | 212 | } |
213 | 213 | |
214 | - unset($var, $default); |
|
214 | + unset( $var, $default ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | return $values; |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
225 | 225 | 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
226 | 226 | 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
227 | - 'before_html' => self::get_default_html('before'), |
|
227 | + 'before_html' => self::get_default_html( 'before' ), |
|
228 | 228 | 'after_html' => '', |
229 | - 'submit_html' => self::get_default_html('submit'), |
|
229 | + 'submit_html' => self::get_default_html( 'submit' ), |
|
230 | 230 | ); |
231 | 231 | } |
232 | 232 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | public static function fill_form_options( &$options, $values ) { |
239 | 239 | $defaults = self::get_default_opts(); |
240 | 240 | foreach ( $defaults as $var => $default ) { |
241 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
241 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
242 | 242 | unset( $var, $default ); |
243 | 243 | } |
244 | 244 | } |
@@ -278,21 +278,21 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
281 | - $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values); |
|
282 | - if ( ! strpos($button, '[button_action]') ) { |
|
281 | + $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); |
|
282 | + if ( ! strpos( $button, '[button_action]' ) ) { |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
286 | - $button_parts = explode('[button_action]', $button); |
|
286 | + $button_parts = explode( '[button_action]', $button ); |
|
287 | 287 | echo $button_parts[0]; |
288 | 288 | //echo ' id="frm_submit_"'; |
289 | 289 | |
290 | - $classes = apply_filters('frm_submit_button_class', array(), $form); |
|
291 | - if ( ! empty($classes) ) { |
|
290 | + $classes = apply_filters( 'frm_submit_button_class', array(), $form ); |
|
291 | + if ( ! empty( $classes ) ) { |
|
292 | 292 | echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"'; |
293 | 293 | } |
294 | 294 | |
295 | - do_action('frm_submit_button_action', $form, $form_action); |
|
295 | + do_action( 'frm_submit_button_action', $form, $form_action ); |
|
296 | 296 | echo $button_parts[1]; |
297 | 297 | } |
298 | 298 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $last_field = false; |
314 | 314 | foreach ( $fields as $field ) { |
315 | 315 | if ( $prev_order === $field->field_order ) { |
316 | - $add_order++; |
|
316 | + $add_order ++; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | if ( $add_order ) { |
@@ -380,21 +380,21 @@ discard block |
||
380 | 380 | if ( $code == 'form_name' ) { |
381 | 381 | $replace_with = $form->name; |
382 | 382 | } else if ( $code == 'form_description' ) { |
383 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
384 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
383 | + $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
|
384 | + } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { |
|
385 | 385 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
386 | 386 | } else { |
387 | 387 | $replace_with = ''; |
388 | 388 | } |
389 | 389 | |
390 | - FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html ); |
|
390 | + FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | //replace [form_key] |
394 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
394 | + $html = str_replace( '[form_key]', $form->form_key, $html ); |
|
395 | 395 | |
396 | 396 | //replace [frmurl] |
397 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
397 | + $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
|
398 | 398 | |
399 | 399 | if ( strpos( $html, '[button_label]' ) ) { |
400 | 400 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $html = str_replace( '[button_label]', $replace_with, $html ); |
403 | 403 | } |
404 | 404 | |
405 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
405 | + $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values ); |
|
406 | 406 | |
407 | 407 | if ( strpos( $html, '[if back_button]' ) ) { |
408 | 408 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | public static function submit_button_label( $submit ) { |
423 | - if ( ! $submit || empty($submit) ) { |
|
423 | + if ( ! $submit || empty( $submit ) ) { |
|
424 | 424 | $frm_settings = FrmAppHelper::get_settings(); |
425 | 425 | $submit = $frm_settings->submit_value; |
426 | 426 | } |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | public static function get_form_style_class( $form = false ) { |
432 | - $style = self::get_form_style($form); |
|
432 | + $style = self::get_form_style( $form ); |
|
433 | 433 | $class = ' with_frm_style'; |
434 | 434 | |
435 | - if ( empty($style) ) { |
|
436 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
435 | + if ( empty( $style ) ) { |
|
436 | + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { |
|
437 | 437 | return $class; |
438 | 438 | } else { |
439 | 439 | return; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | //If submit button needs to be inline or centered |
444 | - if ( is_object($form) ) { |
|
444 | + if ( is_object( $form ) ) { |
|
445 | 445 | $form = $form->options; |
446 | 446 | } |
447 | 447 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $class .= ' frm_center_submit'; |
454 | 454 | } |
455 | 455 | |
456 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
456 | + $class = apply_filters( 'frm_add_form_style_class', $class, $style ); |
|
457 | 457 | |
458 | 458 | return $class; |
459 | 459 | } |
@@ -541,12 +541,12 @@ discard block |
||
541 | 541 | } |
542 | 542 | |
543 | 543 | public static function edit_form_link( $form_id ) { |
544 | - if ( is_object($form_id) ) { |
|
544 | + if ( is_object( $form_id ) ) { |
|
545 | 545 | $form = $form_id; |
546 | 546 | $name = $form->name; |
547 | 547 | $form_id = $form->id; |
548 | 548 | } else { |
549 | - $name = FrmForm::getName($form_id); |
|
549 | + $name = FrmForm::getName( $form_id ); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | if ( $form_id ) { |
@@ -576,14 +576,14 @@ discard block |
||
576 | 576 | ); |
577 | 577 | |
578 | 578 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
579 | - $base_url = '?page=formidable&form_type='. $current_page .'&id='. $id; |
|
579 | + $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
|
580 | 580 | if ( 'trash' == $status ) { |
581 | - $link = '<a href="'. esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
|
582 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
581 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>'; |
|
582 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
583 | 583 | if ( EMPTY_TRASH_DAYS ) { |
584 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
|
584 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>'; |
|
585 | 585 | } else { |
586 | - $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>'; |
|
586 | + $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 | 587 | } |
588 | 588 | } |
589 | 589 | |
@@ -597,11 +597,11 @@ discard block |
||
597 | 597 | 'publish' => __( 'Published', 'formidable' ), |
598 | 598 | ); |
599 | 599 | |
600 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
600 | + if ( ! in_array( $status, array_keys( $nice_names ) ) ) { |
|
601 | 601 | $status = 'publish'; |
602 | 602 | } |
603 | 603 | |
604 | - $name = $nice_names[ $status ]; |
|
604 | + $name = $nice_names[$status]; |
|
605 | 605 | |
606 | 606 | return $name; |
607 | 607 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $page = $this->get_pagenum(); |
27 | 27 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
28 | 28 | |
29 | - $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page); |
|
29 | + $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : ( ( $page - 1 ) * $per_page ); |
|
30 | 30 | |
31 | 31 | $s_query = array(); |
32 | 32 | $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
@@ -48,19 +48,19 @@ discard block |
||
48 | 48 | break; |
49 | 49 | } |
50 | 50 | |
51 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
51 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
52 | 52 | if ( $s != '' ) { |
53 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | - $search_terms = array_map('trim', $matches[0]); |
|
53 | + preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches ); |
|
54 | + $search_terms = array_map( 'trim', $matches[0] ); |
|
55 | 55 | foreach ( (array) $search_terms as $term ) { |
56 | 56 | $s_query[] = array( |
57 | 57 | 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
58 | 58 | ); |
59 | - unset($term); |
|
59 | + unset( $term ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $this->items = FrmForm::getAll($s_query, $orderby .' '. $order, $start .','. $per_page); |
|
63 | + $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); |
|
64 | 64 | $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
65 | 65 | |
66 | 66 | $this->set_pagination_args( array( |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | if ( 'template' == $this->status ) { |
74 | 74 | _e( 'No Templates Found.', 'formidable' ) ?> |
75 | 75 | <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?> |
76 | - <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
|
77 | - <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li> |
|
76 | + <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
|
77 | + <li><?php printf( __( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>' ) ?></li> |
|
78 | 78 | <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li> |
79 | 79 | </ol> |
80 | 80 | <?php } else { |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if ( 'trash' == $this->status ) { |
94 | - if ( current_user_can('frm_edit_forms') ) { |
|
94 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
95 | 95 | $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
96 | 96 | } |
97 | 97 | |
98 | - if ( current_user_can('frm_delete_forms') ) { |
|
98 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
99 | 99 | $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
100 | 100 | } |
101 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
101 | + } else if ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) { |
|
102 | 102 | $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
103 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | - $actions['bulk_delete'] = __( 'Delete'); |
|
103 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
104 | + $actions['bulk_delete'] = __( 'Delete' ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $actions; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
115 | + if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) { |
|
116 | 116 | ?> |
117 | 117 | <div class="alignleft actions frm_visible_overflow"> |
118 | 118 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
129 | 129 | $forms = FrmForm::get_published_forms( $where ); |
130 | 130 | |
131 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
131 | + $base = admin_url( 'admin.php?page=formidable&form_type=template' ); |
|
132 | 132 | $args = array( |
133 | 133 | 'frm_action' => 'duplicate', |
134 | 134 | 'template' => true, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $args['id'] = $form->id; ?> |
149 | 149 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
150 | 150 | <?php |
151 | - unset($form); |
|
151 | + unset( $form ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | ?> |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if ( $counts->{$status} || 'published' == $status ) { |
183 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
183 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
184 | 184 | } |
185 | 185 | |
186 | - unset($status, $name); |
|
186 | + unset( $status, $name ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $links; |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | |
205 | 205 | // Set up the hover actions for this user |
206 | 206 | $actions = array(); |
207 | - $edit_link = '?page=formidable&frm_action=edit&id='. $item->id; |
|
208 | - $duplicate_link = '?page=formidable&frm_action=duplicate&id='. $item->id; |
|
207 | + $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
|
208 | + $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
|
209 | 209 | |
210 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
210 | + $this->get_actions( $actions, $item, $edit_link, $duplicate_link ); |
|
211 | 211 | |
212 | 212 | $action_links = $this->row_actions( $actions ); |
213 | 213 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | foreach ( $columns as $column_name => $column_display_name ) { |
227 | - $class = $column_name .' column-'. $column_name . ( ('name' == $column_name) ? ' post-title page-title column-title' : '' ); |
|
227 | + $class = $column_name . ' column-' . $column_name . ( ( 'name' == $column_name ) ? ' post-title page-title column-title' : '' ); |
|
228 | 228 | |
229 | 229 | $style = ''; |
230 | 230 | if ( in_array( $column_name, $hidden ) ) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | switch ( $column_name ) { |
239 | 239 | case 'cb': |
240 | - $r .= '<th scope="row" class="check-column">'. $checkbox .'</th>'; |
|
240 | + $r .= '<th scope="row" class="check-column">' . $checkbox . '</th>'; |
|
241 | 241 | break; |
242 | 242 | case 'id': |
243 | 243 | case 'form_key': |
@@ -249,22 +249,22 @@ discard block |
||
249 | 249 | |
250 | 250 | break; |
251 | 251 | case 'created_at': |
252 | - $date = date($format, strtotime($item->created_at)); |
|
252 | + $date = date( $format, strtotime( $item->created_at ) ); |
|
253 | 253 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
254 | 254 | break; |
255 | 255 | case 'shortcode': |
256 | - $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id .']' ) . '" /><br/>'; |
|
256 | + $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>'; |
|
257 | 257 | if ( 'excerpt' == $mode ) { |
258 | 258 | $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'entries': |
262 | 262 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
263 | - $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="'. esc_attr('Entries are not being saved', 'formidable' ) .'"></i>'; |
|
263 | + $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Entries are not being saved', 'formidable' ) . '"></i>'; |
|
264 | 264 | } else { |
265 | - $text = FrmEntry::getRecordCount($item->id); |
|
266 | - $val = (current_user_can('frm_view_entries')) ? '<a href="'. esc_url(admin_url('admin.php') .'?page=formidable-entries&form='. $item->id ) .'">'. $text .'</a>' : $text; |
|
267 | - unset($text); |
|
265 | + $text = FrmEntry::getRecordCount( $item->id ); |
|
266 | + $val = ( current_user_can( 'frm_view_entries' ) ) ? '<a href="' . esc_url( admin_url( 'admin.php' ) . '?page=formidable-entries&form=' . $item->id ) . '">' . $text . '</a>' : $text; |
|
267 | + unset( $text ); |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | case 'type': |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | break; |
273 | 273 | } |
274 | 274 | |
275 | - if ( isset($val) ) { |
|
275 | + if ( isset( $val ) ) { |
|
276 | 276 | $r .= "<td $attributes>"; |
277 | 277 | $r .= $val; |
278 | 278 | $r .= '</td>'; |
279 | 279 | } |
280 | - unset($val); |
|
280 | + unset( $val ); |
|
281 | 281 | } |
282 | 282 | $r .= '</tr>'; |
283 | 283 | |
@@ -290,25 +290,25 @@ discard block |
||
290 | 290 | */ |
291 | 291 | private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
292 | 292 | if ( 'trash' == $this->status ) { |
293 | - if ( current_user_can('frm_edit_forms') ) { |
|
293 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
294 | 294 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
295 | 295 | } |
296 | 296 | |
297 | - if ( current_user_can('frm_delete_forms') ) { |
|
298 | - $actions['trash'] = '<a href="' . esc_url(wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id='. $item->id, 'destroy_form_'. $item->id )) .'" class="submitdelete" onclick="return confirm(\''. __( 'Are you sure you want to permanently delete that?', 'formidable' ) .'\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
297 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
298 | + $actions['trash'] = '<a href="' . esc_url( wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ) ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
|
299 | 299 | } |
300 | 300 | return; |
301 | 301 | } |
302 | 302 | |
303 | - if ( current_user_can('frm_edit_forms') ) { |
|
303 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
304 | 304 | if ( ! $item->is_template || ! $item->default_template ) { |
305 | - $actions['frm_edit'] = '<a href="'. esc_url( $edit_link ) . '">'. __( 'Edit') .'</a>'; |
|
305 | + $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | if ( $item->is_template ) { |
309 | - $actions['frm_duplicate'] = '<a href="'. esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
|
309 | + $actions['frm_duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
|
310 | 310 | } else { |
311 | - $actions['frm_settings'] = '<a href="'. esc_url('?page=formidable&frm_action=settings&id='. $item->id ) . '">'. __( 'Settings', 'formidable' ) .'</a>'; |
|
311 | + $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
|
312 | 312 | |
313 | 313 | if ( FrmAppHelper::pro_is_installed() ) { |
314 | 314 | $actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>'; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | unset( $actions['trash'] ); |
323 | 323 | } |
324 | 324 | |
325 | - $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
|
325 | + $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
332 | 332 | $form_name = $item->name; |
333 | - if ( trim($form_name) == '' ) { |
|
334 | - $form_name = __( '(no title)'); |
|
333 | + if ( trim( $form_name ) == '' ) { |
|
334 | + $form_name = __( '(no title)' ); |
|
335 | 335 | } |
336 | 336 | $form_name = FrmAppHelper::kses( $form_name ); |
337 | 337 | if ( 'excerpt' != $mode ) { |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | private function add_draft_label( $item, &$val ) { |
360 | 360 | if ( 'draft' == $item->status && 'draft' != $this->status ) { |
361 | - $val .= ' - <span class="post-state">'. __( 'Draft', 'formidable' ) .'</span>'; |
|
361 | + $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | private function add_form_description( $item, &$val ) { |
369 | 369 | global $mode; |
370 | 370 | if ( 'excerpt' == $mode ) { |
371 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
371 | + $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 ); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'swanky-purse' => 'Swanky Purse', |
30 | 30 | ); |
31 | 31 | |
32 | - $themes = apply_filters('frm_jquery_themes', $themes); |
|
32 | + $themes = apply_filters( 'frm_jquery_themes', $themes ); |
|
33 | 33 | return $themes; |
34 | 34 | } |
35 | 35 | |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | |
41 | 41 | if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) { |
42 | 42 | $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css'; |
43 | - } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) { |
|
43 | + } else if ( preg_match( '/^http.?:\/\/.*\..*$/', $theme_css ) ) { |
|
44 | 44 | $css_file = $theme_css; |
45 | 45 | } else { |
46 | 46 | $uploads = self::get_upload_base(); |
47 | - $file_path = '/formidable/css/'. $theme_css . '/jquery-ui.css'; |
|
48 | - if ( file_exists($uploads['basedir'] . $file_path) ) { |
|
47 | + $file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css'; |
|
48 | + if ( file_exists( $uploads['basedir'] . $file_path ) ) { |
|
49 | 49 | $css_file = $uploads['baseurl'] . $file_path; |
50 | 50 | } else { |
51 | - $css_file = FrmAppHelper::jquery_ui_base_url() .'/themes/'. $theme_css . '/jquery-ui.min.css'; |
|
51 | + $css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css'; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $form = self::get_form_for_page(); |
60 | 60 | $theme_css = FrmStylesController::get_style_val( 'theme_css', $form ); |
61 | 61 | if ( $theme_css != -1 ) { |
62 | - wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version()); |
|
62 | + wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | |
80 | 80 | public static function get_upload_base() { |
81 | 81 | $uploads = wp_upload_dir(); |
82 | - if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) { |
|
83 | - $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']); |
|
82 | + if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $uploads['baseurl'] ) ) { |
|
83 | + $uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $uploads; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | <h2 class="nav-tab-wrapper"> |
92 | 92 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles' ) ) ?>" class="nav-tab <?php echo ( '' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Edit Styles', 'formidable' ) ?></a> |
93 | 93 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=manage' ) ) ?>" class="nav-tab <?php echo ( 'manage' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Manage Form Styles', 'formidable' ) ?></a> |
94 | - <a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a> |
|
94 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a> |
|
95 | 95 | </h2> |
96 | 96 | <?php |
97 | 97 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | * @return The class for this icon |
131 | 131 | */ |
132 | 132 | public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) { |
133 | - if ( 'arrow' == $type && is_numeric($key) ) { |
|
133 | + if ( 'arrow' == $type && is_numeric( $key ) ) { |
|
134 | 134 | //frm_arrowup6_icon |
135 | 135 | $arrow = array( '-' => 'down', '+' => 'up' ); |
136 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
136 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
137 | 137 | } else { |
138 | 138 | //frm_minus1_icon |
139 | - $key = str_replace('p', '', $key); |
|
139 | + $key = str_replace( 'p', '', $key ); |
|
140 | 140 | $plus = array( '-' => 'minus', '+' => 'plus' ); |
141 | - $class = 'frm_' . $plus[ $icon ]; |
|
141 | + $class = 'frm_' . $plus[$icon]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if ( $key ) { |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | |
157 | 157 | $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon'; |
158 | 158 | ?> |
159 | - <select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
|
159 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
|
160 | 160 | <?php foreach ( $icons as $key => $icon ) { ?> |
161 | - <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[ $name ], $key ) ?>> |
|
162 | - <?php echo ''. $icon['+'] .'; '. $icon['-'] .';'; ?> |
|
161 | + <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[$name], $key ) ?>> |
|
162 | + <?php echo '' . $icon['+'] . '; ' . $icon['-'] . ';'; ?> |
|
163 | 163 | </option> |
164 | 164 | <?php } ?> |
165 | 165 | </select> |
166 | 166 | |
167 | 167 | <div class="btn-group hide-if-no-js" id="frm_<?php echo esc_attr( $name ) ?>_select"> |
168 | 168 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
169 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ) ?>"></i> |
|
170 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ) ?>"></i> |
|
169 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '+', $type ) ) ?>"></i> |
|
170 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '-', $type ) ) ?>"></i> |
|
171 | 171 | <b class="caret"></b> |
172 | 172 | </button> |
173 | 173 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | public static function hex2rgb( $hex ) { |
193 | - $hex = str_replace('#', '', $hex); |
|
193 | + $hex = str_replace( '#', '', $hex ); |
|
194 | 194 | |
195 | - if ( strlen($hex) == 3 ) { |
|
196 | - $r = hexdec( substr($hex,0,1).substr($hex,0,1) ); |
|
197 | - $g = hexdec( substr($hex,1,1).substr($hex,1,1) ); |
|
198 | - $b = hexdec( substr($hex,2,1).substr($hex,2,1) ); |
|
195 | + if ( strlen( $hex ) == 3 ) { |
|
196 | + $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); |
|
197 | + $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); |
|
198 | + $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); |
|
199 | 199 | } else { |
200 | - $r = hexdec( substr($hex,0,2) ); |
|
201 | - $g = hexdec( substr($hex,2,2) ); |
|
202 | - $b = hexdec( substr($hex,4,2) ); |
|
200 | + $r = hexdec( substr( $hex, 0, 2 ) ); |
|
201 | + $g = hexdec( substr( $hex, 2, 2 ) ); |
|
202 | + $b = hexdec( substr( $hex, 4, 2 ) ); |
|
203 | 203 | } |
204 | 204 | $rgb = array( $r, $g, $b ); |
205 | - return implode(',', $rgb); // returns the rgb values separated by commas |
|
205 | + return implode( ',', $rgb ); // returns the rgb values separated by commas |
|
206 | 206 | //return $rgb; // returns an array with the rgb values |
207 | 207 | } |
208 | 208 | } |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | var $entry_metas; |
8 | 8 | |
9 | 9 | public function __construct() { |
10 | - if ( ! defined('ABSPATH') ) { |
|
11 | - die('You are not allowed to call this page directly.'); |
|
10 | + if ( ! defined( 'ABSPATH' ) ) { |
|
11 | + die( 'You are not allowed to call this page directly.' ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | global $wpdb; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $frm_db_version = FrmAppHelper::$db_version; |
25 | 25 | $old_db_version = (float) $old_db_version; |
26 | 26 | if ( ! $old_db_version ) { |
27 | - $old_db_version = get_option('frm_db_version'); |
|
27 | + $old_db_version = get_option( 'frm_db_version' ); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( $frm_db_version != $old_db_version ) { |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
35 | 35 | |
36 | 36 | $this->create_tables(); |
37 | - $this->migrate_data($frm_db_version, $old_db_version); |
|
37 | + $this->migrate_data( $frm_db_version, $old_db_version ); |
|
38 | 38 | |
39 | 39 | /***** SAVE DB VERSION *****/ |
40 | - update_option('frm_db_version', $frm_db_version); |
|
40 | + update_option( 'frm_db_version', $frm_db_version ); |
|
41 | 41 | |
42 | 42 | /**** ADD/UPDATE DEFAULT TEMPLATES ****/ |
43 | 43 | FrmXMLController::add_default_templates(); |
44 | 44 | } |
45 | 45 | |
46 | - do_action('frm_after_install'); |
|
46 | + do_action( 'frm_after_install' ); |
|
47 | 47 | |
48 | 48 | /**** update the styling settings ****/ |
49 | 49 | if ( is_admin() && function_exists( 'get_filesystem_method' ) ) { |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | |
61 | 61 | $charset_collate = ''; |
62 | 62 | if ( ! empty( $wpdb->charset ) ) { |
63 | - $charset_collate .= ' DEFAULT CHARACTER SET '. $wpdb->charset; |
|
63 | + $charset_collate .= ' DEFAULT CHARACTER SET ' . $wpdb->charset; |
|
64 | 64 | } |
65 | 65 | |
66 | - if ( ! empty($wpdb->collate) ) { |
|
67 | - $charset_collate .= ' COLLATE '. $wpdb->collate; |
|
66 | + if ( ! empty( $wpdb->collate ) ) { |
|
67 | + $charset_collate .= ' COLLATE ' . $wpdb->collate; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $charset_collate; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $sql = array(); |
76 | 76 | |
77 | 77 | /* Create/Upgrade Fields Table */ |
78 | - $sql[] = 'CREATE TABLE '. $this->fields .' ( |
|
78 | + $sql[] = 'CREATE TABLE ' . $this->fields . ' ( |
|
79 | 79 | id int(11) NOT NULL auto_increment, |
80 | 80 | field_key varchar(100) default NULL, |
81 | 81 | name text default NULL, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | )'; |
95 | 95 | |
96 | 96 | /* Create/Upgrade Forms Table */ |
97 | - $sql[] = 'CREATE TABLE '. $this->forms .' ( |
|
97 | + $sql[] = 'CREATE TABLE ' . $this->forms . ' ( |
|
98 | 98 | id int(11) NOT NULL auto_increment, |
99 | 99 | form_key varchar(100) default NULL, |
100 | 100 | name varchar(255) default NULL, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | )'; |
113 | 113 | |
114 | 114 | /* Create/Upgrade Items Table */ |
115 | - $sql[] = 'CREATE TABLE '. $this->entries .' ( |
|
115 | + $sql[] = 'CREATE TABLE ' . $this->entries . ' ( |
|
116 | 116 | id int(11) NOT NULL auto_increment, |
117 | 117 | item_key varchar(100) default NULL, |
118 | 118 | name varchar(255) default NULL, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | )'; |
136 | 136 | |
137 | 137 | /* Create/Upgrade Meta Table */ |
138 | - $sql[] = 'CREATE TABLE '. $this->entry_metas .' ( |
|
138 | + $sql[] = 'CREATE TABLE ' . $this->entry_metas . ' ( |
|
139 | 139 | id int(11) NOT NULL auto_increment, |
140 | 140 | meta_value longtext default NULL, |
141 | 141 | field_id int(11) NOT NULL, |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | |
149 | 149 | foreach ( $sql as $q ) { |
150 | 150 | if ( function_exists( 'dbDelta' ) ) { |
151 | - dbDelta( $q . $charset_collate .';' ); |
|
151 | + dbDelta( $q . $charset_collate . ';' ); |
|
152 | 152 | } else { |
153 | 153 | global $wpdb; |
154 | 154 | $wpdb->query( $q . $charset_collate ); |
155 | 155 | } |
156 | - unset($q); |
|
156 | + unset( $q ); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $migrations = array( 4, 6, 11, 16, 17, 23, 25 ); |
165 | 165 | foreach ( $migrations as $migration ) { |
166 | 166 | if ( $frm_db_version >= $migration && $old_db_version < $migration ) { |
167 | - $function_name = 'migrate_to_'. $migration; |
|
167 | + $function_name = 'migrate_to_' . $migration; |
|
168 | 168 | $this->$function_name(); |
169 | 169 | } |
170 | 170 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Change array into format $wpdb->prepare can use |
175 | 175 | */ |
176 | 176 | public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
177 | - if ( empty($args) ) { |
|
177 | + if ( empty( $args ) ) { |
|
178 | 178 | // add an arg to prevent prepare from failing |
179 | 179 | $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) ); |
180 | 180 | return; |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
231 | 231 | $key = trim( $key ); |
232 | 232 | |
233 | - if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
234 | - $k = explode(' ', $key); |
|
233 | + if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
|
234 | + $k = explode( ' ', $key ); |
|
235 | 235 | $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
236 | 236 | $values[] = '%Y-%m-%d %H:%i:%s'; |
237 | 237 | } else { |
238 | - $where .= ' '. $key; |
|
238 | + $where .= ' ' . $key; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $lowercase_key = explode( ' ', strtolower( $key ) ); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | $where .= ')'; |
259 | 259 | } else if ( ! empty( $value ) ) { |
260 | - $where .= ' in ('. FrmAppHelper::prepare_array_values( $value, '%s' ) .')'; |
|
260 | + $where .= ' in (' . FrmAppHelper::prepare_array_values( $value, '%s' ) . ')'; |
|
261 | 261 | $values = array_merge( $values, $value ); |
262 | 262 | } |
263 | 263 | } else if ( strpos( $lowercase_key, 'like' ) !== false ) { |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | $query .= $where . ' ' . implode( ' ', $args ); |
323 | 323 | } |
324 | 324 | |
325 | - $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode('_', FrmAppHelper::array_flatten( $where ) ) . implode( '_', $args ) . $field .'_'. $type, ' WHERE' ) ); |
|
326 | - $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_'. $type ); |
|
325 | + $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . implode( '_', $args ) . $field . '_' . $type, ' WHERE' ) ); |
|
326 | + $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_' . $type ); |
|
327 | 327 | return $results; |
328 | 328 | } |
329 | 329 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) { |
356 | 356 | _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' ); |
357 | - return self::get_results( $table, $args, $fields, compact('order_by', 'limit') ); |
|
357 | + return self::get_results( $table, $args, $fields, compact( 'order_by', 'limit' ) ); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | ); |
388 | 388 | |
389 | 389 | $where_is = strtolower( $where_is ); |
390 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
391 | - return ' ' . $switch_to[ $where_is ]; |
|
390 | + if ( isset( $switch_to[$where_is] ) ) { |
|
391 | + return ' ' . $switch_to[$where_is]; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | private static function get_group_and_table_name( &$table, &$group ) { |
411 | 411 | global $wpdb, $wpmuBaseTablePrefix; |
412 | 412 | |
413 | - $table_parts = explode(' ', $table); |
|
414 | - $group = reset($table_parts); |
|
413 | + $table_parts = explode( ' ', $table ); |
|
414 | + $group = reset( $table_parts ); |
|
415 | 415 | $group = str_replace( $wpdb->prefix, '', $group ); |
416 | 416 | |
417 | 417 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
429 | - if ( ! is_array($args) ) { |
|
429 | + if ( ! is_array( $args ) ) { |
|
430 | 430 | $args = array( 'order_by' => $args ); |
431 | 431 | } |
432 | 432 | |
@@ -441,16 +441,16 @@ discard block |
||
441 | 441 | $temp_args = $args; |
442 | 442 | foreach ( $temp_args as $k => $v ) { |
443 | 443 | if ( $v == '' ) { |
444 | - unset( $args[ $k ] ); |
|
444 | + unset( $args[$k] ); |
|
445 | 445 | continue; |
446 | 446 | } |
447 | 447 | |
448 | 448 | if ( $k == 'limit' ) { |
449 | - $args[ $k ] = FrmAppHelper::esc_limit( $v ); |
|
449 | + $args[$k] = FrmAppHelper::esc_limit( $v ); |
|
450 | 450 | } |
451 | 451 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
452 | 452 | if ( strpos( $v, $db_name ) === false ) { |
453 | - $args[ $k ] = $db_name . ' ' . $v; |
|
453 | + $args[$k] = $db_name . ' ' . $v; |
|
454 | 454 | } |
455 | 455 | } |
456 | 456 | } |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | public function uninstall() { |
459 | 459 | if ( ! current_user_can( 'administrator' ) ) { |
460 | 460 | $frm_settings = FrmAppHelper::get_settings(); |
461 | - wp_die($frm_settings->admin_permission); |
|
461 | + wp_die( $frm_settings->admin_permission ); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | global $wpdb, $wp_roles; |
465 | 465 | |
466 | - $wpdb->query( 'DROP TABLE IF EXISTS '. $this->fields ); |
|
467 | - $wpdb->query( 'DROP TABLE IF EXISTS '. $this->forms ); |
|
468 | - $wpdb->query( 'DROP TABLE IF EXISTS '. $this->entries ); |
|
469 | - $wpdb->query( 'DROP TABLE IF EXISTS '. $this->entry_metas ); |
|
466 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields ); |
|
467 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms ); |
|
468 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); |
|
469 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); |
|
470 | 470 | |
471 | - delete_option('frm_options'); |
|
472 | - delete_option('frm_db_version'); |
|
471 | + delete_option( 'frm_options' ); |
|
472 | + delete_option( 'frm_db_version' ); |
|
473 | 473 | |
474 | 474 | //delete roles |
475 | 475 | $frm_roles = FrmAppHelper::frm_capabilities(); |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
478 | 478 | foreach ( $roles as $role => $details ) { |
479 | 479 | $wp_roles->remove_cap( $role, $frm_role ); |
480 | - unset($role, $details); |
|
480 | + unset( $role, $details ); |
|
481 | 481 | } |
482 | - unset($frm_role, $frm_role_description); |
|
482 | + unset( $frm_role, $frm_role_description ); |
|
483 | 483 | } |
484 | - unset($roles, $frm_roles); |
|
484 | + unset( $roles, $frm_roles ); |
|
485 | 485 | |
486 | 486 | // delete actions, views, and styles |
487 | 487 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | remove_action( 'before_delete_post', 'FrmProDisplaysController::before_delete_post' ); |
490 | 490 | remove_action( 'deleted_post', 'FrmProEntriesController::delete_entry' ); |
491 | 491 | |
492 | - $post_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->posts .' WHERE post_type in (%s, %s, %s)', FrmFormActionsController::$action_post_type, FrmStylesController::$post_type, 'frm_display' ) ); |
|
492 | + $post_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type in (%s, %s, %s)', FrmFormActionsController::$action_post_type, FrmStylesController::$post_type, 'frm_display' ) ); |
|
493 | 493 | foreach ( $post_ids as $post_id ) { |
494 | 494 | // Delete's each post. |
495 | 495 | wp_delete_post( $post_id, true ); |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | delete_transient( 'frm_options' ); |
502 | 502 | delete_transient( 'frmpro_options' ); |
503 | 503 | |
504 | - $wpdb->query( $wpdb->prepare( 'DELETE FROM '. $wpdb->options .' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) ); |
|
504 | + $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) ); |
|
505 | 505 | |
506 | - do_action('frm_after_uninstall'); |
|
506 | + do_action( 'frm_after_uninstall' ); |
|
507 | 507 | return true; |
508 | 508 | } |
509 | 509 | |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | */ |
539 | 539 | private function migrate_to_23() { |
540 | 540 | global $wpdb; |
541 | - $exists = $wpdb->get_row( 'SHOW COLUMNS FROM '. $this->forms .' LIKE "parent_form_id"' ); |
|
541 | + $exists = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $this->forms . ' LIKE "parent_form_id"' ); |
|
542 | 542 | if ( empty( $exists ) ) { |
543 | - $wpdb->query( 'ALTER TABLE '. $this->forms .' ADD parent_form_id int(11) default 0' ); |
|
543 | + $wpdb->query( 'ALTER TABLE ' . $this->forms . ' ADD parent_form_id int(11) default 0' ); |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | |
561 | 561 | $updated = 0; |
562 | 562 | foreach ( $fields as $f ) { |
563 | - $f->field_options = maybe_unserialize($f->field_options); |
|
564 | - if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
563 | + $f->field_options = maybe_unserialize( $f->field_options ); |
|
564 | + if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) { |
|
565 | 565 | continue; |
566 | 566 | } |
567 | 567 | |
@@ -569,27 +569,27 @@ discard block |
||
569 | 569 | $f->field_options['size'] .= 'px'; |
570 | 570 | $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
571 | 571 | if ( $u ) { |
572 | - $updated++; |
|
572 | + $updated ++; |
|
573 | 573 | } |
574 | - unset($f); |
|
574 | + unset( $f ); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | // Change the characters in widgets to pixels |
578 | - $widgets = get_option('widget_frm_show_form'); |
|
579 | - if ( empty($widgets) ) { |
|
578 | + $widgets = get_option( 'widget_frm_show_form' ); |
|
579 | + if ( empty( $widgets ) ) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
583 | - $widgets = maybe_unserialize($widgets); |
|
583 | + $widgets = maybe_unserialize( $widgets ); |
|
584 | 584 | foreach ( $widgets as $k => $widget ) { |
585 | - if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
585 | + if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
|
586 | 586 | continue; |
587 | 587 | } |
588 | 588 | $size = round( $pixel_conversion * (int) $widget['size'] ); |
589 | 589 | $size .= 'px'; |
590 | - $widgets[ $k ]['size'] = $size; |
|
590 | + $widgets[$k]['size'] = $size; |
|
591 | 591 | } |
592 | - update_option('widget_frm_show_form', $widgets); |
|
592 | + update_option( 'widget_frm_show_form', $widgets ); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | |
640 | 640 | // Format form options |
641 | - $form_options = maybe_unserialize($form->options); |
|
641 | + $form_options = maybe_unserialize( $form->options ); |
|
642 | 642 | |
643 | 643 | // Migrate settings to actions |
644 | 644 | FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | private function migrate_to_11() { |
649 | 649 | global $wpdb; |
650 | 650 | |
651 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
651 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options' ); |
|
652 | 652 | |
653 | 653 | $sending = __( 'Sending', 'formidable' ); |
654 | - $img = FrmAppHelper::plugin_url() .'/images/ajax_loader.gif'; |
|
654 | + $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif'; |
|
655 | 655 | $old_default_html = <<<DEFAULT_HTML |
656 | 656 | <div class="frm_submit"> |
657 | 657 | [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button] |
@@ -659,13 +659,13 @@ discard block |
||
659 | 659 | <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" /> |
660 | 660 | </div> |
661 | 661 | DEFAULT_HTML; |
662 | - unset($sending, $img); |
|
662 | + unset( $sending, $img ); |
|
663 | 663 | |
664 | - $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
664 | + $new_default_html = FrmFormsHelper::get_default_html( 'submit' ); |
|
665 | 665 | $draft_link = FrmFormsHelper::get_draft_link(); |
666 | 666 | foreach ( $forms as $form ) { |
667 | - $form->options = maybe_unserialize($form->options); |
|
668 | - if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
667 | + $form->options = maybe_unserialize( $form->options ); |
|
668 | + if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) { |
|
669 | 669 | continue; |
670 | 670 | } |
671 | 671 | |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | $form->options['submit_html'] = $new_default_html; |
674 | 674 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
675 | 675 | } else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) { |
676 | - $form->options['submit_html'] = preg_replace('~\<\/div\>(?!.*\<\/div\>)~', $draft_link ."\r\n</div>", $form->options['submit_html']); |
|
676 | + $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] ); |
|
677 | 677 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
678 | 678 | } |
679 | - unset($form); |
|
679 | + unset( $form ); |
|
680 | 680 | } |
681 | - unset($forms); |
|
681 | + unset( $forms ); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | private function migrate_to_6() { |
@@ -707,16 +707,16 @@ discard block |
||
707 | 707 | </div> |
708 | 708 | DEFAULT_HTML; |
709 | 709 | |
710 | - $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
710 | + $new_default_html = FrmFieldsHelper::get_default_html( 'text' ); |
|
711 | 711 | foreach ( $fields as $field ) { |
712 | - $field->field_options = maybe_unserialize($field->field_options); |
|
712 | + $field->field_options = maybe_unserialize( $field->field_options ); |
|
713 | 713 | if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) { |
714 | 714 | $field->field_options['custom_html'] = $new_default_html; |
715 | 715 | $wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) ); |
716 | 716 | } |
717 | - unset($field); |
|
717 | + unset( $field ); |
|
718 | 718 | } |
719 | - unset($default_html, $old_default_html, $fields); |
|
719 | + unset( $default_html, $old_default_html, $fields ); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | private function migrate_to_4() { |