@@ -31,6 +31,10 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | protected $option_label = ''; |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param string $option_key |
|
| 36 | + * @param string $option |
|
| 37 | + */ |
|
| 34 | 38 | public function __construct( $option_key, $option, $args = array() ) { |
| 35 | 39 | $this->option_key = $option_key; |
| 36 | 40 | $this->option = $option; |
@@ -152,6 +152,9 @@ discard block |
||
| 152 | 152 | return $this->add_form( $form ); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | + /** |
|
| 156 | + * @param string $source_form_name |
|
| 157 | + */ |
|
| 155 | 158 | protected function prepare_new_form( $source_id, $source_form_name ) { |
| 156 | 159 | return array( |
| 157 | 160 | 'import_form_id' => $source_id, |
@@ -201,6 +204,11 @@ discard block |
||
| 201 | 204 | // customize this function |
| 202 | 205 | } |
| 203 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $type |
|
| 209 | + * |
|
| 210 | + * @return string |
|
| 211 | + */ |
|
| 204 | 212 | protected function convert_field_type( $type ) { |
| 205 | 213 | return $type; |
| 206 | 214 | } |
@@ -314,6 +322,9 @@ discard block |
||
| 314 | 322 | return array(); |
| 315 | 323 | } |
| 316 | 324 | |
| 325 | + /** |
|
| 326 | + * @param string $type |
|
| 327 | + */ |
|
| 317 | 328 | private function is_unsupported_field( $type ) { |
| 318 | 329 | $fields = $this->unsupported_field_types(); |
| 319 | 330 | |
@@ -329,6 +340,9 @@ discard block |
||
| 329 | 340 | return array(); |
| 330 | 341 | } |
| 331 | 342 | |
| 343 | + /** |
|
| 344 | + * @param string $type |
|
| 345 | + */ |
|
| 332 | 346 | private function should_skip_field( $type ) { |
| 333 | 347 | $skip_pro_fields = $this->skip_pro_fields(); |
| 334 | 348 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | foreach ( $form['fields'] as $key => $new_field ) { |
| 238 | 238 | $new_field['form_id'] = $form_id; |
| 239 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 239 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // create emails |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if ( $key === 'post_title' ) { |
| 249 | 249 | $new_action->post_title = $value; |
| 250 | 250 | } else { |
| 251 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 251 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $imported = $this->get_tracked_import(); |
| 280 | 280 | |
| 281 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 281 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 282 | 282 | |
| 283 | 283 | update_option( $this->tracking, $imported, false ); |
| 284 | 284 | } |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | private function is_imported( $source_id ) { |
| 299 | 299 | $imported = $this->get_tracked_import(); |
| 300 | 300 | $new_form_id = 0; |
| 301 | - if ( isset( $imported[ $this->slug ] ) && in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 302 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 301 | + if ( isset( $imported[$this->slug] ) && in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 302 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | return $new_form_id; |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | public $id = 0; // the id of the post |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | - * @param int|string $id The id of the stylsheet or 'default' |
|
| 8 | + * @param integer $id The id of the stylsheet or 'default' |
|
| 9 | 9 | */ |
| 10 | 10 | public function __construct( $id = 0 ) { |
| 11 | 11 | $this->id = $id; |
@@ -150,6 +150,9 @@ discard block |
||
| 150 | 150 | set_transient( 'frmpro_css', $css, MONTH_IN_SECONDS ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $filename |
|
| 155 | + */ |
|
| 153 | 156 | private function get_css_content( $filename ) { |
| 154 | 157 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
| 155 | 158 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $new_instance = (array) $new_instance; |
| 54 | 54 | $this->id = $new_instance['ID']; |
| 55 | 55 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
| 56 | - $all_instances[ $number ] = $new_instance; |
|
| 56 | + $all_instances[$number] = $new_instance; |
|
| 57 | 57 | |
| 58 | 58 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 59 | 59 | // this style was set to default, so remove default setting on previous default style |
@@ -81,22 +81,22 @@ discard block |
||
| 81 | 81 | $default_settings = $this->get_defaults(); |
| 82 | 82 | |
| 83 | 83 | foreach ( $default_settings as $setting => $default ) { |
| 84 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 85 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 84 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 85 | + $new_instance['post_content'][$setting] = $default; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if ( $this->is_color( $setting ) ) { |
| 89 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
| 89 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
| 90 | 90 | } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) |
| 91 | - && ! isset( $new_instance['post_content'][ $setting ] ) |
|
| 91 | + && ! isset( $new_instance['post_content'][$setting] ) |
|
| 92 | 92 | ) { |
| 93 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 93 | + $new_instance['post_content'][$setting] = 0; |
|
| 94 | 94 | } elseif ( $setting == 'font' ) { |
| 95 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 95 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $all_instances[ $number ] = $new_instance; |
|
| 99 | + $all_instances[$number] = $new_instance; |
|
| 100 | 100 | |
| 101 | 101 | $action_ids[] = $this->save( $new_instance ); |
| 102 | 102 | |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 269 | 269 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 270 | 270 | |
| 271 | - $styles[ $style->ID ] = $style; |
|
| 271 | + $styles[$style->ID] = $style; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | if ( ! $default_style ) { |
| 275 | 275 | $default_style = reset( $styles ); |
| 276 | 276 | |
| 277 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 277 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $styles; |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function validate( $args ) { |
| 37 | 37 | $errors = array(); |
| 38 | 38 | if ( $args['value'] != '' && ! is_email( $args['value'] ) ) { |
| 39 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 39 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $errors; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'sep' => ', ', |
| 40 | 40 | 'html' => false, |
| 41 | 41 | ); |
| 42 | - $atts = wp_parse_args( $atts, $defaults ); |
|
| 42 | + $atts = wp_parse_args( $atts, $defaults ); |
|
| 43 | 43 | |
| 44 | 44 | if ( $atts['html'] ) { |
| 45 | 45 | $atts['sep'] = ' '; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // validate the url format |
| 63 | 63 | if ( ! empty( $value ) && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 64 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 64 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 65 | 65 | } elseif ( $this->field->required == '1' && empty( $value ) ) { |
| 66 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 66 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $errors; |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | $user_ID = get_current_user_id(); |
| 43 | 43 | $user_ID = ( $user_ID ? $user_ID : '' ); |
| 44 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok. |
|
| 44 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // WPCS: CSRF ok. |
|
| 45 | 45 | $updating = ( isset( $args['action'] ) && $args['action'] == 'update' ); |
| 46 | 46 | $value = ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID; |
| 47 | 47 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $checked = FrmAppHelper::get_param( 'recaptcha_checked', '', 'post', 'sanitize_text_field' ); |
| 150 | 150 | if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $checked, 'frm_ajax' ) ) { |
| 151 | 151 | // There was no captcha submitted. |
| 152 | - $errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' ); |
|
| 152 | + $errors['field' . $args['id']] = __( 'The captcha is missing from this form', 'formidable' ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $errors; |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | if ( isset( $response['success'] ) && ! $response['success'] ) { |
| 164 | 164 | // What happens when the CAPTCHA was entered incorrectly |
| 165 | 165 | $invalid_message = FrmField::get_option( $this->field, 'invalid' ); |
| 166 | - $errors[ 'field' . $args['id'] ] = ( $invalid_message == '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 166 | + $errors['field' . $args['id']] = ( $invalid_message == '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 167 | 167 | } elseif ( is_wp_error( $resp ) ) { |
| 168 | 168 | $error_string = $resp->get_error_message(); |
| 169 | - $errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' ); |
|
| 170 | - $errors[ 'field' . $args['id'] ] .= ' ' . $error_string; |
|
| 169 | + $errors['field' . $args['id']] = __( 'There was a problem verifying your recaptcha', 'formidable' ); |
|
| 170 | + $errors['field' . $args['id']] .= ' ' . $error_string; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $errors; |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | foreach ( $settings as $setting => $default ) { |
| 152 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
| 153 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
| 152 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
| 153 | + $this->{$setting} = $params['frm_' . $setting]; |
|
| 154 | 154 | } elseif ( ! isset( $this->{$setting} ) ) { |
| 155 | 155 | $this->{$setting} = $default; |
| 156 | 156 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'old_css', 'no_ips', 'tracking' ); |
| 257 | 257 | foreach ( $checkboxes as $set ) { |
| 258 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; |
|
| 258 | + $this->$set = isset( $params['frm_' . $set] ) ? $params['frm_' . $set] : 0; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 266 | 266 | $roles = get_editable_roles(); |
| 267 | 267 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 268 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 268 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
| 269 | 269 | |
| 270 | 270 | // Make sure administrators always have permissions |
| 271 | 271 | if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private function translate_settings( $settings ) { |
| 59 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 59 | + if ( $settings ) { |
|
| 60 | +//workaround for W3 total cache conflict |
|
| 60 | 61 | return unserialize( serialize( $settings ) ); |
| 61 | 62 | } |
| 62 | 63 | |
@@ -68,7 +69,8 @@ discard block |
||
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | // If unserializing didn't work |
| 71 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 72 | + if ( $settings ) { |
|
| 73 | +//workaround for W3 total cache conflict |
|
| 72 | 74 | $settings = unserialize( serialize( $settings ) ); |
| 73 | 75 | } else { |
| 74 | 76 | $settings = $this; |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | |
| 147 | 147 | $next_dir = ''; |
| 148 | 148 | foreach ( $dir_names as $dir ) { |
| 149 | - $next_dir .= '/' . $dir; |
|
| 149 | + $next_dir .= '/' . $dir; |
|
| 150 | 150 | $needed_dirs[] = $this->uploads['basedir'] . $next_dir; |
| 151 | 151 | } |
| 152 | 152 | |