@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | T_COALESCE_EQUAL, |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - if ( ! in_array( $tokens[ $nextToken ]['code'], $assignmentTokens, true ) ) { |
|
| 78 | + if ( ! in_array( $tokens[$nextToken]['code'], $assignmentTokens, true ) ) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Find the first token on the current line. |
| 83 | 83 | $firstOnLine = $stackPtr; |
| 84 | - for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { |
|
| 85 | - if ( $tokens[ $i ]['line'] < $tokens[ $stackPtr ]['line'] ) { |
|
| 84 | + for ( $i = $stackPtr - 1; $i >= 0; $i -- ) { |
|
| 85 | + if ( $tokens[$i]['line'] < $tokens[$stackPtr]['line'] ) { |
|
| 86 | 86 | break; |
| 87 | 87 | } |
| 88 | 88 | $firstOnLine = $i; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // Now find what's on the previous line. |
| 98 | - $currentLine = $tokens[ $stackPtr ]['line']; |
|
| 98 | + $currentLine = $tokens[$stackPtr]['line']; |
|
| 99 | 99 | $previousLine = $currentLine - 1; |
| 100 | 100 | |
| 101 | 101 | if ( $previousLine < 1 ) { |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // Find the last non-whitespace token on the previous line. |
| 106 | 106 | $lastTokenOnPrevLine = null; |
| 107 | - for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { |
|
| 108 | - if ( $tokens[ $i ]['line'] < $previousLine ) { |
|
| 107 | + for ( $i = $stackPtr - 1; $i >= 0; $i -- ) { |
|
| 108 | + if ( $tokens[$i]['line'] < $previousLine ) { |
|
| 109 | 109 | break; |
| 110 | 110 | } |
| 111 | - if ( $tokens[ $i ]['line'] === $previousLine && $tokens[ $i ]['code'] !== T_WHITESPACE ) { |
|
| 111 | + if ( $tokens[$i]['line'] === $previousLine && $tokens[$i]['code'] !== T_WHITESPACE ) { |
|
| 112 | 112 | $lastTokenOnPrevLine = $i; |
| 113 | 113 | break; |
| 114 | 114 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Check if the last token on the previous line is a closing brace. |
| 124 | - if ( $tokens[ $lastTokenOnPrevLine ]['code'] !== T_CLOSE_CURLY_BRACKET ) { |
|
| 124 | + if ( $tokens[$lastTokenOnPrevLine]['code'] !== T_CLOSE_CURLY_BRACKET ) { |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | '<span class="frm-upgrade-submenu">' . esc_html( $cta_text ) . '</span>', |
| 119 | 119 | 'frm_view_forms', |
| 120 | 120 | 'formidable-pro-upgrade', |
| 121 | - function () { |
|
| 121 | + function() { |
|
| 122 | 122 | // This function doesn't need to do anything. |
| 123 | 123 | // The redirect is handled earlier to avoid issues with the headers being sent. |
| 124 | 124 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | unset( $addons['error'] ); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $pro = array( |
|
| 152 | + $pro = array( |
|
| 153 | 153 | 'pro' => array( |
| 154 | 154 | 'title' => 'Formidable Forms Pro', |
| 155 | 155 | 'slug' => 'formidable-pro', |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | // Extract the elements to move |
| 193 | 193 | foreach ( $plans as $plan ) { |
| 194 | - if ( isset( self::$categories[ $plan ] ) ) { |
|
| 195 | - $bottom_categories[ $plan ] = self::$categories[ $plan ]; |
|
| 196 | - unset( self::$categories[ $plan ] ); |
|
| 194 | + if ( isset( self::$categories[$plan] ) ) { |
|
| 195 | + $bottom_categories[$plan] = self::$categories[$plan]; |
|
| 196 | + unset( self::$categories[$plan] ); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
@@ -248,14 +248,12 @@ discard block |
||
| 248 | 248 | // Add the slug to the new array. |
| 249 | 249 | $addon['category-slugs'][] = $category_slug; |
| 250 | 250 | |
| 251 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 252 | - self::$categories[ $category_slug ] = array( |
|
| 251 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 252 | + self::$categories[$category_slug] = array( |
|
| 253 | 253 | 'name' => $category, |
| 254 | 254 | 'count' => 0, |
| 255 | 255 | ); |
| 256 | - } |
|
| 257 | - |
|
| 258 | - ++self::$categories[ $category_slug ]['count']; |
|
| 256 | + } ++self::$categories[$category_slug]['count']; |
|
| 259 | 257 | } |
| 260 | 258 | } |
| 261 | 259 | |
@@ -287,7 +285,7 @@ discard block |
||
| 287 | 285 | } else { |
| 288 | 286 | foreach ( $addons as $k => $addon ) { |
| 289 | 287 | if ( empty( $addon['excerpt'] ) && $k !== 'error' ) { |
| 290 | - unset( $addons[ $k ] ); |
|
| 288 | + unset( $addons[$k] ); |
|
| 291 | 289 | } |
| 292 | 290 | } |
| 293 | 291 | } |
@@ -402,7 +400,7 @@ discard block |
||
| 402 | 400 | |
| 403 | 401 | foreach ( $list as $k => $info ) { |
| 404 | 402 | $info['slug'] = $k; |
| 405 | - $list[ $k ] = array_merge( $defaults, $info ); |
|
| 403 | + $list[$k] = array_merge( $defaults, $info ); |
|
| 406 | 404 | } |
| 407 | 405 | return $list; |
| 408 | 406 | } |
@@ -564,17 +562,17 @@ discard block |
||
| 564 | 562 | continue; |
| 565 | 563 | } |
| 566 | 564 | |
| 567 | - $wp_plugin = $wp_plugins[ $folder ] ?? array(); |
|
| 565 | + $wp_plugin = $wp_plugins[$folder] ?? array(); |
|
| 568 | 566 | $wp_version = $wp_plugin['Version'] ?? '1.0'; |
| 569 | 567 | $plugin->slug = explode( '/', $folder )[0]; |
| 570 | 568 | |
| 571 | 569 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 572 | - $transient->response[ $folder ] = $plugin; |
|
| 570 | + $transient->response[$folder] = $plugin; |
|
| 573 | 571 | } else { |
| 574 | - $transient->no_update[ $folder ] = $plugin; |
|
| 572 | + $transient->no_update[$folder] = $plugin; |
|
| 575 | 573 | } |
| 576 | 574 | |
| 577 | - $transient->checked[ $folder ] = $wp_version; |
|
| 575 | + $transient->checked[$folder] = $wp_version; |
|
| 578 | 576 | |
| 579 | 577 | }//end foreach |
| 580 | 578 | |
@@ -608,7 +606,7 @@ discard block |
||
| 608 | 606 | */ |
| 609 | 607 | protected static function is_installed( $plugin ) { |
| 610 | 608 | $all_plugins = self::get_plugins(); |
| 611 | - return isset( $all_plugins[ $plugin ] ); |
|
| 609 | + return isset( $all_plugins[$plugin] ); |
|
| 612 | 610 | } |
| 613 | 611 | |
| 614 | 612 | /** |
@@ -647,13 +645,13 @@ discard block |
||
| 647 | 645 | } |
| 648 | 646 | |
| 649 | 647 | $download_id = $plugin['id'] ?? 0; |
| 650 | - if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 648 | + if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 651 | 649 | // if this addon is using its own license, get the update url |
| 652 | 650 | $addon_info = $api->get_api_info(); |
| 653 | 651 | |
| 654 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 652 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 655 | 653 | if ( isset( $addon_info['error'] ) ) { |
| 656 | - $version_info[ $download_id ]['error'] = array( |
|
| 654 | + $version_info[$download_id]['error'] = array( |
|
| 657 | 655 | 'message' => $addon_info['error']['message'], |
| 658 | 656 | 'code' => $addon_info['error']['code'], |
| 659 | 657 | ); |
@@ -757,8 +755,8 @@ discard block |
||
| 757 | 755 | return $addon; |
| 758 | 756 | } |
| 759 | 757 | } |
| 760 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 761 | - $plugin = $addons[ $download_id ]; |
|
| 758 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 759 | + $plugin = $addons[$download_id]; |
|
| 762 | 760 | } |
| 763 | 761 | |
| 764 | 762 | return $plugin; |
@@ -827,7 +825,7 @@ discard block |
||
| 827 | 825 | self::set_addon_status( $addon ); |
| 828 | 826 | self::set_categories( $addon ); |
| 829 | 827 | |
| 830 | - $addons[ $id ] = $addon; |
|
| 828 | + $addons[$id] = $addon; |
|
| 831 | 829 | }//end foreach |
| 832 | 830 | } |
| 833 | 831 | |
@@ -869,7 +867,7 @@ discard block |
||
| 869 | 867 | $link = $site_url . $link; |
| 870 | 868 | } |
| 871 | 869 | |
| 872 | - $link = FrmAppHelper::make_affiliate_url( $link ); |
|
| 870 | + $link = FrmAppHelper::make_affiliate_url( $link ); |
|
| 873 | 871 | |
| 874 | 872 | $utm = array( |
| 875 | 873 | 'campaign' => 'addons', |
@@ -1099,7 +1097,7 @@ discard block |
||
| 1099 | 1097 | */ |
| 1100 | 1098 | public static function ajax_activate_addon() { |
| 1101 | 1099 | self::process_addon_action( |
| 1102 | - function ( $plugin ) { |
|
| 1100 | + function( $plugin ) { |
|
| 1103 | 1101 | return self::handle_addon_action( $plugin, 'activate' ); |
| 1104 | 1102 | }, |
| 1105 | 1103 | array( 'FrmAddonsController', 'get_addon_activation_response' ) |
@@ -1124,7 +1122,7 @@ discard block |
||
| 1124 | 1122 | */ |
| 1125 | 1123 | public static function ajax_deactivate_addon() { |
| 1126 | 1124 | self::process_addon_action( |
| 1127 | - function ( $plugin ) { |
|
| 1125 | + function( $plugin ) { |
|
| 1128 | 1126 | return self::handle_addon_action( $plugin, 'deactivate' ); |
| 1129 | 1127 | } |
| 1130 | 1128 | ); |
@@ -1139,7 +1137,7 @@ discard block |
||
| 1139 | 1137 | */ |
| 1140 | 1138 | public static function ajax_uninstall_addon() { |
| 1141 | 1139 | self::process_addon_action( |
| 1142 | - function ( $plugin ) { |
|
| 1140 | + function( $plugin ) { |
|
| 1143 | 1141 | return self::handle_addon_action( $plugin, 'uninstall' ); |
| 1144 | 1142 | } |
| 1145 | 1143 | ); |
@@ -1542,7 +1540,7 @@ discard block |
||
| 1542 | 1540 | $addons = $api->get_api_info(); |
| 1543 | 1541 | |
| 1544 | 1542 | if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { |
| 1545 | - $dates = $addons[ $addon_id ]; |
|
| 1543 | + $dates = $addons[$addon_id]; |
|
| 1546 | 1544 | $requires = FrmFormsHelper::get_plan_required( $dates ); |
| 1547 | 1545 | } |
| 1548 | 1546 | |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | $input_params['checked'] = 'checked'; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $other_section_selectors = array_map( |
|
| 29 | - function ( $section ) { |
|
| 28 | + $other_section_selectors = array_map( |
|
| 29 | + function( $section ) { |
|
| 30 | 30 | return "#frm_{$section}_settings_section"; |
| 31 | 31 | }, |
| 32 | 32 | array_diff( array_keys( $payment_sections ), array( $key ) ) |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | $errors = array(); |
| 54 | 54 | if ( false !== strpos( $args['value'], '.@' ) || ! is_email( $args['value'] ) ) { |
| 55 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 55 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 56 | 56 | } |
| 57 | 57 | return $errors; |
| 58 | 58 | } |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | if ( is_wp_error( $resp ) ) { |
| 306 | 306 | $error_string = $resp->get_error_message(); |
| 307 | - $errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your captcha', 'formidable' ); |
|
| 308 | - $errors[ 'field' . $args['id'] ] .= ' ' . $error_string; |
|
| 307 | + $errors['field' . $args['id']] = __( 'There was a problem verifying your captcha', 'formidable' ); |
|
| 308 | + $errors['field' . $args['id']] .= ' ' . $error_string; |
|
| 309 | 309 | return $errors; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if ( $invalid_message === __( 'The reCAPTCHA was not entered correctly', 'formidable' ) ) { |
| 333 | 333 | $invalid_message = ''; |
| 334 | 334 | } |
| 335 | - $errors[ 'field' . $args['id'] ] = ( $invalid_message === '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 335 | + $errors['field' . $args['id']] = ( $invalid_message === '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | return $errors; |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | $form_id = is_object( $this->field ) ? $this->field->form_id : $this->field['form_id']; |
| 353 | - if ( ! isset( $frm_vars['captcha_scores'][ $form_id ] ) ) { |
|
| 354 | - $frm_vars['captcha_scores'][ $form_id ] = $score; |
|
| 353 | + if ( ! isset( $frm_vars['captcha_scores'][$form_id] ) ) { |
|
| 354 | + $frm_vars['captcha_scores'][$form_id] = $score; |
|
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | protected static function post_data_includes_token() { |
| 382 | 382 | $settings = FrmCaptchaFactory::get_settings_object(); |
| 383 | 383 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 384 | - return ! empty( $_POST[ $settings->token_field ] ); |
|
| 384 | + return ! empty( $_POST[$settings->token_field] ); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function add_settings( $sections ) { |
| 208 | 208 | wp_enqueue_style( 'formidable-pro-fields' ); |
| 209 | - $sections[ $this->plugin_slug ] = array( |
|
| 209 | + $sections[$this->plugin_slug] = array( |
|
| 210 | 210 | 'class' => $this, |
| 211 | 211 | 'function' => 'settings_page', |
| 212 | 212 | 'name' => $this->plugin_name(), |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | // Set the current step. |
| 376 | 376 | if ( ! isset( $step['current'] ) ) { |
| 377 | 377 | if ( $step['complete'] ) { |
| 378 | - $steps[ $k ]['current'] = false; |
|
| 378 | + $steps[$k]['current'] = false; |
|
| 379 | 379 | } else { |
| 380 | - $steps[ $k ]['current'] = ! $has_current; |
|
| 380 | + $steps[$k]['current'] = ! $has_current; |
|
| 381 | 381 | $has_current = true; |
| 382 | 382 | } |
| 383 | 383 | } elseif ( $step['current'] ) { |
@@ -387,10 +387,10 @@ discard block |
||
| 387 | 387 | // Set disabled buttons. |
| 388 | 388 | $class = $step['button_class'] ?? ''; |
| 389 | 389 | $class .= ' button-primary frm-button-primary'; |
| 390 | - if ( ! $steps[ $k ]['current'] ) { |
|
| 390 | + if ( ! $steps[$k]['current'] ) { |
|
| 391 | 391 | $class .= ' frm_grey disabled'; |
| 392 | 392 | } |
| 393 | - $steps[ $k ]['button_class'] = $class; |
|
| 393 | + $steps[$k]['button_class'] = $class; |
|
| 394 | 394 | }//end foreach |
| 395 | 395 | |
| 396 | 396 | return $steps; |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | $addons = $api->get_api_info(); |
| 556 | 556 | |
| 557 | 557 | $id = $this->download_id(); |
| 558 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
| 558 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
| 559 | 559 | |
| 560 | 560 | if ( ! $step['current'] ) { |
| 561 | 561 | ?> |
@@ -570,10 +570,10 @@ discard block |
||
| 570 | 570 | |
| 571 | 571 | if ( ! $has_file ) { |
| 572 | 572 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
| 573 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
| 573 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
| 574 | 574 | echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; |
| 575 | 575 | } else { |
| 576 | - $xml = $addons[ $id ]['beta']['package']; |
|
| 576 | + $xml = $addons[$id]['beta']['package']; |
|
| 577 | 577 | if ( is_array( $xml ) ) { |
| 578 | 578 | $xml = reset( $xml ); |
| 579 | 579 | } |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | foreach ( $options as $info ) { |
| 653 | 653 | // Count the number of options displayed for css. |
| 654 | 654 | if ( $count > 1 && ! isset( $info['img'] ) ) { |
| 655 | - --$count; |
|
| 655 | + -- $count; |
|
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | foreach ( $forms as $form ) { |
| 746 | 746 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
| 747 | 747 | if ( $was_imported ) { |
| 748 | - $imported[ $form['form'] ] = $was_imported; |
|
| 748 | + $imported[$form['form']] = $was_imported; |
|
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | 751 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 116 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 117 | 117 | // Don't replace messages unless required. |
| 118 | 118 | return; |
| 119 | 119 | } |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 125 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 126 | 126 | // Move up and mark as new. |
| 127 | - unset( self::$messages[ $message['key'] ] ); |
|
| 127 | + unset( self::$messages[$message['key']] ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $this->fill_message( $message ); |
| 131 | - self::$messages[ $message['key'] ] = $message; |
|
| 131 | + self::$messages[$message['key']] = $message; |
|
| 132 | 132 | |
| 133 | 133 | $this->update_list(); |
| 134 | 134 | |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | private function clean_messages() { |
| 166 | 166 | $removed = false; |
| 167 | 167 | foreach ( self::$messages as $t => $message ) { |
| 168 | - $read = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 169 | - $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 168 | + $read = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 169 | + $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 170 | 170 | |
| 171 | 171 | if ( $read || $dismissed || ! $this->within_valid_timeframe( $message ) ) { |
| 172 | - unset( self::$messages[ $t ] ); |
|
| 172 | + unset( self::$messages[$t] ); |
|
| 173 | 173 | $removed = true; |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | public function filter_messages( &$messages, $type = 'unread' ) { |
| 189 | 189 | $user_id = get_current_user_id(); |
| 190 | 190 | foreach ( $messages as $k => $message ) { |
| 191 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 191 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 192 | 192 | if ( empty( $k ) || ! $this->within_valid_timeframe( $message ) || ( $type === 'dismissed' ) !== $dismissed ) { |
| 193 | - unset( $messages[ $k ] ); |
|
| 193 | + unset( $messages[$k] ); |
|
| 194 | 194 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 195 | - unset( $messages[ $k ] ); |
|
| 195 | + unset( $messages[$k] ); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | * @return void |
| 271 | 271 | */ |
| 272 | 272 | public function mark_read( $key ) { |
| 273 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 273 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 278 | - self::$messages[ $key ]['read'] = array(); |
|
| 277 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 278 | + self::$messages[$key]['read'] = array(); |
|
| 279 | 279 | } |
| 280 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 280 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 281 | 281 | |
| 282 | 282 | $this->update_list(); |
| 283 | 283 | } |
@@ -290,9 +290,9 @@ discard block |
||
| 290 | 290 | * @return void |
| 291 | 291 | */ |
| 292 | 292 | public function mark_unread( $key ) { |
| 293 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 293 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 294 | 294 | if ( $is_read ) { |
| 295 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 295 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 296 | 296 | $this->update_list(); |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | return; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 311 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 312 | 312 | return; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 316 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 315 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 316 | + self::$messages[$key]['dismissed'] = array(); |
|
| 317 | 317 | } |
| 318 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 318 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 319 | 319 | |
| 320 | 320 | $this->update_list(); |
| 321 | 321 | } |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | $user_id = get_current_user_id(); |
| 330 | 330 | foreach ( self::$messages as $key => $message ) { |
| 331 | 331 | if ( ! isset( $message['dismissed'] ) ) { |
| 332 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 332 | + self::$messages[$key]['dismissed'] = array(); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 336 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 335 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 336 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | $this->update_list(); |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | $messages = $this->get_messages( 'filter' ); |
| 347 | 347 | $user_id = get_current_user_id(); |
| 348 | 348 | foreach ( $messages as $t => $message ) { |
| 349 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 350 | - unset( $messages[ $t ] ); |
|
| 349 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 350 | + unset( $messages[$t] ); |
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | return $messages; |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | * @return void |
| 389 | 389 | */ |
| 390 | 390 | public function remove( $key ) { |
| 391 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 392 | - unset( self::$messages[ $key ] ); |
|
| 391 | + if ( isset( self::$messages[$key] ) ) { |
|
| 392 | + unset( self::$messages[$key] ); |
|
| 393 | 393 | $this->update_list(); |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * |
| 439 | 439 | * @return string |
| 440 | 440 | */ |
| 441 | - function ( $matches ) { |
|
| 441 | + function( $matches ) { |
|
| 442 | 442 | $url = $matches[2]; |
| 443 | 443 | $parts = parse_url( $url ); |
| 444 | 444 | |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | $inbox = new self(); |
| 503 | 503 | return array_filter( |
| 504 | 504 | $inbox->get_messages( 'filter' ), |
| 505 | - function ( $message ) use ( $key ) { |
|
| 506 | - return ! empty( $message[ $key ] ); |
|
| 505 | + function( $message ) use ( $key ) { |
|
| 506 | + return ! empty( $message[$key] ); |
|
| 507 | 507 | } |
| 508 | 508 | ); |
| 509 | 509 | } |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | return array_reduce( |
| 551 | 551 | $keys_to_return, |
| 552 | - function ( $total, $key ) use ( $message ) { |
|
| 553 | - $total[ $key ] = $message[ $key ] ?? ''; |
|
| 552 | + function( $total, $key ) use ( $message ) { |
|
| 553 | + $total[$key] = $message[$key] ?? ''; |
|
| 554 | 554 | return $total; |
| 555 | 555 | }, |
| 556 | 556 | array() |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
| 45 | 45 | $values['field_options']['data_type'] = $setting; |
| 46 | 46 | } else { |
| 47 | - $values['field_options'][ $setting ] = 1; |
|
| 47 | + $values['field_options'][$setting] = 1; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | foreach ( $defaults as $opt => $default ) { |
| 212 | - $values[ $opt ] = $field->field_options[ $opt ] ?? $default; |
|
| 212 | + $values[$opt] = $field->field_options[$opt] ?? $default; |
|
| 213 | 213 | |
| 214 | 214 | if ( $check_post ) { |
| 215 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 215 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | return self::$context_is_safe_to_load_field_options_from_request_data; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $function = function () { |
|
| 232 | + $function = function() { |
|
| 233 | 233 | if ( ! FrmAppHelper::is_admin_page() ) { |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | 343 | private static function get_posted_field_setting( $setting, &$value ) { |
| 344 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 344 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 345 | 345 | return; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if ( strpos( $setting, 'html' ) !== false ) { |
| 349 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 349 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 350 | 350 | |
| 351 | 351 | // Conditionally strip script tags if the user sending $_POST data is not allowed to use unfiltered HTML. |
| 352 | 352 | if ( ! FrmAppHelper::allow_unfiltered_html() ) { |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 356 | 356 | // TODO: Remove stripslashes on output, and use on input only. |
| 357 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 357 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 358 | 358 | } else { |
| 359 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 359 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 360 | 360 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 361 | 361 | } |
| 362 | 362 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 440 | 440 | |
| 441 | 441 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 442 | - $values[ $col ] = $field->{$col}; |
|
| 442 | + $values[$col] = $field->{$col}; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | ); |
| 478 | 478 | |
| 479 | 479 | $msg = FrmField::get_option( $field, $error ); |
| 480 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 480 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 481 | 481 | $msg = do_shortcode( $msg ); |
| 482 | 482 | |
| 483 | 483 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | 'inside_class' => 'inside', |
| 809 | 809 | 'dismiss-icon' => true, |
| 810 | 810 | ); |
| 811 | - $args = array_merge( $defaults, $args ); |
|
| 811 | + $args = array_merge( $defaults, $args ); |
|
| 812 | 812 | |
| 813 | 813 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
| 814 | 814 | } |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | continue; |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 1096 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 1097 | 1097 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 1098 | 1098 | |
| 1099 | 1099 | $atts['entry'] = $entry; |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | if ( $replace_with !== null ) { |
| 1104 | 1104 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
| 1105 | 1105 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 1106 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 1106 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | unset( $atts, $replace_with ); |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
| 1123 | 1123 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 1124 | 1124 | foreach ( $included_atts as $included_att ) { |
| 1125 | - if ( '0' === $atts[ $included_att ] ) { |
|
| 1125 | + if ( '0' === $atts[$included_att] ) { |
|
| 1126 | 1126 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
| 1127 | 1127 | continue; |
| 1128 | 1128 | } |
@@ -1204,8 +1204,8 @@ discard block |
||
| 1204 | 1204 | |
| 1205 | 1205 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get', 'default-email', 'default-from-email' ); |
| 1206 | 1206 | |
| 1207 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 1208 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 1207 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 1208 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 1209 | 1209 | } elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) { |
| 1210 | 1210 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 1211 | 1211 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1452,8 +1452,8 @@ discard block |
||
| 1452 | 1452 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 1453 | 1453 | } elseif ( in_array( $type, $multiple_input, true ) ) { |
| 1454 | 1454 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 1455 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 1456 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 1455 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 1456 | + $field_types[$type] = $field_selection[$type]; |
|
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | foreach ( $inputs as $input ) { |
| 1499 | 1499 | // This may not be set if a field type was removed using the frm_available_fields or frm_pro_available_fields filters. |
| 1500 | 1500 | if ( array_key_exists( $input, $fields ) ) { |
| 1501 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1501 | + $field_types[$input] = $fields[$input]; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | unset( $input ); |
| 1504 | 1504 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
| 1533 | 1533 | 'parent' => false, |
| 1534 | 1534 | 'pointer' => false, |
| 1535 | 1535 | ); |
| 1536 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1536 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1537 | 1537 | |
| 1538 | 1538 | $opt_key = $args['opt_key']; |
| 1539 | 1539 | $field = $args['field']; |
@@ -1549,25 +1549,25 @@ discard block |
||
| 1549 | 1549 | |
| 1550 | 1550 | // Check posted vals before checking saved values |
| 1551 | 1551 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1552 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1552 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1553 | 1553 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1554 | 1554 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1555 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1555 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1556 | 1556 | } else { |
| 1557 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1557 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | return $other_val; |
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1563 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1564 | 1564 | // For normal fields |
| 1565 | 1565 | |
| 1566 | 1566 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1567 | 1567 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1568 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1568 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1569 | 1569 | } else { |
| 1570 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1570 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | 1573 | return $other_val; |
@@ -1577,8 +1577,8 @@ discard block |
||
| 1577 | 1577 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
| 1578 | 1578 | // Check if there is an "other" val in saved value and make sure the |
| 1579 | 1579 | // "other" val is not equal to the Other checkbox option |
| 1580 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1581 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1580 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1581 | + $other_val = $field['value'][$opt_key]; |
|
| 1582 | 1582 | } |
| 1583 | 1583 | } else { |
| 1584 | 1584 | /** |
@@ -1590,8 +1590,8 @@ discard block |
||
| 1590 | 1590 | // Multi-select dropdowns - key is not preserved |
| 1591 | 1591 | if ( is_array( $field['value'] ) ) { |
| 1592 | 1592 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1593 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1594 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1593 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1594 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1595 | 1595 | } |
| 1596 | 1596 | } elseif ( $temp_val == $field['value'] ) { |
| 1597 | 1597 | // For radio and regular dropdowns |
@@ -1816,11 +1816,11 @@ discard block |
||
| 1816 | 1816 | foreach ( $val as $k => $v ) { |
| 1817 | 1817 | if ( is_string( $v ) ) { |
| 1818 | 1818 | if ( 'custom_html' === $k ) { |
| 1819 | - $val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1819 | + $val[$k] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1820 | 1820 | unset( $k, $v ); |
| 1821 | 1821 | continue; |
| 1822 | 1822 | } |
| 1823 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1823 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1824 | 1824 | unset( $k, $v ); |
| 1825 | 1825 | } |
| 1826 | 1826 | } |
@@ -1849,8 +1849,8 @@ discard block |
||
| 1849 | 1849 | if ( false === $index ) { |
| 1850 | 1850 | continue; |
| 1851 | 1851 | } |
| 1852 | - unset( $replace[ $index ] ); |
|
| 1853 | - unset( $replace_with[ $index ] ); |
|
| 1852 | + unset( $replace[$index] ); |
|
| 1853 | + unset( $replace_with[$index] ); |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | $value = str_replace( $replace, $replace_with, $value ); |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | $countries['class'] = 'frm-countries-opts'; |
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 2212 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 2213 | 2213 | |
| 2214 | 2214 | // State abv. |
| 2215 | 2215 | $states = self::get_us_states(); |
@@ -2219,7 +2219,7 @@ discard block |
||
| 2219 | 2219 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 2220 | 2220 | } |
| 2221 | 2221 | |
| 2222 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 2222 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 2223 | 2223 | |
| 2224 | 2224 | // States. |
| 2225 | 2225 | $states = array_values( $states ); |
@@ -2228,7 +2228,7 @@ discard block |
||
| 2228 | 2228 | $states['class'] = 'frm-states-opts'; |
| 2229 | 2229 | } |
| 2230 | 2230 | |
| 2231 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 2231 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 2232 | 2232 | unset( $state_abv, $states ); |
| 2233 | 2233 | |
| 2234 | 2234 | // Age. |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | $ages['class'] = 'frm-age-opts'; |
| 2247 | 2247 | } |
| 2248 | 2248 | |
| 2249 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 2249 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 2250 | 2250 | |
| 2251 | 2251 | // Satisfaction. |
| 2252 | 2252 | $satisfaction = array( |
@@ -2261,7 +2261,7 @@ discard block |
||
| 2261 | 2261 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 2262 | 2262 | } |
| 2263 | 2263 | |
| 2264 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 2264 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 2265 | 2265 | |
| 2266 | 2266 | // Importance. |
| 2267 | 2267 | $importance = array( |
@@ -2276,7 +2276,7 @@ discard block |
||
| 2276 | 2276 | $importance['class'] = 'frm-importance-opts'; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 2279 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 2280 | 2280 | |
| 2281 | 2281 | // Agreement. |
| 2282 | 2282 | $agreement = array( |
@@ -2291,7 +2291,7 @@ discard block |
||
| 2291 | 2291 | $agreement['class'] = 'frm-agreement-opts'; |
| 2292 | 2292 | } |
| 2293 | 2293 | |
| 2294 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 2294 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 2295 | 2295 | |
| 2296 | 2296 | // Likely. |
| 2297 | 2297 | $likely = array( |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | $likely['class'] = 'frm-likely-opts'; |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 2309 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 2310 | 2310 | |
| 2311 | 2311 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 2312 | 2312 | } |
@@ -2553,16 +2553,16 @@ discard block |
||
| 2553 | 2553 | */ |
| 2554 | 2554 | private static function fill_image_setting_options( $options, &$args ) { |
| 2555 | 2555 | foreach ( $options as $key => $option ) { |
| 2556 | - $args['options'][ $key ] = $option; |
|
| 2556 | + $args['options'][$key] = $option; |
|
| 2557 | 2557 | |
| 2558 | 2558 | if ( ! empty( $option['addon'] ) ) { |
| 2559 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2559 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2560 | 2560 | } |
| 2561 | 2561 | |
| 2562 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 2562 | + unset( $args['options'][$key]['addon'] ); |
|
| 2563 | 2563 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2564 | 2564 | foreach ( $fill as $f ) { |
| 2565 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 2565 | + unset( $args['options'][$key][$f], $f ); |
|
| 2566 | 2566 | } |
| 2567 | 2567 | } |
| 2568 | 2568 | } |
@@ -2585,8 +2585,8 @@ discard block |
||
| 2585 | 2585 | |
| 2586 | 2586 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2587 | 2587 | foreach ( $fill as $f ) { |
| 2588 | - if ( isset( $option[ $f ] ) ) { |
|
| 2589 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 2588 | + if ( isset( $option[$f] ) ) { |
|
| 2589 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 2590 | 2590 | } |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2654,7 +2654,7 @@ discard block |
||
| 2654 | 2654 | |
| 2655 | 2655 | return array_filter( |
| 2656 | 2656 | $rows, |
| 2657 | - function ( $row ) { |
|
| 2657 | + function( $row ) { |
|
| 2658 | 2658 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
| 2659 | 2659 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
| 2660 | 2660 | } |
@@ -2720,7 +2720,7 @@ discard block |
||
| 2720 | 2720 | if ( empty( $attributes['data-fid'] ) ) { |
| 2721 | 2721 | unset( $data['plugin-status'] ); |
| 2722 | 2722 | foreach ( $data as $key => $value ) { |
| 2723 | - $attributes[ 'data-' . $key ] = $value; |
|
| 2723 | + $attributes['data-' . $key] = $value; |
|
| 2724 | 2724 | } |
| 2725 | 2725 | } |
| 2726 | 2726 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $content_before_channel_tag, |
| 105 | 105 | 1 |
| 106 | 106 | ); |
| 107 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 107 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | 198 | if ( $term && is_array( $term ) ) { |
| 199 | - ++$imported['imported']['terms']; |
|
| 200 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 199 | + ++ $imported['imported']['terms']; |
|
| 200 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | unset( $term, $t ); |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | if ( $form_id ) { |
| 260 | 260 | if ( empty( $form['parent_form_id'] ) ) { |
| 261 | 261 | // Don't include the repeater form in the imported count. |
| 262 | - ++$imported['imported']['forms']; |
|
| 262 | + ++ $imported['imported']['forms']; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Keep track of whether this specific form was updated or not. |
| 266 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 266 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // Update field ids/keys to new ones. |
| 279 | 279 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 280 | 280 | |
| 281 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 281 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 282 | 282 | |
| 283 | 283 | // Send pre 2.0 form options through function that creates actions. |
| 284 | 284 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -365,11 +365,11 @@ discard block |
||
| 365 | 365 | FrmForm::update( $form_id, $form ); |
| 366 | 366 | if ( empty( $form['parent_form_id'] ) ) { |
| 367 | 367 | // Don't include the repeater form in the updated count. |
| 368 | - ++$imported['updated']['forms']; |
|
| 368 | + ++ $imported['updated']['forms']; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Keep track of whether this specific form was updated or not |
| 372 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 372 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 382 | 382 | $old_fields = array(); |
| 383 | 383 | foreach ( $form_fields as $f ) { |
| 384 | - $old_fields[ $f->id ] = $f; |
|
| 385 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 384 | + $old_fields[$f->id] = $f; |
|
| 385 | + $old_fields[$f->field_key] = $f->id; |
|
| 386 | 386 | unset( $f ); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 446 | 446 | if ( $parent_form_id ) { |
| 447 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 447 | + $child_forms[$form_id] = $parent_form_id; |
|
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
@@ -459,9 +459,9 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 461 | 461 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 462 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 462 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 463 | 463 | // Update all children with this old parent_form_id |
| 464 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 464 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 465 | 465 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 466 | 466 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 467 | 467 | } |
@@ -497,34 +497,34 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | if ( ! empty( $this_form ) ) { |
| 499 | 499 | // check for field to edit by field id |
| 500 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 500 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 501 | 501 | FrmField::update( $f['id'], $f ); |
| 502 | - ++$imported['updated']['fields']; |
|
| 502 | + ++ $imported['updated']['fields']; |
|
| 503 | 503 | |
| 504 | - unset( $form_fields[ $f['id'] ] ); |
|
| 504 | + unset( $form_fields[$f['id']] ); |
|
| 505 | 505 | |
| 506 | 506 | // Unset old field key. |
| 507 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 508 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 507 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 508 | + unset( $form_fields[$f['field_key']] ); |
|
| 509 | 509 | } |
| 510 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 511 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 510 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 511 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 512 | 512 | |
| 513 | 513 | $old_field_id = $f['id']; |
| 514 | 514 | |
| 515 | 515 | // check for field to edit by field key |
| 516 | 516 | unset( $f['id'] ); |
| 517 | 517 | |
| 518 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 519 | - ++$imported['updated']['fields']; |
|
| 518 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 519 | + ++ $imported['updated']['fields']; |
|
| 520 | 520 | |
| 521 | 521 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
| 522 | 522 | |
| 523 | 523 | // Unset old field id. |
| 524 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
| 524 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
| 525 | 525 | |
| 526 | 526 | // Unset old field key. |
| 527 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 527 | + unset( $form_fields[$f['field_key']] ); |
|
| 528 | 528 | } else { |
| 529 | 529 | // If no matching field id or key in this form, create the field. |
| 530 | 530 | self::create_imported_field( $f, $imported ); |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | */ |
| 566 | 566 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
| 567 | 567 | // Assign field array the update field's ID. |
| 568 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
| 568 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | 571 | * Fires when an existing field is imported. |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | * @param int $field_id |
| 577 | 577 | * @param int $old_field_id |
| 578 | 578 | */ |
| 579 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
| 579 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 690 | 690 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 691 | 691 | $form_select = (int) $f['field_options']['form_select']; |
| 692 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 693 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 692 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 693 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | 696 | } |
@@ -713,8 +713,8 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 715 | 715 | $old_form = $f['field_options']['get_values_form']; |
| 716 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 717 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 716 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 717 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 718 | 718 | } |
| 719 | 719 | } |
| 720 | 720 | } |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | private static function migrate_placeholders( &$f ) { |
| 744 | 744 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 745 | 745 | foreach ( $update_values as $k => $v ) { |
| 746 | - $f[ $k ] = $v; |
|
| 746 | + $f[$k] = $v; |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 750 | 750 | foreach ( $update_values as $k => $v ) { |
| 751 | - $f[ $k ] = $v; |
|
| 751 | + $f[$k] = $v; |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | public static function migrate_field_placeholder( $field, $type ) { |
| 767 | 767 | $field = (array) $field; |
| 768 | 768 | $field_options = $field['field_options']; |
| 769 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 769 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 770 | 770 | return array(); |
| 771 | 771 | } |
| 772 | 772 | |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | if ( $opt == $default_value ) { |
| 795 | - unset( $options[ $opt_key ] ); |
|
| 795 | + unset( $options[$opt_key] ); |
|
| 796 | 796 | break; |
| 797 | 797 | } |
| 798 | 798 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | |
| 822 | 822 | $new_id = FrmField::create( $f ); |
| 823 | 823 | if ( $new_id != false ) { |
| 824 | - ++$imported['imported']['fields']; |
|
| 824 | + ++ $imported['imported']['fields']; |
|
| 825 | 825 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 826 | 826 | } |
| 827 | 827 | } |
@@ -851,10 +851,10 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 853 | 853 | // Remove the src from options as it isn't required after import. |
| 854 | - unset( $field['options'][ $key ]['src'] ); |
|
| 854 | + unset( $field['options'][$key]['src'] ); |
|
| 855 | 855 | |
| 856 | 856 | if ( is_numeric( $image_id ) ) { |
| 857 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 857 | + $field['options'][$key]['image'] = $image_id; |
|
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | |
@@ -1046,8 +1046,8 @@ discard block |
||
| 1046 | 1046 | } else { |
| 1047 | 1047 | if ( $post['post_type'] === 'frm_display' ) { |
| 1048 | 1048 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 1049 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 1050 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 1049 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 1050 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | // Create/update post now |
| 1053 | 1053 | $post_id = wp_insert_post( $post ); |
@@ -1058,27 +1058,27 @@ discard block |
||
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
| 1061 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 1061 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | self::update_postmeta( $post, $post_id ); |
| 1065 | 1065 | self::update_layout( $post, $post_id ); |
| 1066 | 1066 | |
| 1067 | 1067 | $this_type = 'posts'; |
| 1068 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 1069 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 1068 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 1069 | + $this_type = $post_types[$post['post_type']]; |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 1073 | - ++$imported['updated'][ $this_type ]; |
|
| 1073 | + ++ $imported['updated'][$this_type]; |
|
| 1074 | 1074 | } else { |
| 1075 | - ++$imported['imported'][ $this_type ]; |
|
| 1075 | + ++ $imported['imported'][$this_type]; |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | - $imported['posts'][ $old_id ] = $post_id; |
|
| 1078 | + $imported['posts'][$old_id] = $post_id; |
|
| 1079 | 1079 | |
| 1080 | 1080 | if ( $post['post_type'] === 'frm_display' ) { |
| 1081 | - $view_ids[ $old_id ] = $post_id; |
|
| 1081 | + $view_ids[$old_id] = $post_id; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1253,9 +1253,9 @@ discard block |
||
| 1253 | 1253 | $post['attachment_url'] = (string) $item->attachment_url; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 1256 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1257 | 1257 | // update to new form id |
| 1258 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1258 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1259 | 1259 | } |
| 1260 | 1260 | |
| 1261 | 1261 | // Don't allow default styles to take over a site's default style |
@@ -1292,8 +1292,8 @@ discard block |
||
| 1292 | 1292 | ); |
| 1293 | 1293 | |
| 1294 | 1294 | // Switch old form and field ids to new ones. |
| 1295 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1296 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1295 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1296 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1297 | 1297 | } else { |
| 1298 | 1298 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1299 | 1299 | |
@@ -1304,23 +1304,23 @@ discard block |
||
| 1304 | 1304 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1305 | 1305 | |
| 1306 | 1306 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1307 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1308 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1307 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1308 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1309 | 1309 | } |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | if ( ! empty( $m['value']['map_address_fields'] ) ) { |
| 1313 | 1313 | foreach ( $m['value']['map_address_fields'] as $address_field_key => $address_field_id ) { |
| 1314 | - if ( isset( $frm_duplicate_ids[ $address_field_id ] ) ) { |
|
| 1315 | - $m['value']['map_address_fields'][ $address_field_key ] = $frm_duplicate_ids[ $address_field_id ]; |
|
| 1314 | + if ( isset( $frm_duplicate_ids[$address_field_id] ) ) { |
|
| 1315 | + $m['value']['map_address_fields'][$address_field_key] = $frm_duplicate_ids[$address_field_id]; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | if ( ! empty( $m['value']['calendar_options'] ) ) { |
| 1321 | 1321 | foreach ( $m['value']['calendar_options'] as $calendar_option_group_key => $calendar_option ) { |
| 1322 | - if ( isset( $frm_duplicate_ids[ $calendar_option['value'] ] ) ) { |
|
| 1323 | - $m['value']['calendar_options'][ $calendar_option_group_key ]['value'] = $frm_duplicate_ids[ $calendar_option['value'] ]; |
|
| 1322 | + if ( isset( $frm_duplicate_ids[$calendar_option['value']] ) ) { |
|
| 1323 | + $m['value']['calendar_options'][$calendar_option_group_key]['value'] = $frm_duplicate_ids[$calendar_option['value']]; |
|
| 1324 | 1324 | } |
| 1325 | 1325 | } |
| 1326 | 1326 | } |
@@ -1328,8 +1328,8 @@ discard block |
||
| 1328 | 1328 | if ( ! empty( $m['value']['timeline_options'] ) ) { |
| 1329 | 1329 | foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) { |
| 1330 | 1330 | foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) { |
| 1331 | - if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) { |
|
| 1332 | - $m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ]; |
|
| 1331 | + if ( isset( $frm_duplicate_ids[$timeline_option] ) ) { |
|
| 1332 | + $m['value']['timeline_options'][$timeline_option_group_key][$timeline_option_key] = $frm_duplicate_ids[$timeline_option]; |
|
| 1333 | 1333 | } |
| 1334 | 1334 | } |
| 1335 | 1335 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
| 1337 | 1337 | |
| 1338 | 1338 | $check_dup_array = array(); |
| 1339 | 1339 | if ( ! empty( $m['value']['order_by'] ) ) { |
| 1340 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1341 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1340 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1341 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1342 | 1342 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1343 | 1343 | $check_dup_array[] = 'order_by'; |
| 1344 | 1344 | } |
@@ -1349,9 +1349,9 @@ discard block |
||
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | foreach ( $check_dup_array as $check_k ) { |
| 1352 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1353 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1354 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1352 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1353 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1354 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1355 | 1355 | } |
| 1356 | 1356 | unset( $mk, $mv ); |
| 1357 | 1357 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1367 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | /** |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | * @return void |
| 1375 | 1375 | */ |
| 1376 | 1376 | private static function populate_layout( &$post, $layout ) { |
| 1377 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1377 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | /** |
@@ -1402,11 +1402,11 @@ discard block |
||
| 1402 | 1402 | $name = (string) $c; |
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1406 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1405 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1406 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1409 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1410 | 1410 | unset( $name ); |
| 1411 | 1411 | }//end foreach |
| 1412 | 1412 | } |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | |
| 1557 | 1557 | $message = '<ul>'; |
| 1558 | 1558 | foreach ( $result as $type => $results ) { |
| 1559 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1559 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1560 | 1560 | // only print imported and updated |
| 1561 | 1561 | continue; |
| 1562 | 1562 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | if ( ! empty( $s_message ) ) { |
| 1571 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1571 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1572 | 1572 | $message .= implode( ', ', $s_message ); |
| 1573 | 1573 | $message .= '</li>'; |
| 1574 | 1574 | } |
@@ -1620,8 +1620,8 @@ discard block |
||
| 1620 | 1620 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1621 | 1621 | ); |
| 1622 | 1622 | |
| 1623 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1624 | - $s_message[] = $strings[ $type ]; |
|
| 1623 | + if ( isset( $strings[$type] ) ) { |
|
| 1624 | + $s_message[] = $strings[$type]; |
|
| 1625 | 1625 | } else { |
| 1626 | 1626 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1627 | 1627 | |
@@ -1783,7 +1783,7 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | foreach ( $options as $key => $option ) { |
| 1785 | 1785 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1786 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1786 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1787 | 1787 | $updated = true; |
| 1788 | 1788 | } |
| 1789 | 1789 | } |
@@ -1821,8 +1821,8 @@ discard block |
||
| 1821 | 1821 | */ |
| 1822 | 1822 | private static function remove_defaults( $defaults, &$saved ) { |
| 1823 | 1823 | foreach ( $saved as $key => $value ) { |
| 1824 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1825 | - unset( $saved[ $key ] ); |
|
| 1824 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1825 | + unset( $saved[$key] ); |
|
| 1826 | 1826 | } |
| 1827 | 1827 | } |
| 1828 | 1828 | } |
@@ -1839,14 +1839,14 @@ discard block |
||
| 1839 | 1839 | * @return void |
| 1840 | 1840 | */ |
| 1841 | 1841 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1842 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1842 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1843 | 1843 | return; |
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1847 | - $default_html = $defaults[ $html_name ]; |
|
| 1846 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1847 | + $default_html = $defaults[$html_name]; |
|
| 1848 | 1848 | if ( $old_html == $default_html ) { |
| 1849 | - unset( $options[ $html_name ] ); |
|
| 1849 | + unset( $options[$html_name] ); |
|
| 1850 | 1850 | |
| 1851 | 1851 | return; |
| 1852 | 1852 | } |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | // Account for some of the older field default HTML. |
| 1855 | 1855 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1856 | 1856 | if ( $old_html === $default_html ) { |
| 1857 | - unset( $options[ $html_name ] ); |
|
| 1857 | + unset( $options[$html_name] ); |
|
| 1858 | 1858 | } |
| 1859 | 1859 | } |
| 1860 | 1860 | |
@@ -1962,8 +1962,8 @@ discard block |
||
| 1962 | 1962 | ); |
| 1963 | 1963 | |
| 1964 | 1964 | foreach ( $post_settings as $post_setting ) { |
| 1965 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1966 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1965 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1966 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1967 | 1967 | } |
| 1968 | 1968 | unset( $post_setting ); |
| 1969 | 1969 | } |
@@ -2001,7 +2001,7 @@ discard block |
||
| 2001 | 2001 | if ( ! $exists ) { |
| 2002 | 2002 | // this isn't an email, but we need to use a class that will always be included |
| 2003 | 2003 | FrmDb::save_json_post( $new_action ); |
| 2004 | - ++$imported['imported']['actions']; |
|
| 2004 | + ++ $imported['imported']['actions']; |
|
| 2005 | 2005 | } |
| 2006 | 2006 | } |
| 2007 | 2007 | |
@@ -2034,11 +2034,11 @@ discard block |
||
| 2034 | 2034 | foreach ( $post_content as $key => $setting ) { |
| 2035 | 2035 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 2036 | 2036 | // Replace old IDs with new IDs |
| 2037 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 2037 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 2038 | 2038 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 2039 | 2039 | foreach ( $setting as $k => $val ) { |
| 2040 | 2040 | // Replace old IDs with new IDs |
| 2041 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 2041 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 2042 | 2042 | } |
| 2043 | 2043 | } |
| 2044 | 2044 | unset( $key, $setting ); |
@@ -2106,7 +2106,7 @@ discard block |
||
| 2106 | 2106 | |
| 2107 | 2107 | if ( empty( $exists ) ) { |
| 2108 | 2108 | FrmDb::save_json_post( $new_notification ); |
| 2109 | - ++$imported['imported']['actions']; |
|
| 2109 | + ++ $imported['imported']['actions']; |
|
| 2110 | 2110 | } |
| 2111 | 2111 | unset( $new_notification ); |
| 2112 | 2112 | }//end foreach |
@@ -2127,8 +2127,8 @@ discard block |
||
| 2127 | 2127 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 2128 | 2128 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 2129 | 2129 | foreach ( $delete_settings as $index ) { |
| 2130 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 2131 | - unset( $form_options[ $index ] ); |
|
| 2130 | + if ( isset( $form_options[$index] ) ) { |
|
| 2131 | + unset( $form_options[$index] ); |
|
| 2132 | 2132 | } |
| 2133 | 2133 | } |
| 2134 | 2134 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -2198,12 +2198,12 @@ discard block |
||
| 2198 | 2198 | 'reply_to_name' => '', |
| 2199 | 2199 | ); |
| 2200 | 2200 | foreach ( $reply_fields as $f => $val ) { |
| 2201 | - if ( isset( $notification[ $f ] ) ) { |
|
| 2202 | - $atts[ $f ] = $notification[ $f ]; |
|
| 2203 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 2204 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 2205 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 2206 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 2201 | + if ( isset( $notification[$f] ) ) { |
|
| 2202 | + $atts[$f] = $notification[$f]; |
|
| 2203 | + if ( 'custom' == $notification[$f] ) { |
|
| 2204 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 2205 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 2206 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 2207 | 2207 | } |
| 2208 | 2208 | } |
| 2209 | 2209 | unset( $f, $val ); |
@@ -2242,13 +2242,13 @@ discard block |
||
| 2242 | 2242 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 2243 | 2243 | |
| 2244 | 2244 | if ( is_numeric( $email_field ) ) { |
| 2245 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 2245 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | 2248 | if ( strpos( $email_field, '|' ) ) { |
| 2249 | 2249 | $email_opt = explode( '|', $email_field ); |
| 2250 | 2250 | if ( isset( $email_opt[0] ) ) { |
| 2251 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2251 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2252 | 2252 | } |
| 2253 | 2253 | unset( $email_opt ); |
| 2254 | 2254 | } |
@@ -2278,12 +2278,12 @@ discard block |
||
| 2278 | 2278 | // Add more fields to the new notification |
| 2279 | 2279 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 2280 | 2280 | foreach ( $add_fields as $add_field ) { |
| 2281 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 2282 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 2281 | + if ( isset( $notification[$add_field] ) ) { |
|
| 2282 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 2283 | 2283 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 2284 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 2284 | + $new_notification['post_content'][$add_field] = 0; |
|
| 2285 | 2285 | } else { |
| 2286 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 2286 | + $new_notification['post_content'][$add_field] = ''; |
|
| 2287 | 2287 | } |
| 2288 | 2288 | unset( $add_field ); |
| 2289 | 2289 | } |
@@ -2309,7 +2309,7 @@ discard block |
||
| 2309 | 2309 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 2310 | 2310 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 2311 | 2311 | if ( is_numeric( $email_key ) ) { |
| 2312 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2312 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2313 | 2313 | } |
| 2314 | 2314 | unset( $email_key, $val ); |
| 2315 | 2315 | } |