@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'entry' => $this->entry, |
| 96 | 96 | 'form' => $this->form, |
| 97 | 97 | ); |
| 98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 99 | 99 | |
| 100 | 100 | $this->to = array_unique( (array) $to ); |
| 101 | 101 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * @return array |
| 450 | 450 | */ |
| 451 | 451 | private function package_header() { |
| 452 | - $header = array(); |
|
| 452 | + $header = array(); |
|
| 453 | 453 | |
| 454 | 454 | if ( ! empty( $this->cc ) ) { |
| 455 | 455 | $header[] = 'CC: ' . implode( ',', $this->cc ); |
@@ -562,12 +562,12 @@ discard block |
||
| 562 | 562 | $name = trim( str_replace( $email, '', $val ) ); |
| 563 | 563 | } else { |
| 564 | 564 | // If user enters a name without an email |
| 565 | - unset( $recipients[ $key ] ); |
|
| 565 | + unset( $recipients[$key] ); |
|
| 566 | 566 | continue; |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 570 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | return $recipients; |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | ); |
| 707 | 707 | |
| 708 | 708 | // Remove phone number from to addresses |
| 709 | - unset( $this->to[ $key ] ); |
|
| 709 | + unset( $this->to[$key] ); |
|
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | } |
@@ -84,12 +84,12 @@ |
||
| 84 | 84 | $this->style_settings = apply_filters( 'frm_show_entry_styles', $style_settings ); |
| 85 | 85 | |
| 86 | 86 | foreach ( $this->style_settings as $key => $setting ) { |
| 87 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
| 88 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
| 87 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
| 88 | + $this->style_settings[$key] = $atts[$key]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ( $this->is_color_setting( $key ) ) { |
| 92 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
| 92 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -148,6 +148,9 @@ discard block |
||
| 148 | 148 | return $this->add_form( $form ); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $source_form_name |
|
| 153 | + */ |
|
| 151 | 154 | protected function prepare_new_form( $source_id, $source_form_name ) { |
| 152 | 155 | return array( |
| 153 | 156 | 'import_form_id' => $source_id, |
@@ -197,6 +200,11 @@ discard block |
||
| 197 | 200 | // customize this function |
| 198 | 201 | } |
| 199 | 202 | |
| 203 | + /** |
|
| 204 | + * @param string $type |
|
| 205 | + * |
|
| 206 | + * @return string |
|
| 207 | + */ |
|
| 200 | 208 | protected function convert_field_type( $type ) { |
| 201 | 209 | return $type; |
| 202 | 210 | } |
@@ -309,6 +317,9 @@ discard block |
||
| 309 | 317 | return array(); |
| 310 | 318 | } |
| 311 | 319 | |
| 320 | + /** |
|
| 321 | + * @param string $type |
|
| 322 | + */ |
|
| 312 | 323 | private function is_unsupported_field( $type ) { |
| 313 | 324 | $fields = $this->unsupported_field_types(); |
| 314 | 325 | return in_array( $type, $fields, true ); |
@@ -322,6 +333,9 @@ discard block |
||
| 322 | 333 | return array(); |
| 323 | 334 | } |
| 324 | 335 | |
| 336 | + /** |
|
| 337 | + * @param string $type |
|
| 338 | + */ |
|
| 325 | 339 | private function should_skip_field( $type ) { |
| 326 | 340 | $skip_pro_fields = $this->skip_pro_fields(); |
| 327 | 341 | return ( ! FrmAppHelper::pro_is_installed() && in_array( $type, $skip_pro_fields, true ) ); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $this->prepare_field( $field, $new_field ); |
| 190 | 190 | $form['fields'][] = $new_field; |
| 191 | 191 | |
| 192 | - $field_order++; |
|
| 192 | + $field_order ++; |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | foreach ( $form['fields'] as $key => $new_field ) { |
| 234 | 234 | $new_field['form_id'] = $form_id; |
| 235 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 235 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // create emails |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | if ( $key === 'post_title' ) { |
| 245 | 245 | $new_action->post_title = $value; |
| 246 | 246 | } else { |
| 247 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 247 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $imported = $this->get_tracked_import(); |
| 276 | 276 | |
| 277 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 277 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 278 | 278 | |
| 279 | 279 | update_option( $this->tracking, $imported, false ); |
| 280 | 280 | } |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | private function is_imported( $source_id ) { |
| 295 | 295 | $imported = $this->get_tracked_import(); |
| 296 | 296 | $new_form_id = 0; |
| 297 | - if ( isset( $imported[ $this->slug ] ) && in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 298 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 297 | + if ( isset( $imported[$this->slug] ) && in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 298 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 299 | 299 | } |
| 300 | 300 | return $new_form_id; |
| 301 | 301 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Echo the settings update form |
|
| 32 | + * Echo the settings update form |
|
| 33 | 33 | * |
| 34 | 34 | * @param array $instance Current settings |
| 35 | 35 | */ |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | * @return array of the default options |
| 43 | 43 | */ |
| 44 | 44 | public function get_defaults() { |
| 45 | - return array(); |
|
| 45 | + return array(); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function get_switch_fields() { |
| 49 | - return array(); |
|
| 49 | + return array(); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function migrate_values( $action, $form ) { |
| 53 | - return $action; |
|
| 53 | + return $action; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Functions you'll need to call. |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | $this->name = $name; |
| 78 | 78 | $this->option_name = 'frm_' . $this->id_base . '_action'; |
| 79 | 79 | |
| 80 | - $default_options = array( |
|
| 81 | - 'classes' => '', |
|
| 82 | - 'active' => true, |
|
| 80 | + $default_options = array( |
|
| 81 | + 'classes' => '', |
|
| 82 | + 'active' => true, |
|
| 83 | 83 | 'event' => array( 'create' ), |
| 84 | - 'limit' => 1, |
|
| 85 | - 'force_event' => false, |
|
| 86 | - 'priority' => 20, |
|
| 87 | - 'ajax_load' => true, |
|
| 88 | - 'tooltip' => $name, |
|
| 89 | - ); |
|
| 84 | + 'limit' => 1, |
|
| 85 | + 'force_event' => false, |
|
| 86 | + 'priority' => 20, |
|
| 87 | + 'ajax_load' => true, |
|
| 88 | + 'tooltip' => $name, |
|
| 89 | + ); |
|
| 90 | 90 | |
| 91 | 91 | $action_options = apply_filters( 'frm_' . $id_base . '_action_options', $action_options ); |
| 92 | 92 | $this->action_options = wp_parse_args( $action_options, $default_options ); |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | public function prepare_new( $form_id = false ) { |
| 138 | - if ( $form_id ) { |
|
| 139 | - $this->form_id = $form_id; |
|
| 140 | - } |
|
| 138 | + if ( $form_id ) { |
|
| 139 | + $this->form_id = $form_id; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - $post_content = array(); |
|
| 143 | - $default_values = $this->get_global_defaults(); |
|
| 142 | + $post_content = array(); |
|
| 143 | + $default_values = $this->get_global_defaults(); |
|
| 144 | 144 | |
| 145 | 145 | // fill default values |
| 146 | 146 | $post_content = wp_parse_args( $post_content, $default_values ); |
@@ -149,118 +149,118 @@ discard block |
||
| 149 | 149 | $post_content['event'] = array( reset( $this->action_options['event'] ) ); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $form_action = array( |
|
| 153 | - 'post_title' => $this->name, |
|
| 154 | - 'post_content' => $post_content, |
|
| 155 | - 'post_excerpt' => $this->id_base, |
|
| 156 | - 'ID' => '', |
|
| 157 | - 'post_status' => 'publish', |
|
| 158 | - 'post_type' => FrmFormActionsController::$action_post_type, |
|
| 152 | + $form_action = array( |
|
| 153 | + 'post_title' => $this->name, |
|
| 154 | + 'post_content' => $post_content, |
|
| 155 | + 'post_excerpt' => $this->id_base, |
|
| 156 | + 'ID' => '', |
|
| 157 | + 'post_status' => 'publish', |
|
| 158 | + 'post_type' => FrmFormActionsController::$action_post_type, |
|
| 159 | 159 | 'post_name' => $this->form_id . '_' . $this->id_base . '_' . $this->number, |
| 160 | - 'menu_order' => $this->form_id, |
|
| 161 | - ); |
|
| 160 | + 'menu_order' => $this->form_id, |
|
| 161 | + ); |
|
| 162 | 162 | unset( $post_content ); |
| 163 | 163 | |
| 164 | - return (object) $form_action; |
|
| 165 | - } |
|
| 164 | + return (object) $form_action; |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | 167 | public function create( $form_id ) { |
| 168 | - $this->form_id = $form_id; |
|
| 168 | + $this->form_id = $form_id; |
|
| 169 | 169 | |
| 170 | - $action = $this->prepare_new(); |
|
| 170 | + $action = $this->prepare_new(); |
|
| 171 | 171 | |
| 172 | 172 | return $this->save_settings( $action ); |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | public function duplicate_form_actions( $form_id, $old_id ) { |
| 176 | - if ( $form_id == $old_id ) { |
|
| 177 | - // don't duplicate the actions if this is a template getting updated |
|
| 178 | - return; |
|
| 179 | - } |
|
| 176 | + if ( $form_id == $old_id ) { |
|
| 177 | + // don't duplicate the actions if this is a template getting updated |
|
| 178 | + return; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - $this->form_id = $old_id; |
|
| 182 | - $actions = $this->get_all( $old_id ); |
|
| 181 | + $this->form_id = $old_id; |
|
| 182 | + $actions = $this->get_all( $old_id ); |
|
| 183 | 183 | |
| 184 | - $this->form_id = $form_id; |
|
| 185 | - foreach ( $actions as $action ) { |
|
| 184 | + $this->form_id = $form_id; |
|
| 185 | + foreach ( $actions as $action ) { |
|
| 186 | 186 | $this->duplicate_one( $action, $form_id ); |
| 187 | 187 | unset( $action ); |
| 188 | - } |
|
| 189 | - } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - /* Check if imported action should be created or updated |
|
| 191 | + /* Check if imported action should be created or updated |
|
| 192 | 192 | * |
| 193 | 193 | * Since 2.0 |
| 194 | 194 | * |
| 195 | 195 | * @param array $action |
| 196 | 196 | * @return integer $post_id |
| 197 | 197 | */ |
| 198 | - public function maybe_create_action( $action, $forms ) { |
|
| 198 | + public function maybe_create_action( $action, $forms ) { |
|
| 199 | 199 | if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
| 200 | - // Update action only |
|
| 201 | - $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
|
| 202 | - $post_id = $this->save_settings( $action ); |
|
| 203 | - } else { |
|
| 200 | + // Update action only |
|
| 201 | + $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
|
| 202 | + $post_id = $this->save_settings( $action ); |
|
| 203 | + } else { |
|
| 204 | 204 | // Create action |
| 205 | 205 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 206 | 206 | $post_id = $this->duplicate_one( (object) $action, $action['menu_order'] ); |
| 207 | - } |
|
| 208 | - return $post_id; |
|
| 209 | - } |
|
| 207 | + } |
|
| 208 | + return $post_id; |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | 211 | public function duplicate_one( $action, $form_id ) { |
| 212 | - global $frm_duplicate_ids; |
|
| 212 | + global $frm_duplicate_ids; |
|
| 213 | 213 | |
| 214 | - $action->menu_order = $form_id; |
|
| 215 | - $switch = $this->get_global_switch_fields(); |
|
| 216 | - foreach ( (array) $action->post_content as $key => $val ) { |
|
| 214 | + $action->menu_order = $form_id; |
|
| 215 | + $switch = $this->get_global_switch_fields(); |
|
| 216 | + foreach ( (array) $action->post_content as $key => $val ) { |
|
| 217 | 217 | if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
| 218 | 218 | $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
| 219 | - } else if ( ! is_array( $val ) ) { |
|
| 219 | + } else if ( ! is_array( $val ) ) { |
|
| 220 | 220 | $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
| 221 | 221 | } else if ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
| 222 | - // loop through each value if empty |
|
| 222 | + // loop through each value if empty |
|
| 223 | 223 | if ( empty( $switch[ $key ] ) ) { |
| 224 | 224 | $switch[ $key ] = array_keys( $val ); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | foreach ( $switch[ $key ] as $subkey ) { |
| 228 | 228 | $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
| 229 | - } |
|
| 230 | - } |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | 232 | unset( $key, $val ); |
| 233 | 233 | } |
| 234 | 234 | unset( $action->ID ); |
| 235 | 235 | |
| 236 | 236 | return $this->save_settings( $action ); |
| 237 | - } |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | private function duplicate_array_walk( $action, $subkey, $val ) { |
| 240 | - global $frm_duplicate_ids; |
|
| 240 | + global $frm_duplicate_ids; |
|
| 241 | 241 | |
| 242 | 242 | if ( is_array( $subkey ) ) { |
| 243 | - foreach ( $subkey as $subkey2 ) { |
|
| 244 | - foreach ( (array) $val as $ck => $cv ) { |
|
| 243 | + foreach ( $subkey as $subkey2 ) { |
|
| 244 | + foreach ( (array) $val as $ck => $cv ) { |
|
| 245 | 245 | if ( is_array( $cv ) ) { |
| 246 | 246 | $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
| 247 | 247 | } else if ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
| 248 | 248 | $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
| 249 | - } |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - } else { |
|
| 253 | - foreach ( (array) $val as $ck => $cv ) { |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + } else { |
|
| 253 | + foreach ( (array) $val as $ck => $cv ) { |
|
| 254 | 254 | if ( is_array( $cv ) ) { |
| 255 | 255 | $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
| 256 | 256 | } else if ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
| 257 | 257 | $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
| 258 | - } |
|
| 259 | - } |
|
| 260 | - } |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - return $action; |
|
| 263 | - } |
|
| 262 | + return $action; |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Deal with changed settings. |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | */ |
| 271 | 271 | public function update_callback( $form_id ) { |
| 272 | - $this->form_id = $form_id; |
|
| 272 | + $this->form_id = $form_id; |
|
| 273 | 273 | |
| 274 | 274 | $all_instances = $this->get_settings(); |
| 275 | 275 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $action_ids = array(); |
|
| 287 | + $action_ids = array(); |
|
| 288 | 288 | |
| 289 | 289 | foreach ( $settings as $number => $new_instance ) { |
| 290 | 290 | $this->_set( $number ); |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | // settings were never opened, so don't update |
| 299 | 299 | if ( ! isset( $new_instance['post_title'] ) ) { |
| 300 | 300 | $this->maybe_update_status( $new_instance, $old_instance ); |
| 301 | - $action_ids[] = $new_instance['ID']; |
|
| 302 | - $this->updated = true; |
|
| 303 | - continue; |
|
| 301 | + $action_ids[] = $new_instance['ID']; |
|
| 302 | + $this->updated = true; |
|
| 303 | + continue; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | $new_instance['post_type'] = FrmFormActionsController::$action_post_type; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $action_ids[] = $this->save_settings( $instance ); |
| 336 | 336 | |
| 337 | - $this->updated = true; |
|
| 337 | + $this->updated = true; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | return $action_ids; |
@@ -368,59 +368,59 @@ discard block |
||
| 368 | 368 | $action = $this->prepare_action( $action ); |
| 369 | 369 | $this->_set( $id ); |
| 370 | 370 | } |
| 371 | - return $action; |
|
| 371 | + return $action; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | public function get_one( $form_id ) { |
| 375 | 375 | return $this->get_all( $form_id, 1 ); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - public static function get_action_for_form( $form_id, $type = 'all', $atts = array() ) { |
|
| 379 | - $action_controls = FrmFormActionsController::get_form_actions( $type ); |
|
| 378 | + public static function get_action_for_form( $form_id, $type = 'all', $atts = array() ) { |
|
| 379 | + $action_controls = FrmFormActionsController::get_form_actions( $type ); |
|
| 380 | 380 | if ( empty( $action_controls ) ) { |
| 381 | - // don't continue if there are no available actions |
|
| 382 | - return array(); |
|
| 383 | - } |
|
| 381 | + // don't continue if there are no available actions |
|
| 382 | + return array(); |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | 385 | self::prepare_get_action( $atts ); |
| 386 | 386 | |
| 387 | 387 | $limit = apply_filters( 'frm_form_action_limit', $atts['limit'], compact( 'type', 'form_id' ) ); |
| 388 | 388 | |
| 389 | - if ( 'all' != $type ) { |
|
| 390 | - return $action_controls->get_all( $form_id, $limit ); |
|
| 391 | - } |
|
| 389 | + if ( 'all' != $type ) { |
|
| 390 | + return $action_controls->get_all( $form_id, $limit ); |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | 393 | $args = self::action_args( $form_id, $limit ); |
| 394 | 394 | $args['post_status'] = $atts['post_status']; |
| 395 | 395 | $actions = FrmDb::check_cache( serialize( $args ), 'frm_actions', $args, 'get_posts' ); |
| 396 | 396 | |
| 397 | - if ( ! $actions ) { |
|
| 398 | - return array(); |
|
| 399 | - } |
|
| 397 | + if ( ! $actions ) { |
|
| 398 | + return array(); |
|
| 399 | + } |
|
| 400 | 400 | |
| 401 | - $settings = array(); |
|
| 402 | - foreach ( $actions as $action ) { |
|
| 401 | + $settings = array(); |
|
| 402 | + foreach ( $actions as $action ) { |
|
| 403 | 403 | // some plugins/themes are formatting the post_excerpt |
| 404 | 404 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 405 | 405 | |
| 406 | 406 | if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
| 407 | - continue; |
|
| 408 | - } |
|
| 407 | + continue; |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 410 | + $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 411 | 411 | $settings[ $action->ID ] = $action; |
| 412 | 412 | |
| 413 | 413 | if ( count( $settings ) >= $limit ) { |
| 414 | 414 | break; |
| 415 | 415 | } |
| 416 | - } |
|
| 416 | + } |
|
| 417 | 417 | |
| 418 | - if ( 1 === $limit ) { |
|
| 418 | + if ( 1 === $limit ) { |
|
| 419 | 419 | $settings = reset( $settings ); |
| 420 | - } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - return $settings; |
|
| 423 | - } |
|
| 422 | + return $settings; |
|
| 423 | + } |
|
| 424 | 424 | |
| 425 | 425 | /** |
| 426 | 426 | * @since 3.04 |
@@ -460,19 +460,19 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | public function get_all( $form_id = false, $limit = 99 ) { |
| 463 | - if ( $form_id ) { |
|
| 464 | - $this->form_id = $form_id; |
|
| 465 | - } |
|
| 463 | + if ( $form_id ) { |
|
| 464 | + $this->form_id = $form_id; |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - $type = $this->id_base; |
|
| 467 | + $type = $this->id_base; |
|
| 468 | 468 | |
| 469 | - global $frm_vars; |
|
| 470 | - $frm_vars['action_type'] = $type; |
|
| 469 | + global $frm_vars; |
|
| 470 | + $frm_vars['action_type'] = $type; |
|
| 471 | 471 | |
| 472 | 472 | add_filter( 'posts_where', 'FrmFormActionsController::limit_by_type' ); |
| 473 | 473 | $query = self::action_args( $form_id, $limit ); |
| 474 | - $query['post_status'] = 'any'; |
|
| 475 | - $query['suppress_filters'] = false; |
|
| 474 | + $query['post_status'] = 'any'; |
|
| 475 | + $query['suppress_filters'] = false; |
|
| 476 | 476 | |
| 477 | 477 | $actions = FrmDb::check_cache( serialize( $query ) . '_type_' . $type, 'frm_actions', $query, 'get_posts' ); |
| 478 | 478 | unset( $query ); |
@@ -480,25 +480,25 @@ discard block |
||
| 480 | 480 | remove_filter( 'posts_where', 'FrmFormActionsController::limit_by_type' ); |
| 481 | 481 | |
| 482 | 482 | if ( empty( $actions ) ) { |
| 483 | - return array(); |
|
| 484 | - } |
|
| 483 | + return array(); |
|
| 484 | + } |
|
| 485 | 485 | |
| 486 | - $settings = array(); |
|
| 487 | - foreach ( $actions as $action ) { |
|
| 486 | + $settings = array(); |
|
| 487 | + foreach ( $actions as $action ) { |
|
| 488 | 488 | if ( count( $settings ) >= $limit ) { |
| 489 | - continue; |
|
| 490 | - } |
|
| 489 | + continue; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | $action = $this->prepare_action( $action ); |
| 493 | 493 | |
| 494 | 494 | $settings[ $action->ID ] = $action; |
| 495 | - } |
|
| 495 | + } |
|
| 496 | 496 | |
| 497 | - if ( 1 === $limit ) { |
|
| 497 | + if ( 1 === $limit ) { |
|
| 498 | 498 | $settings = reset( $settings ); |
| 499 | - } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - return $settings; |
|
| 501 | + return $settings; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | public static function action_args( $form_id = 0, $limit = 99 ) { |
@@ -521,45 +521,45 @@ discard block |
||
| 521 | 521 | $action->post_content = (array) FrmAppHelper::maybe_json_decode( $action->post_content ); |
| 522 | 522 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 523 | 523 | |
| 524 | - $default_values = $this->get_global_defaults(); |
|
| 524 | + $default_values = $this->get_global_defaults(); |
|
| 525 | 525 | |
| 526 | - // fill default values |
|
| 527 | - $action->post_content += $default_values; |
|
| 526 | + // fill default values |
|
| 527 | + $action->post_content += $default_values; |
|
| 528 | 528 | |
| 529 | - foreach ( $default_values as $k => $vals ) { |
|
| 529 | + foreach ( $default_values as $k => $vals ) { |
|
| 530 | 530 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 531 | 531 | if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
| 532 | - continue; |
|
| 533 | - } |
|
| 532 | + continue; |
|
| 533 | + } |
|
| 534 | 534 | $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
| 535 | - } |
|
| 536 | - } |
|
| 535 | + } |
|
| 536 | + } |
|
| 537 | 537 | |
| 538 | 538 | if ( ! is_array( $action->post_content['event'] ) ) { |
| 539 | 539 | $action->post_content['event'] = explode( ',', $action->post_content['event'] ); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - return $action; |
|
| 542 | + return $action; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | public function destroy( $form_id = false, $type = 'default' ) { |
| 546 | - global $wpdb; |
|
| 546 | + global $wpdb; |
|
| 547 | 547 | |
| 548 | - $this->form_id = $form_id; |
|
| 548 | + $this->form_id = $form_id; |
|
| 549 | 549 | |
| 550 | - $query = array( 'post_type' => FrmFormActionsController::$action_post_type ); |
|
| 551 | - if ( $form_id ) { |
|
| 552 | - $query['menu_order'] = $form_id; |
|
| 553 | - } |
|
| 554 | - if ( 'all' != $type ) { |
|
| 555 | - $query['post_excerpt'] = $this->id_base; |
|
| 556 | - } |
|
| 550 | + $query = array( 'post_type' => FrmFormActionsController::$action_post_type ); |
|
| 551 | + if ( $form_id ) { |
|
| 552 | + $query['menu_order'] = $form_id; |
|
| 553 | + } |
|
| 554 | + if ( 'all' != $type ) { |
|
| 555 | + $query['post_excerpt'] = $this->id_base; |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | - $post_ids = FrmDb::get_col( $wpdb->posts, $query, 'ID' ); |
|
| 558 | + $post_ids = FrmDb::get_col( $wpdb->posts, $query, 'ID' ); |
|
| 559 | 559 | |
| 560 | - foreach ( $post_ids as $id ) { |
|
| 560 | + foreach ( $post_ids as $id ) { |
|
| 561 | 561 | wp_delete_post( $id ); |
| 562 | - } |
|
| 562 | + } |
|
| 563 | 563 | self::clear_cache(); |
| 564 | 564 | } |
| 565 | 565 | |
@@ -577,26 +577,26 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | public function get_global_defaults() { |
| 580 | - $defaults = $this->get_defaults(); |
|
| 580 | + $defaults = $this->get_defaults(); |
|
| 581 | 581 | |
| 582 | 582 | if ( ! isset( $defaults['event'] ) ) { |
| 583 | 583 | $defaults['event'] = array( 'create' ); |
| 584 | - } |
|
| 584 | + } |
|
| 585 | 585 | |
| 586 | 586 | if ( ! isset( $defaults['conditions'] ) ) { |
| 587 | - $defaults['conditions'] = array( |
|
| 588 | - 'send_stop' => '', |
|
| 589 | - 'any_all' => '', |
|
| 590 | - ); |
|
| 591 | - } |
|
| 587 | + $defaults['conditions'] = array( |
|
| 588 | + 'send_stop' => '', |
|
| 589 | + 'any_all' => '', |
|
| 590 | + ); |
|
| 591 | + } |
|
| 592 | 592 | |
| 593 | - return $defaults; |
|
| 593 | + return $defaults; |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | public function get_global_switch_fields() { |
| 597 | - $switch = $this->get_switch_fields(); |
|
| 597 | + $switch = $this->get_switch_fields(); |
|
| 598 | 598 | $switch['conditions'] = array( 'hide_field' ); |
| 599 | - return $switch; |
|
| 599 | + return $switch; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -606,17 +606,17 @@ discard block |
||
| 606 | 606 | $action = $this->prepare_new( $form->id ); |
| 607 | 607 | $form->options = maybe_unserialize( $form->options ); |
| 608 | 608 | |
| 609 | - // fill with existing options |
|
| 610 | - foreach ( $action->post_content as $name => $val ) { |
|
| 609 | + // fill with existing options |
|
| 610 | + foreach ( $action->post_content as $name => $val ) { |
|
| 611 | 611 | if ( isset( $form->options[ $name ] ) ) { |
| 612 | 612 | $action->post_content[ $name ] = $form->options[ $name ]; |
| 613 | 613 | unset( $form->options[ $name ] ); |
| 614 | - } |
|
| 615 | - } |
|
| 614 | + } |
|
| 615 | + } |
|
| 616 | 616 | |
| 617 | 617 | $action = $this->migrate_values( $action, $form ); |
| 618 | 618 | |
| 619 | - // check if action already exists |
|
| 619 | + // check if action already exists |
|
| 620 | 620 | $post_id = get_posts( |
| 621 | 621 | array( |
| 622 | 622 | 'name' => $action->post_name, |
@@ -631,17 +631,17 @@ discard block |
||
| 631 | 631 | $post_id = $this->save_settings( $action ); |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | - if ( $post_id && 'update' == $update ) { |
|
| 635 | - global $wpdb; |
|
| 634 | + if ( $post_id && 'update' == $update ) { |
|
| 635 | + global $wpdb; |
|
| 636 | 636 | $form->options = maybe_serialize( $form->options ); |
| 637 | 637 | |
| 638 | - // update form options |
|
| 638 | + // update form options |
|
| 639 | 639 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => $form->options ), array( 'id' => $form->id ) ); |
| 640 | - FrmForm::clear_form_cache(); |
|
| 641 | - } |
|
| 640 | + FrmForm::clear_form_cache(); |
|
| 641 | + } |
|
| 642 | 642 | |
| 643 | - return $post_id; |
|
| 644 | - } |
|
| 643 | + return $post_id; |
|
| 644 | + } |
|
| 645 | 645 | |
| 646 | 646 | public static function action_conditions_met( $action, $entry ) { |
| 647 | 647 | $notification = $action->post_content; |
@@ -2,15 +2,15 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFormAction { |
| 4 | 4 | |
| 5 | - public $id_base; // Root id for all actions of this type. |
|
| 6 | - public $name; // Name for this action type. |
|
| 5 | + public $id_base; // Root id for all actions of this type. |
|
| 6 | + public $name; // Name for this action type. |
|
| 7 | 7 | public $option_name; |
| 8 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 8 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 9 | 9 | public $control_options; // Option array passed to wp_register_widget_control() |
| 10 | 10 | |
| 11 | - public $form_id; // The ID of the form to evaluate |
|
| 12 | - public $number = false; // Unique ID number of the current instance. |
|
| 13 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 11 | + public $form_id; // The ID of the form to evaluate |
|
| 12 | + public $number = false; // Unique ID number of the current instance. |
|
| 13 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 14 | 14 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
| 15 | 15 | |
| 16 | 16 | // Member functions that you must over-ride. |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @return integer $post_id |
| 197 | 197 | */ |
| 198 | 198 | public function maybe_create_action( $action, $forms ) { |
| 199 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
| 199 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
| 200 | 200 | // Update action only |
| 201 | 201 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 202 | 202 | $post_id = $this->save_settings( $action ); |
@@ -214,18 +214,18 @@ discard block |
||
| 214 | 214 | $action->menu_order = $form_id; |
| 215 | 215 | $switch = $this->get_global_switch_fields(); |
| 216 | 216 | foreach ( (array) $action->post_content as $key => $val ) { |
| 217 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 218 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 217 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 218 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 219 | 219 | } else if ( ! is_array( $val ) ) { |
| 220 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 221 | - } else if ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 220 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 221 | + } else if ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 222 | 222 | // loop through each value if empty |
| 223 | - if ( empty( $switch[ $key ] ) ) { |
|
| 224 | - $switch[ $key ] = array_keys( $val ); |
|
| 223 | + if ( empty( $switch[$key] ) ) { |
|
| 224 | + $switch[$key] = array_keys( $val ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 228 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 227 | + foreach ( $switch[$key] as $subkey ) { |
|
| 228 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -243,18 +243,18 @@ discard block |
||
| 243 | 243 | foreach ( $subkey as $subkey2 ) { |
| 244 | 244 | foreach ( (array) $val as $ck => $cv ) { |
| 245 | 245 | if ( is_array( $cv ) ) { |
| 246 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 247 | - } else if ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 248 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 246 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 247 | + } else if ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 248 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | } else { |
| 253 | 253 | foreach ( (array) $val as $ck => $cv ) { |
| 254 | 254 | if ( is_array( $cv ) ) { |
| 255 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 256 | - } else if ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 257 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 255 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 256 | + } else if ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 257 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 282 | - $settings = $_POST[ $this->option_name ]; |
|
| 281 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 282 | + $settings = $_POST[$this->option_name]; |
|
| 283 | 283 | } else { |
| 284 | 284 | return; |
| 285 | 285 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | foreach ( $settings as $number => $new_instance ) { |
| 290 | 290 | $this->_set( $number ); |
| 291 | 291 | |
| 292 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
| 292 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
| 293 | 293 | |
| 294 | 294 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 295 | 295 | $new_instance['post_status'] = 'draft'; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 330 | 330 | |
| 331 | 331 | if ( false !== $instance ) { |
| 332 | - $all_instances[ $number ] = $instance; |
|
| 332 | + $all_instances[$number] = $instance; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | $action_ids[] = $this->save_settings( $instance ); |
@@ -403,12 +403,12 @@ discard block |
||
| 403 | 403 | // some plugins/themes are formatting the post_excerpt |
| 404 | 404 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 405 | 405 | |
| 406 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 406 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 407 | 407 | continue; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 411 | - $settings[ $action->ID ] = $action; |
|
| 410 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 411 | + $settings[$action->ID] = $action; |
|
| 412 | 412 | |
| 413 | 413 | if ( count( $settings ) >= $limit ) { |
| 414 | 414 | break; |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | $action = $this->prepare_action( $action ); |
| 493 | 493 | |
| 494 | - $settings[ $action->ID ] = $action; |
|
| 494 | + $settings[$action->ID] = $action; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | if ( 1 === $limit ) { |
@@ -528,10 +528,10 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | foreach ( $default_values as $k => $vals ) { |
| 530 | 530 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 531 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 531 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 532 | 532 | continue; |
| 533 | 533 | } |
| 534 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 534 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | 537 | |
@@ -608,9 +608,9 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | // fill with existing options |
| 610 | 610 | foreach ( $action->post_content as $name => $val ) { |
| 611 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 612 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 613 | - unset( $form->options[ $name ] ); |
|
| 611 | + if ( isset( $form->options[$name] ) ) { |
|
| 612 | + $action->post_content[$name] = $form->options[$name]; |
|
| 613 | + unset( $form->options[$name] ); |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $stop = $stop ? false : true; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - $met[ $stop ] = $stop; |
|
| 674 | + $met[$stop] = $stop; |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | private static function get_value_from_entry( $entry, $field_id ) { |
| 712 | 712 | $observed_value = ''; |
| 713 | 713 | |
| 714 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
| 715 | - $observed_value = $entry->metas[ $field_id ]; |
|
| 714 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
| 715 | + $observed_value = $entry->metas[$field_id]; |
|
| 716 | 716 | } else if ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
| 717 | 717 | $field = FrmField::getOne( $field_id ); |
| 718 | 718 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * @param array $atts |
| 42 | 42 | */ |
| 43 | 43 | private function _set( $param, $atts ) { |
| 44 | - if ( isset( $atts[ $param ] ) ) { |
|
| 45 | - $this->{$param} = $atts[ $param ]; |
|
| 44 | + if ( isset( $atts[$param] ) ) { |
|
| 45 | + $this->{$param} = $atts[$param]; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | $exclude = array( 'field_obj', 'html' ); |
| 87 | 87 | |
| 88 | 88 | foreach ( $exclude as $ex ) { |
| 89 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 90 | - unset( $this->pass_args[ $ex ] ); |
|
| 89 | + if ( isset( $atts[$ex] ) ) { |
|
| 90 | + unset( $this->pass_args[$ex] ); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | * @param array $set |
| 100 | 100 | */ |
| 101 | 101 | private function set_from_field( $atts, $set ) { |
| 102 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 103 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 102 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 103 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 104 | 104 | } else { |
| 105 | 105 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 106 | 106 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @since 3.0 |
| 208 | 208 | */ |
| 209 | 209 | private function replace_error_shortcode() { |
| 210 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
| 210 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
| 211 | 211 | FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html ); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
| 284 | 284 | |
| 285 | 285 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 286 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 286 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 287 | 287 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 288 | 288 | |
| 289 | 289 | $replace_with = ''; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 297 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
| 317 | 317 | if ( isset( $shortcode_atts['opt'] ) ) { |
| 318 | - $shortcode_atts['opt']--; |
|
| 318 | + $shortcode_atts['opt'] --; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : ''; |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | unset( $shortcode_atts['class'] ); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 328 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 329 | 329 | $shortcode_atts['aria-invalid'] = 'true'; |
| 330 | 330 | } |
| 331 | 331 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | private function get_field_div_classes() { |
| 385 | 385 | // Add error class |
| 386 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 386 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 387 | 387 | |
| 388 | 388 | // Add label position class |
| 389 | 389 | $settings = $this->field_obj->display_field_settings(); |
@@ -56,27 +56,27 @@ discard block |
||
| 56 | 56 | <?php esc_html_e( 'Helpers', 'formidable' ) ?>: |
| 57 | 57 | <ul class="frm_code_list"> |
| 58 | 58 | <?php |
| 59 | - $col = 'one'; |
|
| 59 | + $col = 'one'; |
|
| 60 | 60 | foreach ( $entry_shortcodes as $skey => $sname ) { |
| 61 | 61 | if ( empty( $skey ) ) { |
| 62 | - $col = 'one'; |
|
| 63 | - echo '<li class="clear frm_block"></li>'; |
|
| 64 | - continue; |
|
| 65 | - } |
|
| 62 | + $col = 'one'; |
|
| 63 | + echo '<li class="clear frm_block"></li>'; |
|
| 64 | + continue; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | $classes = ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : ''; |
| 68 | 68 | $classes .= ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
| 69 | - ?> |
|
| 69 | + ?> |
|
| 70 | 70 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
| 71 | 71 | <a href="javascript:void(0)" class="frmbutton button <?php echo esc_attr( $classes ); ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"> |
| 72 | 72 | <?php echo esc_html( $sname ) ?> |
| 73 | 73 | </a> |
| 74 | 74 | </li> |
| 75 | 75 | <?php |
| 76 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
| 76 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
| 77 | 77 | unset( $skey, $sname, $classes ); |
| 78 | - } |
|
| 79 | - ?> |
|
| 78 | + } |
|
| 79 | + ?> |
|
| 80 | 80 | </ul> |
| 81 | 81 | <div class="clear"></div> |
| 82 | 82 | </div> |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | <ul class="frm_code_list frm_full_width"> |
| 92 | 92 | <?php |
| 93 | 93 | if ( ! empty( $fields ) ) { |
| 94 | - foreach ( $fields as $f ) { |
|
| 94 | + foreach ( $fields as $f ) { |
|
| 95 | 95 | if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) { |
| 96 | - continue; |
|
| 97 | - } |
|
| 98 | - ?> |
|
| 96 | + continue; |
|
| 97 | + } |
|
| 98 | + ?> |
|
| 99 | 99 | <li> |
| 100 | 100 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
| 101 | 101 | <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ); ?>]something[/if <?php echo esc_attr( $f->field_key ); ?>">[if <?php echo FrmAppHelper::truncate( $f->field_key, 10 ); // WPCS: XSS ok. ?>]</a> |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | <p class="howto"><?php esc_html_e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p> |
| 116 | 116 | <ul class="frm_code_list"> |
| 117 | 117 | <?php |
| 118 | - $col = 'one'; |
|
| 118 | + $col = 'one'; |
|
| 119 | 119 | foreach ( $cond_shortcodes as $skey => $sname ) { |
| 120 | - ?> |
|
| 120 | + ?> |
|
| 121 | 121 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
| 122 | 122 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr( $skey ); ?>][/if x"><?php echo esc_html( $sname ); ?></a> |
| 123 | 123 | </li> |
| 124 | 124 | <?php |
| 125 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
| 125 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
| 126 | 126 | unset( $skey, $sname ); |
| 127 | - } |
|
| 128 | - ?> |
|
| 127 | + } |
|
| 128 | + ?> |
|
| 129 | 129 | </ul> |
| 130 | 130 | </div> |
| 131 | 131 | <?php } ?> |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | </div> |
| 166 | 166 | |
| 167 | 167 | <?php |
| 168 | - if ( $settings_tab ) { |
|
| 168 | + if ( $settings_tab ) { |
|
| 169 | 169 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' ); |
| 170 | - } |
|
| 171 | - ?> |
|
| 170 | + } |
|
| 171 | + ?> |
|
| 172 | 172 | </div> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class FrmDefPostAction extends FrmFormAction { |
| 4 | 4 | public function __construct() { |
| 5 | 5 | $action_ops = FrmFormAction::default_action_opts(); |
| 6 | - $action_ops['classes'] = 'ab-icon frm_dashicon_font dashicons-before frm_show_upgrade'; |
|
| 6 | + $action_ops['classes'] = 'ab-icon frm_dashicon_font dashicons-before frm_show_upgrade'; |
|
| 7 | 7 | |
| 8 | 8 | parent::__construct( 'wppost', __( 'Create Post', 'formidable' ), $action_ops ); |
| 9 | 9 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | $field_name = FrmFormsHelper::get_field_link_name( $field_type ); |
| 86 | 86 | $field_label .= ' <span>' . $field_name . '</span>'; |
| 87 | 87 | $upgrade_label = sprintf( esc_html__( '%s fields', 'formidable' ), $field_name ); |
| 88 | - ?> |
|
| 88 | + ?> |
|
| 89 | 89 | <li class="frmbutton button <?php echo esc_attr( $no_allow_class . ' frm_t' . str_replace( '|', '-', $field_key ) ) ?>" id="<?php echo esc_attr( $field_key ) ?>" data-upgrade="<?php echo esc_attr( $upgrade_label ); ?>" data-medium="builder-<?php echo esc_attr( sanitize_title( $upgrade_label ) ); ?>"> |
| 90 | 90 | <?php echo FrmAppHelper::kses( apply_filters( 'frmpro_field_links', $field_label, $id, $field_key ), array( 'a', 'i', 'span' ) ); // WPCS: XSS ok. ?> |
| 91 | 91 | </li> |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | <ul class="frm_actions_list"> |
| 264 | 264 | <?php |
| 265 | 265 | |
| 266 | - //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
| 266 | + //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
| 267 | 267 | $included = false; |
| 268 | 268 | foreach ( $action_controls as $action_control ) { |
| 269 | 269 | $classes = ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action '; |
@@ -274,14 +274,14 @@ discard block |
||
| 274 | 274 | FrmAppController::include_upgrade_overlay(); |
| 275 | 275 | } |
| 276 | 276 | $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] ); |
| 277 | - ?> |
|
| 277 | + ?> |
|
| 278 | 278 | <li> |
| 279 | 279 | <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 ) ?>" data-upgrade="<?php echo esc_attr( $upgrade_label ); ?>" data-medium="settings-<?php echo esc_attr( $action_control->id_base ); ?>"></a> |
| 280 | 280 | </li> |
| 281 | 281 | <?php |
| 282 | 282 | unset( $actions_icon, $classes ); |
| 283 | - } |
|
| 284 | - ?> |
|
| 283 | + } |
|
| 284 | + ?> |
|
| 285 | 285 | </ul> |
| 286 | 286 | </div> |
| 287 | 287 | <div class="frm_no_actions"> |
@@ -319,10 +319,10 @@ discard block |
||
| 319 | 319 | <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'] ); // WPCS: XSS ok. ?></textarea> |
| 320 | 320 | </p> |
| 321 | 321 | <?php |
| 322 | - } |
|
| 322 | + } |
|
| 323 | 323 | unset( $field ); |
| 324 | - } |
|
| 325 | - } |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | 326 | ?> |
| 327 | 327 | </div> |
| 328 | 328 | |