Completed
Branch new-admin-design (7f58b2)
by
unknown
02:54
created
core/third-party-compatibility.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * ACF compatibility
8 8
  */
9 9
 add_action(
10
-    'plugins_loaded',
11
-    function () {
12
-        if (function_exists('acf_include')) {
13
-            add_filter(
14
-                'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
17
-                        $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
-                        $ee_post_types = array_keys($ee_post_types);
19
-                        $post_types = array_merge($post_types, $ee_post_types);
20
-                        $post_types = array_unique($post_types);
21
-                    }
22
-                    return $post_types;
23
-                },
24
-                10,
25
-                2
26
-            );
27
-        }
28
-    },
29
-    100
10
+	'plugins_loaded',
11
+	function () {
12
+		if (function_exists('acf_include')) {
13
+			add_filter(
14
+				'acf/get_post_types',
15
+				function ($post_types, $args) {
16
+					if (! empty($args['show_ui'])) {
17
+						$ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
+						$ee_post_types = array_keys($ee_post_types);
19
+						$post_types = array_merge($post_types, $ee_post_types);
20
+						$post_types = array_unique($post_types);
21
+					}
22
+					return $post_types;
23
+				},
24
+				10,
25
+				2
26
+			);
27
+		}
28
+	},
29
+	100
30 30
 );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
  */
9 9
 add_action(
10 10
     'plugins_loaded',
11
-    function () {
11
+    function() {
12 12
         if (function_exists('acf_include')) {
13 13
             add_filter(
14 14
                 'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
15
+                function($post_types, $args) {
16
+                    if ( ! empty($args['show_ui'])) {
17 17
                         $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18 18
                         $ee_post_types = array_keys($ee_post_types);
19 19
                         $post_types = array_merge($post_types, $ee_post_types);
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         if (isset($input_settings['value_field_name'])) {
38 38
             $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
39
+            if ( ! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40 40
                 throw new InvalidArgumentException(
41 41
                     sprintf(
42 42
                         esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             $this
54 54
         );
55 55
         $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
56
+            ? $input_settings['html_class'].' ee-state-select-js'
57 57
             : 'ee-state-select-js';
58 58
         parent::__construct($state_options, $input_settings);
59 59
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function get_state_answer_options($state_options = null)
84 84
     {
85 85
         // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
86
+        if ( ! is_array($state_options) || empty($state_options)) {
87 87
             // get possibly cached list of states
88 88
             $states = EEM_State::instance()->get_all_active_states();
89 89
         }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
             $states = $state_options;
92 92
             $state_options = array();
93 93
         }
94
-        if (! empty($states)) {
94
+        if ( ! empty($states)) {
95 95
             // set the default
96 96
             $state_options[''][''] = '';
97 97
             foreach ($states as $state) {
98 98
                 if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
99
+                    $state_options[$state->country()->name()][$state->get($this->valueFieldName())] = $state->name();
100 100
                 }
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -12,94 +12,94 @@
 block discarded – undo
12 12
  */
13 13
 class EE_State_Select_Input extends EE_Select_Input
14 14
 {
15
-    /**
16
-     * @var string the name of the EE_State field to use for option values in the HTML form input.
17
-     */
18
-    protected $valueFieldName;
15
+	/**
16
+	 * @var string the name of the EE_State field to use for option values in the HTML form input.
17
+	 */
18
+	protected $valueFieldName;
19 19
 
20
-    /**
21
-     * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
-     * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
-     * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
-     * and $input_settings['value_field_name'] will again be used.     *
25
-     * @param array $input_settings same as parent, but also {
26
-     *   @type string $value_field_name the name of the field to use
27
-     *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
-     * }
29
-     * @throws EE_Error
30
-     * @throws InvalidArgumentException
31
-     * @throws InvalidDataTypeException
32
-     * @throws InvalidInterfaceException
33
-     * @throws ReflectionException
34
-     */
35
-    public function __construct($state_options, $input_settings = array())
36
-    {
37
-        if (isset($input_settings['value_field_name'])) {
38
-            $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
-                throw new InvalidArgumentException(
41
-                    sprintf(
42
-                        esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
-                        $this->valueFieldName()
44
-                    )
45
-                );
46
-            }
47
-        } else {
48
-            $this->valueFieldName = 'STA_ID';
49
-        }
50
-        $state_options = apply_filters(
51
-            'FHEE__EE_State_Select_Input____construct__state_options',
52
-            $this->get_state_answer_options($state_options),
53
-            $this
54
-        );
55
-        $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
57
-            : 'ee-state-select-js';
58
-        parent::__construct($state_options, $input_settings);
59
-    }
20
+	/**
21
+	 * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
+	 * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
+	 * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
+	 * and $input_settings['value_field_name'] will again be used.     *
25
+	 * @param array $input_settings same as parent, but also {
26
+	 *   @type string $value_field_name the name of the field to use
27
+	 *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
+	 * }
29
+	 * @throws EE_Error
30
+	 * @throws InvalidArgumentException
31
+	 * @throws InvalidDataTypeException
32
+	 * @throws InvalidInterfaceException
33
+	 * @throws ReflectionException
34
+	 */
35
+	public function __construct($state_options, $input_settings = array())
36
+	{
37
+		if (isset($input_settings['value_field_name'])) {
38
+			$this->valueFieldName = $input_settings['value_field_name'];
39
+			if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
+				throw new InvalidArgumentException(
41
+					sprintf(
42
+						esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
+						$this->valueFieldName()
44
+					)
45
+				);
46
+			}
47
+		} else {
48
+			$this->valueFieldName = 'STA_ID';
49
+		}
50
+		$state_options = apply_filters(
51
+			'FHEE__EE_State_Select_Input____construct__state_options',
52
+			$this->get_state_answer_options($state_options),
53
+			$this
54
+		);
55
+		$input_settings['html_class'] = isset($input_settings['html_class'])
56
+			? $input_settings['html_class'] . ' ee-state-select-js'
57
+			: 'ee-state-select-js';
58
+		parent::__construct($state_options, $input_settings);
59
+	}
60 60
 
61
-    /**
62
-     * Returns the name of the state field used for the HTML option values.
63
-     * @since 4.10.0.p
64
-     * @return string
65
-     */
66
-    public function valueFieldName()
67
-    {
68
-        return $this->valueFieldName;
69
-    }
61
+	/**
62
+	 * Returns the name of the state field used for the HTML option values.
63
+	 * @since 4.10.0.p
64
+	 * @return string
65
+	 */
66
+	public function valueFieldName()
67
+	{
68
+		return $this->valueFieldName;
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * get_state_answer_options
74
-     *
75
-     * @param array $state_options
76
-     * @return array
77
-     * @throws EE_Error
78
-     * @throws InvalidArgumentException
79
-     * @throws ReflectionException
80
-     * @throws InvalidDataTypeException
81
-     * @throws InvalidInterfaceException
82
-     */
83
-    public function get_state_answer_options($state_options = null)
84
-    {
85
-        // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
87
-            // get possibly cached list of states
88
-            $states = EEM_State::instance()->get_all_active_states();
89
-        }
90
-        if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
-            $states = $state_options;
92
-            $state_options = array();
93
-        }
94
-        if (! empty($states)) {
95
-            // set the default
96
-            $state_options[''][''] = '';
97
-            foreach ($states as $state) {
98
-                if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
-                }
101
-            }
102
-        }
103
-        return $state_options;
104
-    }
72
+	/**
73
+	 * get_state_answer_options
74
+	 *
75
+	 * @param array $state_options
76
+	 * @return array
77
+	 * @throws EE_Error
78
+	 * @throws InvalidArgumentException
79
+	 * @throws ReflectionException
80
+	 * @throws InvalidDataTypeException
81
+	 * @throws InvalidInterfaceException
82
+	 */
83
+	public function get_state_answer_options($state_options = null)
84
+	{
85
+		// if passed something that is NOT an array
86
+		if (! is_array($state_options) || empty($state_options)) {
87
+			// get possibly cached list of states
88
+			$states = EEM_State::instance()->get_all_active_states();
89
+		}
90
+		if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
+			$states = $state_options;
92
+			$state_options = array();
93
+		}
94
+		if (! empty($states)) {
95
+			// set the default
96
+			$state_options[''][''] = '';
97
+			foreach ($states as $state) {
98
+				if ($state instanceof EE_State) {
99
+					$state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
+				}
101
+			}
102
+		}
103
+		return $state_options;
104
+	}
105 105
 }
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
22 22
     {
23 23
 
24 24
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
-        if (! defined('TXN_PG_SLUG')) {
25
+        if ( ! defined('TXN_PG_SLUG')) {
26 26
             define('TXN_PG_SLUG', 'espresso_transactions');
27 27
             define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
-            define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
-            define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
-            define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
-            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
-            define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
-            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
28
+            define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions/');
29
+            define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG));
30
+            define('TXN_ASSETS_PATH', TXN_ADMIN.'assets/');
31
+            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets/'));
32
+            define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates/');
33
+            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates/'));
34 34
         }
35 35
         parent::__construct();
36 36
     }
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @Constructor
18
-     * @access public
19
-     * @return Transactions_Admin_Page_Init
20
-     */
21
-    public function __construct()
22
-    {
16
+	/**
17
+	 * @Constructor
18
+	 * @access public
19
+	 * @return Transactions_Admin_Page_Init
20
+	 */
21
+	public function __construct()
22
+	{
23 23
 
24
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
-        if (! defined('TXN_PG_SLUG')) {
26
-            define('TXN_PG_SLUG', 'espresso_transactions');
27
-            define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
-            define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
-            define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
-            define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
-            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
-            define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
-            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
34
-        }
35
-        parent::__construct();
36
-    }
24
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
+		if (! defined('TXN_PG_SLUG')) {
26
+			define('TXN_PG_SLUG', 'espresso_transactions');
27
+			define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
+			define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
+			define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
+			define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
+			define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
+			define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
+			define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
34
+		}
35
+		parent::__construct();
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     *    _set_init_properties
41
-     *
42
-     * @return void
43
-     */
44
-    protected function _set_init_properties()
45
-    {
46
-        $this->label = esc_html__('Transactions Overview', 'event_espresso');
47
-    }
39
+	/**
40
+	 *    _set_init_properties
41
+	 *
42
+	 * @return void
43
+	 */
44
+	protected function _set_init_properties()
45
+	{
46
+		$this->label = esc_html__('Transactions Overview', 'event_espresso');
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     *    _set_menu_map
52
-     *
53
-     * @return void
54
-     */
55
-    protected function _set_menu_map()
56
-    {
57
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
58
-            array(
59
-                'menu_group'      => 'main',
60
-                'menu_order'      => 50,
61
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
62
-                'parent_slug'     => 'espresso_events',
63
-                'menu_slug'       => TXN_PG_SLUG,
64
-                'menu_label'      => esc_html__('Transactions', 'event_espresso'),
65
-                'capability'      => 'ee_read_transactions',
66
-                'admin_init_page' => $this,
67
-            )
68
-        );
69
-    }
50
+	/**
51
+	 *    _set_menu_map
52
+	 *
53
+	 * @return void
54
+	 */
55
+	protected function _set_menu_map()
56
+	{
57
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
58
+			array(
59
+				'menu_group'      => 'main',
60
+				'menu_order'      => 50,
61
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
62
+				'parent_slug'     => 'espresso_events',
63
+				'menu_slug'       => TXN_PG_SLUG,
64
+				'menu_label'      => esc_html__('Transactions', 'event_espresso'),
65
+				'capability'      => 'ee_read_transactions',
66
+				'admin_init_page' => $this,
67
+			)
68
+		);
69
+	}
70 70
 }
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
     {
22 22
         // define some event categories related constants
23 23
         define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
-        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
-        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
-        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
24
+        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page='.EE_VENUES_PG_SLUG));
25
+        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL.'venues/assets/');
26
+        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES.'venues/templates/');
27 27
 
28 28
         parent::__construct();
29
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
29
+        $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/';
30 30
     }
31 31
 
32 32
     protected function _set_init_properties()
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    public function __construct()
21
-    {
22
-        // define some event categories related constants
23
-        define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
-        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
-        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
-        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
20
+	public function __construct()
21
+	{
22
+		// define some event categories related constants
23
+		define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
+		define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
+		define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
+		define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
27 27
 
28
-        parent::__construct();
29
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
30
-    }
28
+		parent::__construct();
29
+		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
30
+	}
31 31
 
32
-    protected function _set_init_properties()
33
-    {
34
-        $this->label = esc_html__('Event Venues', 'event_espresso');
35
-        $this->menu_label = esc_html__('Venues', 'event_espresso');
36
-        $this->menu_slug = EE_VENUES_PG_SLUG;
37
-    }
32
+	protected function _set_init_properties()
33
+	{
34
+		$this->label = esc_html__('Event Venues', 'event_espresso');
35
+		$this->menu_label = esc_html__('Venues', 'event_espresso');
36
+		$this->menu_slug = EE_VENUES_PG_SLUG;
37
+	}
38 38
 
39 39
 
40
-    protected function _set_menu_map()
41
-    {
42
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
43
-            array(
44
-                'menu_group'      => 'management',
45
-                'menu_order'      => 40,
46
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
47
-                'parent_slug'     => 'espresso_events',
48
-                'menu_slug'       => EE_VENUES_PG_SLUG,
49
-                'menu_label'      => esc_html__('Venues', 'event_espresso'),
50
-                'capability'      => 'ee_read_venues',
51
-                'admin_init_page' => $this,
52
-            )
53
-        );
54
-    }
40
+	protected function _set_menu_map()
41
+	{
42
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
43
+			array(
44
+				'menu_group'      => 'management',
45
+				'menu_order'      => 40,
46
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
47
+				'parent_slug'     => 'espresso_events',
48
+				'menu_slug'       => EE_VENUES_PG_SLUG,
49
+				'menu_label'      => esc_html__('Venues', 'event_espresso'),
50
+				'capability'      => 'ee_read_venues',
51
+				'admin_init_page' => $this,
52
+			)
53
+		);
54
+	}
55 55
 }
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 
25 25
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26 26
 
27
-        if (! defined('EE_MSG_PG_SLUG')) {
27
+        if ( ! defined('EE_MSG_PG_SLUG')) {
28 28
             define('EE_MSG_PG_SLUG', 'espresso_messages');
29 29
             define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
30
-            define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
31
-            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
32
-            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
33
-            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
34
-            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
35
-            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
30
+            define('EE_MSG_ADMIN', EE_ADMIN_PAGES.'messages/');
31
+            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page='.EE_MSG_PG_SLUG));
32
+            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN.'assets/');
33
+            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL.'messages/assets/');
34
+            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN.'templates/');
35
+            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'messages/templates/');
36 36
         }
37 37
 
38 38
         parent::__construct();
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,52 +13,52 @@
 block discarded – undo
13 13
  */
14 14
 class Messages_Admin_Page_Init extends EE_Admin_Page_Init
15 15
 {
16
-    /**
17
-     *constructor
18
-     *
19
-     * @Constructor
20
-     * @access public
21
-     * @return void
22
-     */
23
-    public function __construct()
24
-    {
16
+	/**
17
+	 *constructor
18
+	 *
19
+	 * @Constructor
20
+	 * @access public
21
+	 * @return void
22
+	 */
23
+	public function __construct()
24
+	{
25 25
 
26
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
27 27
 
28
-        if (! defined('EE_MSG_PG_SLUG')) {
29
-            define('EE_MSG_PG_SLUG', 'espresso_messages');
30
-            define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
31
-            define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
32
-            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
33
-            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
34
-            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
35
-            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
36
-            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
37
-        }
28
+		if (! defined('EE_MSG_PG_SLUG')) {
29
+			define('EE_MSG_PG_SLUG', 'espresso_messages');
30
+			define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
31
+			define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
32
+			define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
33
+			define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
34
+			define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
35
+			define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
36
+			define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
37
+		}
38 38
 
39
-        parent::__construct();
40
-    }
39
+		parent::__construct();
40
+	}
41 41
 
42 42
 
43
-    protected function _set_init_properties()
44
-    {
45
-        $this->label = esc_html__('Messages System', 'event_espresso');
46
-    }
43
+	protected function _set_init_properties()
44
+	{
45
+		$this->label = esc_html__('Messages System', 'event_espresso');
46
+	}
47 47
 
48 48
 
49
-    protected function _set_menu_map()
50
-    {
51
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
52
-            array(
53
-                'menu_group'      => 'management',
54
-                'menu_order'      => 10,
55
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
56
-                'parent_slug'     => 'espresso_events',
57
-                'menu_slug'       => EE_MSG_PG_SLUG,
58
-                'menu_label'      => esc_html__('Messages', 'event_espresso'),
59
-                'capability'      => 'ee_read_global_messages',
60
-                'admin_init_page' => $this,
61
-            )
62
-        );
63
-    }
49
+	protected function _set_menu_map()
50
+	{
51
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
52
+			array(
53
+				'menu_group'      => 'management',
54
+				'menu_order'      => 10,
55
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
56
+				'parent_slug'     => 'espresso_events',
57
+				'menu_slug'       => EE_MSG_PG_SLUG,
58
+				'menu_label'      => esc_html__('Messages', 'event_espresso'),
59
+				'capability'      => 'ee_read_global_messages',
60
+				'admin_init_page' => $this,
61
+			)
62
+		);
63
+	}
64 64
 }
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
     public function __construct()
24 24
     {
25 25
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
-        if (! defined('REG_PG_SLUG')) {
26
+        if ( ! defined('REG_PG_SLUG')) {
27 27
             define('REG_PG_SLUG', 'espresso_registrations');
28 28
             define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
29
-            define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
30
-            define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
31
-            define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
32
-            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
33
-            define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
34
-            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
29
+            define('REG_ADMIN', EE_ADMIN_PAGES.'registrations/');
30
+            define('REG_ADMIN_URL', admin_url('admin.php?page='.REG_PG_SLUG));
31
+            define('REG_ASSETS_PATH', REG_ADMIN.'assets/');
32
+            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL.'registrations/assets/');
33
+            define('REG_TEMPLATE_PATH', REG_ADMIN.'templates/');
34
+            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registrations/templates/');
35 35
         }
36 36
 
37 37
         parent::__construct();
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,50 +13,50 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     *        constructor
18
-     *
19
-     * @Constructor
20
-     * @access public
21
-     * @return void
22
-     */
23
-    public function __construct()
24
-    {
25
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
-        if (! defined('REG_PG_SLUG')) {
27
-            define('REG_PG_SLUG', 'espresso_registrations');
28
-            define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
29
-            define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
30
-            define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
31
-            define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
32
-            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
33
-            define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
34
-            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
35
-        }
36
-
37
-        parent::__construct();
38
-    }
39
-
40
-
41
-    protected function _set_init_properties()
42
-    {
43
-        $this->label = esc_html__('Registrations Overview', 'event_espresso');
44
-    }
45
-
46
-
47
-    protected function _set_menu_map()
48
-    {
49
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
50
-            array(
51
-                'menu_group'      => 'main',
52
-                'menu_order'      => 40,
53
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
54
-                'parent_slug'     => 'espresso_events',
55
-                'menu_slug'       => REG_PG_SLUG,
56
-                'menu_label'      => esc_html__('Registrations', 'event_espresso'),
57
-                'capability'      => 'ee_read_registrations',
58
-                'admin_init_page' => $this,
59
-            )
60
-        );
61
-    }
16
+	/**
17
+	 *        constructor
18
+	 *
19
+	 * @Constructor
20
+	 * @access public
21
+	 * @return void
22
+	 */
23
+	public function __construct()
24
+	{
25
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
+		if (! defined('REG_PG_SLUG')) {
27
+			define('REG_PG_SLUG', 'espresso_registrations');
28
+			define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
29
+			define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
30
+			define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
31
+			define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
32
+			define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
33
+			define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
34
+			define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
35
+		}
36
+
37
+		parent::__construct();
38
+	}
39
+
40
+
41
+	protected function _set_init_properties()
42
+	{
43
+		$this->label = esc_html__('Registrations Overview', 'event_espresso');
44
+	}
45
+
46
+
47
+	protected function _set_menu_map()
48
+	{
49
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
50
+			array(
51
+				'menu_group'      => 'main',
52
+				'menu_order'      => 40,
53
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
54
+				'parent_slug'     => 'espresso_events',
55
+				'menu_slug'       => REG_PG_SLUG,
56
+				'menu_label'      => esc_html__('Registrations', 'event_espresso'),
57
+				'capability'      => 'ee_read_registrations',
58
+				'admin_init_page' => $this,
59
+			)
60
+		);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
payment_methods/Paypal_Express/EE_PMT_Paypal_Express.pm.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -15,89 +15,89 @@
 block discarded – undo
15 15
 class EE_PMT_Paypal_Express extends EE_PMT_Base
16 16
 {
17 17
 
18
-    /**
19
-     * EE_PMT_Paypal_Express constructor.
20
-     */
21
-    public function __construct($pm_instance = null)
22
-    {
23
-        require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php');
24
-        $this->_gateway = new EEG_Paypal_Express();
18
+	/**
19
+	 * EE_PMT_Paypal_Express constructor.
20
+	 */
21
+	public function __construct($pm_instance = null)
22
+	{
23
+		require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php');
24
+		$this->_gateway = new EEG_Paypal_Express();
25 25
 
26
-        $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso');
27
-        $this->_template_path = $this->file_folder() . 'templates/';
28
-        $this->_default_description = esc_html__(
29
-            // @codingStandardsIgnoreStart
30
-            'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.',
31
-            // @codingStandardsIgnoreEnd
32
-            'event_espresso'
33
-        );
34
-        $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png';
26
+		$this->_pretty_name = esc_html__('PayPal Express', 'event_espresso');
27
+		$this->_template_path = $this->file_folder() . 'templates/';
28
+		$this->_default_description = esc_html__(
29
+			// @codingStandardsIgnoreStart
30
+			'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.',
31
+			// @codingStandardsIgnoreEnd
32
+			'event_espresso'
33
+		);
34
+		$this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png';
35 35
 
36
-        parent::__construct($pm_instance);
37
-    }
36
+		parent::__construct($pm_instance);
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * Adds the help tab.
42
-     *
43
-     * @see EE_PMT_Base::help_tabs_config()
44
-     * @return array
45
-     */
46
-    public function help_tabs_config()
47
-    {
48
-        return array(
49
-            $this->get_help_tab_name() => array(
50
-                'title'    => esc_html__('PayPal Express Settings', 'event_espresso'),
51
-                'filename' => 'payment_methods_overview_paypal_express'
52
-            )
53
-        );
54
-    }
40
+	/**
41
+	 * Adds the help tab.
42
+	 *
43
+	 * @see EE_PMT_Base::help_tabs_config()
44
+	 * @return array
45
+	 */
46
+	public function help_tabs_config()
47
+	{
48
+		return array(
49
+			$this->get_help_tab_name() => array(
50
+				'title'    => esc_html__('PayPal Express Settings', 'event_espresso'),
51
+				'filename' => 'payment_methods_overview_paypal_express'
52
+			)
53
+		);
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * Gets the form for all the settings related to this payment method type.
59
-     *
60
-     * @return EE_Payment_Method_Form
61
-     */
62
-    public function generate_new_settings_form()
63
-    {
64
-        return new SettingsForm(array(), $this->get_help_tab_link());
65
-    }
57
+	/**
58
+	 * Gets the form for all the settings related to this payment method type.
59
+	 *
60
+	 * @return EE_Payment_Method_Form
61
+	 */
62
+	public function generate_new_settings_form()
63
+	{
64
+		return new SettingsForm(array(), $this->get_help_tab_link());
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * Creates a billing form for this payment method type.
70
-     *
71
-     * @param \EE_Transaction $transaction
72
-     * @return \EE_Billing_Info_Form
73
-     */
74
-    public function generate_new_billing_form(EE_Transaction $transaction = null)
75
-    {
76
-        if ($this->_pm_instance->debug_mode()) {
77
-            $form = new EE_Billing_Info_Form(
78
-                $this->_pm_instance,
79
-                array(
80
-                    'name' => 'paypal_express_Info_Form',
81
-                    'subsections' => array(
82
-                        'paypal_express_debug_info' => new EE_Form_Section_Proper(
83
-                            array(
84
-                                'layout_strategy' => new EE_Template_Layout(
85
-                                    array(
86
-                                        'layout_template_file' => $this->_template_path
87
-                                                                    . 'paypal_express_debug_info.template.php',
88
-                                        'template_args'        => array(
89
-                                            'debug_mode' => $this->_pm_instance->debug_mode()
90
-                                        )
91
-                                    )
92
-                                )
93
-                            )
94
-                        )
95
-                    )
96
-                )
97
-            );
98
-            return $form;
99
-        }
68
+	/**
69
+	 * Creates a billing form for this payment method type.
70
+	 *
71
+	 * @param \EE_Transaction $transaction
72
+	 * @return \EE_Billing_Info_Form
73
+	 */
74
+	public function generate_new_billing_form(EE_Transaction $transaction = null)
75
+	{
76
+		if ($this->_pm_instance->debug_mode()) {
77
+			$form = new EE_Billing_Info_Form(
78
+				$this->_pm_instance,
79
+				array(
80
+					'name' => 'paypal_express_Info_Form',
81
+					'subsections' => array(
82
+						'paypal_express_debug_info' => new EE_Form_Section_Proper(
83
+							array(
84
+								'layout_strategy' => new EE_Template_Layout(
85
+									array(
86
+										'layout_template_file' => $this->_template_path
87
+																	. 'paypal_express_debug_info.template.php',
88
+										'template_args'        => array(
89
+											'debug_mode' => $this->_pm_instance->debug_mode()
90
+										)
91
+									)
92
+								)
93
+							)
94
+						)
95
+					)
96
+				)
97
+			);
98
+			return $form;
99
+		}
100 100
 
101
-        return false;
102
-    }
101
+		return false;
102
+	}
103 103
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct($pm_instance = null)
22 22
     {
23
-        require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php');
23
+        require_once($this->file_folder().'EEG_Paypal_Express.gateway.php');
24 24
         $this->_gateway = new EEG_Paypal_Express();
25 25
 
26 26
         $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso');
27
-        $this->_template_path = $this->file_folder() . 'templates/';
27
+        $this->_template_path = $this->file_folder().'templates/';
28 28
         $this->_default_description = esc_html__(
29 29
             // @codingStandardsIgnoreStart
30 30
             'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.',
31 31
             // @codingStandardsIgnoreEnd
32 32
             'event_espresso'
33 33
         );
34
-        $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png';
34
+        $this->_default_button_url = $this->file_url().'lib/paypal-express-checkout-logo-gold-160.png';
35 35
 
36 36
         parent::__construct($pm_instance);
37 37
     }
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function __construct($routing = true)
21 21
     {
22
-        define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form/');
23
-        define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets/');
24
-        define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/');
25
-        define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates/');
26
-        define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/');
22
+        define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form/');
23
+        define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets/');
24
+        define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
25
+        define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates/');
26
+        define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
27 27
         parent::__construct($routing);
28 28
     }
29 29
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     {
363 363
         wp_register_script(
364 364
             'ee-question-sortable',
365
-            REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js',
365
+            REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js',
366 366
             array('jquery-ui-sortable'),
367 367
             EVENT_ESPRESSO_VERSION,
368 368
             true
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     protected function _questions_overview_list_table()
450 450
     {
451
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
451
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
452 452
             'add_question',
453 453
             'add_question',
454 454
             array(),
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     protected function _question_groups_overview_list_table()
470 470
     {
471 471
         $this->_search_btn_label = esc_html__('Question Groups', 'event_espresso');
472
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
472
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
473 473
             'add_question_group',
474 474
             'add_question_group',
475 475
             array(),
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
     {
532 532
         $success = 0;
533 533
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
534
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
534
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
535 535
             // if array has more than one element than success message should be plural
536 536
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
537 537
             // cycle thru bulk action checkboxes
538 538
             while (list($ID, $value) = each($this->_req_data['checkbox'])) {
539
-                if (! $this->_delete_item($ID, $model)) {
539
+                if ( ! $this->_delete_item($ID, $model)) {
540 540
                     $success = 0;
541 541
                 }
542 542
             }
543
-        } elseif (! empty($this->_req_data['QSG_ID'])) {
543
+        } elseif ( ! empty($this->_req_data['QSG_ID'])) {
544 544
             $success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
545
-        } elseif (! empty($this->_req_data['QST_ID'])) {
545
+        } elseif ( ! empty($this->_req_data['QST_ID'])) {
546 546
             $success = $this->_delete_item($this->_req_data['QST_ID'], $model);
547 547
         } else {
548 548
             EE_Error::add_error(
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                 $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
612 612
         }
613 613
         // add ID to title if editing
614
-        $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
614
+        $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
615 615
         if ($ID) {
616 616
             /** @var EE_Question_Group $questionGroup */
617 617
             $questionGroup = $this->_question_group_model->get_one_by_ID($ID);
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
         $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
632 632
         $this->_set_publish_post_box_vars('id', $ID, false, $redirect_URL);
633 633
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
634
-            REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php',
634
+            REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php',
635 635
             $this->_template_args,
636 636
             true
637 637
         );
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         // update the existing related questions
710 710
         // BUT FIRST...  delete the phone question from the Question_Group_Question
711 711
         // if it is being added to this question group (therefore removed from the existing group)
712
-        if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ])) {
712
+        if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
713 713
             // delete where QST ID = system phone question ID and Question Group ID is NOT this group
714 714
             EEM_Question_Group_Question::instance()->delete(
715 715
                 array(
@@ -724,22 +724,22 @@  discard block
 block discarded – undo
724 724
         $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
725 725
         $questions = $question_group->questions();
726 726
         // make sure system phone question is added to list of questions for this group
727
-        if (! isset($questions[ $phone_question_id ])) {
728
-            $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
727
+        if ( ! isset($questions[$phone_question_id])) {
728
+            $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
729 729
         }
730 730
 
731 731
         foreach ($questions as $question_ID => $question) {
732 732
             // first we always check for order.
733
-            if (! empty($this->_req_data['question_orders'][ $question_ID ])) {
733
+            if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
734 734
                 // update question order
735 735
                 $question_group->update_question_order(
736 736
                     $question_ID,
737
-                    $this->_req_data['question_orders'][ $question_ID ]
737
+                    $this->_req_data['question_orders'][$question_ID]
738 738
                 );
739 739
             }
740 740
 
741 741
             // then we always check if adding or removing.
742
-            if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ])) {
742
+            if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
743 743
                 $question_group->add_question($question_ID);
744 744
             } else {
745 745
                 // not found, remove it (but only if not a system question for the personal group
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
         if (isset($this->_req_data['questions'])) {
761 761
             foreach ($this->_req_data['questions'] as $QST_ID) {
762 762
                 $question_group->add_question($QST_ID);
763
-                if (isset($this->_req_data['question_orders'][ $QST_ID ])) {
764
-                    $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][ $QST_ID ]);
763
+                if (isset($this->_req_data['question_orders'][$QST_ID])) {
764
+                    $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
765 765
                 }
766 766
             }
767 767
         }
@@ -902,33 +902,33 @@  discard block
 block discarded – undo
902 902
         // echo "trash $trash";
903 903
         // var_dump($this->_req_data['checkbox']);die;
904 904
         if (isset($this->_req_data['checkbox'])) {
905
-            if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
905
+            if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
906 906
                 // if array has more than one element than success message should be plural
907 907
                 $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
908 908
                 // cycle thru bulk action checkboxes
909 909
                 while (list($ID, $value) = each($this->_req_data['checkbox'])) {
910
-                    if (! $model->delete_or_restore_by_ID($trash, absint($ID))) {
910
+                    if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
911 911
                         $success = 0;
912 912
                     }
913 913
                 }
914 914
             } else {
915 915
                 // grab single id and delete
916 916
                 $ID = absint($this->_req_data['checkbox']);
917
-                if (! $model->delete_or_restore_by_ID($trash, $ID)) {
917
+                if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
918 918
                     $success = 0;
919 919
                 }
920 920
             }
921 921
         } else {
922 922
             // delete via trash link
923 923
             // grab single id and delete
924
-            $ID = absint($this->_req_data[ $model->primary_key_name() ]);
925
-            if (! $model->delete_or_restore_by_ID($trash, $ID)) {
924
+            $ID = absint($this->_req_data[$model->primary_key_name()]);
925
+            if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
926 926
                 $success = 0;
927 927
             }
928 928
         }
929 929
 
930 930
 
931
-        $action = $model instanceof EEM_Question ? 'default' : 'question_groups';// strtolower( $model->item_name(2) );
931
+        $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; // strtolower( $model->item_name(2) );
932 932
         // echo "action :$action";
933 933
         // $action = 'questions' ? 'default' : $action;
934 934
         if ($trash) {
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
             ? (int) $this->_req_data['curpage']
1049 1049
             : null;
1050 1050
 
1051
-        if (! empty($row_ids)) {
1051
+        if ( ! empty($row_ids)) {
1052 1052
             // figure out where we start the row_id count at for the current page.
1053 1053
             $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
1054 1054
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
                 // Update the questions when re-ordering
1058 1058
                 $updated = EEM_Question_Group::instance()->update(
1059 1059
                     array('QSG_order' => $qsgcount),
1060
-                    array(array('QSG_ID' => $row_ids[ $i ]))
1060
+                    array(array('QSG_ID' => $row_ids[$i]))
1061 1061
                 );
1062 1062
                 if ($updated === false) {
1063 1063
                     $success = false;
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         $this->_set_add_edit_form_tags('update_reg_form_settings');
1104 1104
         $this->_set_publish_post_box_vars(null, false, false, null, false);
1105 1105
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
1106
-            REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
1106
+            REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
1107 1107
             $this->_template_args,
1108 1108
             true
1109 1109
         );
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
                                 $prev_email_validation_level = 'basic';
1241 1241
                             }
1242 1242
                             // confirm our i18n email validation will work on the server
1243
-                            if (! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1243
+                            if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1244 1244
                                 // or reset email validation level to previous value
1245 1245
                                 $email_validation_level = $prev_email_validation_level;
1246 1246
                             }
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
     private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1287 1287
     {
1288 1288
         // first check that PCRE is enabled
1289
-        if (! defined('PREG_BAD_UTF8_ERROR')) {
1289
+        if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1290 1290
             EE_Error::add_error(
1291 1291
                 sprintf(
1292 1292
                     esc_html__(
Please login to merge, or discard this patch.
Indentation   +1429 added lines, -1429 removed lines patch added patch discarded remove patch
@@ -14,1433 +14,1433 @@
 block discarded – undo
14 14
 class Extend_Registration_Form_Admin_Page extends Registration_Form_Admin_Page
15 15
 {
16 16
 
17
-    /**
18
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
19
-     */
20
-    public function __construct($routing = true)
21
-    {
22
-        define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form/');
23
-        define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets/');
24
-        define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/');
25
-        define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates/');
26
-        define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/');
27
-        parent::__construct($routing);
28
-    }
29
-
30
-
31
-    /**
32
-     * @return void
33
-     */
34
-    protected function _extend_page_config()
35
-    {
36
-        $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
37
-        $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID'])
38
-            ? $this->_req_data['QST_ID'] : 0;
39
-        $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID'])
40
-            ? $this->_req_data['QSG_ID'] : 0;
41
-
42
-        $new_page_routes = array(
43
-            'question_groups'    => array(
44
-                'func'       => '_question_groups_overview_list_table',
45
-                'capability' => 'ee_read_question_groups',
46
-            ),
47
-            'add_question'       => array(
48
-                'func'       => '_edit_question',
49
-                'capability' => 'ee_edit_questions',
50
-            ),
51
-            'insert_question'    => array(
52
-                'func'       => '_insert_or_update_question',
53
-                'args'       => array('new_question' => true),
54
-                'capability' => 'ee_edit_questions',
55
-                'noheader'   => true,
56
-            ),
57
-            'duplicate_question' => array(
58
-                'func'       => '_duplicate_question',
59
-                'capability' => 'ee_edit_questions',
60
-                'noheader'   => true,
61
-            ),
62
-            'trash_question'     => array(
63
-                'func'       => '_trash_question',
64
-                'capability' => 'ee_delete_question',
65
-                'obj_id'     => $qst_id,
66
-                'noheader'   => true,
67
-            ),
68
-
69
-            'restore_question' => array(
70
-                'func'       => '_trash_or_restore_questions',
71
-                'capability' => 'ee_delete_question',
72
-                'obj_id'     => $qst_id,
73
-                'args'       => array('trash' => false),
74
-                'noheader'   => true,
75
-            ),
76
-
77
-            'delete_question' => array(
78
-                'func'       => '_delete_question',
79
-                'capability' => 'ee_delete_question',
80
-                'obj_id'     => $qst_id,
81
-                'noheader'   => true,
82
-            ),
83
-
84
-            'trash_questions' => array(
85
-                'func'       => '_trash_or_restore_questions',
86
-                'capability' => 'ee_delete_questions',
87
-                'args'       => array('trash' => true),
88
-                'noheader'   => true,
89
-            ),
90
-
91
-            'restore_questions' => array(
92
-                'func'       => '_trash_or_restore_questions',
93
-                'capability' => 'ee_delete_questions',
94
-                'args'       => array('trash' => false),
95
-                'noheader'   => true,
96
-            ),
97
-
98
-            'delete_questions' => array(
99
-                'func'       => '_delete_questions',
100
-                'args'       => array(),
101
-                'capability' => 'ee_delete_questions',
102
-                'noheader'   => true,
103
-            ),
104
-
105
-            'add_question_group' => array(
106
-                'func'       => '_edit_question_group',
107
-                'capability' => 'ee_edit_question_groups',
108
-            ),
109
-
110
-            'edit_question_group' => array(
111
-                'func'       => '_edit_question_group',
112
-                'capability' => 'ee_edit_question_group',
113
-                'obj_id'     => $qsg_id,
114
-                'args'       => array('edit'),
115
-            ),
116
-
117
-            'delete_question_groups' => array(
118
-                'func'       => '_delete_question_groups',
119
-                'capability' => 'ee_delete_question_groups',
120
-                'noheader'   => true,
121
-            ),
122
-
123
-            'delete_question_group' => array(
124
-                'func'       => '_delete_question_groups',
125
-                'capability' => 'ee_delete_question_group',
126
-                'obj_id'     => $qsg_id,
127
-                'noheader'   => true,
128
-            ),
129
-
130
-            'trash_question_group' => array(
131
-                'func'       => '_trash_or_restore_question_groups',
132
-                'args'       => array('trash' => true),
133
-                'capability' => 'ee_delete_question_group',
134
-                'obj_id'     => $qsg_id,
135
-                'noheader'   => true,
136
-            ),
137
-
138
-            'restore_question_group' => array(
139
-                'func'       => '_trash_or_restore_question_groups',
140
-                'args'       => array('trash' => false),
141
-                'capability' => 'ee_delete_question_group',
142
-                'obj_id'     => $qsg_id,
143
-                'noheader'   => true,
144
-            ),
145
-
146
-            'insert_question_group' => array(
147
-                'func'       => '_insert_or_update_question_group',
148
-                'args'       => array('new_question_group' => true),
149
-                'capability' => 'ee_edit_question_groups',
150
-                'noheader'   => true,
151
-            ),
152
-
153
-            'update_question_group' => array(
154
-                'func'       => '_insert_or_update_question_group',
155
-                'args'       => array('new_question_group' => false),
156
-                'capability' => 'ee_edit_question_group',
157
-                'obj_id'     => $qsg_id,
158
-                'noheader'   => true,
159
-            ),
160
-
161
-            'trash_question_groups' => array(
162
-                'func'       => '_trash_or_restore_question_groups',
163
-                'args'       => array('trash' => true),
164
-                'capability' => 'ee_delete_question_groups',
165
-                'noheader'   => array('trash' => false),
166
-            ),
167
-
168
-            'restore_question_groups' => array(
169
-                'func'       => '_trash_or_restore_question_groups',
170
-                'args'       => array('trash' => false),
171
-                'capability' => 'ee_delete_question_groups',
172
-                'noheader'   => true,
173
-            ),
174
-
175
-
176
-            'espresso_update_question_group_order' => array(
177
-                'func'       => 'update_question_group_order',
178
-                'capability' => 'ee_edit_question_groups',
179
-                'noheader'   => true,
180
-            ),
181
-
182
-            'view_reg_form_settings' => array(
183
-                'func'       => '_reg_form_settings',
184
-                'capability' => 'manage_options',
185
-            ),
186
-
187
-            'update_reg_form_settings' => array(
188
-                'func'       => '_update_reg_form_settings',
189
-                'capability' => 'manage_options',
190
-                'noheader'   => true,
191
-            ),
192
-        );
193
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
194
-
195
-        $new_page_config = array(
196
-
197
-            'question_groups' => array(
198
-                'nav'           => array(
199
-                    'label' => esc_html__('Question Groups', 'event_espresso'),
200
-                    'order' => 20,
201
-                ),
202
-                'list_table'    => 'Registration_Form_Question_Groups_Admin_List_Table',
203
-                'help_tabs'     => array(
204
-                    'registration_form_question_groups_help_tab'                           => array(
205
-                        'title'    => esc_html__('Question Groups', 'event_espresso'),
206
-                        'filename' => 'registration_form_question_groups',
207
-                    ),
208
-                    'registration_form_question_groups_table_column_headings_help_tab'     => array(
209
-                        'title'    => esc_html__('Question Groups Table Column Headings', 'event_espresso'),
210
-                        'filename' => 'registration_form_question_groups_table_column_headings',
211
-                    ),
212
-                    'registration_form_question_groups_views_bulk_actions_search_help_tab' => array(
213
-                        'title'    => esc_html__('Question Groups Views & Bulk Actions & Search', 'event_espresso'),
214
-                        'filename' => 'registration_form_question_groups_views_bulk_actions_search',
215
-                    ),
216
-                ),
217
-                'metaboxes'     => $this->_default_espresso_metaboxes,
218
-                'require_nonce' => false,
219
-            ),
220
-
221
-            'add_question' => array(
222
-                'nav'           => array(
223
-                    'label'      => esc_html__('Add Question', 'event_espresso'),
224
-                    'order'      => 5,
225
-                    'persistent' => false,
226
-                ),
227
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
228
-                'help_tabs'     => array(
229
-                    'registration_form_add_question_help_tab' => array(
230
-                        'title'    => esc_html__('Add Question', 'event_espresso'),
231
-                        'filename' => 'registration_form_add_question',
232
-                    ),
233
-                ),
234
-                'require_nonce' => false,
235
-            ),
236
-
237
-            'add_question_group' => array(
238
-                'nav'           => array(
239
-                    'label'      => esc_html__('Add Question Group', 'event_espresso'),
240
-                    'order'      => 5,
241
-                    'persistent' => false,
242
-                ),
243
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
244
-                'help_tabs'     => array(
245
-                    'registration_form_add_question_group_help_tab' => array(
246
-                        'title'    => esc_html__('Add Question Group', 'event_espresso'),
247
-                        'filename' => 'registration_form_add_question_group',
248
-                    ),
249
-                ),
250
-                'require_nonce' => false,
251
-            ),
252
-
253
-            'edit_question_group' => array(
254
-                'nav'           => array(
255
-                    'label'      => esc_html__('Edit Question Group', 'event_espresso'),
256
-                    'order'      => 5,
257
-                    'persistent' => false,
258
-                    'url'        => isset($this->_req_data['question_group_id']) ? add_query_arg(
259
-                        array('question_group_id' => $this->_req_data['question_group_id']),
260
-                        $this->_current_page_view_url
261
-                    ) : $this->_admin_base_url,
262
-                ),
263
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
264
-                'help_tabs'     => array(
265
-                    'registration_form_edit_question_group_help_tab' => array(
266
-                        'title'    => esc_html__('Edit Question Group', 'event_espresso'),
267
-                        'filename' => 'registration_form_edit_question_group',
268
-                    ),
269
-                ),
270
-                'require_nonce' => false,
271
-            ),
272
-
273
-            'view_reg_form_settings' => array(
274
-                'nav'           => array(
275
-                    'label' => esc_html__('Reg Form Settings', 'event_espresso'),
276
-                    'order' => 40,
277
-                ),
278
-                'labels'        => array(
279
-                    'publishbox' => esc_html__('Update Settings', 'event_espresso'),
280
-                ),
281
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
282
-                'help_tabs'     => array(
283
-                    'registration_form_reg_form_settings_help_tab' => array(
284
-                        'title'    => esc_html__('Registration Form Settings', 'event_espresso'),
285
-                        'filename' => 'registration_form_reg_form_settings',
286
-                    ),
287
-                ),
288
-                'require_nonce' => false,
289
-            ),
290
-
291
-        );
292
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
293
-
294
-        // change the list table we're going to use so it's the NEW list table!
295
-        $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
296
-
297
-
298
-        // additional labels
299
-        $new_labels = array(
300
-            'add_question'          => esc_html__('Add New Question', 'event_espresso'),
301
-            'delete_question'       => esc_html__('Delete Question', 'event_espresso'),
302
-            'add_question_group'    => esc_html__('Add New Question Group', 'event_espresso'),
303
-            'edit_question_group'   => esc_html__('Edit Question Group', 'event_espresso'),
304
-            'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
305
-        );
306
-        $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
307
-    }
308
-
309
-
310
-    /**
311
-     * @return void
312
-     */
313
-    protected function _ajax_hooks()
314
-    {
315
-        add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
316
-    }
317
-
318
-
319
-    /**
320
-     * @return void
321
-     */
322
-    public function load_scripts_styles_question_groups()
323
-    {
324
-        wp_enqueue_script('espresso_ajax_table_sorting');
325
-    }
326
-
327
-
328
-    /**
329
-     * @return void
330
-     */
331
-    public function load_scripts_styles_add_question_group()
332
-    {
333
-        $this->load_scripts_styles_forms();
334
-        $this->load_sortable_question_script();
335
-    }
336
-
337
-
338
-    /**
339
-     * @return void
340
-     */
341
-    public function load_scripts_styles_edit_question_group()
342
-    {
343
-        $this->load_scripts_styles_forms();
344
-        $this->load_sortable_question_script();
345
-    }
346
-
347
-
348
-    /**
349
-     * registers and enqueues script for questions
350
-     *
351
-     * @return void
352
-     */
353
-    public function load_sortable_question_script()
354
-    {
355
-        wp_register_script(
356
-            'ee-question-sortable',
357
-            REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js',
358
-            array('jquery-ui-sortable'),
359
-            EVENT_ESPRESSO_VERSION,
360
-            true
361
-        );
362
-        wp_enqueue_script('ee-question-sortable');
363
-    }
364
-
365
-
366
-    /**
367
-     * @return void
368
-     */
369
-    protected function _set_list_table_views_default()
370
-    {
371
-        $this->_views = array(
372
-            'all' => array(
373
-                'slug'        => 'all',
374
-                'label'       => esc_html__('View All Questions', 'event_espresso'),
375
-                'count'       => 0,
376
-                'bulk_action' => array(
377
-                    'trash_questions' => esc_html__('Trash', 'event_espresso'),
378
-                ),
379
-            ),
380
-        );
381
-
382
-        if (
383
-            EE_Registry::instance()->CAP->current_user_can(
384
-                'ee_delete_questions',
385
-                'espresso_registration_form_trash_questions'
386
-            )
387
-        ) {
388
-            $this->_views['trash'] = array(
389
-                'slug'        => 'trash',
390
-                'label'       => esc_html__('Trash', 'event_espresso'),
391
-                'count'       => 0,
392
-                'bulk_action' => array(
393
-                    'delete_questions'  => esc_html__('Delete Permanently', 'event_espresso'),
394
-                    'restore_questions' => esc_html__('Restore', 'event_espresso'),
395
-                ),
396
-            );
397
-        }
398
-    }
399
-
400
-
401
-    /**
402
-     * @return void
403
-     */
404
-    protected function _set_list_table_views_question_groups()
405
-    {
406
-        $this->_views = array(
407
-            'all' => array(
408
-                'slug'        => 'all',
409
-                'label'       => esc_html__('All', 'event_espresso'),
410
-                'count'       => 0,
411
-                'bulk_action' => array(
412
-                    'trash_question_groups' => esc_html__('Trash', 'event_espresso'),
413
-                ),
414
-            ),
415
-        );
416
-
417
-        if (
418
-            EE_Registry::instance()->CAP->current_user_can(
419
-                'ee_delete_question_groups',
420
-                'espresso_registration_form_trash_question_groups'
421
-            )
422
-        ) {
423
-            $this->_views['trash'] = array(
424
-                'slug'        => 'trash',
425
-                'label'       => esc_html__('Trash', 'event_espresso'),
426
-                'count'       => 0,
427
-                'bulk_action' => array(
428
-                    'delete_question_groups'  => esc_html__('Delete Permanently', 'event_espresso'),
429
-                    'restore_question_groups' => esc_html__('Restore', 'event_espresso'),
430
-                ),
431
-            );
432
-        }
433
-    }
434
-
435
-
436
-    /**
437
-     * @return void
438
-     * @throws EE_Error
439
-     * @throws InvalidArgumentException
440
-     * @throws InvalidDataTypeException
441
-     * @throws InvalidInterfaceException
442
-     */
443
-    protected function _questions_overview_list_table()
444
-    {
445
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
446
-            'add_question',
447
-            'add_question',
448
-            array(),
449
-            'add-new-h2'
450
-        );
451
-        parent::_questions_overview_list_table();
452
-    }
453
-
454
-
455
-    /**
456
-     * @return void
457
-     * @throws DomainException
458
-     * @throws EE_Error
459
-     * @throws InvalidArgumentException
460
-     * @throws InvalidDataTypeException
461
-     * @throws InvalidInterfaceException
462
-     */
463
-    protected function _question_groups_overview_list_table()
464
-    {
465
-        $this->_search_btn_label = esc_html__('Question Groups', 'event_espresso');
466
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
467
-            'add_question_group',
468
-            'add_question_group',
469
-            array(),
470
-            'add-new-h2'
471
-        );
472
-        $this->display_admin_list_table_page_with_sidebar();
473
-    }
474
-
475
-
476
-    /**
477
-     * @return void
478
-     * @throws EE_Error
479
-     * @throws InvalidArgumentException
480
-     * @throws InvalidDataTypeException
481
-     * @throws InvalidInterfaceException
482
-     */
483
-    protected function _delete_question()
484
-    {
485
-        $success = $this->_delete_items($this->_question_model);
486
-        $this->_redirect_after_action(
487
-            $success,
488
-            $this->_question_model->item_name($success),
489
-            'deleted',
490
-            array('action' => 'default', 'status' => 'all')
491
-        );
492
-    }
493
-
494
-
495
-    /**
496
-     * @return void
497
-     * @throws EE_Error
498
-     * @throws InvalidArgumentException
499
-     * @throws InvalidDataTypeException
500
-     * @throws InvalidInterfaceException
501
-     */
502
-    protected function _delete_questions()
503
-    {
504
-        $success = $this->_delete_items($this->_question_model);
505
-        $this->_redirect_after_action(
506
-            $success,
507
-            $this->_question_model->item_name($success),
508
-            'deleted permanently',
509
-            array('action' => 'default', 'status' => 'trash')
510
-        );
511
-    }
512
-
513
-
514
-    /**
515
-     * Performs the deletion of a single or multiple questions or question groups.
516
-     *
517
-     * @param EEM_Soft_Delete_Base $model
518
-     * @return int number of items deleted permanently
519
-     * @throws EE_Error
520
-     * @throws InvalidArgumentException
521
-     * @throws InvalidDataTypeException
522
-     * @throws InvalidInterfaceException
523
-     */
524
-    private function _delete_items(EEM_Soft_Delete_Base $model)
525
-    {
526
-        $success = 0;
527
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
528
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
529
-            // if array has more than one element than success message should be plural
530
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
531
-            // cycle thru bulk action checkboxes
532
-            while (list($ID, $value) = each($this->_req_data['checkbox'])) {
533
-                if (! $this->_delete_item($ID, $model)) {
534
-                    $success = 0;
535
-                }
536
-            }
537
-        } elseif (! empty($this->_req_data['QSG_ID'])) {
538
-            $success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
539
-        } elseif (! empty($this->_req_data['QST_ID'])) {
540
-            $success = $this->_delete_item($this->_req_data['QST_ID'], $model);
541
-        } else {
542
-            EE_Error::add_error(
543
-                sprintf(
544
-                    esc_html__(
545
-                        "No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.",
546
-                        "event_espresso"
547
-                    )
548
-                ),
549
-                __FILE__,
550
-                __FUNCTION__,
551
-                __LINE__
552
-            );
553
-        }
554
-        return $success;
555
-    }
556
-
557
-
558
-    /**
559
-     * Deletes the specified question (and its associated question options) or question group
560
-     *
561
-     * @param int                  $id
562
-     * @param EEM_Soft_Delete_Base $model
563
-     * @return boolean
564
-     * @throws EE_Error
565
-     * @throws InvalidArgumentException
566
-     * @throws InvalidDataTypeException
567
-     * @throws InvalidInterfaceException
568
-     */
569
-    protected function _delete_item($id, $model)
570
-    {
571
-        if ($model instanceof EEM_Question) {
572
-            EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
573
-        }
574
-        return $model->delete_permanently_by_ID(absint($id));
575
-    }
576
-
577
-
578
-    /******************************    QUESTION GROUPS    ******************************/
579
-
580
-
581
-    /**
582
-     * @param string $type
583
-     * @return void
584
-     * @throws DomainException
585
-     * @throws EE_Error
586
-     * @throws InvalidArgumentException
587
-     * @throws InvalidDataTypeException
588
-     * @throws InvalidInterfaceException
589
-     */
590
-    protected function _edit_question_group($type = 'add')
591
-    {
592
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
593
-        $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID'])
594
-            ? absint($this->_req_data['QSG_ID'])
595
-            : false;
596
-
597
-        switch ($this->_req_action) {
598
-            case 'add_question_group':
599
-                $this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
600
-                break;
601
-            case 'edit_question_group':
602
-                $this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
603
-                break;
604
-            default:
605
-                $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
606
-        }
607
-        // add ID to title if editing
608
-        $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
609
-        if ($ID) {
610
-            /** @var EE_Question_Group $questionGroup */
611
-            $questionGroup = $this->_question_group_model->get_one_by_ID($ID);
612
-            $additional_hidden_fields = array('QSG_ID' => array('type' => 'hidden', 'value' => $ID));
613
-            $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
614
-        } else {
615
-            /** @var EE_Question_Group $questionGroup */
616
-            $questionGroup = EEM_Question_Group::instance()->create_default_object();
617
-            $questionGroup->set_order_to_latest();
618
-            $this->_set_add_edit_form_tags('insert_question_group');
619
-        }
620
-        $this->_template_args['values'] = $this->_yes_no_values;
621
-        $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
622
-        $this->_template_args['QSG_ID'] = $ID ? $ID : true;
623
-        $this->_template_args['question_group'] = $questionGroup;
624
-
625
-        $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
626
-        $this->_set_publish_post_box_vars('id', $ID, false, $redirect_URL);
627
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
628
-            REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php',
629
-            $this->_template_args,
630
-            true
631
-        );
632
-
633
-        // the details template wrapper
634
-        $this->display_admin_page_with_sidebar();
635
-    }
636
-
637
-
638
-    /**
639
-     * @return void
640
-     * @throws EE_Error
641
-     * @throws InvalidArgumentException
642
-     * @throws InvalidDataTypeException
643
-     * @throws InvalidInterfaceException
644
-     */
645
-    protected function _delete_question_groups()
646
-    {
647
-        $success = $this->_delete_items($this->_question_group_model);
648
-        $this->_redirect_after_action(
649
-            $success,
650
-            $this->_question_group_model->item_name($success),
651
-            'deleted permanently',
652
-            array('action' => 'question_groups', 'status' => 'trash')
653
-        );
654
-    }
655
-
656
-
657
-    /**
658
-     * @param bool $new_question_group
659
-     * @throws EE_Error
660
-     * @throws InvalidArgumentException
661
-     * @throws InvalidDataTypeException
662
-     * @throws InvalidInterfaceException
663
-     */
664
-    protected function _insert_or_update_question_group($new_question_group = true)
665
-    {
666
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
667
-        $set_column_values = $this->_set_column_values_for($this->_question_group_model);
668
-        if ($new_question_group) {
669
-            // make sure identifier is unique
670
-            $identifier_value = isset($set_column_values['QSG_identifier']) ? $set_column_values['QSG_identifier'] : '';
671
-            $identifier_exists = ! empty($identifier_value)
672
-                ? $this->_question_group_model->count([['QSG_identifier' => $set_column_values['QSG_identifier']]]) > 0
673
-                : false;
674
-            if ($identifier_exists) {
675
-                $set_column_values['QSG_identifier'] .= uniqid('id', true);
676
-            }
677
-            $QSG_ID = $this->_question_group_model->insert($set_column_values);
678
-            $success = $QSG_ID ? 1 : 0;
679
-            if ($success === 0) {
680
-                EE_Error::add_error(
681
-                    esc_html__('Something went wrong saving the question group.', 'event_espresso'),
682
-                    __FILE__,
683
-                    __FUNCTION__,
684
-                    __LINE__
685
-                );
686
-                $this->_redirect_after_action(
687
-                    false,
688
-                    '',
689
-                    '',
690
-                    array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID),
691
-                    true
692
-                );
693
-            }
694
-        } else {
695
-            $QSG_ID = absint($this->_req_data['QSG_ID']);
696
-            unset($set_column_values['QSG_ID']);
697
-            $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
698
-        }
699
-
700
-        $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(
701
-            EEM_Attendee::system_question_phone
702
-        );
703
-        // update the existing related questions
704
-        // BUT FIRST...  delete the phone question from the Question_Group_Question
705
-        // if it is being added to this question group (therefore removed from the existing group)
706
-        if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ])) {
707
-            // delete where QST ID = system phone question ID and Question Group ID is NOT this group
708
-            EEM_Question_Group_Question::instance()->delete(
709
-                array(
710
-                    array(
711
-                        'QST_ID' => $phone_question_id,
712
-                        'QSG_ID' => array('!=', $QSG_ID),
713
-                    ),
714
-                )
715
-            );
716
-        }
717
-        /** @type EE_Question_Group $question_group */
718
-        $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
719
-        $questions = $question_group->questions();
720
-        // make sure system phone question is added to list of questions for this group
721
-        if (! isset($questions[ $phone_question_id ])) {
722
-            $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
723
-        }
724
-
725
-        foreach ($questions as $question_ID => $question) {
726
-            // first we always check for order.
727
-            if (! empty($this->_req_data['question_orders'][ $question_ID ])) {
728
-                // update question order
729
-                $question_group->update_question_order(
730
-                    $question_ID,
731
-                    $this->_req_data['question_orders'][ $question_ID ]
732
-                );
733
-            }
734
-
735
-            // then we always check if adding or removing.
736
-            if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ])) {
737
-                $question_group->add_question($question_ID);
738
-            } else {
739
-                // not found, remove it (but only if not a system question for the personal group
740
-                // with the exception of lname system question - we allow removal of it)
741
-                if (
742
-                    in_array(
743
-                        $question->system_ID(),
744
-                        EEM_Question::instance()->required_system_questions_in_system_question_group(
745
-                            $question_group->system_group()
746
-                        )
747
-                    )
748
-                ) {
749
-                    continue;
750
-                } else {
751
-                    $question_group->remove_question($question_ID);
752
-                }
753
-            }
754
-        }
755
-        // save new related questions
756
-        if (isset($this->_req_data['questions'])) {
757
-            foreach ($this->_req_data['questions'] as $QST_ID) {
758
-                $question_group->add_question($QST_ID);
759
-                if (isset($this->_req_data['question_orders'][ $QST_ID ])) {
760
-                    $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][ $QST_ID ]);
761
-                }
762
-            }
763
-        }
764
-
765
-        if ($success !== false) {
766
-            $msg = $new_question_group
767
-                ? sprintf(
768
-                    esc_html__('The %s has been created', 'event_espresso'),
769
-                    $this->_question_group_model->item_name()
770
-                )
771
-                : sprintf(
772
-                    esc_html__(
773
-                        'The %s has been updated',
774
-                        'event_espresso'
775
-                    ),
776
-                    $this->_question_group_model->item_name()
777
-                );
778
-            EE_Error::add_success($msg);
779
-        }
780
-        $this->_redirect_after_action(
781
-            false,
782
-            '',
783
-            '',
784
-            array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID),
785
-            true
786
-        );
787
-    }
788
-
789
-
790
-    /**
791
-     * duplicates a question and all its question options and redirects to the new question.
792
-     *
793
-     * @return void
794
-     * @throws EE_Error
795
-     * @throws InvalidArgumentException
796
-     * @throws ReflectionException
797
-     * @throws InvalidDataTypeException
798
-     * @throws InvalidInterfaceException
799
-     */
800
-    public function _duplicate_question()
801
-    {
802
-        $question_ID = (int) $this->_req_data['QST_ID'];
803
-        $question = EEM_Question::instance()->get_one_by_ID($question_ID);
804
-        if ($question instanceof EE_Question) {
805
-            $new_question = $question->duplicate();
806
-            if ($new_question instanceof EE_Question) {
807
-                $this->_redirect_after_action(
808
-                    true,
809
-                    esc_html__('Question', 'event_espresso'),
810
-                    esc_html__('Duplicated', 'event_espresso'),
811
-                    array('action' => 'edit_question', 'QST_ID' => $new_question->ID()),
812
-                    true
813
-                );
814
-            } else {
815
-                global $wpdb;
816
-                EE_Error::add_error(
817
-                    sprintf(
818
-                        esc_html__(
819
-                            'Could not duplicate question with ID %1$d because: %2$s',
820
-                            'event_espresso'
821
-                        ),
822
-                        $question_ID,
823
-                        $wpdb->last_error
824
-                    ),
825
-                    __FILE__,
826
-                    __FUNCTION__,
827
-                    __LINE__
828
-                );
829
-                $this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
830
-            }
831
-        } else {
832
-            EE_Error::add_error(
833
-                sprintf(
834
-                    esc_html__(
835
-                        'Could not duplicate question with ID %d because it didn\'t exist!',
836
-                        'event_espresso'
837
-                    ),
838
-                    $question_ID
839
-                ),
840
-                __FILE__,
841
-                __FUNCTION__,
842
-                __LINE__
843
-            );
844
-            $this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
845
-        }
846
-    }
847
-
848
-
849
-    /**
850
-     * @param bool $trash
851
-     * @throws EE_Error
852
-     */
853
-    protected function _trash_or_restore_question_groups($trash = true)
854
-    {
855
-        $this->_trash_or_restore_items($this->_question_group_model, $trash);
856
-    }
857
-
858
-
859
-    /**
860
-     *_trash_question
861
-     *
862
-     * @return void
863
-     * @throws EE_Error
864
-     */
865
-    protected function _trash_question()
866
-    {
867
-        $success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
868
-        $query_args = array('action' => 'default', 'status' => 'all');
869
-        $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
870
-    }
871
-
872
-
873
-    /**
874
-     * @param bool $trash
875
-     * @throws EE_Error
876
-     */
877
-    protected function _trash_or_restore_questions($trash = true)
878
-    {
879
-        $this->_trash_or_restore_items($this->_question_model, $trash);
880
-    }
881
-
882
-
883
-    /**
884
-     * Internally used to delete or restore items, using the request data. Meant to be
885
-     * flexible between question or question groups
886
-     *
887
-     * @param EEM_Soft_Delete_Base $model
888
-     * @param boolean              $trash whether to trash or restore
889
-     * @throws EE_Error
890
-     */
891
-    private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = true)
892
-    {
893
-
894
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
895
-
896
-        $success = 1;
897
-        // Checkboxes
898
-        // echo "trash $trash";
899
-        // var_dump($this->_req_data['checkbox']);die;
900
-        if (isset($this->_req_data['checkbox'])) {
901
-            if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
902
-                // if array has more than one element than success message should be plural
903
-                $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
904
-                // cycle thru bulk action checkboxes
905
-                while (list($ID, $value) = each($this->_req_data['checkbox'])) {
906
-                    if (! $model->delete_or_restore_by_ID($trash, absint($ID))) {
907
-                        $success = 0;
908
-                    }
909
-                }
910
-            } else {
911
-                // grab single id and delete
912
-                $ID = absint($this->_req_data['checkbox']);
913
-                if (! $model->delete_or_restore_by_ID($trash, $ID)) {
914
-                    $success = 0;
915
-                }
916
-            }
917
-        } else {
918
-            // delete via trash link
919
-            // grab single id and delete
920
-            $ID = absint($this->_req_data[ $model->primary_key_name() ]);
921
-            if (! $model->delete_or_restore_by_ID($trash, $ID)) {
922
-                $success = 0;
923
-            }
924
-        }
925
-
926
-
927
-        $action = $model instanceof EEM_Question ? 'default' : 'question_groups';// strtolower( $model->item_name(2) );
928
-        // echo "action :$action";
929
-        // $action = 'questions' ? 'default' : $action;
930
-        if ($trash) {
931
-            $action_desc = 'trashed';
932
-            $status = 'trash';
933
-        } else {
934
-            $action_desc = 'restored';
935
-            $status = 'all';
936
-        }
937
-        $this->_redirect_after_action(
938
-            $success,
939
-            $model->item_name($success),
940
-            $action_desc,
941
-            array('action' => $action, 'status' => $status)
942
-        );
943
-    }
944
-
945
-
946
-    /**
947
-     * @param            $per_page
948
-     * @param int        $current_page
949
-     * @param bool|false $count
950
-     * @return EE_Soft_Delete_Base_Class[]|int
951
-     * @throws EE_Error
952
-     * @throws InvalidArgumentException
953
-     * @throws InvalidDataTypeException
954
-     * @throws InvalidInterfaceException
955
-     */
956
-    public function get_trashed_questions($per_page, $current_page = 1, $count = false)
957
-    {
958
-        $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
959
-
960
-        if ($count) {
961
-            // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
962
-            $where = isset($query_params[0]) ? array($query_params[0]) : array();
963
-            $results = $this->_question_model->count_deleted($where);
964
-        } else {
965
-            // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
966
-            $results = $this->_question_model->get_all_deleted($query_params);
967
-        }
968
-        return $results;
969
-    }
970
-
971
-
972
-    /**
973
-     * @param            $per_page
974
-     * @param int        $current_page
975
-     * @param bool|false $count
976
-     * @return EE_Soft_Delete_Base_Class[]|int
977
-     * @throws EE_Error
978
-     * @throws InvalidArgumentException
979
-     * @throws InvalidDataTypeException
980
-     * @throws InvalidInterfaceException
981
-     */
982
-    public function get_question_groups($per_page, $current_page = 1, $count = false)
983
-    {
984
-        $questionGroupModel = EEM_Question_Group::instance();
985
-        $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
986
-        if ($count) {
987
-            $where = isset($query_params[0]) ? array($query_params[0]) : array();
988
-            $results = $questionGroupModel->count($where);
989
-        } else {
990
-            $results = $questionGroupModel->get_all($query_params);
991
-        }
992
-        return $results;
993
-    }
994
-
995
-
996
-    /**
997
-     * @param      $per_page
998
-     * @param int  $current_page
999
-     * @param bool $count
1000
-     * @return EE_Soft_Delete_Base_Class[]|int
1001
-     * @throws EE_Error
1002
-     * @throws InvalidArgumentException
1003
-     * @throws InvalidDataTypeException
1004
-     * @throws InvalidInterfaceException
1005
-     */
1006
-    public function get_trashed_question_groups($per_page, $current_page = 1, $count = false)
1007
-    {
1008
-        $questionGroupModel = EEM_Question_Group::instance();
1009
-        $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
1010
-        if ($count) {
1011
-            $where = isset($query_params[0]) ? array($query_params[0]) : array();
1012
-            $query_params['limit'] = null;
1013
-            $results = $questionGroupModel->count_deleted($where);
1014
-        } else {
1015
-            $results = $questionGroupModel->get_all_deleted($query_params);
1016
-        }
1017
-        return $results;
1018
-    }
1019
-
1020
-
1021
-    /**
1022
-     * method for performing updates to question order
1023
-     *
1024
-     * @return void results array
1025
-     * @throws EE_Error
1026
-     * @throws InvalidArgumentException
1027
-     * @throws InvalidDataTypeException
1028
-     * @throws InvalidInterfaceException
1029
-     */
1030
-    public function update_question_group_order()
1031
-    {
1032
-
1033
-        $success = esc_html__('Question group order was updated successfully.', 'event_espresso');
1034
-
1035
-        // grab our row IDs
1036
-        $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
1037
-            ? explode(',', rtrim($this->_req_data['row_ids'], ','))
1038
-            : array();
1039
-
1040
-        $perpage = ! empty($this->_req_data['perpage'])
1041
-            ? (int) $this->_req_data['perpage']
1042
-            : null;
1043
-        $curpage = ! empty($this->_req_data['curpage'])
1044
-            ? (int) $this->_req_data['curpage']
1045
-            : null;
1046
-
1047
-        if (! empty($row_ids)) {
1048
-            // figure out where we start the row_id count at for the current page.
1049
-            $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
1050
-
1051
-            $row_count = count($row_ids);
1052
-            for ($i = 0; $i < $row_count; $i++) {
1053
-                // Update the questions when re-ordering
1054
-                $updated = EEM_Question_Group::instance()->update(
1055
-                    array('QSG_order' => $qsgcount),
1056
-                    array(array('QSG_ID' => $row_ids[ $i ]))
1057
-                );
1058
-                if ($updated === false) {
1059
-                    $success = false;
1060
-                }
1061
-                $qsgcount++;
1062
-            }
1063
-        } else {
1064
-            $success = false;
1065
-        }
1066
-
1067
-        $errors = ! $success
1068
-            ? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
1069
-            : false;
1070
-
1071
-        echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
1072
-        die();
1073
-    }
1074
-
1075
-
1076
-
1077
-    /***************************************       REGISTRATION SETTINGS       ***************************************/
1078
-
1079
-
1080
-    /**
1081
-     * @throws DomainException
1082
-     * @throws EE_Error
1083
-     * @throws InvalidArgumentException
1084
-     * @throws InvalidDataTypeException
1085
-     * @throws InvalidInterfaceException
1086
-     */
1087
-    protected function _reg_form_settings()
1088
-    {
1089
-        $this->_template_args['values'] = $this->_yes_no_values;
1090
-        add_action(
1091
-            'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
1092
-            array($this, 'email_validation_settings_form'),
1093
-            2
1094
-        );
1095
-        add_action(
1096
-            'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
1097
-            array($this, 'copy_attendee_info_settings_form'),
1098
-            4
1099
-        );
1100
-        $this->_template_args = (array) apply_filters(
1101
-            'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
1102
-            $this->_template_args
1103
-        );
1104
-        $this->_set_add_edit_form_tags('update_reg_form_settings');
1105
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
1106
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
1107
-            REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
1108
-            $this->_template_args,
1109
-            true
1110
-        );
1111
-        $this->display_admin_page_with_sidebar();
1112
-    }
1113
-
1114
-
1115
-    /**
1116
-     * @return void
1117
-     * @throws EE_Error
1118
-     * @throws InvalidArgumentException
1119
-     * @throws ReflectionException
1120
-     * @throws InvalidDataTypeException
1121
-     * @throws InvalidInterfaceException
1122
-     */
1123
-    protected function _update_reg_form_settings()
1124
-    {
1125
-        EE_Registry::instance()->CFG->registration = $this->update_email_validation_settings_form(
1126
-            EE_Registry::instance()->CFG->registration
1127
-        );
1128
-        EE_Registry::instance()->CFG->registration = $this->update_copy_attendee_info_settings_form(
1129
-            EE_Registry::instance()->CFG->registration
1130
-        );
1131
-        EE_Registry::instance()->CFG->registration = apply_filters(
1132
-            'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
1133
-            EE_Registry::instance()->CFG->registration
1134
-        );
1135
-        $success = $this->_update_espresso_configuration(
1136
-            esc_html__('Registration Form Options', 'event_espresso'),
1137
-            EE_Registry::instance()->CFG,
1138
-            __FILE__,
1139
-            __FUNCTION__,
1140
-            __LINE__
1141
-        );
1142
-        $this->_redirect_after_action(
1143
-            $success,
1144
-            esc_html__('Registration Form Options', 'event_espresso'),
1145
-            'updated',
1146
-            array('action' => 'view_reg_form_settings')
1147
-        );
1148
-    }
1149
-
1150
-
1151
-    /**
1152
-     * @return void
1153
-     * @throws EE_Error
1154
-     * @throws InvalidArgumentException
1155
-     * @throws InvalidDataTypeException
1156
-     * @throws InvalidInterfaceException
1157
-     */
1158
-    public function copy_attendee_info_settings_form()
1159
-    {
1160
-        echo $this->_copy_attendee_info_settings_form()->get_html();
1161
-    }
1162
-
1163
-    /**
1164
-     * _copy_attendee_info_settings_form
1165
-     *
1166
-     * @access protected
1167
-     * @return EE_Form_Section_Proper
1168
-     * @throws \EE_Error
1169
-     */
1170
-    protected function _copy_attendee_info_settings_form()
1171
-    {
1172
-        return new EE_Form_Section_Proper(
1173
-            array(
1174
-                'name'            => 'copy_attendee_info_settings',
1175
-                'html_id'         => 'copy_attendee_info_settings',
1176
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1177
-                'subsections'     => apply_filters(
1178
-                    'FHEE__Extend_Registration_Form_Admin_Page___copy_attendee_info_settings_form__form_subsections',
1179
-                    array(
1180
-                        'copy_attendee_info_hdr'   => new EE_Form_Section_HTML(
1181
-                            EEH_HTML::h2(esc_html__('Copy Attendee Info Settings', 'event_espresso'))
1182
-                        ),
1183
-                        'copy_attendee_info' => new EE_Yes_No_Input(
1184
-                            array(
1185
-                                'html_label_text' => esc_html__(
1186
-                                    'Allow copy #1 attendee info to extra attendees?',
1187
-                                    'event_espresso'
1188
-                                ),
1189
-                                'html_help_text'  => esc_html__(
1190
-                                    'Set to yes if you want to enable the copy of #1 attendee info to extra attendees at Registration Form.',
1191
-                                    'event_espresso'
1192
-                                ),
1193
-                                'default'         => EE_Registry::instance()->CFG->registration->copyAttendeeInfo(),
1194
-                                'required'        => false,
1195
-                                'display_html_label_text' => false,
1196
-                            )
1197
-                        ),
1198
-                    )
1199
-                ),
1200
-            )
1201
-        );
1202
-    }
1203
-
1204
-    /**
1205
-     * @param EE_Registration_Config $EE_Registration_Config
1206
-     * @return EE_Registration_Config
1207
-     * @throws EE_Error
1208
-     * @throws InvalidArgumentException
1209
-     * @throws ReflectionException
1210
-     * @throws InvalidDataTypeException
1211
-     * @throws InvalidInterfaceException
1212
-     */
1213
-    public function update_copy_attendee_info_settings_form(EE_Registration_Config $EE_Registration_Config)
1214
-    {
1215
-        $prev_copy_attendee_info = $EE_Registration_Config->copyAttendeeInfo();
1216
-        try {
1217
-            $copy_attendee_info_settings_form = $this->_copy_attendee_info_settings_form();
1218
-            // if not displaying a form, then check for form submission
1219
-            if ($copy_attendee_info_settings_form->was_submitted()) {
1220
-                // capture form data
1221
-                $copy_attendee_info_settings_form->receive_form_submission();
1222
-                // validate form data
1223
-                if ($copy_attendee_info_settings_form->is_valid()) {
1224
-                    // grab validated data from form
1225
-                    $valid_data = $copy_attendee_info_settings_form->valid_data();
1226
-                    if (isset($valid_data['copy_attendee_info'])) {
1227
-                        $EE_Registration_Config->setCopyAttendeeInfo($valid_data['copy_attendee_info']);
1228
-                    } else {
1229
-                        EE_Error::add_error(
1230
-                            esc_html__(
1231
-                                'Invalid or missing Copy Attendee Info settings. Please refresh the form and try again.',
1232
-                                'event_espresso'
1233
-                            ),
1234
-                            __FILE__,
1235
-                            __FUNCTION__,
1236
-                            __LINE__
1237
-                        );
1238
-                    }
1239
-                } else {
1240
-                    if ($copy_attendee_info_settings_form->submission_error_message() !== '') {
1241
-                        EE_Error::add_error(
1242
-                            $copy_attendee_info_settings_form->submission_error_message(),
1243
-                            __FILE__,
1244
-                            __FUNCTION__,
1245
-                            __LINE__
1246
-                        );
1247
-                    }
1248
-                }
1249
-            }
1250
-        } catch (EE_Error $e) {
1251
-            $e->get_error();
1252
-        }
1253
-        return $EE_Registration_Config;
1254
-    }
1255
-
1256
-
1257
-    /**
1258
-     * @return void
1259
-     * @throws EE_Error
1260
-     * @throws InvalidArgumentException
1261
-     * @throws InvalidDataTypeException
1262
-     * @throws InvalidInterfaceException
1263
-     */
1264
-    public function email_validation_settings_form()
1265
-    {
1266
-        echo $this->_email_validation_settings_form()->get_html();
1267
-    }
1268
-
1269
-
1270
-    /**
1271
-     * _email_validation_settings_form
1272
-     *
1273
-     * @access protected
1274
-     * @return EE_Form_Section_Proper
1275
-     * @throws \EE_Error
1276
-     */
1277
-    protected function _email_validation_settings_form()
1278
-    {
1279
-        return new EE_Form_Section_Proper(
1280
-            array(
1281
-                'name'            => 'email_validation_settings',
1282
-                'html_id'         => 'email_validation_settings',
1283
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1284
-                'subsections'     => apply_filters(
1285
-                    'FHEE__Extend_Registration_Form_Admin_Page___email_validation_settings_form__form_subsections',
1286
-                    array(
1287
-                        'email_validation_hdr'   => new EE_Form_Section_HTML(
1288
-                            EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
1289
-                        ),
1290
-                        'email_validation_level' => new EE_Select_Input(
1291
-                            array(
1292
-                                'basic'      => esc_html__('Basic', 'event_espresso'),
1293
-                                'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
1294
-                                'i18n'       => esc_html__('International', 'event_espresso'),
1295
-                                'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
1296
-                            ),
1297
-                            array(
1298
-                                'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
1299
-                                                     . EEH_Template::get_help_tab_link('email_validation_info'),
1300
-                                'html_help_text'  => esc_html__(
1301
-                                    'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.',
1302
-                                    'event_espresso'
1303
-                                ),
1304
-                                'default'         => isset(
1305
-                                    EE_Registry::instance()->CFG->registration->email_validation_level
1306
-                                )
1307
-                                    ? EE_Registry::instance()->CFG->registration->email_validation_level
1308
-                                    : 'wp_default',
1309
-                                'required'        => false,
1310
-                            )
1311
-                        ),
1312
-                    )
1313
-                ),
1314
-            )
1315
-        );
1316
-    }
1317
-
1318
-
1319
-    /**
1320
-     * @param EE_Registration_Config $EE_Registration_Config
1321
-     * @return EE_Registration_Config
1322
-     * @throws EE_Error
1323
-     * @throws InvalidArgumentException
1324
-     * @throws ReflectionException
1325
-     * @throws InvalidDataTypeException
1326
-     * @throws InvalidInterfaceException
1327
-     */
1328
-    public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config)
1329
-    {
1330
-        $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
1331
-        try {
1332
-            $email_validation_settings_form = $this->_email_validation_settings_form();
1333
-            // if not displaying a form, then check for form submission
1334
-            if ($email_validation_settings_form->was_submitted()) {
1335
-                // capture form data
1336
-                $email_validation_settings_form->receive_form_submission();
1337
-                // validate form data
1338
-                if ($email_validation_settings_form->is_valid()) {
1339
-                    // grab validated data from form
1340
-                    $valid_data = $email_validation_settings_form->valid_data();
1341
-                    if (isset($valid_data['email_validation_level'])) {
1342
-                        $email_validation_level = $valid_data['email_validation_level'];
1343
-                        // now if they want to use international email addresses
1344
-                        if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') {
1345
-                            // in case we need to reset their email validation level,
1346
-                            // make sure that the previous value wasn't already set to one of the i18n options.
1347
-                            if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') {
1348
-                                // if so, then reset it back to "basic" since that is the only other option that,
1349
-                                // despite offering poor validation, supports i18n email addresses
1350
-                                $prev_email_validation_level = 'basic';
1351
-                            }
1352
-                            // confirm our i18n email validation will work on the server
1353
-                            if (! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1354
-                                // or reset email validation level to previous value
1355
-                                $email_validation_level = $prev_email_validation_level;
1356
-                            }
1357
-                        }
1358
-                        $EE_Registration_Config->email_validation_level = $email_validation_level;
1359
-                    } else {
1360
-                        EE_Error::add_error(
1361
-                            esc_html__(
1362
-                                'Invalid or missing Email Validation settings. Please refresh the form and try again.',
1363
-                                'event_espresso'
1364
-                            ),
1365
-                            __FILE__,
1366
-                            __FUNCTION__,
1367
-                            __LINE__
1368
-                        );
1369
-                    }
1370
-                } else {
1371
-                    if ($email_validation_settings_form->submission_error_message() !== '') {
1372
-                        EE_Error::add_error(
1373
-                            $email_validation_settings_form->submission_error_message(),
1374
-                            __FILE__,
1375
-                            __FUNCTION__,
1376
-                            __LINE__
1377
-                        );
1378
-                    }
1379
-                }
1380
-            }
1381
-        } catch (EE_Error $e) {
1382
-            $e->get_error();
1383
-        }
1384
-        return $EE_Registration_Config;
1385
-    }
1386
-
1387
-
1388
-    /**
1389
-     * confirms that the server's PHP version has the PCRE module enabled,
1390
-     * and that the PCRE version works with our i18n email validation
1391
-     *
1392
-     * @param EE_Registration_Config $EE_Registration_Config
1393
-     * @param string                 $email_validation_level
1394
-     * @return bool
1395
-     */
1396
-    private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1397
-    {
1398
-        // first check that PCRE is enabled
1399
-        if (! defined('PREG_BAD_UTF8_ERROR')) {
1400
-            EE_Error::add_error(
1401
-                sprintf(
1402
-                    esc_html__(
1403
-                        'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1404
-                        'event_espresso'
1405
-                    ),
1406
-                    '<br />'
1407
-                ),
1408
-                __FILE__,
1409
-                __FUNCTION__,
1410
-                __LINE__
1411
-            );
1412
-            return false;
1413
-        } else {
1414
-            // PCRE support is enabled, but let's still
1415
-            // perform a test to see if the server will support it.
1416
-            // but first, save the updated validation level to the config,
1417
-            // so that the validation strategy picks it up.
1418
-            // this will get bumped back down if it doesn't work
1419
-            $EE_Registration_Config->email_validation_level = $email_validation_level;
1420
-            try {
1421
-                $email_validator = new EE_Email_Validation_Strategy();
1422
-                $i18n_email_address = apply_filters(
1423
-                    'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1424
-                    'jägerjü[email protected]'
1425
-                );
1426
-                $email_validator->validate($i18n_email_address);
1427
-            } catch (Exception $e) {
1428
-                EE_Error::add_error(
1429
-                    sprintf(
1430
-                        esc_html__(
1431
-                            'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1432
-                            'event_espresso'
1433
-                        ),
1434
-                        '<br />',
1435
-                        '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank" rel="noopener noreferrer">http://php.net/manual/en/pcre.installation.php</a>'
1436
-                    ),
1437
-                    __FILE__,
1438
-                    __FUNCTION__,
1439
-                    __LINE__
1440
-                );
1441
-                return false;
1442
-            }
1443
-        }
1444
-        return true;
1445
-    }
17
+	/**
18
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
19
+	 */
20
+	public function __construct($routing = true)
21
+	{
22
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form/');
23
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets/');
24
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/');
25
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates/');
26
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/');
27
+		parent::__construct($routing);
28
+	}
29
+
30
+
31
+	/**
32
+	 * @return void
33
+	 */
34
+	protected function _extend_page_config()
35
+	{
36
+		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
37
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID'])
38
+			? $this->_req_data['QST_ID'] : 0;
39
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID'])
40
+			? $this->_req_data['QSG_ID'] : 0;
41
+
42
+		$new_page_routes = array(
43
+			'question_groups'    => array(
44
+				'func'       => '_question_groups_overview_list_table',
45
+				'capability' => 'ee_read_question_groups',
46
+			),
47
+			'add_question'       => array(
48
+				'func'       => '_edit_question',
49
+				'capability' => 'ee_edit_questions',
50
+			),
51
+			'insert_question'    => array(
52
+				'func'       => '_insert_or_update_question',
53
+				'args'       => array('new_question' => true),
54
+				'capability' => 'ee_edit_questions',
55
+				'noheader'   => true,
56
+			),
57
+			'duplicate_question' => array(
58
+				'func'       => '_duplicate_question',
59
+				'capability' => 'ee_edit_questions',
60
+				'noheader'   => true,
61
+			),
62
+			'trash_question'     => array(
63
+				'func'       => '_trash_question',
64
+				'capability' => 'ee_delete_question',
65
+				'obj_id'     => $qst_id,
66
+				'noheader'   => true,
67
+			),
68
+
69
+			'restore_question' => array(
70
+				'func'       => '_trash_or_restore_questions',
71
+				'capability' => 'ee_delete_question',
72
+				'obj_id'     => $qst_id,
73
+				'args'       => array('trash' => false),
74
+				'noheader'   => true,
75
+			),
76
+
77
+			'delete_question' => array(
78
+				'func'       => '_delete_question',
79
+				'capability' => 'ee_delete_question',
80
+				'obj_id'     => $qst_id,
81
+				'noheader'   => true,
82
+			),
83
+
84
+			'trash_questions' => array(
85
+				'func'       => '_trash_or_restore_questions',
86
+				'capability' => 'ee_delete_questions',
87
+				'args'       => array('trash' => true),
88
+				'noheader'   => true,
89
+			),
90
+
91
+			'restore_questions' => array(
92
+				'func'       => '_trash_or_restore_questions',
93
+				'capability' => 'ee_delete_questions',
94
+				'args'       => array('trash' => false),
95
+				'noheader'   => true,
96
+			),
97
+
98
+			'delete_questions' => array(
99
+				'func'       => '_delete_questions',
100
+				'args'       => array(),
101
+				'capability' => 'ee_delete_questions',
102
+				'noheader'   => true,
103
+			),
104
+
105
+			'add_question_group' => array(
106
+				'func'       => '_edit_question_group',
107
+				'capability' => 'ee_edit_question_groups',
108
+			),
109
+
110
+			'edit_question_group' => array(
111
+				'func'       => '_edit_question_group',
112
+				'capability' => 'ee_edit_question_group',
113
+				'obj_id'     => $qsg_id,
114
+				'args'       => array('edit'),
115
+			),
116
+
117
+			'delete_question_groups' => array(
118
+				'func'       => '_delete_question_groups',
119
+				'capability' => 'ee_delete_question_groups',
120
+				'noheader'   => true,
121
+			),
122
+
123
+			'delete_question_group' => array(
124
+				'func'       => '_delete_question_groups',
125
+				'capability' => 'ee_delete_question_group',
126
+				'obj_id'     => $qsg_id,
127
+				'noheader'   => true,
128
+			),
129
+
130
+			'trash_question_group' => array(
131
+				'func'       => '_trash_or_restore_question_groups',
132
+				'args'       => array('trash' => true),
133
+				'capability' => 'ee_delete_question_group',
134
+				'obj_id'     => $qsg_id,
135
+				'noheader'   => true,
136
+			),
137
+
138
+			'restore_question_group' => array(
139
+				'func'       => '_trash_or_restore_question_groups',
140
+				'args'       => array('trash' => false),
141
+				'capability' => 'ee_delete_question_group',
142
+				'obj_id'     => $qsg_id,
143
+				'noheader'   => true,
144
+			),
145
+
146
+			'insert_question_group' => array(
147
+				'func'       => '_insert_or_update_question_group',
148
+				'args'       => array('new_question_group' => true),
149
+				'capability' => 'ee_edit_question_groups',
150
+				'noheader'   => true,
151
+			),
152
+
153
+			'update_question_group' => array(
154
+				'func'       => '_insert_or_update_question_group',
155
+				'args'       => array('new_question_group' => false),
156
+				'capability' => 'ee_edit_question_group',
157
+				'obj_id'     => $qsg_id,
158
+				'noheader'   => true,
159
+			),
160
+
161
+			'trash_question_groups' => array(
162
+				'func'       => '_trash_or_restore_question_groups',
163
+				'args'       => array('trash' => true),
164
+				'capability' => 'ee_delete_question_groups',
165
+				'noheader'   => array('trash' => false),
166
+			),
167
+
168
+			'restore_question_groups' => array(
169
+				'func'       => '_trash_or_restore_question_groups',
170
+				'args'       => array('trash' => false),
171
+				'capability' => 'ee_delete_question_groups',
172
+				'noheader'   => true,
173
+			),
174
+
175
+
176
+			'espresso_update_question_group_order' => array(
177
+				'func'       => 'update_question_group_order',
178
+				'capability' => 'ee_edit_question_groups',
179
+				'noheader'   => true,
180
+			),
181
+
182
+			'view_reg_form_settings' => array(
183
+				'func'       => '_reg_form_settings',
184
+				'capability' => 'manage_options',
185
+			),
186
+
187
+			'update_reg_form_settings' => array(
188
+				'func'       => '_update_reg_form_settings',
189
+				'capability' => 'manage_options',
190
+				'noheader'   => true,
191
+			),
192
+		);
193
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
194
+
195
+		$new_page_config = array(
196
+
197
+			'question_groups' => array(
198
+				'nav'           => array(
199
+					'label' => esc_html__('Question Groups', 'event_espresso'),
200
+					'order' => 20,
201
+				),
202
+				'list_table'    => 'Registration_Form_Question_Groups_Admin_List_Table',
203
+				'help_tabs'     => array(
204
+					'registration_form_question_groups_help_tab'                           => array(
205
+						'title'    => esc_html__('Question Groups', 'event_espresso'),
206
+						'filename' => 'registration_form_question_groups',
207
+					),
208
+					'registration_form_question_groups_table_column_headings_help_tab'     => array(
209
+						'title'    => esc_html__('Question Groups Table Column Headings', 'event_espresso'),
210
+						'filename' => 'registration_form_question_groups_table_column_headings',
211
+					),
212
+					'registration_form_question_groups_views_bulk_actions_search_help_tab' => array(
213
+						'title'    => esc_html__('Question Groups Views & Bulk Actions & Search', 'event_espresso'),
214
+						'filename' => 'registration_form_question_groups_views_bulk_actions_search',
215
+					),
216
+				),
217
+				'metaboxes'     => $this->_default_espresso_metaboxes,
218
+				'require_nonce' => false,
219
+			),
220
+
221
+			'add_question' => array(
222
+				'nav'           => array(
223
+					'label'      => esc_html__('Add Question', 'event_espresso'),
224
+					'order'      => 5,
225
+					'persistent' => false,
226
+				),
227
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
228
+				'help_tabs'     => array(
229
+					'registration_form_add_question_help_tab' => array(
230
+						'title'    => esc_html__('Add Question', 'event_espresso'),
231
+						'filename' => 'registration_form_add_question',
232
+					),
233
+				),
234
+				'require_nonce' => false,
235
+			),
236
+
237
+			'add_question_group' => array(
238
+				'nav'           => array(
239
+					'label'      => esc_html__('Add Question Group', 'event_espresso'),
240
+					'order'      => 5,
241
+					'persistent' => false,
242
+				),
243
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
244
+				'help_tabs'     => array(
245
+					'registration_form_add_question_group_help_tab' => array(
246
+						'title'    => esc_html__('Add Question Group', 'event_espresso'),
247
+						'filename' => 'registration_form_add_question_group',
248
+					),
249
+				),
250
+				'require_nonce' => false,
251
+			),
252
+
253
+			'edit_question_group' => array(
254
+				'nav'           => array(
255
+					'label'      => esc_html__('Edit Question Group', 'event_espresso'),
256
+					'order'      => 5,
257
+					'persistent' => false,
258
+					'url'        => isset($this->_req_data['question_group_id']) ? add_query_arg(
259
+						array('question_group_id' => $this->_req_data['question_group_id']),
260
+						$this->_current_page_view_url
261
+					) : $this->_admin_base_url,
262
+				),
263
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
264
+				'help_tabs'     => array(
265
+					'registration_form_edit_question_group_help_tab' => array(
266
+						'title'    => esc_html__('Edit Question Group', 'event_espresso'),
267
+						'filename' => 'registration_form_edit_question_group',
268
+					),
269
+				),
270
+				'require_nonce' => false,
271
+			),
272
+
273
+			'view_reg_form_settings' => array(
274
+				'nav'           => array(
275
+					'label' => esc_html__('Reg Form Settings', 'event_espresso'),
276
+					'order' => 40,
277
+				),
278
+				'labels'        => array(
279
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
280
+				),
281
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
282
+				'help_tabs'     => array(
283
+					'registration_form_reg_form_settings_help_tab' => array(
284
+						'title'    => esc_html__('Registration Form Settings', 'event_espresso'),
285
+						'filename' => 'registration_form_reg_form_settings',
286
+					),
287
+				),
288
+				'require_nonce' => false,
289
+			),
290
+
291
+		);
292
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
293
+
294
+		// change the list table we're going to use so it's the NEW list table!
295
+		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
296
+
297
+
298
+		// additional labels
299
+		$new_labels = array(
300
+			'add_question'          => esc_html__('Add New Question', 'event_espresso'),
301
+			'delete_question'       => esc_html__('Delete Question', 'event_espresso'),
302
+			'add_question_group'    => esc_html__('Add New Question Group', 'event_espresso'),
303
+			'edit_question_group'   => esc_html__('Edit Question Group', 'event_espresso'),
304
+			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
305
+		);
306
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
307
+	}
308
+
309
+
310
+	/**
311
+	 * @return void
312
+	 */
313
+	protected function _ajax_hooks()
314
+	{
315
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
316
+	}
317
+
318
+
319
+	/**
320
+	 * @return void
321
+	 */
322
+	public function load_scripts_styles_question_groups()
323
+	{
324
+		wp_enqueue_script('espresso_ajax_table_sorting');
325
+	}
326
+
327
+
328
+	/**
329
+	 * @return void
330
+	 */
331
+	public function load_scripts_styles_add_question_group()
332
+	{
333
+		$this->load_scripts_styles_forms();
334
+		$this->load_sortable_question_script();
335
+	}
336
+
337
+
338
+	/**
339
+	 * @return void
340
+	 */
341
+	public function load_scripts_styles_edit_question_group()
342
+	{
343
+		$this->load_scripts_styles_forms();
344
+		$this->load_sortable_question_script();
345
+	}
346
+
347
+
348
+	/**
349
+	 * registers and enqueues script for questions
350
+	 *
351
+	 * @return void
352
+	 */
353
+	public function load_sortable_question_script()
354
+	{
355
+		wp_register_script(
356
+			'ee-question-sortable',
357
+			REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js',
358
+			array('jquery-ui-sortable'),
359
+			EVENT_ESPRESSO_VERSION,
360
+			true
361
+		);
362
+		wp_enqueue_script('ee-question-sortable');
363
+	}
364
+
365
+
366
+	/**
367
+	 * @return void
368
+	 */
369
+	protected function _set_list_table_views_default()
370
+	{
371
+		$this->_views = array(
372
+			'all' => array(
373
+				'slug'        => 'all',
374
+				'label'       => esc_html__('View All Questions', 'event_espresso'),
375
+				'count'       => 0,
376
+				'bulk_action' => array(
377
+					'trash_questions' => esc_html__('Trash', 'event_espresso'),
378
+				),
379
+			),
380
+		);
381
+
382
+		if (
383
+			EE_Registry::instance()->CAP->current_user_can(
384
+				'ee_delete_questions',
385
+				'espresso_registration_form_trash_questions'
386
+			)
387
+		) {
388
+			$this->_views['trash'] = array(
389
+				'slug'        => 'trash',
390
+				'label'       => esc_html__('Trash', 'event_espresso'),
391
+				'count'       => 0,
392
+				'bulk_action' => array(
393
+					'delete_questions'  => esc_html__('Delete Permanently', 'event_espresso'),
394
+					'restore_questions' => esc_html__('Restore', 'event_espresso'),
395
+				),
396
+			);
397
+		}
398
+	}
399
+
400
+
401
+	/**
402
+	 * @return void
403
+	 */
404
+	protected function _set_list_table_views_question_groups()
405
+	{
406
+		$this->_views = array(
407
+			'all' => array(
408
+				'slug'        => 'all',
409
+				'label'       => esc_html__('All', 'event_espresso'),
410
+				'count'       => 0,
411
+				'bulk_action' => array(
412
+					'trash_question_groups' => esc_html__('Trash', 'event_espresso'),
413
+				),
414
+			),
415
+		);
416
+
417
+		if (
418
+			EE_Registry::instance()->CAP->current_user_can(
419
+				'ee_delete_question_groups',
420
+				'espresso_registration_form_trash_question_groups'
421
+			)
422
+		) {
423
+			$this->_views['trash'] = array(
424
+				'slug'        => 'trash',
425
+				'label'       => esc_html__('Trash', 'event_espresso'),
426
+				'count'       => 0,
427
+				'bulk_action' => array(
428
+					'delete_question_groups'  => esc_html__('Delete Permanently', 'event_espresso'),
429
+					'restore_question_groups' => esc_html__('Restore', 'event_espresso'),
430
+				),
431
+			);
432
+		}
433
+	}
434
+
435
+
436
+	/**
437
+	 * @return void
438
+	 * @throws EE_Error
439
+	 * @throws InvalidArgumentException
440
+	 * @throws InvalidDataTypeException
441
+	 * @throws InvalidInterfaceException
442
+	 */
443
+	protected function _questions_overview_list_table()
444
+	{
445
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
446
+			'add_question',
447
+			'add_question',
448
+			array(),
449
+			'add-new-h2'
450
+		);
451
+		parent::_questions_overview_list_table();
452
+	}
453
+
454
+
455
+	/**
456
+	 * @return void
457
+	 * @throws DomainException
458
+	 * @throws EE_Error
459
+	 * @throws InvalidArgumentException
460
+	 * @throws InvalidDataTypeException
461
+	 * @throws InvalidInterfaceException
462
+	 */
463
+	protected function _question_groups_overview_list_table()
464
+	{
465
+		$this->_search_btn_label = esc_html__('Question Groups', 'event_espresso');
466
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
467
+			'add_question_group',
468
+			'add_question_group',
469
+			array(),
470
+			'add-new-h2'
471
+		);
472
+		$this->display_admin_list_table_page_with_sidebar();
473
+	}
474
+
475
+
476
+	/**
477
+	 * @return void
478
+	 * @throws EE_Error
479
+	 * @throws InvalidArgumentException
480
+	 * @throws InvalidDataTypeException
481
+	 * @throws InvalidInterfaceException
482
+	 */
483
+	protected function _delete_question()
484
+	{
485
+		$success = $this->_delete_items($this->_question_model);
486
+		$this->_redirect_after_action(
487
+			$success,
488
+			$this->_question_model->item_name($success),
489
+			'deleted',
490
+			array('action' => 'default', 'status' => 'all')
491
+		);
492
+	}
493
+
494
+
495
+	/**
496
+	 * @return void
497
+	 * @throws EE_Error
498
+	 * @throws InvalidArgumentException
499
+	 * @throws InvalidDataTypeException
500
+	 * @throws InvalidInterfaceException
501
+	 */
502
+	protected function _delete_questions()
503
+	{
504
+		$success = $this->_delete_items($this->_question_model);
505
+		$this->_redirect_after_action(
506
+			$success,
507
+			$this->_question_model->item_name($success),
508
+			'deleted permanently',
509
+			array('action' => 'default', 'status' => 'trash')
510
+		);
511
+	}
512
+
513
+
514
+	/**
515
+	 * Performs the deletion of a single or multiple questions or question groups.
516
+	 *
517
+	 * @param EEM_Soft_Delete_Base $model
518
+	 * @return int number of items deleted permanently
519
+	 * @throws EE_Error
520
+	 * @throws InvalidArgumentException
521
+	 * @throws InvalidDataTypeException
522
+	 * @throws InvalidInterfaceException
523
+	 */
524
+	private function _delete_items(EEM_Soft_Delete_Base $model)
525
+	{
526
+		$success = 0;
527
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
528
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
529
+			// if array has more than one element than success message should be plural
530
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
531
+			// cycle thru bulk action checkboxes
532
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
533
+				if (! $this->_delete_item($ID, $model)) {
534
+					$success = 0;
535
+				}
536
+			}
537
+		} elseif (! empty($this->_req_data['QSG_ID'])) {
538
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
539
+		} elseif (! empty($this->_req_data['QST_ID'])) {
540
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
541
+		} else {
542
+			EE_Error::add_error(
543
+				sprintf(
544
+					esc_html__(
545
+						"No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.",
546
+						"event_espresso"
547
+					)
548
+				),
549
+				__FILE__,
550
+				__FUNCTION__,
551
+				__LINE__
552
+			);
553
+		}
554
+		return $success;
555
+	}
556
+
557
+
558
+	/**
559
+	 * Deletes the specified question (and its associated question options) or question group
560
+	 *
561
+	 * @param int                  $id
562
+	 * @param EEM_Soft_Delete_Base $model
563
+	 * @return boolean
564
+	 * @throws EE_Error
565
+	 * @throws InvalidArgumentException
566
+	 * @throws InvalidDataTypeException
567
+	 * @throws InvalidInterfaceException
568
+	 */
569
+	protected function _delete_item($id, $model)
570
+	{
571
+		if ($model instanceof EEM_Question) {
572
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
573
+		}
574
+		return $model->delete_permanently_by_ID(absint($id));
575
+	}
576
+
577
+
578
+	/******************************    QUESTION GROUPS    ******************************/
579
+
580
+
581
+	/**
582
+	 * @param string $type
583
+	 * @return void
584
+	 * @throws DomainException
585
+	 * @throws EE_Error
586
+	 * @throws InvalidArgumentException
587
+	 * @throws InvalidDataTypeException
588
+	 * @throws InvalidInterfaceException
589
+	 */
590
+	protected function _edit_question_group($type = 'add')
591
+	{
592
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
593
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID'])
594
+			? absint($this->_req_data['QSG_ID'])
595
+			: false;
596
+
597
+		switch ($this->_req_action) {
598
+			case 'add_question_group':
599
+				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
600
+				break;
601
+			case 'edit_question_group':
602
+				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
603
+				break;
604
+			default:
605
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
606
+		}
607
+		// add ID to title if editing
608
+		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
609
+		if ($ID) {
610
+			/** @var EE_Question_Group $questionGroup */
611
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
612
+			$additional_hidden_fields = array('QSG_ID' => array('type' => 'hidden', 'value' => $ID));
613
+			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
614
+		} else {
615
+			/** @var EE_Question_Group $questionGroup */
616
+			$questionGroup = EEM_Question_Group::instance()->create_default_object();
617
+			$questionGroup->set_order_to_latest();
618
+			$this->_set_add_edit_form_tags('insert_question_group');
619
+		}
620
+		$this->_template_args['values'] = $this->_yes_no_values;
621
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
622
+		$this->_template_args['QSG_ID'] = $ID ? $ID : true;
623
+		$this->_template_args['question_group'] = $questionGroup;
624
+
625
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
626
+		$this->_set_publish_post_box_vars('id', $ID, false, $redirect_URL);
627
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
628
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php',
629
+			$this->_template_args,
630
+			true
631
+		);
632
+
633
+		// the details template wrapper
634
+		$this->display_admin_page_with_sidebar();
635
+	}
636
+
637
+
638
+	/**
639
+	 * @return void
640
+	 * @throws EE_Error
641
+	 * @throws InvalidArgumentException
642
+	 * @throws InvalidDataTypeException
643
+	 * @throws InvalidInterfaceException
644
+	 */
645
+	protected function _delete_question_groups()
646
+	{
647
+		$success = $this->_delete_items($this->_question_group_model);
648
+		$this->_redirect_after_action(
649
+			$success,
650
+			$this->_question_group_model->item_name($success),
651
+			'deleted permanently',
652
+			array('action' => 'question_groups', 'status' => 'trash')
653
+		);
654
+	}
655
+
656
+
657
+	/**
658
+	 * @param bool $new_question_group
659
+	 * @throws EE_Error
660
+	 * @throws InvalidArgumentException
661
+	 * @throws InvalidDataTypeException
662
+	 * @throws InvalidInterfaceException
663
+	 */
664
+	protected function _insert_or_update_question_group($new_question_group = true)
665
+	{
666
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
667
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
668
+		if ($new_question_group) {
669
+			// make sure identifier is unique
670
+			$identifier_value = isset($set_column_values['QSG_identifier']) ? $set_column_values['QSG_identifier'] : '';
671
+			$identifier_exists = ! empty($identifier_value)
672
+				? $this->_question_group_model->count([['QSG_identifier' => $set_column_values['QSG_identifier']]]) > 0
673
+				: false;
674
+			if ($identifier_exists) {
675
+				$set_column_values['QSG_identifier'] .= uniqid('id', true);
676
+			}
677
+			$QSG_ID = $this->_question_group_model->insert($set_column_values);
678
+			$success = $QSG_ID ? 1 : 0;
679
+			if ($success === 0) {
680
+				EE_Error::add_error(
681
+					esc_html__('Something went wrong saving the question group.', 'event_espresso'),
682
+					__FILE__,
683
+					__FUNCTION__,
684
+					__LINE__
685
+				);
686
+				$this->_redirect_after_action(
687
+					false,
688
+					'',
689
+					'',
690
+					array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID),
691
+					true
692
+				);
693
+			}
694
+		} else {
695
+			$QSG_ID = absint($this->_req_data['QSG_ID']);
696
+			unset($set_column_values['QSG_ID']);
697
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
698
+		}
699
+
700
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(
701
+			EEM_Attendee::system_question_phone
702
+		);
703
+		// update the existing related questions
704
+		// BUT FIRST...  delete the phone question from the Question_Group_Question
705
+		// if it is being added to this question group (therefore removed from the existing group)
706
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ])) {
707
+			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
708
+			EEM_Question_Group_Question::instance()->delete(
709
+				array(
710
+					array(
711
+						'QST_ID' => $phone_question_id,
712
+						'QSG_ID' => array('!=', $QSG_ID),
713
+					),
714
+				)
715
+			);
716
+		}
717
+		/** @type EE_Question_Group $question_group */
718
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
719
+		$questions = $question_group->questions();
720
+		// make sure system phone question is added to list of questions for this group
721
+		if (! isset($questions[ $phone_question_id ])) {
722
+			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
723
+		}
724
+
725
+		foreach ($questions as $question_ID => $question) {
726
+			// first we always check for order.
727
+			if (! empty($this->_req_data['question_orders'][ $question_ID ])) {
728
+				// update question order
729
+				$question_group->update_question_order(
730
+					$question_ID,
731
+					$this->_req_data['question_orders'][ $question_ID ]
732
+				);
733
+			}
734
+
735
+			// then we always check if adding or removing.
736
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ])) {
737
+				$question_group->add_question($question_ID);
738
+			} else {
739
+				// not found, remove it (but only if not a system question for the personal group
740
+				// with the exception of lname system question - we allow removal of it)
741
+				if (
742
+					in_array(
743
+						$question->system_ID(),
744
+						EEM_Question::instance()->required_system_questions_in_system_question_group(
745
+							$question_group->system_group()
746
+						)
747
+					)
748
+				) {
749
+					continue;
750
+				} else {
751
+					$question_group->remove_question($question_ID);
752
+				}
753
+			}
754
+		}
755
+		// save new related questions
756
+		if (isset($this->_req_data['questions'])) {
757
+			foreach ($this->_req_data['questions'] as $QST_ID) {
758
+				$question_group->add_question($QST_ID);
759
+				if (isset($this->_req_data['question_orders'][ $QST_ID ])) {
760
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][ $QST_ID ]);
761
+				}
762
+			}
763
+		}
764
+
765
+		if ($success !== false) {
766
+			$msg = $new_question_group
767
+				? sprintf(
768
+					esc_html__('The %s has been created', 'event_espresso'),
769
+					$this->_question_group_model->item_name()
770
+				)
771
+				: sprintf(
772
+					esc_html__(
773
+						'The %s has been updated',
774
+						'event_espresso'
775
+					),
776
+					$this->_question_group_model->item_name()
777
+				);
778
+			EE_Error::add_success($msg);
779
+		}
780
+		$this->_redirect_after_action(
781
+			false,
782
+			'',
783
+			'',
784
+			array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID),
785
+			true
786
+		);
787
+	}
788
+
789
+
790
+	/**
791
+	 * duplicates a question and all its question options and redirects to the new question.
792
+	 *
793
+	 * @return void
794
+	 * @throws EE_Error
795
+	 * @throws InvalidArgumentException
796
+	 * @throws ReflectionException
797
+	 * @throws InvalidDataTypeException
798
+	 * @throws InvalidInterfaceException
799
+	 */
800
+	public function _duplicate_question()
801
+	{
802
+		$question_ID = (int) $this->_req_data['QST_ID'];
803
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
804
+		if ($question instanceof EE_Question) {
805
+			$new_question = $question->duplicate();
806
+			if ($new_question instanceof EE_Question) {
807
+				$this->_redirect_after_action(
808
+					true,
809
+					esc_html__('Question', 'event_espresso'),
810
+					esc_html__('Duplicated', 'event_espresso'),
811
+					array('action' => 'edit_question', 'QST_ID' => $new_question->ID()),
812
+					true
813
+				);
814
+			} else {
815
+				global $wpdb;
816
+				EE_Error::add_error(
817
+					sprintf(
818
+						esc_html__(
819
+							'Could not duplicate question with ID %1$d because: %2$s',
820
+							'event_espresso'
821
+						),
822
+						$question_ID,
823
+						$wpdb->last_error
824
+					),
825
+					__FILE__,
826
+					__FUNCTION__,
827
+					__LINE__
828
+				);
829
+				$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
830
+			}
831
+		} else {
832
+			EE_Error::add_error(
833
+				sprintf(
834
+					esc_html__(
835
+						'Could not duplicate question with ID %d because it didn\'t exist!',
836
+						'event_espresso'
837
+					),
838
+					$question_ID
839
+				),
840
+				__FILE__,
841
+				__FUNCTION__,
842
+				__LINE__
843
+			);
844
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
845
+		}
846
+	}
847
+
848
+
849
+	/**
850
+	 * @param bool $trash
851
+	 * @throws EE_Error
852
+	 */
853
+	protected function _trash_or_restore_question_groups($trash = true)
854
+	{
855
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
856
+	}
857
+
858
+
859
+	/**
860
+	 *_trash_question
861
+	 *
862
+	 * @return void
863
+	 * @throws EE_Error
864
+	 */
865
+	protected function _trash_question()
866
+	{
867
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
868
+		$query_args = array('action' => 'default', 'status' => 'all');
869
+		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
870
+	}
871
+
872
+
873
+	/**
874
+	 * @param bool $trash
875
+	 * @throws EE_Error
876
+	 */
877
+	protected function _trash_or_restore_questions($trash = true)
878
+	{
879
+		$this->_trash_or_restore_items($this->_question_model, $trash);
880
+	}
881
+
882
+
883
+	/**
884
+	 * Internally used to delete or restore items, using the request data. Meant to be
885
+	 * flexible between question or question groups
886
+	 *
887
+	 * @param EEM_Soft_Delete_Base $model
888
+	 * @param boolean              $trash whether to trash or restore
889
+	 * @throws EE_Error
890
+	 */
891
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = true)
892
+	{
893
+
894
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
895
+
896
+		$success = 1;
897
+		// Checkboxes
898
+		// echo "trash $trash";
899
+		// var_dump($this->_req_data['checkbox']);die;
900
+		if (isset($this->_req_data['checkbox'])) {
901
+			if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
902
+				// if array has more than one element than success message should be plural
903
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
904
+				// cycle thru bulk action checkboxes
905
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
906
+					if (! $model->delete_or_restore_by_ID($trash, absint($ID))) {
907
+						$success = 0;
908
+					}
909
+				}
910
+			} else {
911
+				// grab single id and delete
912
+				$ID = absint($this->_req_data['checkbox']);
913
+				if (! $model->delete_or_restore_by_ID($trash, $ID)) {
914
+					$success = 0;
915
+				}
916
+			}
917
+		} else {
918
+			// delete via trash link
919
+			// grab single id and delete
920
+			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
921
+			if (! $model->delete_or_restore_by_ID($trash, $ID)) {
922
+				$success = 0;
923
+			}
924
+		}
925
+
926
+
927
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';// strtolower( $model->item_name(2) );
928
+		// echo "action :$action";
929
+		// $action = 'questions' ? 'default' : $action;
930
+		if ($trash) {
931
+			$action_desc = 'trashed';
932
+			$status = 'trash';
933
+		} else {
934
+			$action_desc = 'restored';
935
+			$status = 'all';
936
+		}
937
+		$this->_redirect_after_action(
938
+			$success,
939
+			$model->item_name($success),
940
+			$action_desc,
941
+			array('action' => $action, 'status' => $status)
942
+		);
943
+	}
944
+
945
+
946
+	/**
947
+	 * @param            $per_page
948
+	 * @param int        $current_page
949
+	 * @param bool|false $count
950
+	 * @return EE_Soft_Delete_Base_Class[]|int
951
+	 * @throws EE_Error
952
+	 * @throws InvalidArgumentException
953
+	 * @throws InvalidDataTypeException
954
+	 * @throws InvalidInterfaceException
955
+	 */
956
+	public function get_trashed_questions($per_page, $current_page = 1, $count = false)
957
+	{
958
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
959
+
960
+		if ($count) {
961
+			// note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
962
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
963
+			$results = $this->_question_model->count_deleted($where);
964
+		} else {
965
+			// note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
966
+			$results = $this->_question_model->get_all_deleted($query_params);
967
+		}
968
+		return $results;
969
+	}
970
+
971
+
972
+	/**
973
+	 * @param            $per_page
974
+	 * @param int        $current_page
975
+	 * @param bool|false $count
976
+	 * @return EE_Soft_Delete_Base_Class[]|int
977
+	 * @throws EE_Error
978
+	 * @throws InvalidArgumentException
979
+	 * @throws InvalidDataTypeException
980
+	 * @throws InvalidInterfaceException
981
+	 */
982
+	public function get_question_groups($per_page, $current_page = 1, $count = false)
983
+	{
984
+		$questionGroupModel = EEM_Question_Group::instance();
985
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
986
+		if ($count) {
987
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
988
+			$results = $questionGroupModel->count($where);
989
+		} else {
990
+			$results = $questionGroupModel->get_all($query_params);
991
+		}
992
+		return $results;
993
+	}
994
+
995
+
996
+	/**
997
+	 * @param      $per_page
998
+	 * @param int  $current_page
999
+	 * @param bool $count
1000
+	 * @return EE_Soft_Delete_Base_Class[]|int
1001
+	 * @throws EE_Error
1002
+	 * @throws InvalidArgumentException
1003
+	 * @throws InvalidDataTypeException
1004
+	 * @throws InvalidInterfaceException
1005
+	 */
1006
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = false)
1007
+	{
1008
+		$questionGroupModel = EEM_Question_Group::instance();
1009
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
1010
+		if ($count) {
1011
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
1012
+			$query_params['limit'] = null;
1013
+			$results = $questionGroupModel->count_deleted($where);
1014
+		} else {
1015
+			$results = $questionGroupModel->get_all_deleted($query_params);
1016
+		}
1017
+		return $results;
1018
+	}
1019
+
1020
+
1021
+	/**
1022
+	 * method for performing updates to question order
1023
+	 *
1024
+	 * @return void results array
1025
+	 * @throws EE_Error
1026
+	 * @throws InvalidArgumentException
1027
+	 * @throws InvalidDataTypeException
1028
+	 * @throws InvalidInterfaceException
1029
+	 */
1030
+	public function update_question_group_order()
1031
+	{
1032
+
1033
+		$success = esc_html__('Question group order was updated successfully.', 'event_espresso');
1034
+
1035
+		// grab our row IDs
1036
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
1037
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
1038
+			: array();
1039
+
1040
+		$perpage = ! empty($this->_req_data['perpage'])
1041
+			? (int) $this->_req_data['perpage']
1042
+			: null;
1043
+		$curpage = ! empty($this->_req_data['curpage'])
1044
+			? (int) $this->_req_data['curpage']
1045
+			: null;
1046
+
1047
+		if (! empty($row_ids)) {
1048
+			// figure out where we start the row_id count at for the current page.
1049
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
1050
+
1051
+			$row_count = count($row_ids);
1052
+			for ($i = 0; $i < $row_count; $i++) {
1053
+				// Update the questions when re-ordering
1054
+				$updated = EEM_Question_Group::instance()->update(
1055
+					array('QSG_order' => $qsgcount),
1056
+					array(array('QSG_ID' => $row_ids[ $i ]))
1057
+				);
1058
+				if ($updated === false) {
1059
+					$success = false;
1060
+				}
1061
+				$qsgcount++;
1062
+			}
1063
+		} else {
1064
+			$success = false;
1065
+		}
1066
+
1067
+		$errors = ! $success
1068
+			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
1069
+			: false;
1070
+
1071
+		echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
1072
+		die();
1073
+	}
1074
+
1075
+
1076
+
1077
+	/***************************************       REGISTRATION SETTINGS       ***************************************/
1078
+
1079
+
1080
+	/**
1081
+	 * @throws DomainException
1082
+	 * @throws EE_Error
1083
+	 * @throws InvalidArgumentException
1084
+	 * @throws InvalidDataTypeException
1085
+	 * @throws InvalidInterfaceException
1086
+	 */
1087
+	protected function _reg_form_settings()
1088
+	{
1089
+		$this->_template_args['values'] = $this->_yes_no_values;
1090
+		add_action(
1091
+			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
1092
+			array($this, 'email_validation_settings_form'),
1093
+			2
1094
+		);
1095
+		add_action(
1096
+			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
1097
+			array($this, 'copy_attendee_info_settings_form'),
1098
+			4
1099
+		);
1100
+		$this->_template_args = (array) apply_filters(
1101
+			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
1102
+			$this->_template_args
1103
+		);
1104
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
1105
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
1106
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
1107
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
1108
+			$this->_template_args,
1109
+			true
1110
+		);
1111
+		$this->display_admin_page_with_sidebar();
1112
+	}
1113
+
1114
+
1115
+	/**
1116
+	 * @return void
1117
+	 * @throws EE_Error
1118
+	 * @throws InvalidArgumentException
1119
+	 * @throws ReflectionException
1120
+	 * @throws InvalidDataTypeException
1121
+	 * @throws InvalidInterfaceException
1122
+	 */
1123
+	protected function _update_reg_form_settings()
1124
+	{
1125
+		EE_Registry::instance()->CFG->registration = $this->update_email_validation_settings_form(
1126
+			EE_Registry::instance()->CFG->registration
1127
+		);
1128
+		EE_Registry::instance()->CFG->registration = $this->update_copy_attendee_info_settings_form(
1129
+			EE_Registry::instance()->CFG->registration
1130
+		);
1131
+		EE_Registry::instance()->CFG->registration = apply_filters(
1132
+			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
1133
+			EE_Registry::instance()->CFG->registration
1134
+		);
1135
+		$success = $this->_update_espresso_configuration(
1136
+			esc_html__('Registration Form Options', 'event_espresso'),
1137
+			EE_Registry::instance()->CFG,
1138
+			__FILE__,
1139
+			__FUNCTION__,
1140
+			__LINE__
1141
+		);
1142
+		$this->_redirect_after_action(
1143
+			$success,
1144
+			esc_html__('Registration Form Options', 'event_espresso'),
1145
+			'updated',
1146
+			array('action' => 'view_reg_form_settings')
1147
+		);
1148
+	}
1149
+
1150
+
1151
+	/**
1152
+	 * @return void
1153
+	 * @throws EE_Error
1154
+	 * @throws InvalidArgumentException
1155
+	 * @throws InvalidDataTypeException
1156
+	 * @throws InvalidInterfaceException
1157
+	 */
1158
+	public function copy_attendee_info_settings_form()
1159
+	{
1160
+		echo $this->_copy_attendee_info_settings_form()->get_html();
1161
+	}
1162
+
1163
+	/**
1164
+	 * _copy_attendee_info_settings_form
1165
+	 *
1166
+	 * @access protected
1167
+	 * @return EE_Form_Section_Proper
1168
+	 * @throws \EE_Error
1169
+	 */
1170
+	protected function _copy_attendee_info_settings_form()
1171
+	{
1172
+		return new EE_Form_Section_Proper(
1173
+			array(
1174
+				'name'            => 'copy_attendee_info_settings',
1175
+				'html_id'         => 'copy_attendee_info_settings',
1176
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1177
+				'subsections'     => apply_filters(
1178
+					'FHEE__Extend_Registration_Form_Admin_Page___copy_attendee_info_settings_form__form_subsections',
1179
+					array(
1180
+						'copy_attendee_info_hdr'   => new EE_Form_Section_HTML(
1181
+							EEH_HTML::h2(esc_html__('Copy Attendee Info Settings', 'event_espresso'))
1182
+						),
1183
+						'copy_attendee_info' => new EE_Yes_No_Input(
1184
+							array(
1185
+								'html_label_text' => esc_html__(
1186
+									'Allow copy #1 attendee info to extra attendees?',
1187
+									'event_espresso'
1188
+								),
1189
+								'html_help_text'  => esc_html__(
1190
+									'Set to yes if you want to enable the copy of #1 attendee info to extra attendees at Registration Form.',
1191
+									'event_espresso'
1192
+								),
1193
+								'default'         => EE_Registry::instance()->CFG->registration->copyAttendeeInfo(),
1194
+								'required'        => false,
1195
+								'display_html_label_text' => false,
1196
+							)
1197
+						),
1198
+					)
1199
+				),
1200
+			)
1201
+		);
1202
+	}
1203
+
1204
+	/**
1205
+	 * @param EE_Registration_Config $EE_Registration_Config
1206
+	 * @return EE_Registration_Config
1207
+	 * @throws EE_Error
1208
+	 * @throws InvalidArgumentException
1209
+	 * @throws ReflectionException
1210
+	 * @throws InvalidDataTypeException
1211
+	 * @throws InvalidInterfaceException
1212
+	 */
1213
+	public function update_copy_attendee_info_settings_form(EE_Registration_Config $EE_Registration_Config)
1214
+	{
1215
+		$prev_copy_attendee_info = $EE_Registration_Config->copyAttendeeInfo();
1216
+		try {
1217
+			$copy_attendee_info_settings_form = $this->_copy_attendee_info_settings_form();
1218
+			// if not displaying a form, then check for form submission
1219
+			if ($copy_attendee_info_settings_form->was_submitted()) {
1220
+				// capture form data
1221
+				$copy_attendee_info_settings_form->receive_form_submission();
1222
+				// validate form data
1223
+				if ($copy_attendee_info_settings_form->is_valid()) {
1224
+					// grab validated data from form
1225
+					$valid_data = $copy_attendee_info_settings_form->valid_data();
1226
+					if (isset($valid_data['copy_attendee_info'])) {
1227
+						$EE_Registration_Config->setCopyAttendeeInfo($valid_data['copy_attendee_info']);
1228
+					} else {
1229
+						EE_Error::add_error(
1230
+							esc_html__(
1231
+								'Invalid or missing Copy Attendee Info settings. Please refresh the form and try again.',
1232
+								'event_espresso'
1233
+							),
1234
+							__FILE__,
1235
+							__FUNCTION__,
1236
+							__LINE__
1237
+						);
1238
+					}
1239
+				} else {
1240
+					if ($copy_attendee_info_settings_form->submission_error_message() !== '') {
1241
+						EE_Error::add_error(
1242
+							$copy_attendee_info_settings_form->submission_error_message(),
1243
+							__FILE__,
1244
+							__FUNCTION__,
1245
+							__LINE__
1246
+						);
1247
+					}
1248
+				}
1249
+			}
1250
+		} catch (EE_Error $e) {
1251
+			$e->get_error();
1252
+		}
1253
+		return $EE_Registration_Config;
1254
+	}
1255
+
1256
+
1257
+	/**
1258
+	 * @return void
1259
+	 * @throws EE_Error
1260
+	 * @throws InvalidArgumentException
1261
+	 * @throws InvalidDataTypeException
1262
+	 * @throws InvalidInterfaceException
1263
+	 */
1264
+	public function email_validation_settings_form()
1265
+	{
1266
+		echo $this->_email_validation_settings_form()->get_html();
1267
+	}
1268
+
1269
+
1270
+	/**
1271
+	 * _email_validation_settings_form
1272
+	 *
1273
+	 * @access protected
1274
+	 * @return EE_Form_Section_Proper
1275
+	 * @throws \EE_Error
1276
+	 */
1277
+	protected function _email_validation_settings_form()
1278
+	{
1279
+		return new EE_Form_Section_Proper(
1280
+			array(
1281
+				'name'            => 'email_validation_settings',
1282
+				'html_id'         => 'email_validation_settings',
1283
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1284
+				'subsections'     => apply_filters(
1285
+					'FHEE__Extend_Registration_Form_Admin_Page___email_validation_settings_form__form_subsections',
1286
+					array(
1287
+						'email_validation_hdr'   => new EE_Form_Section_HTML(
1288
+							EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
1289
+						),
1290
+						'email_validation_level' => new EE_Select_Input(
1291
+							array(
1292
+								'basic'      => esc_html__('Basic', 'event_espresso'),
1293
+								'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
1294
+								'i18n'       => esc_html__('International', 'event_espresso'),
1295
+								'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
1296
+							),
1297
+							array(
1298
+								'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
1299
+													 . EEH_Template::get_help_tab_link('email_validation_info'),
1300
+								'html_help_text'  => esc_html__(
1301
+									'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.',
1302
+									'event_espresso'
1303
+								),
1304
+								'default'         => isset(
1305
+									EE_Registry::instance()->CFG->registration->email_validation_level
1306
+								)
1307
+									? EE_Registry::instance()->CFG->registration->email_validation_level
1308
+									: 'wp_default',
1309
+								'required'        => false,
1310
+							)
1311
+						),
1312
+					)
1313
+				),
1314
+			)
1315
+		);
1316
+	}
1317
+
1318
+
1319
+	/**
1320
+	 * @param EE_Registration_Config $EE_Registration_Config
1321
+	 * @return EE_Registration_Config
1322
+	 * @throws EE_Error
1323
+	 * @throws InvalidArgumentException
1324
+	 * @throws ReflectionException
1325
+	 * @throws InvalidDataTypeException
1326
+	 * @throws InvalidInterfaceException
1327
+	 */
1328
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config)
1329
+	{
1330
+		$prev_email_validation_level = $EE_Registration_Config->email_validation_level;
1331
+		try {
1332
+			$email_validation_settings_form = $this->_email_validation_settings_form();
1333
+			// if not displaying a form, then check for form submission
1334
+			if ($email_validation_settings_form->was_submitted()) {
1335
+				// capture form data
1336
+				$email_validation_settings_form->receive_form_submission();
1337
+				// validate form data
1338
+				if ($email_validation_settings_form->is_valid()) {
1339
+					// grab validated data from form
1340
+					$valid_data = $email_validation_settings_form->valid_data();
1341
+					if (isset($valid_data['email_validation_level'])) {
1342
+						$email_validation_level = $valid_data['email_validation_level'];
1343
+						// now if they want to use international email addresses
1344
+						if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') {
1345
+							// in case we need to reset their email validation level,
1346
+							// make sure that the previous value wasn't already set to one of the i18n options.
1347
+							if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') {
1348
+								// if so, then reset it back to "basic" since that is the only other option that,
1349
+								// despite offering poor validation, supports i18n email addresses
1350
+								$prev_email_validation_level = 'basic';
1351
+							}
1352
+							// confirm our i18n email validation will work on the server
1353
+							if (! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1354
+								// or reset email validation level to previous value
1355
+								$email_validation_level = $prev_email_validation_level;
1356
+							}
1357
+						}
1358
+						$EE_Registration_Config->email_validation_level = $email_validation_level;
1359
+					} else {
1360
+						EE_Error::add_error(
1361
+							esc_html__(
1362
+								'Invalid or missing Email Validation settings. Please refresh the form and try again.',
1363
+								'event_espresso'
1364
+							),
1365
+							__FILE__,
1366
+							__FUNCTION__,
1367
+							__LINE__
1368
+						);
1369
+					}
1370
+				} else {
1371
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1372
+						EE_Error::add_error(
1373
+							$email_validation_settings_form->submission_error_message(),
1374
+							__FILE__,
1375
+							__FUNCTION__,
1376
+							__LINE__
1377
+						);
1378
+					}
1379
+				}
1380
+			}
1381
+		} catch (EE_Error $e) {
1382
+			$e->get_error();
1383
+		}
1384
+		return $EE_Registration_Config;
1385
+	}
1386
+
1387
+
1388
+	/**
1389
+	 * confirms that the server's PHP version has the PCRE module enabled,
1390
+	 * and that the PCRE version works with our i18n email validation
1391
+	 *
1392
+	 * @param EE_Registration_Config $EE_Registration_Config
1393
+	 * @param string                 $email_validation_level
1394
+	 * @return bool
1395
+	 */
1396
+	private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1397
+	{
1398
+		// first check that PCRE is enabled
1399
+		if (! defined('PREG_BAD_UTF8_ERROR')) {
1400
+			EE_Error::add_error(
1401
+				sprintf(
1402
+					esc_html__(
1403
+						'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1404
+						'event_espresso'
1405
+					),
1406
+					'<br />'
1407
+				),
1408
+				__FILE__,
1409
+				__FUNCTION__,
1410
+				__LINE__
1411
+			);
1412
+			return false;
1413
+		} else {
1414
+			// PCRE support is enabled, but let's still
1415
+			// perform a test to see if the server will support it.
1416
+			// but first, save the updated validation level to the config,
1417
+			// so that the validation strategy picks it up.
1418
+			// this will get bumped back down if it doesn't work
1419
+			$EE_Registration_Config->email_validation_level = $email_validation_level;
1420
+			try {
1421
+				$email_validator = new EE_Email_Validation_Strategy();
1422
+				$i18n_email_address = apply_filters(
1423
+					'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1424
+					'jägerjü[email protected]'
1425
+				);
1426
+				$email_validator->validate($i18n_email_address);
1427
+			} catch (Exception $e) {
1428
+				EE_Error::add_error(
1429
+					sprintf(
1430
+						esc_html__(
1431
+							'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1432
+							'event_espresso'
1433
+						),
1434
+						'<br />',
1435
+						'<a href="http://php.net/manual/en/pcre.installation.php" target="_blank" rel="noopener noreferrer">http://php.net/manual/en/pcre.installation.php</a>'
1436
+					),
1437
+					__FILE__,
1438
+					__FUNCTION__,
1439
+					__LINE__
1440
+				);
1441
+				return false;
1442
+			}
1443
+		}
1444
+		return true;
1445
+	}
1446 1446
 }
Please login to merge, or discard this patch.
core/bootstrap_espresso.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function espresso_load_error_handling()
8 8
 {
9
-    static $error_handling_loaded = false;
10
-    if ($error_handling_loaded) {
11
-        return;
12
-    }
13
-    // load debugging tools
14
-    if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
-        require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
16
-        \EEH_Debug_Tools::instance();
17
-    }
18
-    // load error handling
19
-    if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
-        require_once EE_CORE . 'EE_Error.core.php';
21
-    } else {
22
-        wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23
-    }
24
-    $error_handling_loaded = true;
9
+	static $error_handling_loaded = false;
10
+	if ($error_handling_loaded) {
11
+		return;
12
+	}
13
+	// load debugging tools
14
+	if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
+		require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
16
+		\EEH_Debug_Tools::instance();
17
+	}
18
+	// load error handling
19
+	if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
+		require_once EE_CORE . 'EE_Error.core.php';
21
+	} else {
22
+		wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23
+	}
24
+	$error_handling_loaded = true;
25 25
 }
26 26
 
27 27
 
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function espresso_load_required($classname, $full_path_to_file)
37 37
 {
38
-    if (is_readable($full_path_to_file)) {
39
-        require_once $full_path_to_file;
40
-    } else {
41
-        throw new \EE_Error(
42
-            sprintf(
43
-                esc_html__(
44
-                    'The %s class file could not be located or is not readable due to file permissions.',
45
-                    'event_espresso'
46
-                ),
47
-                $classname
48
-            )
49
-        );
50
-    }
38
+	if (is_readable($full_path_to_file)) {
39
+		require_once $full_path_to_file;
40
+	} else {
41
+		throw new \EE_Error(
42
+			sprintf(
43
+				esc_html__(
44
+					'The %s class file could not be located or is not readable due to file permissions.',
45
+					'event_espresso'
46
+				),
47
+				$classname
48
+			)
49
+		);
50
+	}
51 51
 }
52 52
 
53 53
 
@@ -66,52 +66,52 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function bootstrap_espresso()
68 68
 {
69
-    require_once __DIR__ . '/espresso_definitions.php';
70
-    try {
71
-        espresso_load_error_handling();
72
-        // include WordPress shims for functions introduced in later versions of WordPress
73
-        espresso_load_required(
74
-            '',
75
-            EE_CORE . 'wordpress-shims.php'
76
-        );
77
-        espresso_load_required(
78
-            '',
79
-            EE_CORE . 'third-party-compatibility.php'
80
-        );
81
-        espresso_load_required(
82
-            'EEH_Base',
83
-            EE_CORE . 'helpers/EEH_Base.helper.php'
84
-        );
85
-        espresso_load_required(
86
-            'EEH_File',
87
-            EE_CORE . 'interfaces/EEHI_File.interface.php'
88
-        );
89
-        espresso_load_required(
90
-            'EEH_File',
91
-            EE_CORE . 'helpers/EEH_File.helper.php'
92
-        );
93
-        espresso_load_required(
94
-            'EEH_Array',
95
-            EE_CORE . 'helpers/EEH_Array.helper.php'
96
-        );
97
-        espresso_load_required(
98
-            'EE_Base',
99
-            EE_CORE . 'EE_Base.core.php'
100
-        );
101
-        // instantiate and configure PSR4 autoloader
102
-        espresso_load_required(
103
-            'Psr4Autoloader',
104
-            EE_CORE . 'Psr4Autoloader.php'
105
-        );
106
-        espresso_load_required(
107
-            'EE_Psr4AutoloaderInit',
108
-            EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
109
-        );
110
-        $AutoloaderInit = new EE_Psr4AutoloaderInit();
111
-        $AutoloaderInit->initializeAutoloader();
112
-        new EventEspresso\core\services\bootstrap\BootstrapCore();
113
-    } catch (Exception $e) {
114
-        require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php';
115
-        new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116
-    }
69
+	require_once __DIR__ . '/espresso_definitions.php';
70
+	try {
71
+		espresso_load_error_handling();
72
+		// include WordPress shims for functions introduced in later versions of WordPress
73
+		espresso_load_required(
74
+			'',
75
+			EE_CORE . 'wordpress-shims.php'
76
+		);
77
+		espresso_load_required(
78
+			'',
79
+			EE_CORE . 'third-party-compatibility.php'
80
+		);
81
+		espresso_load_required(
82
+			'EEH_Base',
83
+			EE_CORE . 'helpers/EEH_Base.helper.php'
84
+		);
85
+		espresso_load_required(
86
+			'EEH_File',
87
+			EE_CORE . 'interfaces/EEHI_File.interface.php'
88
+		);
89
+		espresso_load_required(
90
+			'EEH_File',
91
+			EE_CORE . 'helpers/EEH_File.helper.php'
92
+		);
93
+		espresso_load_required(
94
+			'EEH_Array',
95
+			EE_CORE . 'helpers/EEH_Array.helper.php'
96
+		);
97
+		espresso_load_required(
98
+			'EE_Base',
99
+			EE_CORE . 'EE_Base.core.php'
100
+		);
101
+		// instantiate and configure PSR4 autoloader
102
+		espresso_load_required(
103
+			'Psr4Autoloader',
104
+			EE_CORE . 'Psr4Autoloader.php'
105
+		);
106
+		espresso_load_required(
107
+			'EE_Psr4AutoloaderInit',
108
+			EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
109
+		);
110
+		$AutoloaderInit = new EE_Psr4AutoloaderInit();
111
+		$AutoloaderInit->initializeAutoloader();
112
+		new EventEspresso\core\services\bootstrap\BootstrapCore();
113
+	} catch (Exception $e) {
114
+		require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php';
115
+		new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
         return;
12 12
     }
13 13
     // load debugging tools
14
-    if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
-        require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
14
+    if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
15
+        require_once EE_HELPERS.'EEH_Debug_Tools.helper.php';
16 16
         \EEH_Debug_Tools::instance();
17 17
     }
18 18
     // load error handling
19
-    if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
-        require_once EE_CORE . 'EE_Error.core.php';
19
+    if (is_readable(EE_CORE.'EE_Error.core.php')) {
20
+        require_once EE_CORE.'EE_Error.core.php';
21 21
     } else {
22 22
         wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23 23
     }
@@ -66,52 +66,52 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function bootstrap_espresso()
68 68
 {
69
-    require_once __DIR__ . '/espresso_definitions.php';
69
+    require_once __DIR__.'/espresso_definitions.php';
70 70
     try {
71 71
         espresso_load_error_handling();
72 72
         // include WordPress shims for functions introduced in later versions of WordPress
73 73
         espresso_load_required(
74 74
             '',
75
-            EE_CORE . 'wordpress-shims.php'
75
+            EE_CORE.'wordpress-shims.php'
76 76
         );
77 77
         espresso_load_required(
78 78
             '',
79
-            EE_CORE . 'third-party-compatibility.php'
79
+            EE_CORE.'third-party-compatibility.php'
80 80
         );
81 81
         espresso_load_required(
82 82
             'EEH_Base',
83
-            EE_CORE . 'helpers/EEH_Base.helper.php'
83
+            EE_CORE.'helpers/EEH_Base.helper.php'
84 84
         );
85 85
         espresso_load_required(
86 86
             'EEH_File',
87
-            EE_CORE . 'interfaces/EEHI_File.interface.php'
87
+            EE_CORE.'interfaces/EEHI_File.interface.php'
88 88
         );
89 89
         espresso_load_required(
90 90
             'EEH_File',
91
-            EE_CORE . 'helpers/EEH_File.helper.php'
91
+            EE_CORE.'helpers/EEH_File.helper.php'
92 92
         );
93 93
         espresso_load_required(
94 94
             'EEH_Array',
95
-            EE_CORE . 'helpers/EEH_Array.helper.php'
95
+            EE_CORE.'helpers/EEH_Array.helper.php'
96 96
         );
97 97
         espresso_load_required(
98 98
             'EE_Base',
99
-            EE_CORE . 'EE_Base.core.php'
99
+            EE_CORE.'EE_Base.core.php'
100 100
         );
101 101
         // instantiate and configure PSR4 autoloader
102 102
         espresso_load_required(
103 103
             'Psr4Autoloader',
104
-            EE_CORE . 'Psr4Autoloader.php'
104
+            EE_CORE.'Psr4Autoloader.php'
105 105
         );
106 106
         espresso_load_required(
107 107
             'EE_Psr4AutoloaderInit',
108
-            EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
108
+            EE_CORE.'EE_Psr4AutoloaderInit.core.php'
109 109
         );
110 110
         $AutoloaderInit = new EE_Psr4AutoloaderInit();
111 111
         $AutoloaderInit->initializeAutoloader();
112 112
         new EventEspresso\core\services\bootstrap\BootstrapCore();
113 113
     } catch (Exception $e) {
114
-        require_once EE_CORE . 'exceptions/ExceptionStackTraceDisplay.php';
114
+        require_once EE_CORE.'exceptions/ExceptionStackTraceDisplay.php';
115 115
         new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116 116
     }
117 117
 }
Please login to merge, or discard this patch.