PluginProbe
Hello Plus / 1.7.0
Hello Plus v1.7.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / forms / actions / redirect.php

redirect.php in Hello Plus 1.7.0, at modules/forms/actions/redirect.php

47 lines 995 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HelloPlus\Modules\Forms\Actions;
3
4 use HelloPlus\Modules\Forms\Classes\Action_Base;
5
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly
9 }
10
11 class Redirect extends Action_Base {
12
13 public function get_name(): string {
14 return 'ehp-redirect';
15 }
16
17 public function get_label(): string {
18 return esc_html__( 'Redirect', 'hello-plus' );
19 }
20
21 public function register_settings_section( $widget ) {
22 }
23
24 public function on_export( $element ) {
25 unset(
26 $element['settings']['redirect_to']
27 );
28
29 return $element;
30 }
31
32 public function run( $record, $ajax_handler ) {
33 $redirect_to = $record->get_form_settings( 'redirect_to' );
34 if ( empty( $redirect_to ) ) {
35 return;
36 }
37
38 $redirect_to = $record->replace_setting_shortcodes( $redirect_to, true );
39
40 $redirect_to = esc_url_raw( $redirect_to );
41
42 if ( ! empty( $redirect_to ) && filter_var( $redirect_to, FILTER_VALIDATE_URL ) ) {
43 $ajax_handler->add_response_data( 'redirect_url', $redirect_to );
44 }
45 }
46 }
47