| @@ -38,40 +38,34 @@ | ||
| 38 | 38 | self::register_actions(); |
| 39 | 39 | do_action( 'frm_form_actions_init' ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - /** | |
| 43 | - * @return void | |
| 44 | - */ | |
| 45 | 42 | public static function register_actions() { |
| 46 | 43 | $action_classes = array( |
| 47 | - 'on_submit' => 'FrmOnSubmitAction', | |
| 48 | - 'email' => 'FrmEmailAction', | |
| 49 | - 'wppost' => 'FrmDefPostAction', | |
| 50 | - 'register' => 'FrmDefRegAction', | |
| 51 | - 'paypal' => 'FrmDefPayPalAction', | |
| 52 | - 'payment' => 'FrmDefHrsAction', | |
| 53 | - 'quiz' => 'FrmDefQuizAction', | |
| 54 | - 'quiz_outcome' => 'FrmDefQuizOutcomeAction', | |
| 55 | - 'mailchimp' => 'FrmDefMlcmpAction', | |
| 56 | - 'api' => 'FrmDefApiAction', | |
| 57 | - 'salesforce' => 'FrmDefSalesforceAction', | |
| 58 | - 'activecampaign' => 'FrmDefActiveCampaignAction', | |
| 59 | - 'constantcontact' => 'FrmDefConstContactAction', | |
| 60 | - 'getresponse' => 'FrmDefGetResponseAction', | |
| 61 | - 'hubspot' => 'FrmDefHubspotAction', | |
| 62 | - 'zapier' => 'FrmDefZapierAction', | |
| 63 | - 'twilio' => 'FrmDefTwilioAction', | |
| 64 | - 'highrise' => 'FrmDefHighriseAction', | |
| 65 | - 'mailpoet' => 'FrmDefMailpoetAction', | |
| 66 | - 'aweber' => 'FrmDefAweberAction', | |
| 67 | - 'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction', | |
| 44 | + 'email' => 'FrmEmailAction', | |
| 45 | + 'wppost' => 'FrmDefPostAction', | |
| 46 | + 'register' => 'FrmDefRegAction', | |
| 47 | + 'paypal' => 'FrmDefPayPalAction', | |
| 48 | + 'payment' => 'FrmDefHrsAction', | |
| 49 | + 'mailchimp' => 'FrmDefMlcmpAction', | |
| 50 | + 'api' => 'FrmDefApiAction', | |
| 51 | + | |
| 52 | + 'salesforce' => 'FrmDefSalesforceAction', | |
| 53 | + 'activecampaign' => 'FrmDefActiveCampaignAction', | |
| 54 | + 'constantcontact' => 'FrmDefConstContactAction', | |
| 55 | + 'getresponse' => 'FrmDefGetResponseAction', | |
| 56 | + 'hubspot' => 'FrmDefHubspotAction', | |
| 57 | + 'zapier' => 'FrmDefZapierAction', | |
| 58 | + 'twilio' => 'FrmDefTwilioAction', | |
| 59 | + 'highrise' => 'FrmDefHighriseAction', | |
| 60 | + 'mailpoet' => 'FrmDefMailpoetAction', | |
| 61 | + 'aweber' => 'FrmDefAweberAction', | |
| 68 | 62 | ); |
| 69 | 63 | |
| 70 | 64 | $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes ); |
| 71 | 65 | |
| 72 | - include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php'; | |
| 73 | - include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php'; | |
| 66 | + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' ); | |
| 67 | + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' ); | |
| 74 | 68 | |
| 75 | 69 | foreach ( $action_classes as $action_class ) { |
| 76 | 70 | self::$registered_actions->register( $action_class ); |
| 77 | 71 | } |
| @@ -90,9 +84,9 @@ | ||
| 90 | 84 | self::maybe_add_action_to_group( $action_controls, $groups ); |
| 91 | 85 | |
| 92 | 86 | $allowed = self::active_actions( $action_controls ); |
| 93 | 87 | |
| 94 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php'; | |
| 88 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php' ); | |
| 95 | 89 | } |
| 96 | 90 | |
| 97 | 91 | /** |
| 98 | 92 | * Add unknown actions to a group. |
| @@ -132,9 +126,9 @@ | ||
| 132 | 126 | * @return array |
| 133 | 127 | */ |
| 134 | 128 | public static function form_action_groups() { |
| 135 | 129 | $groups = array( |
| 136 | - 'misc' => array( | |
| 130 | + 'misc' => array( | |
| 137 | 131 | 'name' => '', |
| 138 | 132 | 'icon' => 'frm_icon_font frm_shuffle_icon', |
| 139 | 133 | 'actions' => array( |
| 140 | 134 | 'email', |
| @@ -139,10 +133,8 @@ | ||
| 139 | 133 | 'actions' => array( |
| 140 | 134 | 'email', |
| 141 | 135 | 'wppost', |
| 142 | 136 | 'register', |
| 143 | - 'quiz', | |
| 144 | - 'quiz_outcome', | |
| 145 | 137 | 'twilio', |
| 146 | 138 | ), |
| 147 | 139 | ), |
| 148 | 140 | 'payment' => array( |
| @@ -211,9 +203,9 @@ | ||
| 211 | 203 | |
| 212 | 204 | /* translators: %s: Name of form action */ |
| 213 | 205 | $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] ); |
| 214 | 206 | |
| 215 | - $default_shown = array( 'wppost', 'register', 'payment', 'quiz', 'hubspot' ); | |
| 207 | + $default_shown = array( 'wppost', 'register', 'paypal', 'payment', 'mailchimp' ); | |
| 216 | 208 | $default_shown = array_values( array_diff( $default_shown, $allowed ) ); |
| 217 | 209 | $default_position = array_search( $action_control->id_base, $default_shown ); |
| 218 | 210 | $allowed_count = count( $allowed ); |
| 219 | 211 | |
| @@ -231,28 +223,19 @@ | ||
| 231 | 223 | $upgrading = FrmAddonsController::install_link( $action_control->action_options['plugin'] ); |
| 232 | 224 | if ( isset( $upgrading['url'] ) ) { |
| 233 | 225 | $data['data-oneclick'] = json_encode( $upgrading ); |
| 234 | 226 | } |
| 235 | - | |
| 236 | - if ( isset( $action_control->action_options['message'] ) ) { | |
| 237 | - $data['data-message'] = $action_control->action_options['message']; | |
| 238 | - } | |
| 239 | - | |
| 240 | - $requires = FrmFormsHelper::get_plan_required( $upgrading ); | |
| 241 | - if ( $requires && 'free' !== $requires ) { | |
| 242 | - $data['data-requires'] = $requires; | |
| 243 | - } | |
| 244 | 227 | } |
| 245 | 228 | |
| 246 | 229 | // HTML to include on the icon. |
| 247 | 230 | $icon_atts = array(); |
| 248 | - if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) { | |
| 231 | + if ( $action_control->action_options['color'] !== 'var(--primary-hover)' ) { | |
| 249 | 232 | $icon_atts = array( |
| 250 | - 'style' => '--primary-700:' . $action_control->action_options['color'], | |
| 233 | + 'style' => '--primary-hover:' . $action_control->action_options['color'], | |
| 251 | 234 | ); |
| 252 | 235 | } |
| 253 | 236 | |
| 254 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php'; | |
| 237 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php' ); | |
| 255 | 238 | } |
| 256 | 239 | |
| 257 | 240 | public static function get_form_actions( $action = 'all' ) { |
| 258 | 241 | $temp_actions = self::$registered_actions; |
| @@ -318,9 +301,9 @@ | ||
| 318 | 301 | $action_control->_set( $action_key ); |
| 319 | 302 | |
| 320 | 303 | $use_logging = self::should_show_log_message( $form_action->post_excerpt ); |
| 321 | 304 | |
| 322 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php'; | |
| 305 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); | |
| 323 | 306 | } |
| 324 | 307 | |
| 325 | 308 | public static function add_form_action() { |
| 326 | 309 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| @@ -341,9 +324,9 @@ | ||
| 341 | 324 | |
| 342 | 325 | $values = array(); |
| 343 | 326 | $form = self::fields_to_values( $form_id, $values ); |
| 344 | 327 | |
| 345 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php'; | |
| 328 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); | |
| 346 | 329 | wp_die(); |
| 347 | 330 | } |
| 348 | 331 | |
| 349 | 332 | public static function fill_action() { |
| @@ -364,9 +347,9 @@ | ||
| 364 | 347 | $form = self::fields_to_values( $form_action->menu_order, $values ); |
| 365 | 348 | |
| 366 | 349 | $use_logging = self::should_show_log_message( $action_type ); |
| 367 | 350 | |
| 368 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php'; | |
| 351 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' ); | |
| 369 | 352 | wp_die(); |
| 370 | 353 | } |
| 371 | 354 | |
| 372 | 355 | /** |
| @@ -400,18 +383,13 @@ | ||
| 400 | 383 | |
| 401 | 384 | return $form; |
| 402 | 385 | } |
| 403 | 386 | |
| 404 | - /** | |
| 405 | - * @param int $form_id | |
| 406 | - * @return void | |
| 407 | - */ | |
| 408 | 387 | public static function update_settings( $form_id ) { |
| 409 | 388 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 410 | 389 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 411 | 390 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 412 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 413 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 391 | + wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) ); | |
| 414 | 392 | } |
| 415 | 393 | |
| 416 | 394 | global $wpdb; |
| 417 | 395 | |
| @@ -440,10 +418,8 @@ | ||
| 440 | 418 | } |
| 441 | 419 | $old_actions = array_diff( $old_actions, $new_actions ); |
| 442 | 420 | |
| 443 | 421 | self::delete_missing_actions( $old_actions ); |
| 444 | - | |
| 445 | - FrmOnSubmitHelper::save_on_submit_settings( $form_id ); | |
| 446 | 422 | } |
| 447 | 423 | |
| 448 | 424 | public static function delete_missing_actions( $old_actions ) { |
| 449 | 425 | if ( ! empty( $old_actions ) ) { |
| @@ -470,9 +446,9 @@ | ||
| 470 | 446 | public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) { |
| 471 | 447 | $action_status = array( |
| 472 | 448 | 'post_status' => 'publish', |
| 473 | 449 | ); |
| 474 | - $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status ); | |
| 450 | + $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status ); | |
| 475 | 451 | |
| 476 | 452 | if ( empty( $form_actions ) ) { |
| 477 | 453 | return; |
| 478 | 454 | } |
| @@ -494,9 +470,9 @@ | ||
| 494 | 470 | } |
| 495 | 471 | |
| 496 | 472 | foreach ( $form_actions as $action ) { |
| 497 | 473 | |
| 498 | - $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt; | |
| 474 | + $skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) ); | |
| 499 | 475 | $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) ); |
| 500 | 476 | if ( $skip_this_action ) { |
| 501 | 477 | continue; |
| 502 | 478 | } |