@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | <ul class="frm_actions_list"> |
| 224 | 224 | <?php |
| 225 | 225 | |
| 226 | - //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
| 227 | - foreach ( $action_controls as $action_control ) { |
|
| 226 | + //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
| 227 | + foreach ( $action_controls as $action_control ) { |
|
| 228 | 228 | $classes = ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action '; |
| 229 | 229 | $classes .= $action_control->action_options['classes']; |
| 230 | - ?> |
|
| 230 | + ?> |
|
| 231 | 231 | <li> |
| 232 | 232 | <a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php echo esc_attr( $classes ); ?>" title="<?php echo esc_attr( $action_control->action_options['tooltip'] ) ?>" data-limit="<?php echo esc_attr( isset( $action_control->action_options['limit'] ) ? $action_control->action_options['limit'] : '99' ); ?>" data-actiontype="<?php echo esc_attr( $action_control->id_base ) ?>"></a> |
| 233 | 233 | </li> |
| 234 | 234 | <?php |
| 235 | 235 | unset( $actions_icon, $classes ); |
| 236 | - } |
|
| 237 | - ?> |
|
| 236 | + } |
|
| 237 | + ?> |
|
| 238 | 238 | </ul> |
| 239 | 239 | </div> |
| 240 | 240 | <div class="frm_no_actions"> |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea( $field['custom_html'] ) ?></textarea> |
| 273 | 273 | </p> |
| 274 | 274 | <?php |
| 275 | - } |
|
| 275 | + } |
|
| 276 | 276 | unset( $field ); |
| 277 | - } |
|
| 278 | - } |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | ?> |
| 280 | 280 | </div> |
| 281 | 281 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | <tr> |
| 95 | 95 | <td class="frm_175_width"> |
| 96 | 96 | <select name="options[success_action]" id="success_action"> |
| 97 | - <option value="message" <?php selected($values['success_action'], 'message') ?>> |
|
| 97 | + <option value="message" <?php selected( $values['success_action'], 'message' ) ?>> |
|
| 98 | 98 | <?php esc_html_e( 'Show Message', 'formidable' ) ?> |
| 99 | 99 | </option> |
| 100 | 100 | <option value="redirect" <?php selected( $values['success_action'], 'redirect' ); ?>> |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | </label> |
| 134 | 134 | </td> |
| 135 | 135 | </tr> |
| 136 | - <?php if ( function_exists( 'akismet_http_post') ) { ?> |
|
| 136 | + <?php if ( function_exists( 'akismet_http_post' ) ) { ?> |
|
| 137 | 137 | <tr> |
| 138 | 138 | <td colspan="2"><?php esc_html_e( 'Use Akismet to check entries for spam for', 'formidable' ) ?> |
| 139 | 139 | <select name="options[akismet]"> |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | <textarea id="frm_form_description" name="description" cols="50" rows="5" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['description'] ); ?></textarea> |
| 247 | 247 | </td> |
| 248 | 248 | </tr> |
| 249 | - <?php do_action('frm_additional_form_options', $values); ?> |
|
| 249 | + <?php do_action( 'frm_additional_form_options', $values ); ?> |
|
| 250 | 250 | </table> |
| 251 | 251 | </div> |
| 252 | 252 | |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | </div> |
| 316 | 316 | |
| 317 | 317 | <p><label><?php esc_html_e( 'After Fields', 'formidable' ) ?></label> |
| 318 | - <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['after_html']) ?></textarea></p> |
|
| 318 | + <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['after_html'] ) ?></textarea></p> |
|
| 319 | 319 | |
| 320 | 320 | <p><label><?php esc_html_e( 'Submit Button', 'formidable' ) ?></label> |
| 321 | - <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['submit_html']) ?></textarea></p> |
|
| 321 | + <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['submit_html'] ) ?></textarea></p> |
|
| 322 | 322 | </div> |
| 323 | 323 | </div> |
| 324 | 324 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | </div> |
| 342 | 342 | <?php } ?> |
| 343 | 343 | |
| 344 | - <?php do_action('frm_add_form_option_section', $values); ?> |
|
| 344 | + <?php do_action( 'frm_add_form_option_section', $values ); ?> |
|
| 345 | 345 | <div class="clear"></div> |
| 346 | 346 | </div> |
| 347 | 347 | </div> |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $styles = $frm_style->get_all(); |
| 217 | 217 | |
| 218 | 218 | if ( is_numeric( $style ) ) { |
| 219 | - $style = $styles[ $style ]; |
|
| 219 | + $style = $styles[$style]; |
|
| 220 | 220 | } elseif ( 'default' == $style ) { |
| 221 | 221 | $style = $frm_style->get_default_style( $styles ); |
| 222 | 222 | } |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $forms = FrmForm::get_published_forms(); |
| 254 | 254 | foreach ( $forms as $form ) { |
| 255 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 255 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
| 256 | 256 | continue; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 259 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
| 260 | 260 | |
| 261 | 261 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 262 | 262 | unset( $form ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // remove the # from the colors |
| 353 | 353 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
| 354 | 354 | if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
| 355 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 355 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | */ |
| 489 | 489 | public static function get_style_val( $val, $form = 'default' ) { |
| 490 | 490 | $style = self::get_form_style( $form ); |
| 491 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 492 | - return $style->post_content[ $val ]; |
|
| 491 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
| 492 | + return $style->post_content[$val]; |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | } else if ( 'alt_bg_color' == $name ) { |
| 509 | 509 | $setting = 'bg_color_active'; |
| 510 | 510 | } |
| 511 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 511 | + $default_styles[$name] = $style->post_content[$setting]; |
|
| 512 | 512 | unset( $name, $val ); |
| 513 | 513 | } |
| 514 | 514 | |
@@ -542,18 +542,18 @@ discard block |
||
| 542 | 542 | $i = 0; |
| 543 | 543 | $first_open = false; |
| 544 | 544 | do { |
| 545 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
| 545 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
| 546 | 546 | break; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
| 550 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 551 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 550 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
| 551 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
| 552 | 552 | if ( false == $box || ! $box['title'] ) { |
| 553 | 553 | continue; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - $i++; |
|
| 556 | + $i ++; |
|
| 557 | 557 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
| 558 | 558 | |
| 559 | 559 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -149,6 +149,9 @@ |
||
| 149 | 149 | return $name; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | + /** |
|
| 153 | + * @param string $version |
|
| 154 | + */ |
|
| 152 | 155 | private static function get_css_version( $css_key, $version ) { |
| 153 | 156 | if ( 'formidable' == $css_key ) { |
| 154 | 157 | $this_version = get_option( 'frm_last_style_update' ); |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmStylesController { |
| 4 | - public static $post_type = 'frm_styles'; |
|
| 5 | - public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | - |
|
| 7 | - public static function load_pro_hooks() { |
|
| 8 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | - FrmProStylesController::load_pro_hooks(); |
|
| 10 | - } |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public static function register_post_types() { |
|
| 14 | - register_post_type( self::$post_type, array( |
|
| 15 | - 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | - 'public' => false, |
|
| 17 | - 'show_ui' => false, |
|
| 18 | - 'capability_type' => 'page', |
|
| 4 | + public static $post_type = 'frm_styles'; |
|
| 5 | + public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | + |
|
| 7 | + public static function load_pro_hooks() { |
|
| 8 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | + FrmProStylesController::load_pro_hooks(); |
|
| 10 | + } |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public static function register_post_types() { |
|
| 14 | + register_post_type( self::$post_type, array( |
|
| 15 | + 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | + 'public' => false, |
|
| 17 | + 'show_ui' => false, |
|
| 18 | + 'capability_type' => 'page', |
|
| 19 | 19 | 'capabilities' => array( |
| 20 | 20 | 'edit_post' => 'frm_change_settings', |
| 21 | 21 | 'edit_posts' => 'frm_change_settings', |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | 'delete_posts' => 'frm_change_settings', |
| 26 | 26 | 'read_private_posts' => 'read_private_posts', |
| 27 | 27 | ), |
| 28 | - 'supports' => array( |
|
| 28 | + 'supports' => array( |
|
| 29 | 29 | 'title', |
| 30 | - ), |
|
| 31 | - 'has_archive' => false, |
|
| 32 | - 'labels' => array( |
|
| 30 | + ), |
|
| 31 | + 'has_archive' => false, |
|
| 32 | + 'labels' => array( |
|
| 33 | 33 | 'name' => __( 'Styles', 'formidable' ), |
| 34 | 34 | 'singular_name' => __( 'Style', 'formidable' ), |
| 35 | 35 | 'menu_name' => __( 'Style', 'formidable' ), |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | 'add_new_item' => __( 'Create a New Style', 'formidable' ), |
| 38 | 38 | 'edit_item' => __( 'Edit Style', 'formidable' ), |
| 39 | 39 | ), |
| 40 | - ) ); |
|
| 41 | - } |
|
| 40 | + ) ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public static function menu() { |
|
| 43 | + public static function menu() { |
|
| 44 | 44 | add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | public static function admin_init() { |
| 48 | 48 | if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - self::load_pro_hooks(); |
|
| 52 | + self::load_pro_hooks(); |
|
| 53 | 53 | |
| 54 | 54 | $style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 55 | 55 | if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) { |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 61 | 61 | |
| 62 | - $version = FrmAppHelper::plugin_version(); |
|
| 62 | + $version = FrmAppHelper::plugin_version(); |
|
| 63 | 63 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 64 | 64 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker' . $suffix . '.js', array( 'jquery' ), $version ); |
| 65 | 65 | |
| 66 | 66 | wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
| 67 | 67 | |
| 68 | 68 | $style = apply_filters( 'frm_style_head', false ); |
| 69 | - if ( $style ) { |
|
| 69 | + if ( $style ) { |
|
| 70 | 70 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 71 | - } |
|
| 72 | - } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | public static function enqueue_css( $register = 'enqueue' ) { |
| 75 | 75 | global $frm_vars; |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | public static function load_styler( $style, $message = '' ) { |
| 229 | - global $frm_settings; |
|
| 229 | + global $frm_settings; |
|
| 230 | 230 | |
| 231 | - $frm_style = new FrmStyle(); |
|
| 232 | - $styles = $frm_style->get_all(); |
|
| 231 | + $frm_style = new FrmStyle(); |
|
| 232 | + $styles = $frm_style->get_all(); |
|
| 233 | 233 | |
| 234 | 234 | if ( is_numeric( $style ) ) { |
| 235 | 235 | $style = $styles[ $style ]; |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | $style = $frm_style->get_default_style( $styles ); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - self::add_meta_boxes(); |
|
| 240 | + self::add_meta_boxes(); |
|
| 241 | 241 | |
| 242 | 242 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
| 243 | - } |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @param string $message |
@@ -258,31 +258,31 @@ discard block |
||
| 258 | 258 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - private static function manage_styles() { |
|
| 261 | + private static function manage_styles() { |
|
| 262 | 262 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
| 263 | 263 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
| 264 | - return self::manage(); |
|
| 265 | - } |
|
| 264 | + return self::manage(); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - global $wpdb; |
|
| 267 | + global $wpdb; |
|
| 268 | 268 | |
| 269 | 269 | $forms = FrmForm::get_published_forms(); |
| 270 | - foreach ( $forms as $form ) { |
|
| 271 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 272 | - continue; |
|
| 273 | - } |
|
| 270 | + foreach ( $forms as $form ) { |
|
| 271 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 272 | + continue; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 275 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 276 | 276 | |
| 277 | 277 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 278 | 278 | unset( $form ); |
| 279 | - } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 281 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 282 | 282 | return self::manage( $message, $forms ); |
| 283 | - } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - public static function custom_css( $message = '', $style = null ) { |
|
| 285 | + public static function custom_css( $message = '', $style = null ) { |
|
| 286 | 286 | if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
| 287 | 287 | $id = 'frm_codemirror_box'; |
| 288 | 288 | $settings = wp_enqueue_code_editor( array( |
@@ -322,41 +322,41 @@ discard block |
||
| 322 | 322 | return self::custom_css( $message ); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public static function route() { |
|
| 325 | + public static function route() { |
|
| 326 | 326 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 327 | 327 | |
| 328 | - switch ( $action ) { |
|
| 329 | - case 'edit': |
|
| 330 | - case 'save': |
|
| 331 | - case 'manage': |
|
| 332 | - case 'manage_styles': |
|
| 333 | - case 'custom_css': |
|
| 334 | - case 'save_css': |
|
| 328 | + switch ( $action ) { |
|
| 329 | + case 'edit': |
|
| 330 | + case 'save': |
|
| 331 | + case 'manage': |
|
| 332 | + case 'manage_styles': |
|
| 333 | + case 'custom_css': |
|
| 334 | + case 'save_css': |
|
| 335 | 335 | return self::$action(); |
| 336 | - default: |
|
| 337 | - do_action( 'frm_style_action_route', $action ); |
|
| 338 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 339 | - return; |
|
| 340 | - } |
|
| 336 | + default: |
|
| 337 | + do_action( 'frm_style_action_route', $action ); |
|
| 338 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 339 | + return; |
|
| 340 | + } |
|
| 341 | 341 | |
| 342 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 343 | - return self::$action(); |
|
| 344 | - } |
|
| 342 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 343 | + return self::$action(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - return self::edit(); |
|
| 347 | - } |
|
| 348 | - } |
|
| 346 | + return self::edit(); |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | 349 | |
| 350 | - public static function reset_styling() { |
|
| 350 | + public static function reset_styling() { |
|
| 351 | 351 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 352 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 352 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 353 | 353 | |
| 354 | - $frm_style = new FrmStyle(); |
|
| 355 | - $defaults = $frm_style->get_defaults(); |
|
| 354 | + $frm_style = new FrmStyle(); |
|
| 355 | + $defaults = $frm_style->get_defaults(); |
|
| 356 | 356 | |
| 357 | - echo json_encode( $defaults ); |
|
| 358 | - wp_die(); |
|
| 359 | - } |
|
| 357 | + echo json_encode( $defaults ); |
|
| 358 | + wp_die(); |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | public static function change_styling() { |
| 362 | 362 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
@@ -378,21 +378,21 @@ discard block |
||
| 378 | 378 | wp_die(); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - private static function add_meta_boxes() { |
|
| 382 | - |
|
| 383 | - // setup meta boxes |
|
| 384 | - $meta_boxes = array( |
|
| 385 | - 'general' => __( 'General', 'formidable' ), |
|
| 386 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 387 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 388 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 389 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 390 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 391 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 392 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 393 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 394 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 395 | - ); |
|
| 381 | + private static function add_meta_boxes() { |
|
| 382 | + |
|
| 383 | + // setup meta boxes |
|
| 384 | + $meta_boxes = array( |
|
| 385 | + 'general' => __( 'General', 'formidable' ), |
|
| 386 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 387 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 388 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 389 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 390 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 391 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 392 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 393 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 394 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 395 | + ); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Add custom boxes to the styling settings |
@@ -421,18 +421,18 @@ discard block |
||
| 421 | 421 | $file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name ); |
| 422 | 422 | |
| 423 | 423 | include( $file_name ); |
| 424 | - } |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | - public static function load_css() { |
|
| 426 | + public static function load_css() { |
|
| 427 | 427 | header( 'Content-type: text/css' ); |
| 428 | 428 | |
| 429 | - $frm_style = new FrmStyle(); |
|
| 430 | - $defaults = $frm_style->get_defaults(); |
|
| 429 | + $frm_style = new FrmStyle(); |
|
| 430 | + $defaults = $frm_style->get_defaults(); |
|
| 431 | 431 | $style = ''; |
| 432 | 432 | |
| 433 | 433 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 434 | - wp_die(); |
|
| 435 | - } |
|
| 434 | + wp_die(); |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | 437 | public static function load_saved_css() { |
| 438 | 438 | $css = get_transient( 'frmpro_css' ); |
@@ -441,49 +441,49 @@ discard block |
||
| 441 | 441 | wp_die(); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - /** |
|
| 445 | - * Check if the Formidable styling should be loaded, |
|
| 446 | - * then enqueue it for the footer |
|
| 447 | - * @since 2.0 |
|
| 448 | - */ |
|
| 449 | - public static function enqueue_style() { |
|
| 450 | - global $frm_vars; |
|
| 451 | - |
|
| 452 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 453 | - // the CSS has already been loaded |
|
| 454 | - return; |
|
| 455 | - } |
|
| 456 | - |
|
| 457 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 458 | - if ( $frm_settings->load_style != 'none' ) { |
|
| 459 | - wp_enqueue_style( 'formidable' ); |
|
| 460 | - $frm_vars['css_loaded'] = true; |
|
| 461 | - } |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - // Get the stylesheets for the form settings page |
|
| 465 | - public static function get_style_opts() { |
|
| 466 | - $frm_style = new FrmStyle(); |
|
| 467 | - $styles = $frm_style->get_all(); |
|
| 468 | - |
|
| 469 | - return $styles; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - public static function get_form_style( $form = 'default' ) { |
|
| 473 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
| 474 | - |
|
| 475 | - if ( empty( $style ) || 1 == $style ) { |
|
| 476 | - $style = 'default'; |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - $frm_style = new FrmStyle( $style ); |
|
| 480 | - return $frm_style->get_one(); |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * @param string $class |
|
| 485 | - * @param string $style |
|
| 486 | - */ |
|
| 444 | + /** |
|
| 445 | + * Check if the Formidable styling should be loaded, |
|
| 446 | + * then enqueue it for the footer |
|
| 447 | + * @since 2.0 |
|
| 448 | + */ |
|
| 449 | + public static function enqueue_style() { |
|
| 450 | + global $frm_vars; |
|
| 451 | + |
|
| 452 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 453 | + // the CSS has already been loaded |
|
| 454 | + return; |
|
| 455 | + } |
|
| 456 | + |
|
| 457 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 458 | + if ( $frm_settings->load_style != 'none' ) { |
|
| 459 | + wp_enqueue_style( 'formidable' ); |
|
| 460 | + $frm_vars['css_loaded'] = true; |
|
| 461 | + } |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + // Get the stylesheets for the form settings page |
|
| 465 | + public static function get_style_opts() { |
|
| 466 | + $frm_style = new FrmStyle(); |
|
| 467 | + $styles = $frm_style->get_all(); |
|
| 468 | + |
|
| 469 | + return $styles; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + public static function get_form_style( $form = 'default' ) { |
|
| 473 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
| 474 | + |
|
| 475 | + if ( empty( $style ) || 1 == $style ) { |
|
| 476 | + $style = 'default'; |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + $frm_style = new FrmStyle( $style ); |
|
| 480 | + return $frm_style->get_one(); |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * @param string $class |
|
| 485 | + * @param string $style |
|
| 486 | + */ |
|
| 487 | 487 | public static function get_form_style_class( $class, $style ) { |
| 488 | 488 | if ( 1 == $style ) { |
| 489 | 489 | $style = 'default'; |
@@ -513,9 +513,9 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - /** |
|
| 517 | - * @param string $val |
|
| 518 | - */ |
|
| 516 | + /** |
|
| 517 | + * @param string $val |
|
| 518 | + */ |
|
| 519 | 519 | public static function get_style_val( $val, $form = 'default' ) { |
| 520 | 520 | $style = self::get_form_style( $form ); |
| 521 | 521 | if ( $style && isset( $style->post_content[ $val ] ) ) { |
@@ -525,72 +525,72 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | public static function show_entry_styles( $default_styles ) { |
| 527 | 527 | $frm_style = new FrmStyle( 'default' ); |
| 528 | - $style = $frm_style->get_one(); |
|
| 529 | - |
|
| 530 | - if ( ! $style ) { |
|
| 531 | - return $default_styles; |
|
| 532 | - } |
|
| 533 | - |
|
| 534 | - foreach ( $default_styles as $name => $val ) { |
|
| 535 | - $setting = $name; |
|
| 536 | - if ( 'border_width' == $name ) { |
|
| 537 | - $setting = 'field_border_width'; |
|
| 538 | - } else if ( 'alt_bg_color' == $name ) { |
|
| 539 | - $setting = 'bg_color_active'; |
|
| 540 | - } |
|
| 541 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 528 | + $style = $frm_style->get_one(); |
|
| 529 | + |
|
| 530 | + if ( ! $style ) { |
|
| 531 | + return $default_styles; |
|
| 532 | + } |
|
| 533 | + |
|
| 534 | + foreach ( $default_styles as $name => $val ) { |
|
| 535 | + $setting = $name; |
|
| 536 | + if ( 'border_width' == $name ) { |
|
| 537 | + $setting = 'field_border_width'; |
|
| 538 | + } else if ( 'alt_bg_color' == $name ) { |
|
| 539 | + $setting = 'bg_color_active'; |
|
| 540 | + } |
|
| 541 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 542 | 542 | unset( $name, $val ); |
| 543 | - } |
|
| 543 | + } |
|
| 544 | 544 | |
| 545 | - return $default_styles; |
|
| 546 | - } |
|
| 545 | + return $default_styles; |
|
| 546 | + } |
|
| 547 | 547 | |
| 548 | 548 | public static function &important_style( $important, $field ) { |
| 549 | 549 | $important = self::get_style_val( 'important_style', $field['form_id'] ); |
| 550 | - return $important; |
|
| 551 | - } |
|
| 550 | + return $important; |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | - /** |
|
| 554 | - * Fallback for WP < 3.6 |
|
| 555 | - */ |
|
| 556 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 557 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 558 | - return do_accordion_sections( $screen, $context, $object ); |
|
| 559 | - } |
|
| 553 | + /** |
|
| 554 | + * Fallback for WP < 3.6 |
|
| 555 | + */ |
|
| 556 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 557 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 558 | + return do_accordion_sections( $screen, $context, $object ); |
|
| 559 | + } |
|
| 560 | 560 | |
| 561 | - global $wp_meta_boxes; |
|
| 561 | + global $wp_meta_boxes; |
|
| 562 | 562 | |
| 563 | - $screen = 'formidable_page_formidable-styles'; |
|
| 564 | - $screen = convert_to_screen( $screen ); |
|
| 563 | + $screen = 'formidable_page_formidable-styles'; |
|
| 564 | + $screen = convert_to_screen( $screen ); |
|
| 565 | 565 | |
| 566 | - $page = $screen->id; |
|
| 566 | + $page = $screen->id; |
|
| 567 | 567 | |
| 568 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
| 569 | - ?> |
|
| 568 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
| 569 | + ?> |
|
| 570 | 570 | <div id="side-sortables" class="accordion-container"> |
| 571 | 571 | <?php |
| 572 | - $i = 0; |
|
| 573 | - $first_open = false; |
|
| 574 | - do { |
|
| 572 | + $i = 0; |
|
| 573 | + $first_open = false; |
|
| 574 | + do { |
|
| 575 | 575 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 576 | 576 | break; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 580 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 581 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 582 | - if ( false == $box || ! $box['title'] ) { |
|
| 583 | - continue; |
|
| 579 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 580 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 581 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 582 | + if ( false == $box || ! $box['title'] ) { |
|
| 583 | + continue; |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - $i++; |
|
| 587 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 586 | + $i++; |
|
| 587 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 588 | 588 | |
| 589 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 590 | - $first_open = true; |
|
| 591 | - } |
|
| 589 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 590 | + $first_open = true; |
|
| 591 | + } |
|
| 592 | 592 | |
| 593 | - ?> |
|
| 593 | + ?> |
|
| 594 | 594 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
| 595 | 595 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ); ?>"><br/></div> |
| 596 | 596 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -601,13 +601,13 @@ discard block |
||
| 601 | 601 | </div><!-- .accordion-section-content --> |
| 602 | 602 | </div><!-- .postbox --> |
| 603 | 603 | <?php |
| 604 | - } |
|
| 605 | - } |
|
| 606 | - } |
|
| 607 | - } while ( 0 ); |
|
| 608 | - ?> |
|
| 604 | + } |
|
| 605 | + } |
|
| 606 | + } |
|
| 607 | + } while ( 0 ); |
|
| 608 | + ?> |
|
| 609 | 609 | </div><!-- .accordion-container --> |
| 610 | 610 | <?php |
| 611 | - return $i; |
|
| 612 | - } |
|
| 611 | + return $i; |
|
| 612 | + } |
|
| 613 | 613 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | if ( ! isset( $frm_style ) ) { |
| 12 | - $frm_style = new FrmStyle(); |
|
| 12 | + $frm_style = new FrmStyle(); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $styles = $frm_style->get_all(); |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before{ |
| 126 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
| 126 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_plus_icon:before{ |
| 130 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
| 130 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before, |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
| 139 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
| 139 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
| 140 | 140 | color:<?php echo esc_html( $section_color . $important ) ?>; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
| 144 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
| 144 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
| 145 | 145 | color:<?php echo esc_html( $section_color . $important ) ?>; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | background-color:<?php echo esc_html( $bg_color . $important ); ?>; |
| 288 | 288 | <?php |
| 289 | 289 | if ( ! empty( $important ) ) { |
| 290 | - echo esc_html( 'background-image:none' . $important . ';' ); |
|
| 290 | + echo esc_html( 'background-image:none' . $important . ';' ); |
|
| 291 | 291 | } |
| 292 | 292 | ?> |
| 293 | 293 | border-color: <?php echo esc_html( $border_color . $important ) ?>; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | <?php } ?> |
| 523 | 523 | } |
| 524 | 524 | <?php |
| 525 | - } |
|
| 525 | + } |
|
| 526 | 526 | } |
| 527 | 527 | ?> |
| 528 | 528 | |
@@ -246,6 +246,7 @@ |
||
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * @since 3.0 |
| 249 | + * @param stdClass $field_info |
|
| 249 | 250 | */ |
| 250 | 251 | private static function get_classes_for_builder_field( $field, $display, $field_info ) { |
| 251 | 252 | $li_classes = $field_info->form_builder_classes( $display['type'] ); |
@@ -2,25 +2,25 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFieldsController { |
| 4 | 4 | |
| 5 | - public static function load_field() { |
|
| 5 | + public static function load_field() { |
|
| 6 | 6 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 7 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 7 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 8 | 8 | |
| 9 | - $fields = $_POST['field']; |
|
| 10 | - if ( empty( $fields ) ) { |
|
| 11 | - wp_die(); |
|
| 12 | - } |
|
| 9 | + $fields = $_POST['field']; |
|
| 10 | + if ( empty( $fields ) ) { |
|
| 11 | + wp_die(); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - $_GET['page'] = 'formidable'; |
|
| 15 | - $fields = stripslashes_deep( $fields ); |
|
| 14 | + $_GET['page'] = 'formidable'; |
|
| 15 | + $fields = stripslashes_deep( $fields ); |
|
| 16 | 16 | |
| 17 | 17 | $values = array( |
| 18 | 18 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 19 | 19 | 'doing_ajax' => true, |
| 20 | 20 | ); |
| 21 | - $field_html = array(); |
|
| 21 | + $field_html = array(); |
|
| 22 | 22 | |
| 23 | - foreach ( $fields as $field ) { |
|
| 23 | + foreach ( $fields as $field ) { |
|
| 24 | 24 | $field = htmlspecialchars_decode( nl2br( $field ) ); |
| 25 | 25 | $field = json_decode( $field ); |
| 26 | 26 | if ( ! isset( $field->id ) || ! is_numeric( $field->id ) ) { |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | self::load_single_field( $field, $values ); |
| 39 | 39 | $field_html[ absint( $field->id ) ] = ob_get_contents(); |
| 40 | 40 | ob_end_clean(); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | echo json_encode( $field_html ); |
| 44 | 44 | |
| 45 | - wp_die(); |
|
| 46 | - } |
|
| 45 | + wp_die(); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Create a new field with ajax |
| 50 | 50 | */ |
| 51 | - public static function create() { |
|
| 51 | + public static function create() { |
|
| 52 | 52 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 53 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 53 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 54 | 54 | |
| 55 | 55 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
| 56 | 56 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | // this hook will allow for multiple fields to be added at once |
| 61 | 61 | do_action( 'frm_after_field_created', $field, $form_id ); |
| 62 | 62 | |
| 63 | - wp_die(); |
|
| 64 | - } |
|
| 63 | + wp_die(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Set up and create a new field |
|
| 68 | - * |
|
| 69 | - * @param string $field_type |
|
| 70 | - * @param integer $form_id |
|
| 71 | - * @return array|bool |
|
| 72 | - */ |
|
| 66 | + /** |
|
| 67 | + * Set up and create a new field |
|
| 68 | + * |
|
| 69 | + * @param string $field_type |
|
| 70 | + * @param integer $form_id |
|
| 71 | + * @return array|bool |
|
| 72 | + */ |
|
| 73 | 73 | public static function include_new_field( $field_type, $form_id ) { |
| 74 | 74 | $values = array(); |
| 75 | 75 | if ( FrmAppHelper::pro_is_installed() ) { |
@@ -77,19 +77,19 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
| 80 | - $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 80 | + $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 81 | 81 | |
| 82 | - $field_id = FrmField::create( $field_values ); |
|
| 82 | + $field_id = FrmField::create( $field_values ); |
|
| 83 | 83 | |
| 84 | - if ( ! $field_id ) { |
|
| 85 | - return false; |
|
| 86 | - } |
|
| 84 | + if ( ! $field_id ) { |
|
| 85 | + return false; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | $field = self::get_field_array_from_id( $field_id ); |
| 89 | 89 | self::load_single_field( $field, $values, $form_id ); |
| 90 | 90 | |
| 91 | - return $field; |
|
| 92 | - } |
|
| 91 | + return $field; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | public static function edit_name( $field = 'name', $id = '' ) { |
| 95 | 95 | _deprecated_function( __FUNCTION__, '3.0' ); |
@@ -101,29 +101,29 @@ discard block |
||
| 101 | 101 | $field = 'name'; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ( empty( $id ) ) { |
|
| 104 | + if ( empty( $id ) ) { |
|
| 105 | 105 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 106 | 106 | $id = str_replace( 'field_label_', '', $id ); |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 110 | 110 | $value = trim( $value ); |
| 111 | - if ( trim( strip_tags( $value ) ) === '' ) { |
|
| 112 | - // set blank value if there is no content |
|
| 113 | - $value = ''; |
|
| 114 | - } |
|
| 111 | + if ( trim( strip_tags( $value ) ) === '' ) { |
|
| 112 | + // set blank value if there is no content |
|
| 113 | + $value = ''; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | FrmField::update( $id, array( $field => $value ) ); |
| 117 | 117 | |
| 118 | 118 | do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) ); |
| 119 | 119 | |
| 120 | 120 | echo stripslashes( wp_kses_post( $value ) ); |
| 121 | - wp_die(); |
|
| 122 | - } |
|
| 121 | + wp_die(); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - public static function update_ajax_option() { |
|
| 124 | + public static function update_ajax_option() { |
|
| 125 | 125 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 126 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 126 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 127 | 127 | |
| 128 | 128 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
| 129 | 129 | if ( ! $field_id ) { |
@@ -138,24 +138,24 @@ discard block |
||
| 138 | 138 | unset( $new_val ); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - FrmField::update( $field_id, array( |
|
| 142 | - 'field_options' => $field->field_options, |
|
| 141 | + FrmField::update( $field_id, array( |
|
| 142 | + 'field_options' => $field->field_options, |
|
| 143 | 143 | 'form_id' => $field->form_id, |
| 144 | - ) ); |
|
| 145 | - wp_die(); |
|
| 146 | - } |
|
| 144 | + ) ); |
|
| 145 | + wp_die(); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - public static function duplicate() { |
|
| 148 | + public static function duplicate() { |
|
| 149 | 149 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 150 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 150 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 151 | 151 | |
| 152 | 152 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 153 | 153 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 154 | 154 | |
| 155 | 155 | $copy_field = FrmField::getOne( $field_id ); |
| 156 | - if ( ! $copy_field ) { |
|
| 157 | - wp_die(); |
|
| 158 | - } |
|
| 156 | + if ( ! $copy_field ) { |
|
| 157 | + wp_die(); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | do_action( 'frm_duplicate_field', $copy_field, $form_id ); |
| 161 | 161 | do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id ); |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | self::load_single_field( $field_id, $values ); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - wp_die(); |
|
| 173 | - } |
|
| 172 | + wp_die(); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Load a single field in the form builder along with all needed variables |
@@ -255,21 +255,21 @@ discard block |
||
| 255 | 255 | return $li_classes; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - public static function destroy() { |
|
| 258 | + public static function destroy() { |
|
| 259 | 259 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 260 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 260 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 261 | 261 | |
| 262 | 262 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 263 | 263 | FrmField::destroy( $field_id ); |
| 264 | - wp_die(); |
|
| 265 | - } |
|
| 264 | + wp_die(); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - /* Field Options */ |
|
| 267 | + /* Field Options */ |
|
| 268 | 268 | |
| 269 | - //Add Single Option or Other Option |
|
| 270 | - public static function add_option() { |
|
| 269 | + //Add Single Option or Other Option |
|
| 270 | + public static function add_option() { |
|
| 271 | 271 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 272 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 272 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 273 | 273 | |
| 274 | 274 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 275 | 275 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
@@ -294,61 +294,61 @@ discard block |
||
| 294 | 294 | FrmFieldsHelper::show_single_option( $field ); |
| 295 | 295 | |
| 296 | 296 | wp_die(); |
| 297 | - } |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - public static function edit_option() { |
|
| 299 | + public static function edit_option() { |
|
| 300 | 300 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 301 | - } |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - public static function delete_option() { |
|
| 303 | + public static function delete_option() { |
|
| 304 | 304 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 305 | - } |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - public static function import_choices() { |
|
| 308 | - FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 307 | + public static function import_choices() { |
|
| 308 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 309 | 309 | |
| 310 | 310 | $field_id = absint( $_REQUEST['field_id'] ); |
| 311 | 311 | |
| 312 | - global $current_screen, $hook_suffix; |
|
| 312 | + global $current_screen, $hook_suffix; |
|
| 313 | 313 | |
| 314 | - // Catch plugins that include admin-header.php before admin.php completes. |
|
| 315 | - if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 316 | - $hook_suffix = ''; |
|
| 317 | - set_current_screen(); |
|
| 318 | - } |
|
| 314 | + // Catch plugins that include admin-header.php before admin.php completes. |
|
| 315 | + if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 316 | + $hook_suffix = ''; |
|
| 317 | + set_current_screen(); |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 321 | - register_admin_color_schemes(); |
|
| 322 | - } |
|
| 320 | + if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 321 | + register_admin_color_schemes(); |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | $hook_suffix = ''; |
| 325 | 325 | $admin_body_class = ''; |
| 326 | 326 | |
| 327 | - if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 328 | - $admin_body_class .= ' folded'; |
|
| 329 | - } |
|
| 327 | + if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 328 | + $admin_body_class .= ' folded'; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 332 | - $admin_body_class .= ' admin-bar'; |
|
| 333 | - } |
|
| 331 | + if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 332 | + $admin_body_class .= ' admin-bar'; |
|
| 333 | + } |
|
| 334 | 334 | |
| 335 | - if ( is_rtl() ) { |
|
| 336 | - $admin_body_class .= ' rtl'; |
|
| 337 | - } |
|
| 335 | + if ( is_rtl() ) { |
|
| 336 | + $admin_body_class .= ' rtl'; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 340 | - $prepop = array(); |
|
| 339 | + $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 340 | + $prepop = array(); |
|
| 341 | 341 | FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
| 342 | 342 | |
| 343 | 343 | $field = FrmField::getOne( $field_id ); |
| 344 | 344 | |
| 345 | - wp_enqueue_script( 'utils' ); |
|
| 345 | + wp_enqueue_script( 'utils' ); |
|
| 346 | 346 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
| 347 | - FrmAppHelper::load_admin_wide_js(); |
|
| 347 | + FrmAppHelper::load_admin_wide_js(); |
|
| 348 | 348 | |
| 349 | 349 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' ); |
| 350 | - wp_die(); |
|
| 351 | - } |
|
| 350 | + wp_die(); |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | 353 | public static function import_options() { |
| 354 | 354 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | $field = FrmField::getOne( $field_id ); |
| 363 | 363 | |
| 364 | 364 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
| 365 | - return; |
|
| 366 | - } |
|
| 365 | + return; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | $field = FrmFieldsHelper::setup_edit_vars( $field ); |
| 369 | 369 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - //Keep other options after bulk update |
|
| 390 | - if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 391 | - $other_array = array(); |
|
| 392 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 389 | + //Keep other options after bulk update |
|
| 390 | + if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 391 | + $other_array = array(); |
|
| 392 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 393 | 393 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 394 | 394 | $other_array[ $opt_key ] = $opt; |
| 395 | 395 | } |
@@ -400,36 +400,36 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - $field['options'] = $opts; |
|
| 403 | + $field['options'] = $opts; |
|
| 404 | 404 | |
| 405 | 405 | FrmFieldsHelper::show_single_option( $field ); |
| 406 | 406 | |
| 407 | - wp_die(); |
|
| 408 | - } |
|
| 407 | + wp_die(); |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | - public static function update_order() { |
|
| 410 | + public static function update_order() { |
|
| 411 | 411 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 412 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 412 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 413 | 413 | |
| 414 | 414 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
| 415 | 415 | foreach ( (array) $fields as $position => $item ) { |
| 416 | 416 | FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) ); |
| 417 | 417 | } |
| 418 | - wp_die(); |
|
| 419 | - } |
|
| 418 | + wp_die(); |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | 421 | public static function change_type( $type ) { |
| 422 | - $type_switch = array( |
|
| 423 | - 'scale' => 'radio', |
|
| 422 | + $type_switch = array( |
|
| 423 | + 'scale' => 'radio', |
|
| 424 | 424 | 'star' => 'radio', |
| 425 | - '10radio' => 'radio', |
|
| 426 | - 'rte' => 'textarea', |
|
| 427 | - 'website' => 'url', |
|
| 425 | + '10radio' => 'radio', |
|
| 426 | + 'rte' => 'textarea', |
|
| 427 | + 'website' => 'url', |
|
| 428 | 428 | 'image' => 'url', |
| 429 | - ); |
|
| 430 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | - $type = $type_switch[ $type ]; |
|
| 432 | - } |
|
| 429 | + ); |
|
| 430 | + if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | + $type = $type_switch[ $type ]; |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | $pro_fields = FrmField::pro_field_selection(); |
| 435 | 435 | $types = array_keys( $pro_fields ); |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | $type = 'text'; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - return $type; |
|
| 441 | - } |
|
| 440 | + return $type; |
|
| 441 | + } |
|
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | 444 | * @param array $settings |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | return apply_filters( 'frm_display_field_options', $settings ); |
| 456 | - } |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Display the format option |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/value-format.php' ); |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - public static function input_html( $field, $echo = true ) { |
|
| 469 | - $class = array(); //$field['type']; |
|
| 468 | + public static function input_html( $field, $echo = true ) { |
|
| 469 | + $class = array(); //$field['type']; |
|
| 470 | 470 | self::add_input_classes( $field, $class ); |
| 471 | 471 | |
| 472 | 472 | $add_html = array(); |
@@ -485,85 +485,85 @@ discard block |
||
| 485 | 485 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
| 486 | 486 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
| 487 | 487 | |
| 488 | - if ( $echo ) { |
|
| 489 | - echo $add_html; |
|
| 490 | - } |
|
| 488 | + if ( $echo ) { |
|
| 489 | + echo $add_html; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - return $add_html; |
|
| 493 | - } |
|
| 492 | + return $add_html; |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | 495 | private static function add_input_classes( $field, array &$class ) { |
| 496 | 496 | if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
| 497 | 497 | $class[] = $field['input_class']; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 501 | - return; |
|
| 502 | - } |
|
| 500 | + if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 501 | + return; |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | 504 | if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
| 505 | 505 | $class[] = 'auto_width'; |
| 506 | 506 | } |
| 507 | - } |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | 509 | private static function add_html_size( $field, array &$add_html ) { |
| 510 | 510 | if ( ! isset( $field['size'] ) || $field['size'] <= 0 || in_array( $field['type'], array( 'select', 'data', 'time', 'hidden', 'file', 'lookup' ) ) ) { |
| 511 | - return; |
|
| 512 | - } |
|
| 511 | + return; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | - return; |
|
| 516 | - } |
|
| 514 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | + return; |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | 518 | if ( is_numeric( $field['size'] ) ) { |
| 519 | 519 | $field['size'] .= 'px'; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | $important = apply_filters( 'frm_use_important_width', 1, $field ); |
| 523 | - // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 523 | + // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 524 | 524 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
| 525 | 525 | |
| 526 | 526 | self::add_html_cols( $field, $add_html ); |
| 527 | - } |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | 529 | private static function add_html_cols( $field, array &$add_html ) { |
| 530 | 530 | if ( ! in_array( $field['type'], array( 'textarea', 'rte' ) ) ) { |
| 531 | - return; |
|
| 532 | - } |
|
| 531 | + return; |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - // convert to cols for textareas |
|
| 535 | - $calc = array( |
|
| 536 | - '' => 9, |
|
| 537 | - 'px' => 9, |
|
| 538 | - 'rem' => 0.444, |
|
| 539 | - 'em' => 0.544, |
|
| 540 | - ); |
|
| 534 | + // convert to cols for textareas |
|
| 535 | + $calc = array( |
|
| 536 | + '' => 9, |
|
| 537 | + 'px' => 9, |
|
| 538 | + 'rem' => 0.444, |
|
| 539 | + 'em' => 0.544, |
|
| 540 | + ); |
|
| 541 | 541 | |
| 542 | 542 | // include "col" for valid html |
| 543 | 543 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 544 | 544 | |
| 545 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 546 | - return; |
|
| 547 | - } |
|
| 545 | + if ( ! isset( $calc[ $unit ] ) ) { |
|
| 546 | + return; |
|
| 547 | + } |
|
| 548 | 548 | |
| 549 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 549 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 550 | 550 | |
| 551 | 551 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 552 | - } |
|
| 552 | + } |
|
| 553 | 553 | |
| 554 | 554 | private static function add_html_length( $field, array &$add_html ) { |
| 555 | - // check for max setting and if this field accepts maxlength |
|
| 555 | + // check for max setting and if this field accepts maxlength |
|
| 556 | 556 | if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden', 'file' ) ) ) { |
| 557 | - return; |
|
| 558 | - } |
|
| 557 | + return; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | 560 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
| 561 | - // don't load on form builder page |
|
| 562 | - return; |
|
| 563 | - } |
|
| 561 | + // don't load on form builder page |
|
| 562 | + return; |
|
| 563 | + } |
|
| 564 | 564 | |
| 565 | 565 | $add_html['maxlength'] = 'maxlength="' . esc_attr( $field['max'] ) . '"'; |
| 566 | - } |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | 568 | private static function add_html_placeholder( $field, array &$add_html, array &$class ) { |
| 569 | 569 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
@@ -665,27 +665,27 @@ discard block |
||
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 669 | - if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 670 | - return; |
|
| 671 | - } |
|
| 668 | + private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 669 | + if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 670 | + return; |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | - foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 674 | - if ( 'opt' === $k ) { |
|
| 675 | - continue; |
|
| 676 | - } |
|
| 673 | + foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 674 | + if ( 'opt' === $k ) { |
|
| 675 | + continue; |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | 678 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 679 | - $add_html[] = $v; |
|
| 680 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 679 | + $add_html[] = $v; |
|
| 680 | + } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 681 | 681 | $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
| 682 | - } else { |
|
| 682 | + } else { |
|
| 683 | 683 | $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
| 684 | - } |
|
| 684 | + } |
|
| 685 | 685 | |
| 686 | 686 | unset( $k, $v ); |
| 687 | - } |
|
| 688 | - } |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | 689 | |
| 690 | 690 | /** |
| 691 | 691 | * Add pattern attribute |
@@ -709,16 +709,16 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - public static function check_value( $opt, $opt_key, $field ) { |
|
| 713 | - if ( is_array( $opt ) ) { |
|
| 714 | - if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 715 | - $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 716 | - } else { |
|
| 717 | - $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 718 | - } |
|
| 719 | - } |
|
| 720 | - return $opt; |
|
| 721 | - } |
|
| 712 | + public static function check_value( $opt, $opt_key, $field ) { |
|
| 713 | + if ( is_array( $opt ) ) { |
|
| 714 | + if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 715 | + $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 716 | + } else { |
|
| 717 | + $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 718 | + } |
|
| 719 | + } |
|
| 720 | + return $opt; |
|
| 721 | + } |
|
| 722 | 722 | |
| 723 | 723 | public static function check_label( $opt ) { |
| 724 | 724 | if ( is_array( $opt ) ) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | ob_start(); |
| 38 | 38 | self::load_single_field( $field, $values ); |
| 39 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 39 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 40 | 40 | ob_end_clean(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | if ( strpos( $opt, '|' ) !== false ) { |
| 376 | 376 | $vals = explode( '|', $opt ); |
| 377 | 377 | if ( $vals[0] != $vals[1] ) { |
| 378 | - $opts[ $opt_key ] = array( |
|
| 378 | + $opts[$opt_key] = array( |
|
| 379 | 379 | 'label' => trim( $vals[0] ), |
| 380 | 380 | 'value' => trim( $vals[1] ), |
| 381 | 381 | ); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $other_array = array(); |
| 392 | 392 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 393 | 393 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 394 | - $other_array[ $opt_key ] = $opt; |
|
| 394 | + $other_array[$opt_key] = $opt; |
|
| 395 | 395 | } |
| 396 | 396 | unset( $opt_key, $opt ); |
| 397 | 397 | } |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | 'website' => 'url', |
| 428 | 428 | 'image' => 'url', |
| 429 | 429 | ); |
| 430 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | - $type = $type_switch[ $type ]; |
|
| 430 | + if ( isset( $type_switch[$type] ) ) { |
|
| 431 | + $type = $type_switch[$type]; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $pro_fields = FrmField::pro_field_selection(); |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 514 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | 517 | |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | // include "col" for valid html |
| 543 | 543 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 544 | 544 | |
| 545 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 545 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 546 | 546 | return; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 549 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 550 | 550 | |
| 551 | 551 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 552 | 552 | } |
@@ -677,10 +677,10 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 679 | 679 | $add_html[] = $v; |
| 680 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 681 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 680 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 681 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 682 | 682 | } else { |
| 683 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 683 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | unset( $k, $v ); |
@@ -270,6 +270,9 @@ discard block |
||
| 270 | 270 | return $this->alter_builder_classes( $classes ); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | + /** |
|
| 274 | + * @param string $classes |
|
| 275 | + */ |
|
| 273 | 276 | protected function alter_builder_classes( $classes ) { |
| 274 | 277 | return $classes; |
| 275 | 278 | } |
@@ -443,6 +446,11 @@ discard block |
||
| 443 | 446 | return $html; |
| 444 | 447 | } |
| 445 | 448 | |
| 449 | + /** |
|
| 450 | + * @param string $html |
|
| 451 | + * |
|
| 452 | + * @return string |
|
| 453 | + */ |
|
| 446 | 454 | protected function after_replace_html_shortcodes( $args, $html ) { |
| 447 | 455 | return $html; |
| 448 | 456 | } |
@@ -667,6 +675,7 @@ discard block |
||
| 667 | 675 | /** |
| 668 | 676 | * Link input to field description for screen readers |
| 669 | 677 | * @since 3.0 |
| 678 | + * @param string $input_html |
|
| 670 | 679 | */ |
| 671 | 680 | protected function add_aria_description( $args, &$input_html ) { |
| 672 | 681 | if ( $this->get_field_column('description') != '' ) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | protected function html_id( $plus = '' ) { |
| 219 | 219 | return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field ); |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | 222 | public function display_field_settings() { |
| 223 | 223 | $default_settings = $this->default_field_settings(); |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | $input = $this->select_tag( $values ); |
| 593 | 593 | |
| 594 | - foreach ( $options as $option ) { |
|
| 594 | + foreach ( $options as $option ) { |
|
| 595 | 595 | $input .= '<option value="' . esc_attr( $option ) . '" ' . selected( $selected, $option, false ) . '>'; |
| 596 | 596 | $input .= esc_html( $option ); |
| 597 | 597 | $input .= '</option>'; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function set_type( $type ) { |
| 84 | 84 | if ( empty( $this->type ) ) { |
| 85 | - $this->type = $this->get_field_column('type'); |
|
| 85 | + $this->type = $this->get_field_column( 'type' ); |
|
| 86 | 86 | if ( empty( $this->type ) && ! empty( $type ) ) { |
| 87 | 87 | $this->type = $type; |
| 88 | 88 | } |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $field_val = ''; |
| 99 | 99 | if ( is_object( $this->field ) ) { |
| 100 | 100 | $field_val = $this->field->{$column}; |
| 101 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 102 | - $field_val = $this->field[ $column ]; |
|
| 101 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 102 | + $field_val = $this->field[$column]; |
|
| 103 | 103 | } |
| 104 | 104 | return $field_val; |
| 105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ( is_object( $this->field ) ) { |
| 113 | 113 | $this->field->{$column} = $value; |
| 114 | 114 | } elseif ( is_array( $this->field ) ) { |
| 115 | - $this->field[ $column ] = $value; |
|
| 115 | + $this->field[$column] = $value; |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | protected function builder_text_field( $name = '' ) { |
| 210 | - return '<input type="text" name="' . esc_attr( $this->html_name( $name ) ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column('default_value') ) . '" class="dyn_default_value" />'; |
|
| 210 | + return '<input type="text" name="' . esc_attr( $this->html_name( $name ) ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column( 'default_value' ) ) . '" class="dyn_default_value" />'; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | protected function html_name( $name = '' ) { |
| 214 | 214 | $prefix = empty( $name ) ? 'item_meta' : $name; |
| 215 | - return $prefix . '[' . $this->get_field_column('id') . ']'; |
|
| 215 | + return $prefix . '[' . $this->get_field_column( 'id' ) . ']'; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | protected function html_id( $plus = '' ) { |
| 219 | - return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field ); |
|
| 219 | + return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field ); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function display_field_settings() { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | protected function default_invalid_msg() { |
| 310 | - $field_name = $this->get_field_column('name'); |
|
| 310 | + $field_name = $this->get_field_column( 'name' ); |
|
| 311 | 311 | if ( $field_name == '' ) { |
| 312 | 312 | $invalid = __( 'This field is invalid', 'formidable' ); |
| 313 | 313 | } else { |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | $fields = FrmField::field_selection(); |
| 324 | 324 | $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
| 325 | 325 | |
| 326 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 327 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 326 | + if ( isset( $fields[$this->type] ) ) { |
|
| 327 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | return $name; |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | * @since 3.0 |
| 582 | 582 | */ |
| 583 | 583 | protected function get_select_box( $values ) { |
| 584 | - $options = $this->get_field_column('options'); |
|
| 584 | + $options = $this->get_field_column( 'options' ); |
|
| 585 | 585 | $selected = $values['field_value']; |
| 586 | 586 | |
| 587 | 587 | if ( isset( $values['combo_name'] ) ) { |
| 588 | - $options = $options[ $values['combo_name'] ]; |
|
| 589 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 588 | + $options = $options[$values['combo_name']]; |
|
| 589 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | $input = $this->select_tag( $values ); |
@@ -640,8 +640,8 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | protected function fill_display_field_values( $args = array() ) { |
| 642 | 642 | $defaults = array( |
| 643 | - 'field_name' => 'item_meta[' . $this->get_field_column('id') . ']', |
|
| 644 | - 'field_id' => $this->get_field_column('id'), |
|
| 643 | + 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
|
| 644 | + 'field_id' => $this->get_field_column( 'id' ), |
|
| 645 | 645 | 'field_plus_id' => '', |
| 646 | 646 | 'section_id' => '', |
| 647 | 647 | ); |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | * @since 3.0 |
| 670 | 670 | */ |
| 671 | 671 | protected function add_aria_description( $args, &$input_html ) { |
| 672 | - if ( $this->get_field_column('description') != '' ) { |
|
| 672 | + if ( $this->get_field_column( 'description' ) != '' ) { |
|
| 673 | 673 | $desc_id = 'frm_desc_' . esc_attr( $args['html_id'] ); |
| 674 | 674 | $input_html .= ' aria-describedby="' . esc_attr( $desc_id ) . '"'; |
| 675 | 675 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | public function is_not_unique( $value, $entry_id ) { |
| 687 | 687 | $exists = false; |
| 688 | 688 | if ( FrmAppHelper::pro_is_installed() ) { |
| 689 | - $exists = FrmProEntryMetaHelper::value_exists( $this->get_field_column('id'), $value, $entry_id ); |
|
| 689 | + $exists = FrmProEntryMetaHelper::value_exists( $this->get_field_column( 'id' ), $value, $entry_id ); |
|
| 690 | 690 | } |
| 691 | 691 | return $exists; |
| 692 | 692 | } |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | $value = $this->prepare_display_value( $value, $atts ); |
| 721 | 721 | |
| 722 | 722 | if ( is_array( $value ) ) { |
| 723 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 724 | - $value = $value[ $atts['show'] ]; |
|
| 723 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 724 | + $value = $value[$atts['show']]; |
|
| 725 | 725 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 726 | 726 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 727 | 727 | $value = implode( $sep, $value ); |
@@ -788,8 +788,8 @@ discard block |
||
| 788 | 788 | $saved_entries = $atts['ids']; |
| 789 | 789 | $new_value = array(); |
| 790 | 790 | foreach ( (array) $value as $old_child_id ) { |
| 791 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 792 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 791 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 792 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @uses api_request() |
| 74 | 74 | * |
| 75 | 75 | * @param array $_transient_data Update array build by WordPress. |
| 76 | - * @return array Modified update array with custom plugin data. |
|
| 76 | + * @return stdClass Modified update array with custom plugin data. |
|
| 77 | 77 | */ |
| 78 | 78 | public function check_update( $_transient_data ) { |
| 79 | 79 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * |
| 220 | 220 | * @param string $_action The requested action. |
| 221 | 221 | * @param array $_data Parameters for the API action. |
| 222 | - * @return false|object |
|
| 222 | + * @return string |
|
| 223 | 223 | */ |
| 224 | 224 | private function api_request( $_action, $_data ) { |
| 225 | 225 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $this->beta = ! empty( $this->api_data['beta'] ); |
| 44 | 44 | $this->cache_key = md5( serialize( $this->slug . $this->version . $this->api_data['license'] . $this->beta ) ); |
| 45 | 45 | |
| 46 | - $frm_edd_plugin_data[ $this->slug ] = $this->api_data; |
|
| 46 | + $frm_edd_plugin_data[$this->slug] = $this->api_data; |
|
| 47 | 47 | |
| 48 | 48 | // Set up hooks. |
| 49 | 49 | $this->init(); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $_transient_data = new stdClass; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
| 86 | + if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[$this->name] ) && false === $this->wp_override ) { |
|
| 87 | 87 | return $_transient_data; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | $version_info->plugin = $this->name; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 110 | + $_transient_data->response[$this->name] = $version_info; |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $_transient_data->last_checked = current_time( 'timestamp' ); |
| 115 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 115 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
| 177 | 177 | $new_sections = array(); |
| 178 | 178 | foreach ( $_data->sections as $key => $value ) { |
| 179 | - $new_sections[ $key ] = $value; |
|
| 179 | + $new_sections[$key] = $value; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $_data->sections = $new_sections; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
| 187 | 187 | $new_banners = array(); |
| 188 | 188 | foreach ( $_data->banners as $key => $value ) { |
| 189 | - $new_banners[ $key ] = $value; |
|
| 189 | + $new_banners[$key] = $value; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $_data->banners = $new_banners; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | wp_die( __( 'You do not have permission to install plugin updates', 'formidable' ), __( 'Error', 'formidable' ), array( 'response' => 403 ) ); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - $data = $frm_edd_plugin_data[ $_REQUEST['slug'] ]; |
|
| 299 | + $data = $frm_edd_plugin_data[$_REQUEST['slug']]; |
|
| 300 | 300 | $beta = ! empty( $data['beta'] ); |
| 301 | 301 | $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
| 302 | 302 | $version_info = get_transient( $cache_key ); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | function load_formidable_forms() { |
| 26 | 26 | global $frm_vars; |
| 27 | 27 | $frm_vars = array( |
| 28 | - 'load_css' => false, |
|
| 28 | + 'load_css' => false, |
|
| 29 | 29 | 'forms_loaded' => array(), |
| 30 | - 'created_entries' => array(), |
|
| 31 | - 'pro_is_authorized' => false, |
|
| 30 | + 'created_entries' => array(), |
|
| 31 | + 'pro_is_authorized' => false, |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | $frm_path = dirname(__FILE__); |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // if __autoload is active, put it on the spl_autoload stack |
| 43 | 43 | if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
| 44 | - spl_autoload_register('__autoload'); |
|
| 44 | + spl_autoload_register('__autoload'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Add the autoloader |
| 48 | 48 | spl_autoload_register('frm_forms_autoloader'); |
| 49 | 49 | |
| 50 | 50 | function frm_forms_autoloader( $class_name ) { |
| 51 | - // Only load Frm classes here |
|
| 51 | + // Only load Frm classes here |
|
| 52 | 52 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 53 | - return; |
|
| 54 | - } |
|
| 53 | + return; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | frm_class_autoloader( $class_name, dirname( __FILE__ ) ); |
| 57 | 57 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | 'pro_is_authorized' => false, |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $frm_path = dirname(__FILE__); |
|
| 34 | + $frm_path = dirname( __FILE__ ); |
|
| 35 | 35 | if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
| 36 | 36 | include( $frm_path . '/pro/formidable-pro.php' ); |
| 37 | 37 | } |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // if __autoload is active, put it on the spl_autoload stack |
| 43 | 43 | if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
| 44 | - spl_autoload_register('__autoload'); |
|
| 44 | + spl_autoload_register( '__autoload' ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Add the autoloader |
| 48 | -spl_autoload_register('frm_forms_autoloader'); |
|
| 48 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
| 49 | 49 | |
| 50 | 50 | function frm_forms_autoloader( $class_name ) { |
| 51 | 51 | // Only load Frm classes here |
@@ -26,55 +26,55 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - /* Display in Back End */ |
|
| 30 | - public static function route() { |
|
| 29 | + /* Display in Back End */ |
|
| 30 | + public static function route() { |
|
| 31 | 31 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 32 | 32 | |
| 33 | - switch ( $action ) { |
|
| 34 | - case 'show': |
|
| 35 | - case 'destroy': |
|
| 36 | - case 'destroy_all': |
|
| 37 | - return self::$action(); |
|
| 33 | + switch ( $action ) { |
|
| 34 | + case 'show': |
|
| 35 | + case 'destroy': |
|
| 36 | + case 'destroy_all': |
|
| 37 | + return self::$action(); |
|
| 38 | 38 | |
| 39 | - default: |
|
| 40 | - do_action( 'frm_entry_action_route', $action ); |
|
| 41 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 42 | - return; |
|
| 43 | - } |
|
| 39 | + default: |
|
| 40 | + do_action( 'frm_entry_action_route', $action ); |
|
| 41 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return self::display_list(); |
|
| 46 | - } |
|
| 47 | - } |
|
| 45 | + return self::display_list(); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | public static function contextual_help( $help, $screen_id, $screen ) { |
| 50 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 51 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 52 | - return $help; |
|
| 53 | - } |
|
| 50 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 51 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 52 | + return $help; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 56 | 56 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 57 | 57 | $show_help = ( $page == 'formidable-entries' && ( empty( $action ) || $action == 'list' ) ); |
| 58 | 58 | if ( ! $show_help ) { |
| 59 | - return $help; |
|
| 60 | - } |
|
| 59 | + return $help; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | unset( $action, $page ); |
| 63 | 63 | |
| 64 | - $screen->add_help_tab( array( |
|
| 65 | - 'id' => 'formidable-entries-tab', |
|
| 66 | - 'title' => __( 'Overview', 'formidable' ), |
|
| 64 | + $screen->add_help_tab( array( |
|
| 65 | + 'id' => 'formidable-entries-tab', |
|
| 66 | + 'title' => __( 'Overview', 'formidable' ), |
|
| 67 | 67 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
| 68 | - )); |
|
| 68 | + )); |
|
| 69 | 69 | |
| 70 | - $screen->set_help_sidebar( |
|
| 70 | + $screen->set_help_sidebar( |
|
| 71 | 71 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
| 72 | 72 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
| 73 | 73 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
| 74 | - ); |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - return $help; |
|
| 77 | - } |
|
| 76 | + return $help; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Prevent the "screen options" tab from showing when |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public static function manage_columns( $columns ) { |
| 95 | - global $frm_vars; |
|
| 95 | + global $frm_vars; |
|
| 96 | 96 | $form_id = FrmForm::get_current_form_id(); |
| 97 | 97 | |
| 98 | 98 | $columns[ $form_id . '_id' ] = 'ID'; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
| 111 | 111 | self::maybe_add_ip_col( $form_id, $columns ); |
| 112 | 112 | |
| 113 | - $frm_vars['cols'] = $columns; |
|
| 113 | + $frm_vars['cols'] = $columns; |
|
| 114 | 114 | |
| 115 | 115 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 116 | 116 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | 'default' => 20, |
| 120 | 120 | 'option' => 'formidable_page_formidable_entries_per_page', |
| 121 | 121 | ) ); |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - return $columns; |
|
| 125 | - } |
|
| 124 | + return $columns; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | private static function get_columns_for_form( $form_id, &$columns ) { |
| 128 | 128 | $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
@@ -171,67 +171,67 @@ discard block |
||
| 171 | 171 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
| 172 | 172 | $this_page_name = self::hidden_column_key(); |
| 173 | 173 | if ( $meta_key != $this_page_name || $meta_value == $prev_value ) { |
| 174 | - return $check; |
|
| 175 | - } |
|
| 174 | + return $check; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | if ( empty( $prev_value ) ) { |
| 178 | 178 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - global $frm_vars; |
|
| 181 | + global $frm_vars; |
|
| 182 | 182 | //add a check so we don't create a loop |
| 183 | 183 | $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
| 184 | 184 | |
| 185 | - return $check; |
|
| 186 | - } |
|
| 185 | + return $check; |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - //add hidden columns back from other forms |
|
| 188 | + //add hidden columns back from other forms |
|
| 189 | 189 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
| 190 | 190 | $this_page_name = self::hidden_column_key(); |
| 191 | 191 | if ( $meta_key != $this_page_name ) { |
| 192 | - return; |
|
| 193 | - } |
|
| 192 | + return; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | global $frm_vars; |
| 196 | 196 | if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
| 197 | 197 | return; //don't continue if there's no previous value |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - foreach ( $meta_value as $mk => $mv ) { |
|
| 201 | - //remove blank values |
|
| 202 | - if ( empty( $mv ) ) { |
|
| 203 | - unset( $meta_value[ $mk ] ); |
|
| 204 | - } |
|
| 205 | - } |
|
| 200 | + foreach ( $meta_value as $mk => $mv ) { |
|
| 201 | + //remove blank values |
|
| 202 | + if ( empty( $mv ) ) { |
|
| 203 | + unset( $meta_value[ $mk ] ); |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | $cur_form_prefix = reset( $meta_value ); |
| 208 | 208 | $cur_form_prefix = explode( '_', $cur_form_prefix ); |
| 209 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
| 210 | - $save = false; |
|
| 209 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
| 210 | + $save = false; |
|
| 211 | 211 | |
| 212 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 212 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 213 | 213 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
| 214 | - //don't add blank cols or process included cols |
|
| 215 | - continue; |
|
| 216 | - } |
|
| 214 | + //don't add blank cols or process included cols |
|
| 215 | + continue; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | $form_prefix = explode( '_', $prev_hidden ); |
| 219 | - $form_prefix = $form_prefix[0]; |
|
| 220 | - if ( $form_prefix == $cur_form_prefix ) { |
|
| 221 | - //don't add back columns that are meant to be hidden |
|
| 222 | - continue; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - $meta_value[] = $prev_hidden; |
|
| 226 | - $save = true; |
|
| 219 | + $form_prefix = $form_prefix[0]; |
|
| 220 | + if ( $form_prefix == $cur_form_prefix ) { |
|
| 221 | + //don't add back columns that are meant to be hidden |
|
| 222 | + continue; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + $meta_value[] = $prev_hidden; |
|
| 226 | + $save = true; |
|
| 227 | 227 | unset( $form_prefix ); |
| 228 | - } |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | 230 | if ( $save ) { |
| 231 | 231 | $user_id = get_current_user_id(); |
| 232 | 232 | update_user_option( $user_id, $this_page_name, $meta_value, true ); |
| 233 | - } |
|
| 234 | - } |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | 237 | * @since 2.05.07 |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | public static function save_per_page( $save, $option, $value ) { |
| 255 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 256 | - $save = (int) $value; |
|
| 257 | - } |
|
| 258 | - return $save; |
|
| 259 | - } |
|
| 255 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 256 | + $save = (int) $value; |
|
| 257 | + } |
|
| 258 | + return $save; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | 261 | public static function sortable_columns() { |
| 262 | 262 | $form_id = FrmForm::get_current_form_id(); |
@@ -356,43 +356,43 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | public static function display_list( $message = '', $errors = array() ) { |
| 359 | - global $wpdb, $frm_vars; |
|
| 359 | + global $wpdb, $frm_vars; |
|
| 360 | 360 | |
| 361 | 361 | $form = FrmForm::maybe_get_current_form(); |
| 362 | 362 | $params = FrmForm::get_admin_params( $form ); |
| 363 | 363 | |
| 364 | - if ( $form ) { |
|
| 365 | - $params['form'] = $form->id; |
|
| 366 | - $frm_vars['current_form'] = $form; |
|
| 364 | + if ( $form ) { |
|
| 365 | + $params['form'] = $form->id; |
|
| 366 | + $frm_vars['current_form'] = $form; |
|
| 367 | 367 | |
| 368 | 368 | self::get_delete_form_time( $form, $errors ); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 371 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 372 | 372 | |
| 373 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 373 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 374 | 374 | |
| 375 | - $pagenum = $wp_list_table->get_pagenum(); |
|
| 375 | + $pagenum = $wp_list_table->get_pagenum(); |
|
| 376 | 376 | |
| 377 | - $wp_list_table->prepare_items(); |
|
| 377 | + $wp_list_table->prepare_items(); |
|
| 378 | 378 | |
| 379 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 380 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 379 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 380 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 381 | 381 | $url = add_query_arg( 'paged', $total_pages ); |
| 382 | - if ( headers_sent() ) { |
|
| 382 | + if ( headers_sent() ) { |
|
| 383 | 383 | echo FrmAppHelper::js_redirect( $url ); |
| 384 | - } else { |
|
| 385 | - wp_redirect( esc_url_raw( $url ) ); |
|
| 386 | - } |
|
| 387 | - die(); |
|
| 388 | - } |
|
| 384 | + } else { |
|
| 385 | + wp_redirect( esc_url_raw( $url ) ); |
|
| 386 | + } |
|
| 387 | + die(); |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | 390 | if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
| 391 | - $message = __( 'Your import is complete', 'formidable' ); |
|
| 392 | - } |
|
| 391 | + $message = __( 'Your import is complete', 'formidable' ); |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | 394 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | |
| 397 | 397 | private static function get_delete_form_time( $form, &$errors ) { |
| 398 | 398 | if ( 'trash' == $form->status ) { |
@@ -402,17 +402,17 @@ discard block |
||
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - /* Back End CRUD */ |
|
| 405 | + /* Back End CRUD */ |
|
| 406 | 406 | public static function show( $id = 0 ) { |
| 407 | 407 | FrmAppHelper::permission_check( 'frm_view_entries' ); |
| 408 | 408 | |
| 409 | - if ( ! $id ) { |
|
| 409 | + if ( ! $id ) { |
|
| 410 | 410 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
| 411 | 411 | |
| 412 | - if ( ! $id ) { |
|
| 412 | + if ( ! $id ) { |
|
| 413 | 413 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
| 414 | - } |
|
| 415 | - } |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | 416 | |
| 417 | 417 | $entry = FrmEntry::getOne( $id, true ); |
| 418 | 418 | if ( ! $entry ) { |
@@ -428,103 +428,103 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
| 431 | - $to_emails = array(); |
|
| 431 | + $to_emails = array(); |
|
| 432 | 432 | $form = FrmForm::getOne( $entry->form_id ); |
| 433 | 433 | |
| 434 | 434 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
| 435 | - } |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | - public static function destroy() { |
|
| 437 | + public static function destroy() { |
|
| 438 | 438 | FrmAppHelper::permission_check( 'frm_delete_entries' ); |
| 439 | 439 | |
| 440 | 440 | $params = FrmForm::get_admin_params(); |
| 441 | 441 | |
| 442 | 442 | if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
| 443 | 443 | self::unlink_post( $params['id'] ); |
| 444 | - } |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - $message = ''; |
|
| 447 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 448 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 449 | - } |
|
| 446 | + $message = ''; |
|
| 447 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 448 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - self::display_list( $message ); |
|
| 452 | - } |
|
| 451 | + self::display_list( $message ); |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - public static function destroy_all() { |
|
| 455 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 456 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 457 | - wp_die( $frm_settings->admin_permission ); |
|
| 458 | - } |
|
| 454 | + public static function destroy_all() { |
|
| 455 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 456 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 457 | + wp_die( $frm_settings->admin_permission ); |
|
| 458 | + } |
|
| 459 | 459 | |
| 460 | - global $wpdb; |
|
| 460 | + global $wpdb; |
|
| 461 | 461 | $params = FrmForm::get_admin_params(); |
| 462 | - $message = ''; |
|
| 463 | - $errors = array(); |
|
| 464 | - $form_id = (int) $params['form']; |
|
| 462 | + $message = ''; |
|
| 463 | + $errors = array(); |
|
| 464 | + $form_id = (int) $params['form']; |
|
| 465 | 465 | |
| 466 | - if ( $form_id ) { |
|
| 467 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 466 | + if ( $form_id ) { |
|
| 467 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 468 | 468 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
| 469 | 469 | |
| 470 | - if ( $action ) { |
|
| 471 | - // this action takes a while, so only trigger it if there are posts to delete |
|
| 472 | - foreach ( $entry_ids as $entry_id ) { |
|
| 473 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 474 | - unset( $entry_id ); |
|
| 475 | - } |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
| 479 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
| 480 | - if ( $results ) { |
|
| 470 | + if ( $action ) { |
|
| 471 | + // this action takes a while, so only trigger it if there are posts to delete |
|
| 472 | + foreach ( $entry_ids as $entry_id ) { |
|
| 473 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 474 | + unset( $entry_id ); |
|
| 475 | + } |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
| 479 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
| 480 | + if ( $results ) { |
|
| 481 | 481 | FrmEntry::clear_cache(); |
| 482 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 483 | - } |
|
| 484 | - } else { |
|
| 485 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - self::display_list( $message, $errors ); |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 492 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 493 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 494 | - } |
|
| 495 | - |
|
| 496 | - public static function get_form( $filename, $form, $title, $description ) { |
|
| 497 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 498 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
| 482 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 483 | + } |
|
| 484 | + } else { |
|
| 485 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + self::display_list( $message, $errors ); |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 492 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 493 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 494 | + } |
|
| 495 | + |
|
| 496 | + public static function get_form( $filename, $form, $title, $description ) { |
|
| 497 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 498 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
| 502 | 502 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 503 | 503 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
| 504 | - return; |
|
| 505 | - } |
|
| 504 | + return; |
|
| 505 | + } |
|
| 506 | 506 | |
| 507 | - global $frm_vars; |
|
| 507 | + global $frm_vars; |
|
| 508 | 508 | |
| 509 | 509 | $form = FrmForm::getOne( $form_id ); |
| 510 | - if ( ! $form ) { |
|
| 511 | - return; |
|
| 512 | - } |
|
| 510 | + if ( ! $form ) { |
|
| 511 | + return; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | 514 | $params = FrmForm::get_params( $form ); |
| 515 | 515 | |
| 516 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 517 | - $frm_vars['form_params'] = array(); |
|
| 518 | - } |
|
| 516 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 517 | + $frm_vars['form_params'] = array(); |
|
| 518 | + } |
|
| 519 | 519 | $frm_vars['form_params'][ $form->id ] = $params; |
| 520 | 520 | |
| 521 | 521 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
| 522 | - return; |
|
| 523 | - } |
|
| 522 | + return; |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - if ( $errors == '' && ! $ajax ) { |
|
| 525 | + if ( $errors == '' && ! $ajax ) { |
|
| 526 | 526 | $errors = FrmEntryValidate::validate( $_POST ); |
| 527 | - } |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | 529 | /** |
| 530 | 530 | * Use this filter to add trigger actions and add errors after |
@@ -535,24 +535,24 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
| 537 | 537 | |
| 538 | - if ( empty( $errors ) ) { |
|
| 538 | + if ( empty( $errors ) ) { |
|
| 539 | 539 | $_POST['frm_skip_cookie'] = 1; |
| 540 | 540 | $do_success = false; |
| 541 | - if ( $params['action'] == 'create' ) { |
|
| 541 | + if ( $params['action'] == 'create' ) { |
|
| 542 | 542 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
| 543 | 543 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
| 544 | 544 | $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
| 545 | 545 | $do_success = true; |
| 546 | - } |
|
| 547 | - } |
|
| 546 | + } |
|
| 547 | + } |
|
| 548 | 548 | |
| 549 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 549 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 550 | 550 | if ( $do_success ) { |
| 551 | 551 | FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) ); |
| 552 | 552 | } |
| 553 | 553 | unset( $_POST['frm_skip_cookie'] ); |
| 554 | - } |
|
| 555 | - } |
|
| 554 | + } |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | 557 | /** |
| 558 | 558 | * Escape url entities before redirect |
@@ -566,27 +566,27 @@ discard block |
||
| 566 | 566 | return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url ); |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 570 | - self::_delete_entry( $atts['id'], $form ); |
|
| 571 | - return $url; |
|
| 572 | - } |
|
| 569 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 570 | + self::_delete_entry( $atts['id'], $form ); |
|
| 571 | + return $url; |
|
| 572 | + } |
|
| 573 | 573 | |
| 574 | - //Delete entry if not redirected |
|
| 575 | - public static function delete_entry_after_save( $atts ) { |
|
| 576 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 577 | - } |
|
| 574 | + //Delete entry if not redirected |
|
| 575 | + public static function delete_entry_after_save( $atts ) { |
|
| 576 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - private static function _delete_entry( $entry_id, $form ) { |
|
| 580 | - if ( ! $form ) { |
|
| 581 | - return; |
|
| 582 | - } |
|
| 579 | + private static function _delete_entry( $entry_id, $form ) { |
|
| 580 | + if ( ! $form ) { |
|
| 581 | + return; |
|
| 582 | + } |
|
| 583 | 583 | |
| 584 | - $form->options = maybe_unserialize( $form->options ); |
|
| 585 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 584 | + $form->options = maybe_unserialize( $form->options ); |
|
| 585 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 586 | 586 | self::unlink_post( $entry_id ); |
| 587 | - FrmEntry::destroy( $entry_id ); |
|
| 588 | - } |
|
| 589 | - } |
|
| 587 | + FrmEntry::destroy( $entry_id ); |
|
| 588 | + } |
|
| 589 | + } |
|
| 590 | 590 | |
| 591 | 591 | /** |
| 592 | 592 | * unlink entry from post |
@@ -658,5 +658,5 @@ discard block |
||
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
| 661 | - } |
|
| 661 | + } |
|
| 662 | 662 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'id' => 'formidable-entries-tab', |
| 66 | 66 | 'title' => __( 'Overview', 'formidable' ), |
| 67 | 67 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
| 68 | - )); |
|
| 68 | + ) ); |
|
| 69 | 69 | |
| 70 | 70 | $screen->set_help_sidebar( |
| 71 | 71 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | global $frm_vars; |
| 96 | 96 | $form_id = FrmForm::get_current_form_id(); |
| 97 | 97 | |
| 98 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 99 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 98 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 99 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 100 | 100 | |
| 101 | 101 | if ( $form_id ) { |
| 102 | 102 | self::get_columns_for_form( $form_id, $columns ); |
| 103 | 103 | } else { |
| 104 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
| 105 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
| 106 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
| 104 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
| 105 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
| 106 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 110 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 109 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 110 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 111 | 111 | self::maybe_add_ip_col( $form_id, $columns ); |
| 112 | 112 | |
| 113 | 113 | $frm_vars['cols'] = $columns; |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | if ( $sub_form_cols ) { |
| 139 | 139 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 140 | 140 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 141 | - unset( $sub_form_cols[ $k ] ); |
|
| 141 | + unset( $sub_form_cols[$k] ); |
|
| 142 | 142 | continue; |
| 143 | 143 | } |
| 144 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 144 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 145 | 145 | unset( $sub_form_col ); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | $has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' ); |
| 156 | 156 | $is_post_status = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status'; |
| 157 | 157 | if ( $has_separate_value && ! $is_post_status ) { |
| 158 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 158 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 159 | 159 | } |
| 160 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 160 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 166 | 166 | if ( FrmAppHelper::ips_saved() ) { |
| 167 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 167 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | foreach ( $meta_value as $mk => $mv ) { |
| 201 | 201 | //remove blank values |
| 202 | 202 | if ( empty( $mv ) ) { |
| 203 | - unset( $meta_value[ $mk ] ); |
|
| 203 | + unset( $meta_value[$mk] ); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | foreach ( $fields as $field ) { |
| 275 | 275 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
| 276 | 276 | // Can't sort on checkboxes because they are stored serialized, or post fields |
| 277 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 277 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
| 350 | 350 | $result[] = $col_key; |
| 351 | - $i--; |
|
| 351 | + $i --; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | unset( $col_key, $col ); |
@@ -516,9 +516,9 @@ discard block |
||
| 516 | 516 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 517 | 517 | $frm_vars['form_params'] = array(); |
| 518 | 518 | } |
| 519 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 519 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 520 | 520 | |
| 521 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 521 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 522 | 522 | return; |
| 523 | 523 | } |
| 524 | 524 | |
@@ -533,15 +533,15 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 535 | 535 | |
| 536 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 536 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 537 | 537 | |
| 538 | 538 | if ( empty( $errors ) ) { |
| 539 | 539 | $_POST['frm_skip_cookie'] = 1; |
| 540 | 540 | $do_success = false; |
| 541 | 541 | if ( $params['action'] == 'create' ) { |
| 542 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 543 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 544 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
| 542 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 543 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 544 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
| 545 | 545 | $do_success = true; |
| 546 | 546 | } |
| 547 | 547 | } |