| @@ -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', 'hubspot' ); | |
| 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 | |
| @@ -236,10 +228,10 @@ | ||
| 236 | 228 | if ( isset( $action_control->action_options['message'] ) ) { |
| 237 | 229 | $data['data-message'] = $action_control->action_options['message']; |
| 238 | 230 | } |
| 239 | 231 | |
| 240 | - $requires = FrmFormsHelper::get_plan_required( $upgrading ); | |
| 241 | - if ( $requires && 'free' !== $requires ) { | |
| 232 | + $requires = self::action_requires( $upgrading ); | |
| 233 | + if ( $requires ) { | |
| 242 | 234 | $data['data-requires'] = $requires; |
| 243 | 235 | } |
| 244 | 236 | } |
| 245 | 237 | |
| @@ -244,11 +236,11 @@ | ||
| 244 | 236 | } |
| 245 | 237 | |
| 246 | 238 | // HTML to include on the icon. |
| 247 | 239 | $icon_atts = array(); |
| 248 | - if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) { | |
| 240 | + if ( $action_control->action_options['color'] !== 'var(--primary-hover)' ) { | |
| 249 | 241 | $icon_atts = array( |
| 250 | - 'style' => '--primary-700:' . $action_control->action_options['color'], | |
| 242 | + 'style' => '--primary-hover:' . $action_control->action_options['color'], | |
| 251 | 243 | ); |
| 252 | 244 | } |
| 253 | 245 | |
| 254 | 246 | include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php'; |
| @@ -253,8 +245,31 @@ | ||
| 253 | 245 | |
| 254 | 246 | include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php'; |
| 255 | 247 | } |
| 256 | 248 | |
| 249 | + /** | |
| 250 | + * @since 5.0.06 | |
| 251 | + * | |
| 252 | + * @param array $upgrading | |
| 253 | + * @return string|false | |
| 254 | + */ | |
| 255 | + private static function action_requires( $upgrading ) { | |
| 256 | + if ( ! isset( $upgrading['categories'] ) || ! is_array( $upgrading['categories'] ) ) { | |
| 257 | + return false; | |
| 258 | + } | |
| 259 | + $plans = array( 'Business', 'Elite', 'Basic' ); | |
| 260 | + $plus_plans = array( 'Creator', 'Personal', 'Plus' ); | |
| 261 | + foreach ( $upgrading['categories'] as $category ) { | |
| 262 | + if ( in_array( $category, $plans, true ) ) { | |
| 263 | + return $category; | |
| 264 | + } | |
| 265 | + if ( in_array( $category, $plus_plans, true ) ) { | |
| 266 | + return 'Plus'; | |
| 267 | + } | |
| 268 | + } | |
| 269 | + return false; | |
| 270 | + } | |
| 271 | + | |
| 257 | 272 | public static function get_form_actions( $action = 'all' ) { |
| 258 | 273 | $temp_actions = self::$registered_actions; |
| 259 | 274 | if ( empty( $temp_actions ) ) { |
| 260 | 275 | self::actions_init(); |
| @@ -318,9 +333,9 @@ | ||
| 318 | 333 | $action_control->_set( $action_key ); |
| 319 | 334 | |
| 320 | 335 | $use_logging = self::should_show_log_message( $form_action->post_excerpt ); |
| 321 | 336 | |
| 322 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php'; | |
| 337 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); | |
| 323 | 338 | } |
| 324 | 339 | |
| 325 | 340 | public static function add_form_action() { |
| 326 | 341 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| @@ -341,9 +356,9 @@ | ||
| 341 | 356 | |
| 342 | 357 | $values = array(); |
| 343 | 358 | $form = self::fields_to_values( $form_id, $values ); |
| 344 | 359 | |
| 345 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php'; | |
| 360 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' ); | |
| 346 | 361 | wp_die(); |
| 347 | 362 | } |
| 348 | 363 | |
| 349 | 364 | public static function fill_action() { |
| @@ -364,9 +379,9 @@ | ||
| 364 | 379 | $form = self::fields_to_values( $form_action->menu_order, $values ); |
| 365 | 380 | |
| 366 | 381 | $use_logging = self::should_show_log_message( $action_type ); |
| 367 | 382 | |
| 368 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php'; | |
| 383 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' ); | |
| 369 | 384 | wp_die(); |
| 370 | 385 | } |
| 371 | 386 | |
| 372 | 387 | /** |
| @@ -400,18 +415,13 @@ | ||
| 400 | 415 | |
| 401 | 416 | return $form; |
| 402 | 417 | } |
| 403 | 418 | |
| 404 | - /** | |
| 405 | - * @param int $form_id | |
| 406 | - * @return void | |
| 407 | - */ | |
| 408 | 419 | public static function update_settings( $form_id ) { |
| 409 | 420 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 410 | 421 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 411 | 422 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 412 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 413 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 423 | + wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) ); | |
| 414 | 424 | } |
| 415 | 425 | |
| 416 | 426 | global $wpdb; |
| 417 | 427 | |
| @@ -440,10 +450,8 @@ | ||
| 440 | 450 | } |
| 441 | 451 | $old_actions = array_diff( $old_actions, $new_actions ); |
| 442 | 452 | |
| 443 | 453 | self::delete_missing_actions( $old_actions ); |
| 444 | - | |
| 445 | - FrmOnSubmitHelper::save_on_submit_settings( $form_id ); | |
| 446 | 454 | } |
| 447 | 455 | |
| 448 | 456 | public static function delete_missing_actions( $old_actions ) { |
| 449 | 457 | if ( ! empty( $old_actions ) ) { |
| @@ -470,9 +478,9 @@ | ||
| 470 | 478 | public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) { |
| 471 | 479 | $action_status = array( |
| 472 | 480 | 'post_status' => 'publish', |
| 473 | 481 | ); |
| 474 | - $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status ); | |
| 482 | + $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status ); | |
| 475 | 483 | |
| 476 | 484 | if ( empty( $form_actions ) ) { |
| 477 | 485 | return; |
| 478 | 486 | } |
| @@ -494,9 +502,9 @@ | ||
| 494 | 502 | } |
| 495 | 503 | |
| 496 | 504 | foreach ( $form_actions as $action ) { |
| 497 | 505 | |
| 498 | - $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt; | |
| 506 | + $skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) ); | |
| 499 | 507 | $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) ); |
| 500 | 508 | if ( $skip_this_action ) { |
| 501 | 509 | continue; |
| 502 | 510 | } |