Completed
Branch FET-3467-waitlists (871a70)
by
unknown
96:23 queued 82:42
created
libraries/form_sections/strategies/layout/EE_Template_Layout.strategy.php 2 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -27,201 +27,201 @@  discard block
 block discarded – undo
27 27
 class EE_Template_Layout extends EE_Div_Per_Section_Layout
28 28
 {
29 29
 
30
-    protected $_layout_template_file       = null;
31
-
32
-    protected $_layout_begin_template_file = null;
33
-
34
-    protected $_input_template_file        = null;
35
-
36
-    protected $_subsection_template_file   = null;
37
-
38
-    protected $_layout_end_template_file   = null;
39
-
40
-    protected $_template_args              = array();
41
-
42
-
43
-
44
-    /**
45
-     * @param array $template_options {
46
-     * @type string $_layout_template_file
47
-     * @type string $_begin_template_file
48
-     * @type string $_input_template_file
49
-     * @type string $_subsection_template_file
50
-     * @type string $_end_template_file
51
-     * @type array  $_template_args
52
-     *                                }
53
-     */
54
-    public function __construct($template_options = array())
55
-    {
56
-        // loop through incoming options
57
-        foreach ($template_options as $key => $value) {
58
-            // add underscore to $key to match property names
59
-            $_key = '_' . $key;
60
-            if (property_exists($this, $_key)) {
61
-                $this->{$_key} = $value;
62
-            }
63
-        }
64
-        parent::__construct();
65
-    }
66
-
67
-
68
-
69
-    /**
70
-     * Also has the side effect of enqueuing any needed JS and CSS for
71
-     * this form.
72
-     * Creates all the HTML necessary for displaying this form, its inputs, and
73
-     * proper subsections.
74
-     * Returns the HTML
75
-     *
76
-     * @return string
77
-     */
78
-    public function layout_form()
79
-    {
80
-        if ($this->_layout_template_file) {
81
-            return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), true, true);
82
-        } else {
83
-            return parent::layout_form();
84
-        }
85
-    }
86
-
87
-
88
-
89
-    /**
90
-     * opening div tag for a form
91
-     *
92
-     * @return string
93
-     */
94
-    public function layout_form_begin()
95
-    {
96
-        if ($this->_layout_begin_template_file) {
97
-            return EEH_Template::locate_template(
98
-                $this->_layout_begin_template_file,
99
-                $this->template_args(),
100
-                true,
101
-                true
102
-            );
103
-        } else {
104
-            return parent::layout_form_begin();
105
-        }
106
-    }
107
-
108
-
109
-
110
-    /**
111
-     * If an input_template_file was provided upon construction, uses that to layout the input. Otherwise uses parent.
112
-     *
113
-     * @see EE_DIv_Per_Section_Layout::layout_input() for documentation
114
-     * @param EE_Form_Input_Base $input
115
-     * @return string
116
-     */
117
-    public function layout_input($input)
118
-    {
119
-        if ($this->_input_template_file) {
120
-            return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), true, true);
121
-        }
122
-        return parent::layout_input($input);
123
-    }
124
-
125
-
126
-
127
-    /**
128
-     * If a subsection_template_file was provided upon construction, uses that to layout the subsection. Otherwise uses parent.
129
-     *
130
-     * @see EE_Div_Per_Section_Layout::layout_subsection() for documentation
131
-     * @param EE_Form_Section_Proper $form_section
132
-     * @return string
133
-     */
134
-    public function layout_subsection($form_section)
135
-    {
136
-        if ($this->_subsection_template_file) {
137
-            return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), true, true);
138
-        }
139
-        return parent::layout_subsection($form_section);
140
-    }
141
-
142
-
143
-
144
-    /**
145
-     * closing div tag for a form
146
-     *
147
-     * @return string
148
-     */
149
-    public function layout_form_end()
150
-    {
151
-        if ($this->_layout_end_template_file) {
152
-            return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), true, true);
153
-        } else {
154
-            return parent::layout_form_end();
155
-        }
156
-    }
157
-
158
-
159
-
160
-    /**
161
-     * @param array $template_args
162
-     */
163
-    public function set_template_args($template_args = array())
164
-    {
165
-        $this->_template_args = $template_args;
166
-    }
167
-
168
-
169
-
170
-    /**
171
-     * @param array $template_args
172
-     */
173
-    public function add_template_args($template_args = array())
174
-    {
175
-        $this->_template_args = array_merge_recursive($this->_template_args, $template_args);
176
-    }
177
-
178
-
179
-
180
-    /**
181
-     * @return array
182
-     */
183
-    public function template_args()
184
-    {
185
-        foreach ($this->form_section()->subsections() as $subsection_name => $subsection) {
186
-            $subsection_name = self::prep_form_subsection_key_name($subsection_name);
187
-            if (strpos($subsection_name, '[') !== false) {
188
-                $sub_name = explode('[', $subsection_name);
189
-                $this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection);
190
-            } else {
191
-                $this->_template_args[$subsection_name] = $this->layout_subsection($subsection);
192
-            }
193
-        }
194
-        //		d( $this->_template_args );
195
-        return $this->_template_args;
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     * prep_form_section_key_name
202
-     *
203
-     * @access public
204
-     * @param string $subsection_name
205
-     * @return string
206
-     */
207
-    public static function prep_form_subsection_key_name($subsection_name = '')
208
-    {
209
-        $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name);
210
-        return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name;
211
-    }
212
-
213
-
214
-
215
-    /**
216
-     * get_subform - just a wrapper for the above method
217
-     *
218
-     * @access public
219
-     * @param string $subsection_name
220
-     * @return string
221
-     */
222
-    public static function get_subform_name($subsection_name = '')
223
-    {
224
-        return EE_Template_Layout::prep_form_subsection_key_name($subsection_name);
225
-    }
30
+	protected $_layout_template_file       = null;
31
+
32
+	protected $_layout_begin_template_file = null;
33
+
34
+	protected $_input_template_file        = null;
35
+
36
+	protected $_subsection_template_file   = null;
37
+
38
+	protected $_layout_end_template_file   = null;
39
+
40
+	protected $_template_args              = array();
41
+
42
+
43
+
44
+	/**
45
+	 * @param array $template_options {
46
+	 * @type string $_layout_template_file
47
+	 * @type string $_begin_template_file
48
+	 * @type string $_input_template_file
49
+	 * @type string $_subsection_template_file
50
+	 * @type string $_end_template_file
51
+	 * @type array  $_template_args
52
+	 *                                }
53
+	 */
54
+	public function __construct($template_options = array())
55
+	{
56
+		// loop through incoming options
57
+		foreach ($template_options as $key => $value) {
58
+			// add underscore to $key to match property names
59
+			$_key = '_' . $key;
60
+			if (property_exists($this, $_key)) {
61
+				$this->{$_key} = $value;
62
+			}
63
+		}
64
+		parent::__construct();
65
+	}
66
+
67
+
68
+
69
+	/**
70
+	 * Also has the side effect of enqueuing any needed JS and CSS for
71
+	 * this form.
72
+	 * Creates all the HTML necessary for displaying this form, its inputs, and
73
+	 * proper subsections.
74
+	 * Returns the HTML
75
+	 *
76
+	 * @return string
77
+	 */
78
+	public function layout_form()
79
+	{
80
+		if ($this->_layout_template_file) {
81
+			return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), true, true);
82
+		} else {
83
+			return parent::layout_form();
84
+		}
85
+	}
86
+
87
+
88
+
89
+	/**
90
+	 * opening div tag for a form
91
+	 *
92
+	 * @return string
93
+	 */
94
+	public function layout_form_begin()
95
+	{
96
+		if ($this->_layout_begin_template_file) {
97
+			return EEH_Template::locate_template(
98
+				$this->_layout_begin_template_file,
99
+				$this->template_args(),
100
+				true,
101
+				true
102
+			);
103
+		} else {
104
+			return parent::layout_form_begin();
105
+		}
106
+	}
107
+
108
+
109
+
110
+	/**
111
+	 * If an input_template_file was provided upon construction, uses that to layout the input. Otherwise uses parent.
112
+	 *
113
+	 * @see EE_DIv_Per_Section_Layout::layout_input() for documentation
114
+	 * @param EE_Form_Input_Base $input
115
+	 * @return string
116
+	 */
117
+	public function layout_input($input)
118
+	{
119
+		if ($this->_input_template_file) {
120
+			return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), true, true);
121
+		}
122
+		return parent::layout_input($input);
123
+	}
124
+
125
+
126
+
127
+	/**
128
+	 * If a subsection_template_file was provided upon construction, uses that to layout the subsection. Otherwise uses parent.
129
+	 *
130
+	 * @see EE_Div_Per_Section_Layout::layout_subsection() for documentation
131
+	 * @param EE_Form_Section_Proper $form_section
132
+	 * @return string
133
+	 */
134
+	public function layout_subsection($form_section)
135
+	{
136
+		if ($this->_subsection_template_file) {
137
+			return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), true, true);
138
+		}
139
+		return parent::layout_subsection($form_section);
140
+	}
141
+
142
+
143
+
144
+	/**
145
+	 * closing div tag for a form
146
+	 *
147
+	 * @return string
148
+	 */
149
+	public function layout_form_end()
150
+	{
151
+		if ($this->_layout_end_template_file) {
152
+			return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), true, true);
153
+		} else {
154
+			return parent::layout_form_end();
155
+		}
156
+	}
157
+
158
+
159
+
160
+	/**
161
+	 * @param array $template_args
162
+	 */
163
+	public function set_template_args($template_args = array())
164
+	{
165
+		$this->_template_args = $template_args;
166
+	}
167
+
168
+
169
+
170
+	/**
171
+	 * @param array $template_args
172
+	 */
173
+	public function add_template_args($template_args = array())
174
+	{
175
+		$this->_template_args = array_merge_recursive($this->_template_args, $template_args);
176
+	}
177
+
178
+
179
+
180
+	/**
181
+	 * @return array
182
+	 */
183
+	public function template_args()
184
+	{
185
+		foreach ($this->form_section()->subsections() as $subsection_name => $subsection) {
186
+			$subsection_name = self::prep_form_subsection_key_name($subsection_name);
187
+			if (strpos($subsection_name, '[') !== false) {
188
+				$sub_name = explode('[', $subsection_name);
189
+				$this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection);
190
+			} else {
191
+				$this->_template_args[$subsection_name] = $this->layout_subsection($subsection);
192
+			}
193
+		}
194
+		//		d( $this->_template_args );
195
+		return $this->_template_args;
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 * prep_form_section_key_name
202
+	 *
203
+	 * @access public
204
+	 * @param string $subsection_name
205
+	 * @return string
206
+	 */
207
+	public static function prep_form_subsection_key_name($subsection_name = '')
208
+	{
209
+		$subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name);
210
+		return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name;
211
+	}
212
+
213
+
214
+
215
+	/**
216
+	 * get_subform - just a wrapper for the above method
217
+	 *
218
+	 * @access public
219
+	 * @param string $subsection_name
220
+	 * @return string
221
+	 */
222
+	public static function get_subform_name($subsection_name = '')
223
+	{
224
+		return EE_Template_Layout::prep_form_subsection_key_name($subsection_name);
225
+	}
226 226
 }
227 227
 // End of file EE_Template_Layout.strategy.php
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // loop through incoming options
57 57
         foreach ($template_options as $key => $value) {
58 58
             // add underscore to $key to match property names
59
-            $_key = '_' . $key;
59
+            $_key = '_'.$key;
60 60
             if (property_exists($this, $_key)) {
61 61
                 $this->{$_key} = $value;
62 62
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public static function prep_form_subsection_key_name($subsection_name = '')
208 208
     {
209 209
         $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name);
210
-        return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name;
210
+        return is_numeric(substr($subsection_name, 0, 1)) ? 'form_'.$subsection_name : $subsection_name;
211 211
     }
212 212
 
213 213
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
      *
112 112
      * @abstract
113 113
      * @access protected
114
-     * @return array
114
+     * @return string[]
115 115
      */
116 116
     protected function _get_table_filters()
117 117
     {
Please login to merge, or discard this patch.
Indentation   +427 added lines, -427 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -22,106 +22,106 @@  discard block
 block discarded – undo
22 22
 class EE_Admin_Transactions_List_Table extends EE_Admin_List_Table
23 23
 {
24 24
 
25
-    private $_status;
26
-
27
-
28
-    /**
29
-     * @param \Transactions_Admin_Page $admin_page
30
-     */
31
-    public function __construct(\Transactions_Admin_Page $admin_page)
32
-    {
33
-        parent::__construct($admin_page);
34
-        $this->_status = $this->_admin_page->get_transaction_status_array();
35
-    }
36
-
37
-
38
-    /**
39
-     *_setup_data
40
-     */
41
-    protected function _setup_data()
42
-    {
43
-        $this->_data           = $this->_admin_page->get_transactions($this->_per_page);
44
-        $status                = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
45
-        $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, true, $status);
46
-    }
47
-
48
-
49
-    /**
50
-     *_set_properties
51
-     */
52
-    protected function _set_properties()
53
-    {
54
-        $this->_wp_list_args = array(
55
-            'singular' => __('transaction', 'event_espresso'),
56
-            'plural'   => __('transactions', 'event_espresso'),
57
-            'ajax'     => true,
58
-            'screen'   => $this->_admin_page->get_current_screen()->id,
59
-        );
60
-        $ID_column_name      = __('ID', 'event_espresso');
61
-        $ID_column_name      .= ' : <span class="show-on-mobile-view-only" style="float:none">';
62
-        $ID_column_name      .= __('Transaction Date', 'event_espresso');
63
-        $ID_column_name      .= '</span> ';
64
-        $this->_columns      = array(
65
-            'TXN_ID'        => $ID_column_name,
66
-            'TXN_timestamp' => __('Transaction Date', 'event_espresso'),
67
-            'TXN_total'     => __('Total', 'event_espresso'),
68
-            'TXN_paid'      => __('Paid', 'event_espresso'),
69
-            'ATT_fname'     => __('Primary Registrant', 'event_espresso'),
70
-            'event_name'    => __('Event', 'event_espresso'),
71
-            'actions'       => __('Actions', 'event_espresso'),
72
-        );
73
-
74
-        $this->_sortable_columns = array(
75
-            'TXN_ID'        => array('TXN_ID' => false),
76
-            'event_name'    => array('event_name' => false),
77
-            'ATT_fname'     => array('ATT_fname' => false),
78
-            'TXN_timestamp' => array('TXN_timestamp' => true) //true means its already sorted
79
-        );
80
-
81
-        $this->_primary_column = 'TXN_ID';
82
-
83
-        $this->_hidden_columns = array();
84
-    }
85
-
86
-
87
-    /**
88
-     * This simply sets up the row class for the table rows.
89
-     * Allows for easier overriding of child methods for setting up sorting.
90
-     *
91
-     * @param  EE_Transaction $item the current item
92
-     * @return string
93
-     * @throws \EE_Error
94
-     */
95
-    protected function _get_row_class($item)
96
-    {
97
-        $class = parent::_get_row_class($item);
98
-        //add status class
99
-        $class .= ' ee-status-strip txn-status-' . $item->status_ID();
100
-        if ($this->_has_checkbox_column) {
101
-            $class .= ' has-checkbox-column';
102
-        }
103
-        return $class;
104
-    }
105
-
106
-
107
-    /**
108
-     * _get_table_filters
109
-     * We use this to assemble and return any filters that are associated with this table that help further refine what
110
-     * get's shown in the table.
111
-     *
112
-     * @abstract
113
-     * @access protected
114
-     * @return array
115
-     */
116
-    protected function _get_table_filters()
117
-    {
118
-        $filters    = array();
119
-        $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y',
120
-            strtotime('-10 year'));
121
-        $end_date   = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y',
122
-            current_time('timestamp'));
123
-        ob_start();
124
-        ?>
25
+	private $_status;
26
+
27
+
28
+	/**
29
+	 * @param \Transactions_Admin_Page $admin_page
30
+	 */
31
+	public function __construct(\Transactions_Admin_Page $admin_page)
32
+	{
33
+		parent::__construct($admin_page);
34
+		$this->_status = $this->_admin_page->get_transaction_status_array();
35
+	}
36
+
37
+
38
+	/**
39
+	 *_setup_data
40
+	 */
41
+	protected function _setup_data()
42
+	{
43
+		$this->_data           = $this->_admin_page->get_transactions($this->_per_page);
44
+		$status                = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
45
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, true, $status);
46
+	}
47
+
48
+
49
+	/**
50
+	 *_set_properties
51
+	 */
52
+	protected function _set_properties()
53
+	{
54
+		$this->_wp_list_args = array(
55
+			'singular' => __('transaction', 'event_espresso'),
56
+			'plural'   => __('transactions', 'event_espresso'),
57
+			'ajax'     => true,
58
+			'screen'   => $this->_admin_page->get_current_screen()->id,
59
+		);
60
+		$ID_column_name      = __('ID', 'event_espresso');
61
+		$ID_column_name      .= ' : <span class="show-on-mobile-view-only" style="float:none">';
62
+		$ID_column_name      .= __('Transaction Date', 'event_espresso');
63
+		$ID_column_name      .= '</span> ';
64
+		$this->_columns      = array(
65
+			'TXN_ID'        => $ID_column_name,
66
+			'TXN_timestamp' => __('Transaction Date', 'event_espresso'),
67
+			'TXN_total'     => __('Total', 'event_espresso'),
68
+			'TXN_paid'      => __('Paid', 'event_espresso'),
69
+			'ATT_fname'     => __('Primary Registrant', 'event_espresso'),
70
+			'event_name'    => __('Event', 'event_espresso'),
71
+			'actions'       => __('Actions', 'event_espresso'),
72
+		);
73
+
74
+		$this->_sortable_columns = array(
75
+			'TXN_ID'        => array('TXN_ID' => false),
76
+			'event_name'    => array('event_name' => false),
77
+			'ATT_fname'     => array('ATT_fname' => false),
78
+			'TXN_timestamp' => array('TXN_timestamp' => true) //true means its already sorted
79
+		);
80
+
81
+		$this->_primary_column = 'TXN_ID';
82
+
83
+		$this->_hidden_columns = array();
84
+	}
85
+
86
+
87
+	/**
88
+	 * This simply sets up the row class for the table rows.
89
+	 * Allows for easier overriding of child methods for setting up sorting.
90
+	 *
91
+	 * @param  EE_Transaction $item the current item
92
+	 * @return string
93
+	 * @throws \EE_Error
94
+	 */
95
+	protected function _get_row_class($item)
96
+	{
97
+		$class = parent::_get_row_class($item);
98
+		//add status class
99
+		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
100
+		if ($this->_has_checkbox_column) {
101
+			$class .= ' has-checkbox-column';
102
+		}
103
+		return $class;
104
+	}
105
+
106
+
107
+	/**
108
+	 * _get_table_filters
109
+	 * We use this to assemble and return any filters that are associated with this table that help further refine what
110
+	 * get's shown in the table.
111
+	 *
112
+	 * @abstract
113
+	 * @access protected
114
+	 * @return array
115
+	 */
116
+	protected function _get_table_filters()
117
+	{
118
+		$filters    = array();
119
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y',
120
+			strtotime('-10 year'));
121
+		$end_date   = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y',
122
+			current_time('timestamp'));
123
+		ob_start();
124
+		?>
125 125
         <label for="txn-filter-start-date">Display Transactions from </label>
126 126
         <input id="txn-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>"
127 127
                name="txn-filter-start-date" size="15"/>
@@ -129,361 +129,361 @@  discard block
 block discarded – undo
129 129
         <input id="txn-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>"
130 130
                name="txn-filter-end-date" size="15"/>
131 131
         <?php
132
-        $filters[] = ob_get_contents();
133
-        ob_end_clean();
134
-        return $filters;
135
-    }
136
-
137
-
138
-    /**
139
-     *_add_view_counts
140
-     */
141
-    protected function _add_view_counts()
142
-    {
143
-        $this->_views['all']['count']       = $this->_admin_page->get_transactions($this->_per_page, true, 'all');
144
-        $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, true, 'abandoned');
145
-        $this->_views['failed']['count']    = $this->_admin_page->get_transactions($this->_per_page, true, 'failed');
146
-    }
147
-
148
-
149
-    /**
150
-     *    column TXN_ID
151
-     *
152
-     * @param \EE_Transaction $item
153
-     * @return string
154
-     * @throws \EE_Error
155
-     */
156
-    public function column_TXN_ID(EE_Transaction $item)
157
-    {
158
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
159
-            'action' => 'view_transaction',
160
-            'TXN_ID' => $item->ID(),
161
-        ), TXN_ADMIN_URL);
162
-        $content      = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('Go to Transaction Details',
163
-                'event_espresso') . '">' . $item->ID() . '</a>';
164
-
165
-        //txn timestamp
166
-        $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp($item) . '</span>';
167
-        return $content;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param \EE_Transaction $item
173
-     * @return mixed|string|void
174
-     * @throws \EE_Error
175
-     */
176
-    protected function _get_txn_timestamp(EE_Transaction $item)
177
-    {
178
-        //txn timestamp
179
-        // is TXN less than 2 hours old ?
180
-        if (
181
-            ($item->failed() || $item->is_abandoned())
182
-            && (
183
-                (time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true)
184
-            )
185
-        ) {
186
-            $timestamp = __('TXN in progress...', 'event_espresso');
187
-        } else {
188
-            $timestamp = $item->get_i18n_datetime('TXN_timestamp');
189
-        }
190
-        return $timestamp;
191
-    }
192
-
193
-
194
-    /**
195
-     *    column_cb
196
-     *
197
-     * @param \EE_Transaction $item
198
-     * @return string
199
-     * @throws \EE_Error
200
-     */
201
-    public function column_cb($item)
202
-    {
203
-        return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],
204
-            $item->ID());
205
-    }
206
-
207
-
208
-    /**
209
-     *    column_TXN_timestamp
210
-     *
211
-     * @param \EE_Transaction $item
212
-     * @return string
213
-     * @throws \EE_Error
214
-     */
215
-    public function column_TXN_timestamp(EE_Transaction $item)
216
-    {
217
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
218
-            'action' => 'view_transaction',
219
-            'TXN_ID' => $item->ID(),
220
-        ), TXN_ADMIN_URL);
221
-        $txn_date     = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details for TXN #',
222
-                'event_espresso') . $item->ID() . '">' . $this->_get_txn_timestamp($item) . '</a>';
223
-        //status
224
-        $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
225
-                'sentence') . '</span>';
226
-        return $txn_date;
227
-    }
228
-
229
-
230
-    /**
231
-     *    column_TXN_total
232
-     *
233
-     * @param \EE_Transaction $item
234
-     * @return string
235
-     * @throws \EE_Error
236
-     */
237
-    public function column_TXN_total(EE_Transaction $item)
238
-    {
239
-        if ($item->get('TXN_total') > 0) {
240
-            return '<span class="txn-pad-rght">' . apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
241
-                    $item->get_pretty('TXN_total'), $item) . '</span>';
242
-        } else {
243
-            return '<span class="txn-overview-free-event-spn">' . __('free', 'event_espresso') . '</span>';
244
-        }
245
-    }
246
-
247
-
248
-    /**
249
-     *    column_TXN_paid
250
-     *
251
-     * @param \EE_Transaction $item
252
-     * @return mixed|string
253
-     * @throws \EE_Error
254
-     */
255
-    public function column_TXN_paid(EE_Transaction $item)
256
-    {
257
-        $transaction_total = $item->get('TXN_total');
258
-        $transaction_paid  = $item->get('TXN_paid');
259
-
260
-        if (\EEH_Money::compare_floats($transaction_total, 0, '>')) {
261
-            // monies owing
262
-            $span_class = 'txn-overview-part-payment-spn';
263
-            if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
264
-                // paid in full
265
-                $span_class = 'txn-overview-full-payment-spn';
266
-            } elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) {
267
-                // no payments made
268
-                $span_class = 'txn-overview-no-payment-spn';
269
-            }
270
-        } else {
271
-            $span_class       = 'txn-overview-free-event-spn';
272
-            $transaction_paid = 0;
273
-        }
274
-
275
-        $payment_method      = $item->payment_method();
276
-        $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown',
277
-            'event_espresso');
278
-
279
-        $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
280
-        if ($transaction_paid > 0) {
281
-            $content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
282
-                    $payment_method_name) . '</span>';
283
-        }
284
-        return $content;
285
-    }
286
-
287
-
288
-    /**
289
-     *    column_ATT_fname
290
-     *
291
-     * @param \EE_Transaction $item
292
-     * @return string|void
293
-     * @throws \EE_Error
294
-     */
295
-    public function column_ATT_fname(EE_Transaction $item)
296
-    {
297
-        $primary_reg = $item->primary_registration();
298
-        $attendee    = $primary_reg->get_first_related('Attendee');
299
-        if ($attendee instanceof EE_Attendee) {
300
-            $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
301
-                'action'  => 'view_registration',
302
-                '_REG_ID' => $primary_reg->ID(),
303
-            ), REG_ADMIN_URL);
304
-            $content      = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
305
-                'espresso_registrations_view_registration',
306
-                $primary_reg->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details',
307
-                    'event_espresso') . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
308
-            $content      .= '<br>' . $attendee->email();
309
-            return $content;
310
-        }
311
-        return $item->failed() || $item->is_abandoned() ? __('no contact record.',
312
-            'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.',
313
-            'event_espresso');
314
-    }
315
-
316
-
317
-    /**
318
-     *    column_ATT_email
319
-     *
320
-     * @param \EE_Transaction $item
321
-     * @return string|void
322
-     * @throws \EE_Error
323
-     */
324
-    public function column_ATT_email(EE_Transaction $item)
325
-    {
326
-        $attendee = $item->primary_registration()->get_first_related('Attendee');
327
-        if (! empty($attendee)) {
328
-            return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
329
-        } else {
330
-            return $item->failed() || $item->is_abandoned()
331
-                ? __('no contact record.', 'event_espresso')
332
-                : __(
333
-                    'No contact record, because the transaction was abandoned or the registration process failed.',
334
-                    'event_espresso'
335
-                );
336
-        }
337
-    }
338
-
339
-
340
-    /**
341
-     *    column_event_name
342
-     *
343
-     * @param \EE_Transaction $item
344
-     * @return string|void
345
-     * @throws \EE_Error
346
-     */
347
-    public function column_event_name(EE_Transaction $item)
348
-    {
349
-        $actions = array();
350
-        $event   = $item->primary_registration()->get_first_related('Event');
351
-        if (! empty($event)) {
352
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()),
353
-                EVENTS_ADMIN_URL);
354
-            $event_name     = $event->get('EVT_name');
355
-
356
-            //filter this view by transactions for this event
357
-            $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array(
358
-                'action' => 'default',
359
-                'EVT_ID' => $event->ID(),
360
-            ));
361
-            if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
362
-                $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event',
363
-                        'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
364
-            }
365
-
366
-            return sprintf('%1$s %2$s',
367
-                EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit',
368
-                    $event->ID()) ? '<a href="' . $edit_event_url . '" title="' . sprintf(esc_attr__('Edit Event: %s',
369
-                        'event_espresso'), $event->get('EVT_name')) . '">' . wp_trim_words($event_name, 30,
370
-                        '...') . '</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
371
-        } else {
372
-            return __('The event associated with this transaction via the primary registration cannot be retrieved.',
373
-                'event_espresso');
374
-        }
375
-    }
376
-
377
-
378
-    /**
379
-     *    column_actions
380
-     *
381
-     * @param \EE_Transaction $item
382
-     * @return string
383
-     * @throws \EE_Error
384
-     */
385
-    public function column_actions(EE_Transaction $item)
386
-    {
387
-
388
-        $registration = $item->primary_registration();
389
-        $attendee     = $registration->attendee();
390
-
391
-        //Build row actions
392
-        $view_lnk_url          = EE_Admin_Page::add_query_args_and_nonce(array(
393
-            'action' => 'view_transaction',
394
-            'TXN_ID' => $item->ID(),
395
-        ), TXN_ADMIN_URL);
396
-        $dl_invoice_lnk_url    = $registration->invoice_url();
397
-        $dl_receipt_lnk_url    = $registration->receipt_url();
398
-        $view_reg_lnk_url      = EE_Admin_Page::add_query_args_and_nonce(array(
399
-            'action'  => 'view_registration',
400
-            '_REG_ID' => $registration->ID(),
401
-        ), REG_ADMIN_URL);
402
-        $send_pay_lnk_url      = EE_Admin_Page::add_query_args_and_nonce(array(
403
-            'action' => 'send_payment_reminder',
404
-            'TXN_ID' => $item->ID(),
405
-        ), TXN_ADMIN_URL);
406
-        $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array(
407
-            'TXN_ID' => $item->ID(),
408
-        ));
409
-
410
-        //Build row actions
411
-        $view_lnk = '
132
+		$filters[] = ob_get_contents();
133
+		ob_end_clean();
134
+		return $filters;
135
+	}
136
+
137
+
138
+	/**
139
+	 *_add_view_counts
140
+	 */
141
+	protected function _add_view_counts()
142
+	{
143
+		$this->_views['all']['count']       = $this->_admin_page->get_transactions($this->_per_page, true, 'all');
144
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, true, 'abandoned');
145
+		$this->_views['failed']['count']    = $this->_admin_page->get_transactions($this->_per_page, true, 'failed');
146
+	}
147
+
148
+
149
+	/**
150
+	 *    column TXN_ID
151
+	 *
152
+	 * @param \EE_Transaction $item
153
+	 * @return string
154
+	 * @throws \EE_Error
155
+	 */
156
+	public function column_TXN_ID(EE_Transaction $item)
157
+	{
158
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
159
+			'action' => 'view_transaction',
160
+			'TXN_ID' => $item->ID(),
161
+		), TXN_ADMIN_URL);
162
+		$content      = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('Go to Transaction Details',
163
+				'event_espresso') . '">' . $item->ID() . '</a>';
164
+
165
+		//txn timestamp
166
+		$content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp($item) . '</span>';
167
+		return $content;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param \EE_Transaction $item
173
+	 * @return mixed|string|void
174
+	 * @throws \EE_Error
175
+	 */
176
+	protected function _get_txn_timestamp(EE_Transaction $item)
177
+	{
178
+		//txn timestamp
179
+		// is TXN less than 2 hours old ?
180
+		if (
181
+			($item->failed() || $item->is_abandoned())
182
+			&& (
183
+				(time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true)
184
+			)
185
+		) {
186
+			$timestamp = __('TXN in progress...', 'event_espresso');
187
+		} else {
188
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
189
+		}
190
+		return $timestamp;
191
+	}
192
+
193
+
194
+	/**
195
+	 *    column_cb
196
+	 *
197
+	 * @param \EE_Transaction $item
198
+	 * @return string
199
+	 * @throws \EE_Error
200
+	 */
201
+	public function column_cb($item)
202
+	{
203
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],
204
+			$item->ID());
205
+	}
206
+
207
+
208
+	/**
209
+	 *    column_TXN_timestamp
210
+	 *
211
+	 * @param \EE_Transaction $item
212
+	 * @return string
213
+	 * @throws \EE_Error
214
+	 */
215
+	public function column_TXN_timestamp(EE_Transaction $item)
216
+	{
217
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
218
+			'action' => 'view_transaction',
219
+			'TXN_ID' => $item->ID(),
220
+		), TXN_ADMIN_URL);
221
+		$txn_date     = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details for TXN #',
222
+				'event_espresso') . $item->ID() . '">' . $this->_get_txn_timestamp($item) . '</a>';
223
+		//status
224
+		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
225
+				'sentence') . '</span>';
226
+		return $txn_date;
227
+	}
228
+
229
+
230
+	/**
231
+	 *    column_TXN_total
232
+	 *
233
+	 * @param \EE_Transaction $item
234
+	 * @return string
235
+	 * @throws \EE_Error
236
+	 */
237
+	public function column_TXN_total(EE_Transaction $item)
238
+	{
239
+		if ($item->get('TXN_total') > 0) {
240
+			return '<span class="txn-pad-rght">' . apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
241
+					$item->get_pretty('TXN_total'), $item) . '</span>';
242
+		} else {
243
+			return '<span class="txn-overview-free-event-spn">' . __('free', 'event_espresso') . '</span>';
244
+		}
245
+	}
246
+
247
+
248
+	/**
249
+	 *    column_TXN_paid
250
+	 *
251
+	 * @param \EE_Transaction $item
252
+	 * @return mixed|string
253
+	 * @throws \EE_Error
254
+	 */
255
+	public function column_TXN_paid(EE_Transaction $item)
256
+	{
257
+		$transaction_total = $item->get('TXN_total');
258
+		$transaction_paid  = $item->get('TXN_paid');
259
+
260
+		if (\EEH_Money::compare_floats($transaction_total, 0, '>')) {
261
+			// monies owing
262
+			$span_class = 'txn-overview-part-payment-spn';
263
+			if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
264
+				// paid in full
265
+				$span_class = 'txn-overview-full-payment-spn';
266
+			} elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) {
267
+				// no payments made
268
+				$span_class = 'txn-overview-no-payment-spn';
269
+			}
270
+		} else {
271
+			$span_class       = 'txn-overview-free-event-spn';
272
+			$transaction_paid = 0;
273
+		}
274
+
275
+		$payment_method      = $item->payment_method();
276
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown',
277
+			'event_espresso');
278
+
279
+		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
280
+		if ($transaction_paid > 0) {
281
+			$content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
282
+					$payment_method_name) . '</span>';
283
+		}
284
+		return $content;
285
+	}
286
+
287
+
288
+	/**
289
+	 *    column_ATT_fname
290
+	 *
291
+	 * @param \EE_Transaction $item
292
+	 * @return string|void
293
+	 * @throws \EE_Error
294
+	 */
295
+	public function column_ATT_fname(EE_Transaction $item)
296
+	{
297
+		$primary_reg = $item->primary_registration();
298
+		$attendee    = $primary_reg->get_first_related('Attendee');
299
+		if ($attendee instanceof EE_Attendee) {
300
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
301
+				'action'  => 'view_registration',
302
+				'_REG_ID' => $primary_reg->ID(),
303
+			), REG_ADMIN_URL);
304
+			$content      = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
305
+				'espresso_registrations_view_registration',
306
+				$primary_reg->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details',
307
+					'event_espresso') . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
308
+			$content      .= '<br>' . $attendee->email();
309
+			return $content;
310
+		}
311
+		return $item->failed() || $item->is_abandoned() ? __('no contact record.',
312
+			'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.',
313
+			'event_espresso');
314
+	}
315
+
316
+
317
+	/**
318
+	 *    column_ATT_email
319
+	 *
320
+	 * @param \EE_Transaction $item
321
+	 * @return string|void
322
+	 * @throws \EE_Error
323
+	 */
324
+	public function column_ATT_email(EE_Transaction $item)
325
+	{
326
+		$attendee = $item->primary_registration()->get_first_related('Attendee');
327
+		if (! empty($attendee)) {
328
+			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
329
+		} else {
330
+			return $item->failed() || $item->is_abandoned()
331
+				? __('no contact record.', 'event_espresso')
332
+				: __(
333
+					'No contact record, because the transaction was abandoned or the registration process failed.',
334
+					'event_espresso'
335
+				);
336
+		}
337
+	}
338
+
339
+
340
+	/**
341
+	 *    column_event_name
342
+	 *
343
+	 * @param \EE_Transaction $item
344
+	 * @return string|void
345
+	 * @throws \EE_Error
346
+	 */
347
+	public function column_event_name(EE_Transaction $item)
348
+	{
349
+		$actions = array();
350
+		$event   = $item->primary_registration()->get_first_related('Event');
351
+		if (! empty($event)) {
352
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()),
353
+				EVENTS_ADMIN_URL);
354
+			$event_name     = $event->get('EVT_name');
355
+
356
+			//filter this view by transactions for this event
357
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array(
358
+				'action' => 'default',
359
+				'EVT_ID' => $event->ID(),
360
+			));
361
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
362
+				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event',
363
+						'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
364
+			}
365
+
366
+			return sprintf('%1$s %2$s',
367
+				EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit',
368
+					$event->ID()) ? '<a href="' . $edit_event_url . '" title="' . sprintf(esc_attr__('Edit Event: %s',
369
+						'event_espresso'), $event->get('EVT_name')) . '">' . wp_trim_words($event_name, 30,
370
+						'...') . '</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
371
+		} else {
372
+			return __('The event associated with this transaction via the primary registration cannot be retrieved.',
373
+				'event_espresso');
374
+		}
375
+	}
376
+
377
+
378
+	/**
379
+	 *    column_actions
380
+	 *
381
+	 * @param \EE_Transaction $item
382
+	 * @return string
383
+	 * @throws \EE_Error
384
+	 */
385
+	public function column_actions(EE_Transaction $item)
386
+	{
387
+
388
+		$registration = $item->primary_registration();
389
+		$attendee     = $registration->attendee();
390
+
391
+		//Build row actions
392
+		$view_lnk_url          = EE_Admin_Page::add_query_args_and_nonce(array(
393
+			'action' => 'view_transaction',
394
+			'TXN_ID' => $item->ID(),
395
+		), TXN_ADMIN_URL);
396
+		$dl_invoice_lnk_url    = $registration->invoice_url();
397
+		$dl_receipt_lnk_url    = $registration->receipt_url();
398
+		$view_reg_lnk_url      = EE_Admin_Page::add_query_args_and_nonce(array(
399
+			'action'  => 'view_registration',
400
+			'_REG_ID' => $registration->ID(),
401
+		), REG_ADMIN_URL);
402
+		$send_pay_lnk_url      = EE_Admin_Page::add_query_args_and_nonce(array(
403
+			'action' => 'send_payment_reminder',
404
+			'TXN_ID' => $item->ID(),
405
+		), TXN_ADMIN_URL);
406
+		$related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array(
407
+			'TXN_ID' => $item->ID(),
408
+		));
409
+
410
+		//Build row actions
411
+		$view_lnk = '
412 412
 			<li>
413 413
 				<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details', 'event_espresso') . '" class="tiny-text">
414 414
 					<span class="dashicons dashicons-cart"></span>
415 415
 				</a>
416 416
 			</li>';
417 417
 
418
-        $dl_invoice_lnk = '';
419
-        //only show invoice link if message type is active.
420
-        if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
421
-            $dl_invoice_lnk = '
418
+		$dl_invoice_lnk = '';
419
+		//only show invoice link if message type is active.
420
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
421
+			$dl_invoice_lnk = '
422 422
 			<li>
423 423
 				<a title="' . esc_attr__('View Transaction Invoice',
424
-                    'event_espresso') . '" target="_blank" href="' . $dl_invoice_lnk_url . '" class="tiny-text">
424
+					'event_espresso') . '" target="_blank" href="' . $dl_invoice_lnk_url . '" class="tiny-text">
425 425
 					<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
426 426
 				</a>
427 427
 			</li>';
428
-        }
428
+		}
429 429
 
430
-        $dl_receipt_lnk = '';
431
-        //only show receipt link if message type is active.
432
-        if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
433
-            $dl_receipt_lnk = '
430
+		$dl_receipt_lnk = '';
431
+		//only show receipt link if message type is active.
432
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
433
+			$dl_receipt_lnk = '
434 434
 			<li>
435 435
 				<a title="' . esc_attr__('View Transaction Receipt',
436
-                    'event_espresso') . '" target="_blank" href="' . $dl_receipt_lnk_url . '" class="tiny-text">
436
+					'event_espresso') . '" target="_blank" href="' . $dl_receipt_lnk_url . '" class="tiny-text">
437 437
 					<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
438 438
 				</a>
439 439
 			</li>';
440
-        }
441
-
442
-        //only show payment reminder link if the message type is active.
443
-        if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
444
-            $send_pay_lnk = $attendee instanceof EE_Attendee
445
-                            && EE_Registry::instance()->CAP->current_user_can(
446
-                'ee_send_message',
447
-                'espresso_transactions_send_payment_reminder'
448
-            )
449
-                ? '
440
+		}
441
+
442
+		//only show payment reminder link if the message type is active.
443
+		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
444
+			$send_pay_lnk = $attendee instanceof EE_Attendee
445
+							&& EE_Registry::instance()->CAP->current_user_can(
446
+				'ee_send_message',
447
+				'espresso_transactions_send_payment_reminder'
448
+			)
449
+				? '
450 450
 				<li>
451 451
 					<a href="' . $send_pay_lnk_url . '" title="' . esc_attr__('Send Payment Reminder',
452
-                    'event_espresso') . '" class="tiny-text">
452
+					'event_espresso') . '" class="tiny-text">
453 453
 						<span class="dashicons dashicons-email-alt"></span>
454 454
 					</a>
455 455
 				</li>'
456
-                : '';
457
-            $send_pay_lnk = $item->get('STS_ID') !== EEM_Transaction::complete_status_code
458
-                            && $item->get('STS_ID') !== EEM_Transaction::overpaid_status_code
459
-                ? $send_pay_lnk
460
-                : '';
461
-        } else {
462
-            $send_pay_lnk = '';
463
-        }
464
-
465
-        $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can(
466
-            'ee_read_registration',
467
-            'espresso_registrations_view_registration',
468
-            $registration->ID()
469
-        )
470
-            ? '
456
+				: '';
457
+			$send_pay_lnk = $item->get('STS_ID') !== EEM_Transaction::complete_status_code
458
+							&& $item->get('STS_ID') !== EEM_Transaction::overpaid_status_code
459
+				? $send_pay_lnk
460
+				: '';
461
+		} else {
462
+			$send_pay_lnk = '';
463
+		}
464
+
465
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can(
466
+			'ee_read_registration',
467
+			'espresso_registrations_view_registration',
468
+			$registration->ID()
469
+		)
470
+			? '
471 471
 				<li>
472 472
 					<a href="' . $view_reg_lnk_url . '" title="' . esc_attr__('View Registration Details',
473
-                'event_espresso') . '" class="tiny-text">
473
+				'event_espresso') . '" class="tiny-text">
474 474
 						<span class="dashicons dashicons-clipboard"></span>
475 475
 					</a>
476 476
 				</li>'
477
-            : '';
477
+			: '';
478 478
 
479
-        $view_related_messages_lnk = '';
480
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
481
-            $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
482
-        }
479
+		$view_related_messages_lnk = '';
480
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
481
+			$view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
482
+		}
483 483
 
484
-        return $this->_action_string($view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk,
485
-            $item, 'ul', 'txn-overview-actions-ul');
486
-    }
484
+		return $this->_action_string($view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk,
485
+			$item, 'ul', 'txn-overview-actions-ul');
486
+	}
487 487
 
488 488
 
489 489
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
             'ajax'     => true,
58 58
             'screen'   => $this->_admin_page->get_current_screen()->id,
59 59
         );
60
-        $ID_column_name      = __('ID', 'event_espresso');
60
+        $ID_column_name = __('ID', 'event_espresso');
61 61
         $ID_column_name      .= ' : <span class="show-on-mobile-view-only" style="float:none">';
62 62
         $ID_column_name      .= __('Transaction Date', 'event_espresso');
63 63
         $ID_column_name      .= '</span> ';
64
-        $this->_columns      = array(
64
+        $this->_columns = array(
65 65
             'TXN_ID'        => $ID_column_name,
66 66
             'TXN_timestamp' => __('Transaction Date', 'event_espresso'),
67 67
             'TXN_total'     => __('Total', 'event_espresso'),
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $class = parent::_get_row_class($item);
98 98
         //add status class
99
-        $class .= ' ee-status-strip txn-status-' . $item->status_ID();
99
+        $class .= ' ee-status-strip txn-status-'.$item->status_ID();
100 100
         if ($this->_has_checkbox_column) {
101 101
             $class .= ' has-checkbox-column';
102 102
         }
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
             'action' => 'view_transaction',
160 160
             'TXN_ID' => $item->ID(),
161 161
         ), TXN_ADMIN_URL);
162
-        $content      = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('Go to Transaction Details',
163
-                'event_espresso') . '">' . $item->ID() . '</a>';
162
+        $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details',
163
+                'event_espresso').'">'.$item->ID().'</a>';
164 164
 
165 165
         //txn timestamp
166
-        $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp($item) . '</span>';
166
+        $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
167 167
         return $content;
168 168
     }
169 169
 
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
             'action' => 'view_transaction',
219 219
             'TXN_ID' => $item->ID(),
220 220
         ), TXN_ADMIN_URL);
221
-        $txn_date     = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details for TXN #',
222
-                'event_espresso') . $item->ID() . '">' . $this->_get_txn_timestamp($item) . '</a>';
221
+        $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #',
222
+                'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
223 223
         //status
224
-        $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
225
-                'sentence') . '</span>';
224
+        $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false,
225
+                'sentence').'</span>';
226 226
         return $txn_date;
227 227
     }
228 228
 
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
     public function column_TXN_total(EE_Transaction $item)
238 238
     {
239 239
         if ($item->get('TXN_total') > 0) {
240
-            return '<span class="txn-pad-rght">' . apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
241
-                    $item->get_pretty('TXN_total'), $item) . '</span>';
240
+            return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
241
+                    $item->get_pretty('TXN_total'), $item).'</span>';
242 242
         } else {
243
-            return '<span class="txn-overview-free-event-spn">' . __('free', 'event_espresso') . '</span>';
243
+            return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
244 244
         }
245 245
     }
246 246
 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
         $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown',
277 277
             'event_espresso');
278 278
 
279
-        $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
279
+        $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
280 280
         if ($transaction_paid > 0) {
281
-            $content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
282
-                    $payment_method_name) . '</span>';
281
+            $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'),
282
+                    $payment_method_name).'</span>';
283 283
         }
284 284
         return $content;
285 285
     }
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
                 'action'  => 'view_registration',
302 302
                 '_REG_ID' => $primary_reg->ID(),
303 303
             ), REG_ADMIN_URL);
304
-            $content      = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
304
+            $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
305 305
                 'espresso_registrations_view_registration',
306
-                $primary_reg->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details',
307
-                    'event_espresso') . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
308
-            $content      .= '<br>' . $attendee->email();
306
+                $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details',
307
+                    'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
308
+            $content .= '<br>'.$attendee->email();
309 309
             return $content;
310 310
         }
311 311
         return $item->failed() || $item->is_abandoned() ? __('no contact record.',
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
     public function column_ATT_email(EE_Transaction $item)
325 325
     {
326 326
         $attendee = $item->primary_registration()->get_first_related('Attendee');
327
-        if (! empty($attendee)) {
328
-            return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
327
+        if ( ! empty($attendee)) {
328
+            return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
329 329
         } else {
330 330
             return $item->failed() || $item->is_abandoned()
331 331
                 ? __('no contact record.', 'event_espresso')
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     {
349 349
         $actions = array();
350 350
         $event   = $item->primary_registration()->get_first_related('Event');
351
-        if (! empty($event)) {
351
+        if ( ! empty($event)) {
352 352
             $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()),
353 353
                 EVENTS_ADMIN_URL);
354 354
             $event_name     = $event->get('EVT_name');
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
                 'EVT_ID' => $event->ID(),
360 360
             ));
361 361
             if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
362
-                $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event',
363
-                        'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
362
+                $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event',
363
+                        'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
364 364
             }
365 365
 
366 366
             return sprintf('%1$s %2$s',
367 367
                 EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit',
368
-                    $event->ID()) ? '<a href="' . $edit_event_url . '" title="' . sprintf(esc_attr__('Edit Event: %s',
369
-                        'event_espresso'), $event->get('EVT_name')) . '">' . wp_trim_words($event_name, 30,
370
-                        '...') . '</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
368
+                    $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s',
369
+                        'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30,
370
+                        '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
371 371
         } else {
372 372
             return __('The event associated with this transaction via the primary registration cannot be retrieved.',
373 373
                 'event_espresso');
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $attendee     = $registration->attendee();
390 390
 
391 391
         //Build row actions
392
-        $view_lnk_url          = EE_Admin_Page::add_query_args_and_nonce(array(
392
+        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
393 393
             'action' => 'view_transaction',
394 394
             'TXN_ID' => $item->ID(),
395 395
         ), TXN_ADMIN_URL);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             'action'  => 'view_registration',
400 400
             '_REG_ID' => $registration->ID(),
401 401
         ), REG_ADMIN_URL);
402
-        $send_pay_lnk_url      = EE_Admin_Page::add_query_args_and_nonce(array(
402
+        $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
403 403
             'action' => 'send_payment_reminder',
404 404
             'TXN_ID' => $item->ID(),
405 405
         ), TXN_ADMIN_URL);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         //Build row actions
411 411
         $view_lnk = '
412 412
 			<li>
413
-				<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details', 'event_espresso') . '" class="tiny-text">
413
+				<a href="' . $view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
414 414
 					<span class="dashicons dashicons-cart"></span>
415 415
 				</a>
416 416
 			</li>';
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             $dl_invoice_lnk = '
422 422
 			<li>
423 423
 				<a title="' . esc_attr__('View Transaction Invoice',
424
-                    'event_espresso') . '" target="_blank" href="' . $dl_invoice_lnk_url . '" class="tiny-text">
424
+                    'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
425 425
 					<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
426 426
 				</a>
427 427
 			</li>';
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             $dl_receipt_lnk = '
434 434
 			<li>
435 435
 				<a title="' . esc_attr__('View Transaction Receipt',
436
-                    'event_espresso') . '" target="_blank" href="' . $dl_receipt_lnk_url . '" class="tiny-text">
436
+                    'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
437 437
 					<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
438 438
 				</a>
439 439
 			</li>';
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
             )
449 449
                 ? '
450 450
 				<li>
451
-					<a href="' . $send_pay_lnk_url . '" title="' . esc_attr__('Send Payment Reminder',
452
-                    'event_espresso') . '" class="tiny-text">
451
+					<a href="' . $send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder',
452
+                    'event_espresso').'" class="tiny-text">
453 453
 						<span class="dashicons dashicons-email-alt"></span>
454 454
 					</a>
455 455
 				</li>'
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
         )
470 470
             ? '
471 471
 				<li>
472
-					<a href="' . $view_reg_lnk_url . '" title="' . esc_attr__('View Registration Details',
473
-                'event_espresso') . '" class="tiny-text">
472
+					<a href="' . $view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details',
473
+                'event_espresso').'" class="tiny-text">
474 474
 						<span class="dashicons dashicons-clipboard"></span>
475 475
 					</a>
476 476
 				</li>'
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 
479 479
         $view_related_messages_lnk = '';
480 480
         if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
481
-            $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
481
+            $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>';
482 482
         }
483 483
 
484
-        return $this->_action_string($view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk,
484
+        return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk,
485 485
             $item, 'ul', 'txn-overview-actions-ul');
486 486
     }
487 487
 
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 2 patches
Indentation   +606 added lines, -606 removed lines patch added patch discarded remove patch
@@ -16,612 +16,612 @@
 block discarded – undo
16 16
 class EE_SPCO_Line_Item_Display_Strategy implements EEI_Line_Item_Display
17 17
 {
18 18
 
19
-    /**
20
-     * array of events
21
-     *
22
-     * @type EE_Line_Item[] $_events
23
-     */
24
-    private $_events = array();
25
-
26
-    /**
27
-     * whether to display the taxes row or not
28
-     *
29
-     * @type bool $_show_taxes
30
-     */
31
-    private $_show_taxes = false;
32
-
33
-    /**
34
-     * html for any tax rows
35
-     *
36
-     * @type string $_show_taxes
37
-     */
38
-    private $_taxes_html = '';
39
-
40
-    /**
41
-     * total amount including tax we can bill for at this time
42
-     *
43
-     * @type float $_grand_total
44
-     */
45
-    private $_grand_total = 0.00;
46
-
47
-    /**
48
-     * total number of items being billed for
49
-     *
50
-     * @type int $_total_items
51
-     */
52
-    private $_total_items = 0;
53
-
54
-
55
-
56
-    /**
57
-     * @return float
58
-     */
59
-    public function grand_total()
60
-    {
61
-        return $this->_grand_total;
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * @return int
68
-     */
69
-    public function total_items()
70
-    {
71
-        return $this->_total_items;
72
-    }
73
-
74
-
75
-
76
-    /**
77
-     * @param EE_Line_Item $line_item
78
-     * @param array        $options
79
-     * @param EE_Line_Item $parent_line_item
80
-     * @return mixed
81
-     * @throws EE_Error
82
-     */
83
-    public function display_line_item(
84
-        EE_Line_Item $line_item,
85
-        $options = array(),
86
-        EE_Line_Item $parent_line_item = null
87
-    ) {
88
-        $html = '';
89
-        // set some default options and merge with incoming
90
-        $default_options = array(
91
-            'show_desc' => true,  // 	true 		false
92
-            'odd'       => false,
93
-        );
94
-        $options = array_merge($default_options, (array)$options);
95
-        switch ($line_item->type()) {
96
-            case EEM_Line_Item::type_line_item:
97
-                $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
98
-                if ($line_item->OBJ_type() === 'Ticket') {
99
-                    // item row
100
-                    $html .= $this->_ticket_row($line_item, $options);
101
-                } else {
102
-                    // item row
103
-                    $html .= $this->_item_row($line_item, $options);
104
-                }
105
-                if (
106
-                apply_filters(
107
-                    'FHEE__EE_SPCO_Line_Item_Display_Strategy__display_line_item__display_sub_line_items',
108
-                    true
109
-                )
110
-                ) {
111
-                    // got any kids?
112
-                    foreach ($line_item->children() as $child_line_item) {
113
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
114
-                    }
115
-                }
116
-                break;
117
-            case EEM_Line_Item::type_sub_line_item:
118
-                $html .= $this->_sub_item_row($line_item, $options, $parent_line_item);
119
-                break;
120
-            case EEM_Line_Item::type_sub_total:
121
-                static $sub_total = 0;
122
-                $event_sub_total = 0;
123
-                $text = esc_html__('Sub-Total', 'event_espresso');
124
-                if ($line_item->OBJ_type() === 'Event') {
125
-                    $options['event_id'] = $event_id = $line_item->OBJ_ID();
126
-                    if (! isset($this->_events[$options['event_id']])) {
127
-                        $event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
128
-                        // if event has default reg status of Not Approved, then don't display info on it
129
-                        if (
130
-                            $event instanceof EE_Event
131
-                            && $event->default_registration_status() === EEM_Registration::status_id_not_approved
132
-                        ) {
133
-                            $display_event = false;
134
-                            // unless there are registrations for it that are returning to pay
135
-                            if (isset($options['registrations']) && is_array($options['registrations'])) {
136
-                                foreach ($options['registrations'] as $registration) {
137
-                                    if (! $registration instanceof EE_Registration) {
138
-                                        continue;
139
-                                    }
140
-                                    $display_event = $registration->event_ID() === $options['event_id']
141
-                                                     && $registration->status_ID() !== EEM_Registration::status_id_not_approved
142
-                                        ? true
143
-                                        : $display_event;
144
-                                }
145
-                            }
146
-                            if (! $display_event) {
147
-                                return '';
148
-                            }
149
-                        }
150
-                        $this->_events[$options['event_id']] = 0;
151
-                        $html .= $this->_event_row($line_item);
152
-                        $text = esc_html__('Event Sub-Total', 'event_espresso');
153
-                    }
154
-                }
155
-                $child_line_items = $line_item->children();
156
-                // loop thru children
157
-                foreach ($child_line_items as $child_line_item) {
158
-                    // recursively feed children back into this method
159
-                    $html .= $this->display_line_item($child_line_item, $options, $line_item);
160
-                }
161
-                $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
162
-                $sub_total += $event_sub_total;
163
-                if (
164
-                    (
165
-                        // event subtotals
166
-                        $line_item->code() !== 'pre-tax-subtotal' && count($child_line_items) > 1
167
-                    )
168
-                    || (
169
-                        // pre-tax subtotals
170
-                        $line_item->code() === 'pre-tax-subtotal' && count($this->_events) > 1
171
-                    )
172
-                ) {
173
-                    $options['sub_total'] = $line_item->OBJ_type() === 'Event' ? $event_sub_total : $sub_total;
174
-                    $html .= $this->_sub_total_row($line_item, $text, $options);
175
-                }
176
-                break;
177
-            case EEM_Line_Item::type_tax:
178
-                if ($this->_show_taxes) {
179
-                    $this->_taxes_html .= $this->_tax_row($line_item, $options);
180
-                }
181
-                break;
182
-            case EEM_Line_Item::type_tax_sub_total:
183
-                if ($this->_show_taxes) {
184
-                    $child_line_items = $line_item->children();
185
-                    // loop thru children
186
-                    foreach ($child_line_items as $child_line_item) {
187
-                        // recursively feed children back into this method
188
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
189
-                    }
190
-                    if (count($child_line_items) > 1) {
191
-                        $this->_taxes_html .= $this->_total_tax_row($line_item, esc_html__('Tax Total', 'event_espresso'));
192
-                    }
193
-                }
194
-                break;
195
-            case EEM_Line_Item::type_total:
196
-                // get all child line items
197
-                $children = $line_item->children();
198
-                // loop thru all non-tax child line items
199
-                foreach ($children as $child_line_item) {
200
-                    if ($child_line_item->type() !== EEM_Line_Item::type_tax_sub_total) {
201
-                        // recursively feed children back into this method
202
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
203
-                    }
204
-                }
205
-                // now loop thru  tax child line items
206
-                foreach ($children as $child_line_item) {
207
-                    if ($child_line_item->type() === EEM_Line_Item::type_tax_sub_total) {
208
-                        // recursively feed children back into this method
209
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
210
-                    }
211
-                }
212
-                $html .= $this->_taxes_html;
213
-                $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'));
214
-                $html .= $this->_payments_and_amount_owing_rows($line_item, $options);
215
-                break;
216
-        }
217
-        return $html;
218
-    }
219
-
220
-
221
-
222
-    /**
223
-     * _event_row - basically a Heading row displayed once above each event's ticket rows
224
-     *
225
-     * @param EE_Line_Item $line_item
226
-     * @return mixed
227
-     */
228
-    private function _event_row(EE_Line_Item $line_item)
229
-    {
230
-        // start of row
231
-        $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
232
-        // event name td
233
-        $html .= EEH_HTML::td(
234
-            EEH_HTML::strong($line_item->name()),
235
-            '',
236
-            'event-header',
237
-            '',
238
-            ' colspan="4"'
239
-        );
240
-        // end of row
241
-        $html .= EEH_HTML::trx();
242
-        return $html;
243
-    }
244
-
245
-
246
-
247
-    /**
248
-     * _ticket_row
249
-     *
250
-     * @param EE_Line_Item $line_item
251
-     * @param array        $options
252
-     * @return mixed
253
-     * @throws EE_Error
254
-     */
255
-    private function _ticket_row(EE_Line_Item $line_item, $options = array())
256
-    {
257
-        // start of row
258
-        $row_class = $options['odd'] ? 'item odd' : 'item';
259
-        $html = EEH_HTML::tr('', '', $row_class);
260
-        // name && desc
261
-        $name_and_desc = apply_filters(
262
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
263
-            $line_item->name(),
264
-            $line_item
265
-        );
266
-        $name_and_desc .= apply_filters(
267
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
268
-            (
269
-                $options['show_desc']
270
-                    ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
271
-                    : ''
272
-            ),
273
-            $line_item,
274
-            $options
275
-        );
276
-        $name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
277
-        // name td
278
-        $html .= EEH_HTML::td( /*__FUNCTION__ .*/
279
-            $name_and_desc, '', 'item_l');
280
-        // price td
281
-        $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
282
-        // quantity td
283
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
284
-        $this->_total_items += $line_item->quantity();
285
-        // determine total for line item
286
-        $total = $line_item->total();
287
-        $this->_events[$options['event_id']] += $total;
288
-        // total td
289
-        $html .= EEH_HTML::td(
290
-            EEH_Template::format_currency($total, false, false),
291
-            '',
292
-            'item_r jst-rght'
293
-        );
294
-        // end of row
295
-        $html .= EEH_HTML::trx();
296
-        return $html;
297
-    }
298
-
299
-
300
-
301
-    /**
302
-     * _item_row
303
-     *
304
-     * @param EE_Line_Item $line_item
305
-     * @param array        $options
306
-     * @return mixed
307
-     * @throws EE_Error
308
-     */
309
-    private function _item_row(EE_Line_Item $line_item, $options = array())
310
-    {
311
-        // start of row
312
-        $row_class = $options['odd'] ? 'item odd' : 'item';
313
-        $html = EEH_HTML::tr('', '', $row_class);
314
-        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
315
-        // name && desc
316
-        $name_and_desc = apply_filters(
317
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
318
-            $obj_name . $line_item->name(),
319
-            $line_item
320
-        );
321
-        $name_and_desc .= apply_filters(
322
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
323
-            (
324
-                $options['show_desc']
325
-                ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
326
-                : ''
327
-            ),
328
-            $line_item,
329
-            $options
330
-        );
331
-        $name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
332
-        // name td
333
-        $html .= EEH_HTML::td($name_and_desc, '', 'item_l');
334
-        // price td
335
-        if ($line_item->is_percent()) {
336
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c jst-rght');
337
-        } else {
338
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
339
-        }
340
-        // quantity td
341
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
342
-        //$total = $line_item->total() * $line_item->quantity();
343
-        $total = $line_item->total();
344
-        if (isset($options['event_id'], $this->_events[$options['event_id']])) {
345
-            $this->_events[$options['event_id']] += $total;
346
-        }
347
-        // total td
348
-        $html .= EEH_HTML::td(
349
-            EEH_Template::format_currency($total, false, false),
350
-            '',
351
-            'item_r jst-rght'
352
-        );
353
-        // end of row
354
-        $html .= EEH_HTML::trx();
355
-        return $html;
356
-    }
357
-
358
-
359
-
360
-    /**
361
-     * _sub_item_row
362
-     *
363
-     * @param EE_Line_Item $line_item
364
-     * @param array        $options
365
-     * @param EE_Line_Item $parent_line_item
366
-     * @return mixed
367
-     * @throws EE_Error
368
-     */
369
-    private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null)
370
-    {
371
-        if($parent_line_item instanceof  EE_Line_Item && $line_item->name() === $parent_line_item->name()) {
372
-            return '';
373
-        }
374
-        // start of row
375
-        $html = EEH_HTML::tr('', '', 'item sub-item-row');
376
-        // name && desc
377
-        $name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right')
378
-                         . $line_item->name();
379
-        $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '
380
-                                                  . $line_item->desc()
381
-                                                  . '</span>' : '';
382
-        // name td
383
-        $html .= EEH_HTML::td( $name_and_desc, '', 'item_l sub-item');
384
-        $qty = $parent_line_item instanceof EE_Line_Item ? $parent_line_item->quantity() : 1;
385
-        // discount/surcharge td
386
-        if ($line_item->is_percent()) {
387
-            $html .= EEH_HTML::td(
388
-                EEH_Template::format_currency(
389
-                    $line_item->total() / $qty,
390
-                    false, false
391
-                ),
392
-                '', 'item_c jst-rght'
393
-            );
394
-        } else {
395
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
396
-        }
397
-        // no quantity td
398
-        $html .= EEH_HTML::td();
399
-        // no total td
400
-        $html .= EEH_HTML::td();
401
-        // end of row
402
-        $html .= EEH_HTML::trx();
403
-        return $html;
404
-    }
405
-
406
-
407
-
408
-    /**
409
-     * _tax_row
410
-     *
411
-     * @param EE_Line_Item $line_item
412
-     * @param array        $options
413
-     * @return mixed
414
-     * @throws EE_Error
415
-     */
416
-    private function _tax_row(EE_Line_Item $line_item, $options = array())
417
-    {
418
-        // start of row
419
-        $html = EEH_HTML::tr('', 'item sub-item tax-total');
420
-        // name && desc
421
-        $name_and_desc = $line_item->name();
422
-        $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
423
-                          . esc_html__(' * taxable items', 'event_espresso') . '</span>';
424
-        $name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
425
-        // name td
426
-        $html .= EEH_HTML::td( /*__FUNCTION__ .*/
427
-            $name_and_desc, '', 'item_l sub-item');
428
-        // percent td
429
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', ' jst-rght', '');
430
-        // empty td (price)
431
-        $html .= EEH_HTML::td(EEH_HTML::nbsp());
432
-        // total td
433
-        $html .= EEH_HTML::td(EEH_Template::format_currency(
434
-            $line_item->total(), false, false),
435
-            '',
436
-            'item_r jst-rght'
437
-        );
438
-        // end of row
439
-        $html .= EEH_HTML::trx();
440
-        return $html;
441
-    }
442
-
443
-
444
-
445
-    /**
446
-     * _total_row
447
-     *
448
-     * @param EE_Line_Item $line_item
449
-     * @param string       $text
450
-     * @return mixed
451
-     * @throws EE_Error
452
-     */
453
-    private function _total_tax_row(EE_Line_Item $line_item, $text = '')
454
-    {
455
-        $html = '';
456
-        if ($line_item->total()) {
457
-            // start of row
458
-            $html = EEH_HTML::tr('', '', 'total_tr odd');
459
-            // total td
460
-            $html .= EEH_HTML::td(
461
-                $text,
462
-                '',
463
-                'total_currency total jst-rght',
464
-                '',
465
-                ' colspan="2"'
466
-            );
467
-            // empty td (price)
468
-            $html .= EEH_HTML::td(EEH_HTML::nbsp());
469
-            // total td
470
-            $html .= EEH_HTML::td(
471
-                EEH_Template::format_currency($line_item->total(), false, false),
472
-                '',
473
-                'total jst-rght'
474
-            );
475
-            // end of row
476
-            $html .= EEH_HTML::trx();
477
-        }
478
-        return $html;
479
-    }
480
-
481
-
482
-
483
-    /**
484
-     * _total_row
485
-     *
486
-     * @param EE_Line_Item $line_item
487
-     * @param string       $text
488
-     * @param array        $options
489
-     * @return mixed
490
-     * @throws EE_Error
491
-     */
492
-    private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
493
-    {
494
-        $html = '';
495
-        if ($line_item->total()) {
496
-            // start of row
497
-            $html = EEH_HTML::tr('', '', 'total_tr odd');
498
-            // total td
499
-            $html .= EEH_HTML::td(
500
-                $text,
501
-                '',
502
-                'total_currency total jst-rght',
503
-                '',
504
-                ' colspan="3"'
505
-            );
506
-            // total td
507
-            $html .= EEH_HTML::td(
508
-                EEH_Template::format_currency($options['sub_total'], false, false),
509
-                '',
510
-                'total jst-rght'
511
-            );
512
-            // end of row
513
-            $html .= EEH_HTML::trx();
514
-        }
515
-        return $html;
516
-    }
517
-
518
-
519
-
520
-    /**
521
-     * _total_row
522
-     *
523
-     * @param EE_Line_Item $line_item
524
-     * @param string       $text
525
-     * @return mixed
526
-     * @throws EE_Error
527
-     */
528
-    private function _total_row(EE_Line_Item $line_item, $text = '')
529
-    {
530
-        // start of row
531
-        $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
532
-        // total td
533
-        $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
534
-        // total td
535
-        $html .= EEH_HTML::td(
536
-            EEH_Template::format_currency($line_item->total(), false, false),
537
-            '',
538
-            'total jst-rght'
539
-        );
540
-        // end of row
541
-        $html .= EEH_HTML::trx();
542
-        return $html;
543
-    }
544
-
545
-
546
-
547
-    /**
548
-     * _payments_and_amount_owing_rows
549
-     *
550
-     * @param EE_Line_Item $line_item
551
-     * @param array        $options
552
-     * @return mixed
553
-     * @throws EE_Error
554
-     */
555
-    private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
556
-    {
557
-        $html = '';
558
-        $owing = $line_item->total();
559
-        $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
560
-        if ($transaction instanceof EE_Transaction) {
561
-            $registration_payments = array();
562
-            $registrations = ! empty($options['registrations'])
563
-                ? $options['registrations']
564
-                : $transaction->registrations();
565
-            foreach ($registrations as $registration) {
566
-                if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
567
-                    $registration_payments += $registration->registration_payments();
568
-                }
569
-            }
570
-            if (! empty($registration_payments)) {
571
-                foreach ($registration_payments as $registration_payment) {
572
-                    if ($registration_payment instanceof EE_Registration_Payment) {
573
-                        $owing -= $registration_payment->amount();
574
-                        $payment = $registration_payment->payment();
575
-                        $payment_desc = '';
576
-                        if ($payment instanceof EE_Payment) {
577
-                            $payment_desc = sprintf(
578
-                                esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
579
-                                $payment->txn_id_chq_nmbr() !== ''
580
-                                    ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
581
-                                    : '',
582
-                                $payment->timestamp()
583
-                            );
584
-                        }
585
-                        // start of row
586
-                        $html .= EEH_HTML::tr('', '', 'total_tr odd');
587
-                        // payment desc
588
-                        $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
589
-                        // total td
590
-                        $html .= EEH_HTML::td(
591
-                            EEH_Template::format_currency(
592
-                                $registration_payment->amount(),
593
-                                false,
594
-                                false
595
-                            ),
596
-                            '',
597
-                            'total jst-rght'
598
-                        );
599
-                        // end of row
600
-                        $html .= EEH_HTML::trx();
601
-                    }
602
-                }
603
-                if ($line_item->total()) {
604
-                    // start of row
605
-                    $html .= EEH_HTML::tr('', '', 'total_tr odd');
606
-                    // total td
607
-                    $html .= EEH_HTML::td(
608
-                        esc_html__('Amount Owing', 'event_espresso'),
609
-                        '', 'total_currency total jst-rght', '', ' colspan="3"'
610
-                    );
611
-                    // total td
612
-                    $html .= EEH_HTML::td(
613
-                        EEH_Template::format_currency($owing, false, false),
614
-                        '',
615
-                        'total jst-rght'
616
-                    );
617
-                    // end of row
618
-                    $html .= EEH_HTML::trx();
619
-                }
620
-            }
621
-        }
622
-        $this->_grand_total = $owing;
623
-        return $html;
624
-    }
19
+	/**
20
+	 * array of events
21
+	 *
22
+	 * @type EE_Line_Item[] $_events
23
+	 */
24
+	private $_events = array();
25
+
26
+	/**
27
+	 * whether to display the taxes row or not
28
+	 *
29
+	 * @type bool $_show_taxes
30
+	 */
31
+	private $_show_taxes = false;
32
+
33
+	/**
34
+	 * html for any tax rows
35
+	 *
36
+	 * @type string $_show_taxes
37
+	 */
38
+	private $_taxes_html = '';
39
+
40
+	/**
41
+	 * total amount including tax we can bill for at this time
42
+	 *
43
+	 * @type float $_grand_total
44
+	 */
45
+	private $_grand_total = 0.00;
46
+
47
+	/**
48
+	 * total number of items being billed for
49
+	 *
50
+	 * @type int $_total_items
51
+	 */
52
+	private $_total_items = 0;
53
+
54
+
55
+
56
+	/**
57
+	 * @return float
58
+	 */
59
+	public function grand_total()
60
+	{
61
+		return $this->_grand_total;
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * @return int
68
+	 */
69
+	public function total_items()
70
+	{
71
+		return $this->_total_items;
72
+	}
73
+
74
+
75
+
76
+	/**
77
+	 * @param EE_Line_Item $line_item
78
+	 * @param array        $options
79
+	 * @param EE_Line_Item $parent_line_item
80
+	 * @return mixed
81
+	 * @throws EE_Error
82
+	 */
83
+	public function display_line_item(
84
+		EE_Line_Item $line_item,
85
+		$options = array(),
86
+		EE_Line_Item $parent_line_item = null
87
+	) {
88
+		$html = '';
89
+		// set some default options and merge with incoming
90
+		$default_options = array(
91
+			'show_desc' => true,  // 	true 		false
92
+			'odd'       => false,
93
+		);
94
+		$options = array_merge($default_options, (array)$options);
95
+		switch ($line_item->type()) {
96
+			case EEM_Line_Item::type_line_item:
97
+				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
98
+				if ($line_item->OBJ_type() === 'Ticket') {
99
+					// item row
100
+					$html .= $this->_ticket_row($line_item, $options);
101
+				} else {
102
+					// item row
103
+					$html .= $this->_item_row($line_item, $options);
104
+				}
105
+				if (
106
+				apply_filters(
107
+					'FHEE__EE_SPCO_Line_Item_Display_Strategy__display_line_item__display_sub_line_items',
108
+					true
109
+				)
110
+				) {
111
+					// got any kids?
112
+					foreach ($line_item->children() as $child_line_item) {
113
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
114
+					}
115
+				}
116
+				break;
117
+			case EEM_Line_Item::type_sub_line_item:
118
+				$html .= $this->_sub_item_row($line_item, $options, $parent_line_item);
119
+				break;
120
+			case EEM_Line_Item::type_sub_total:
121
+				static $sub_total = 0;
122
+				$event_sub_total = 0;
123
+				$text = esc_html__('Sub-Total', 'event_espresso');
124
+				if ($line_item->OBJ_type() === 'Event') {
125
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
126
+					if (! isset($this->_events[$options['event_id']])) {
127
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
128
+						// if event has default reg status of Not Approved, then don't display info on it
129
+						if (
130
+							$event instanceof EE_Event
131
+							&& $event->default_registration_status() === EEM_Registration::status_id_not_approved
132
+						) {
133
+							$display_event = false;
134
+							// unless there are registrations for it that are returning to pay
135
+							if (isset($options['registrations']) && is_array($options['registrations'])) {
136
+								foreach ($options['registrations'] as $registration) {
137
+									if (! $registration instanceof EE_Registration) {
138
+										continue;
139
+									}
140
+									$display_event = $registration->event_ID() === $options['event_id']
141
+													 && $registration->status_ID() !== EEM_Registration::status_id_not_approved
142
+										? true
143
+										: $display_event;
144
+								}
145
+							}
146
+							if (! $display_event) {
147
+								return '';
148
+							}
149
+						}
150
+						$this->_events[$options['event_id']] = 0;
151
+						$html .= $this->_event_row($line_item);
152
+						$text = esc_html__('Event Sub-Total', 'event_espresso');
153
+					}
154
+				}
155
+				$child_line_items = $line_item->children();
156
+				// loop thru children
157
+				foreach ($child_line_items as $child_line_item) {
158
+					// recursively feed children back into this method
159
+					$html .= $this->display_line_item($child_line_item, $options, $line_item);
160
+				}
161
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
162
+				$sub_total += $event_sub_total;
163
+				if (
164
+					(
165
+						// event subtotals
166
+						$line_item->code() !== 'pre-tax-subtotal' && count($child_line_items) > 1
167
+					)
168
+					|| (
169
+						// pre-tax subtotals
170
+						$line_item->code() === 'pre-tax-subtotal' && count($this->_events) > 1
171
+					)
172
+				) {
173
+					$options['sub_total'] = $line_item->OBJ_type() === 'Event' ? $event_sub_total : $sub_total;
174
+					$html .= $this->_sub_total_row($line_item, $text, $options);
175
+				}
176
+				break;
177
+			case EEM_Line_Item::type_tax:
178
+				if ($this->_show_taxes) {
179
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
180
+				}
181
+				break;
182
+			case EEM_Line_Item::type_tax_sub_total:
183
+				if ($this->_show_taxes) {
184
+					$child_line_items = $line_item->children();
185
+					// loop thru children
186
+					foreach ($child_line_items as $child_line_item) {
187
+						// recursively feed children back into this method
188
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
189
+					}
190
+					if (count($child_line_items) > 1) {
191
+						$this->_taxes_html .= $this->_total_tax_row($line_item, esc_html__('Tax Total', 'event_espresso'));
192
+					}
193
+				}
194
+				break;
195
+			case EEM_Line_Item::type_total:
196
+				// get all child line items
197
+				$children = $line_item->children();
198
+				// loop thru all non-tax child line items
199
+				foreach ($children as $child_line_item) {
200
+					if ($child_line_item->type() !== EEM_Line_Item::type_tax_sub_total) {
201
+						// recursively feed children back into this method
202
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
203
+					}
204
+				}
205
+				// now loop thru  tax child line items
206
+				foreach ($children as $child_line_item) {
207
+					if ($child_line_item->type() === EEM_Line_Item::type_tax_sub_total) {
208
+						// recursively feed children back into this method
209
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
210
+					}
211
+				}
212
+				$html .= $this->_taxes_html;
213
+				$html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'));
214
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
215
+				break;
216
+		}
217
+		return $html;
218
+	}
219
+
220
+
221
+
222
+	/**
223
+	 * _event_row - basically a Heading row displayed once above each event's ticket rows
224
+	 *
225
+	 * @param EE_Line_Item $line_item
226
+	 * @return mixed
227
+	 */
228
+	private function _event_row(EE_Line_Item $line_item)
229
+	{
230
+		// start of row
231
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
232
+		// event name td
233
+		$html .= EEH_HTML::td(
234
+			EEH_HTML::strong($line_item->name()),
235
+			'',
236
+			'event-header',
237
+			'',
238
+			' colspan="4"'
239
+		);
240
+		// end of row
241
+		$html .= EEH_HTML::trx();
242
+		return $html;
243
+	}
244
+
245
+
246
+
247
+	/**
248
+	 * _ticket_row
249
+	 *
250
+	 * @param EE_Line_Item $line_item
251
+	 * @param array        $options
252
+	 * @return mixed
253
+	 * @throws EE_Error
254
+	 */
255
+	private function _ticket_row(EE_Line_Item $line_item, $options = array())
256
+	{
257
+		// start of row
258
+		$row_class = $options['odd'] ? 'item odd' : 'item';
259
+		$html = EEH_HTML::tr('', '', $row_class);
260
+		// name && desc
261
+		$name_and_desc = apply_filters(
262
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
263
+			$line_item->name(),
264
+			$line_item
265
+		);
266
+		$name_and_desc .= apply_filters(
267
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
268
+			(
269
+				$options['show_desc']
270
+					? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
271
+					: ''
272
+			),
273
+			$line_item,
274
+			$options
275
+		);
276
+		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
277
+		// name td
278
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/
279
+			$name_and_desc, '', 'item_l');
280
+		// price td
281
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
282
+		// quantity td
283
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
284
+		$this->_total_items += $line_item->quantity();
285
+		// determine total for line item
286
+		$total = $line_item->total();
287
+		$this->_events[$options['event_id']] += $total;
288
+		// total td
289
+		$html .= EEH_HTML::td(
290
+			EEH_Template::format_currency($total, false, false),
291
+			'',
292
+			'item_r jst-rght'
293
+		);
294
+		// end of row
295
+		$html .= EEH_HTML::trx();
296
+		return $html;
297
+	}
298
+
299
+
300
+
301
+	/**
302
+	 * _item_row
303
+	 *
304
+	 * @param EE_Line_Item $line_item
305
+	 * @param array        $options
306
+	 * @return mixed
307
+	 * @throws EE_Error
308
+	 */
309
+	private function _item_row(EE_Line_Item $line_item, $options = array())
310
+	{
311
+		// start of row
312
+		$row_class = $options['odd'] ? 'item odd' : 'item';
313
+		$html = EEH_HTML::tr('', '', $row_class);
314
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
315
+		// name && desc
316
+		$name_and_desc = apply_filters(
317
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
318
+			$obj_name . $line_item->name(),
319
+			$line_item
320
+		);
321
+		$name_and_desc .= apply_filters(
322
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
323
+			(
324
+				$options['show_desc']
325
+				? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
326
+				: ''
327
+			),
328
+			$line_item,
329
+			$options
330
+		);
331
+		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
332
+		// name td
333
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
334
+		// price td
335
+		if ($line_item->is_percent()) {
336
+			$html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c jst-rght');
337
+		} else {
338
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
339
+		}
340
+		// quantity td
341
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
342
+		//$total = $line_item->total() * $line_item->quantity();
343
+		$total = $line_item->total();
344
+		if (isset($options['event_id'], $this->_events[$options['event_id']])) {
345
+			$this->_events[$options['event_id']] += $total;
346
+		}
347
+		// total td
348
+		$html .= EEH_HTML::td(
349
+			EEH_Template::format_currency($total, false, false),
350
+			'',
351
+			'item_r jst-rght'
352
+		);
353
+		// end of row
354
+		$html .= EEH_HTML::trx();
355
+		return $html;
356
+	}
357
+
358
+
359
+
360
+	/**
361
+	 * _sub_item_row
362
+	 *
363
+	 * @param EE_Line_Item $line_item
364
+	 * @param array        $options
365
+	 * @param EE_Line_Item $parent_line_item
366
+	 * @return mixed
367
+	 * @throws EE_Error
368
+	 */
369
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null)
370
+	{
371
+		if($parent_line_item instanceof  EE_Line_Item && $line_item->name() === $parent_line_item->name()) {
372
+			return '';
373
+		}
374
+		// start of row
375
+		$html = EEH_HTML::tr('', '', 'item sub-item-row');
376
+		// name && desc
377
+		$name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right')
378
+						 . $line_item->name();
379
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '
380
+												  . $line_item->desc()
381
+												  . '</span>' : '';
382
+		// name td
383
+		$html .= EEH_HTML::td( $name_and_desc, '', 'item_l sub-item');
384
+		$qty = $parent_line_item instanceof EE_Line_Item ? $parent_line_item->quantity() : 1;
385
+		// discount/surcharge td
386
+		if ($line_item->is_percent()) {
387
+			$html .= EEH_HTML::td(
388
+				EEH_Template::format_currency(
389
+					$line_item->total() / $qty,
390
+					false, false
391
+				),
392
+				'', 'item_c jst-rght'
393
+			);
394
+		} else {
395
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
396
+		}
397
+		// no quantity td
398
+		$html .= EEH_HTML::td();
399
+		// no total td
400
+		$html .= EEH_HTML::td();
401
+		// end of row
402
+		$html .= EEH_HTML::trx();
403
+		return $html;
404
+	}
405
+
406
+
407
+
408
+	/**
409
+	 * _tax_row
410
+	 *
411
+	 * @param EE_Line_Item $line_item
412
+	 * @param array        $options
413
+	 * @return mixed
414
+	 * @throws EE_Error
415
+	 */
416
+	private function _tax_row(EE_Line_Item $line_item, $options = array())
417
+	{
418
+		// start of row
419
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
420
+		// name && desc
421
+		$name_and_desc = $line_item->name();
422
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
423
+						  . esc_html__(' * taxable items', 'event_espresso') . '</span>';
424
+		$name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
425
+		// name td
426
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/
427
+			$name_and_desc, '', 'item_l sub-item');
428
+		// percent td
429
+		$html .= EEH_HTML::td($line_item->percent() . '%', '', ' jst-rght', '');
430
+		// empty td (price)
431
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
432
+		// total td
433
+		$html .= EEH_HTML::td(EEH_Template::format_currency(
434
+			$line_item->total(), false, false),
435
+			'',
436
+			'item_r jst-rght'
437
+		);
438
+		// end of row
439
+		$html .= EEH_HTML::trx();
440
+		return $html;
441
+	}
442
+
443
+
444
+
445
+	/**
446
+	 * _total_row
447
+	 *
448
+	 * @param EE_Line_Item $line_item
449
+	 * @param string       $text
450
+	 * @return mixed
451
+	 * @throws EE_Error
452
+	 */
453
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '')
454
+	{
455
+		$html = '';
456
+		if ($line_item->total()) {
457
+			// start of row
458
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
459
+			// total td
460
+			$html .= EEH_HTML::td(
461
+				$text,
462
+				'',
463
+				'total_currency total jst-rght',
464
+				'',
465
+				' colspan="2"'
466
+			);
467
+			// empty td (price)
468
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
469
+			// total td
470
+			$html .= EEH_HTML::td(
471
+				EEH_Template::format_currency($line_item->total(), false, false),
472
+				'',
473
+				'total jst-rght'
474
+			);
475
+			// end of row
476
+			$html .= EEH_HTML::trx();
477
+		}
478
+		return $html;
479
+	}
480
+
481
+
482
+
483
+	/**
484
+	 * _total_row
485
+	 *
486
+	 * @param EE_Line_Item $line_item
487
+	 * @param string       $text
488
+	 * @param array        $options
489
+	 * @return mixed
490
+	 * @throws EE_Error
491
+	 */
492
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
493
+	{
494
+		$html = '';
495
+		if ($line_item->total()) {
496
+			// start of row
497
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
498
+			// total td
499
+			$html .= EEH_HTML::td(
500
+				$text,
501
+				'',
502
+				'total_currency total jst-rght',
503
+				'',
504
+				' colspan="3"'
505
+			);
506
+			// total td
507
+			$html .= EEH_HTML::td(
508
+				EEH_Template::format_currency($options['sub_total'], false, false),
509
+				'',
510
+				'total jst-rght'
511
+			);
512
+			// end of row
513
+			$html .= EEH_HTML::trx();
514
+		}
515
+		return $html;
516
+	}
517
+
518
+
519
+
520
+	/**
521
+	 * _total_row
522
+	 *
523
+	 * @param EE_Line_Item $line_item
524
+	 * @param string       $text
525
+	 * @return mixed
526
+	 * @throws EE_Error
527
+	 */
528
+	private function _total_row(EE_Line_Item $line_item, $text = '')
529
+	{
530
+		// start of row
531
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
532
+		// total td
533
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
534
+		// total td
535
+		$html .= EEH_HTML::td(
536
+			EEH_Template::format_currency($line_item->total(), false, false),
537
+			'',
538
+			'total jst-rght'
539
+		);
540
+		// end of row
541
+		$html .= EEH_HTML::trx();
542
+		return $html;
543
+	}
544
+
545
+
546
+
547
+	/**
548
+	 * _payments_and_amount_owing_rows
549
+	 *
550
+	 * @param EE_Line_Item $line_item
551
+	 * @param array        $options
552
+	 * @return mixed
553
+	 * @throws EE_Error
554
+	 */
555
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
556
+	{
557
+		$html = '';
558
+		$owing = $line_item->total();
559
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
560
+		if ($transaction instanceof EE_Transaction) {
561
+			$registration_payments = array();
562
+			$registrations = ! empty($options['registrations'])
563
+				? $options['registrations']
564
+				: $transaction->registrations();
565
+			foreach ($registrations as $registration) {
566
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
567
+					$registration_payments += $registration->registration_payments();
568
+				}
569
+			}
570
+			if (! empty($registration_payments)) {
571
+				foreach ($registration_payments as $registration_payment) {
572
+					if ($registration_payment instanceof EE_Registration_Payment) {
573
+						$owing -= $registration_payment->amount();
574
+						$payment = $registration_payment->payment();
575
+						$payment_desc = '';
576
+						if ($payment instanceof EE_Payment) {
577
+							$payment_desc = sprintf(
578
+								esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
579
+								$payment->txn_id_chq_nmbr() !== ''
580
+									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
581
+									: '',
582
+								$payment->timestamp()
583
+							);
584
+						}
585
+						// start of row
586
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
587
+						// payment desc
588
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
589
+						// total td
590
+						$html .= EEH_HTML::td(
591
+							EEH_Template::format_currency(
592
+								$registration_payment->amount(),
593
+								false,
594
+								false
595
+							),
596
+							'',
597
+							'total jst-rght'
598
+						);
599
+						// end of row
600
+						$html .= EEH_HTML::trx();
601
+					}
602
+				}
603
+				if ($line_item->total()) {
604
+					// start of row
605
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
606
+					// total td
607
+					$html .= EEH_HTML::td(
608
+						esc_html__('Amount Owing', 'event_espresso'),
609
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
610
+					);
611
+					// total td
612
+					$html .= EEH_HTML::td(
613
+						EEH_Template::format_currency($owing, false, false),
614
+						'',
615
+						'total jst-rght'
616
+					);
617
+					// end of row
618
+					$html .= EEH_HTML::trx();
619
+				}
620
+			}
621
+		}
622
+		$this->_grand_total = $owing;
623
+		return $html;
624
+	}
625 625
 
626 626
 
627 627
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         $html = '';
89 89
         // set some default options and merge with incoming
90 90
         $default_options = array(
91
-            'show_desc' => true,  // 	true 		false
91
+            'show_desc' => true, // 	true 		false
92 92
             'odd'       => false,
93 93
         );
94
-        $options = array_merge($default_options, (array)$options);
94
+        $options = array_merge($default_options, (array) $options);
95 95
         switch ($line_item->type()) {
96 96
             case EEM_Line_Item::type_line_item:
97 97
                 $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 $text = esc_html__('Sub-Total', 'event_espresso');
124 124
                 if ($line_item->OBJ_type() === 'Event') {
125 125
                     $options['event_id'] = $event_id = $line_item->OBJ_ID();
126
-                    if (! isset($this->_events[$options['event_id']])) {
126
+                    if ( ! isset($this->_events[$options['event_id']])) {
127 127
                         $event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
128 128
                         // if event has default reg status of Not Approved, then don't display info on it
129 129
                         if (
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                             // unless there are registrations for it that are returning to pay
135 135
                             if (isset($options['registrations']) && is_array($options['registrations'])) {
136 136
                                 foreach ($options['registrations'] as $registration) {
137
-                                    if (! $registration instanceof EE_Registration) {
137
+                                    if ( ! $registration instanceof EE_Registration) {
138 138
                                         continue;
139 139
                                     }
140 140
                                     $display_event = $registration->event_ID() === $options['event_id']
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                                         : $display_event;
144 144
                                 }
145 145
                             }
146
-                            if (! $display_event) {
146
+                            if ( ! $display_event) {
147 147
                                 return '';
148 148
                             }
149 149
                         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
268 268
             (
269 269
                 $options['show_desc']
270
-                    ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
270
+                    ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>'
271 271
                     : ''
272 272
             ),
273 273
             $line_item,
@@ -311,18 +311,18 @@  discard block
 block discarded – undo
311 311
         // start of row
312 312
         $row_class = $options['odd'] ? 'item odd' : 'item';
313 313
         $html = EEH_HTML::tr('', '', $row_class);
314
-        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
314
+        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : '';
315 315
         // name && desc
316 316
         $name_and_desc = apply_filters(
317 317
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
318
-            $obj_name . $line_item->name(),
318
+            $obj_name.$line_item->name(),
319 319
             $line_item
320 320
         );
321 321
         $name_and_desc .= apply_filters(
322 322
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
323 323
             (
324 324
                 $options['show_desc']
325
-                ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
325
+                ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>'
326 326
                 : ''
327 327
             ),
328 328
             $line_item,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $html .= EEH_HTML::td($name_and_desc, '', 'item_l');
334 334
         // price td
335 335
         if ($line_item->is_percent()) {
336
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c jst-rght');
336
+            $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
337 337
         } else {
338 338
             $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
339 339
         }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
      */
369 369
     private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null)
370 370
     {
371
-        if($parent_line_item instanceof  EE_Line_Item && $line_item->name() === $parent_line_item->name()) {
371
+        if ($parent_line_item instanceof  EE_Line_Item && $line_item->name() === $parent_line_item->name()) {
372 372
             return '';
373 373
         }
374 374
         // start of row
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                                                   . $line_item->desc()
381 381
                                                   . '</span>' : '';
382 382
         // name td
383
-        $html .= EEH_HTML::td( $name_and_desc, '', 'item_l sub-item');
383
+        $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
384 384
         $qty = $parent_line_item instanceof EE_Line_Item ? $parent_line_item->quantity() : 1;
385 385
         // discount/surcharge td
386 386
         if ($line_item->is_percent()) {
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
         // name && desc
421 421
         $name_and_desc = $line_item->name();
422 422
         $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
423
-                          . esc_html__(' * taxable items', 'event_espresso') . '</span>';
424
-        $name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
423
+                          . esc_html__(' * taxable items', 'event_espresso').'</span>';
424
+        $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
425 425
         // name td
426 426
         $html .= EEH_HTML::td( /*__FUNCTION__ .*/
427 427
             $name_and_desc, '', 'item_l sub-item');
428 428
         // percent td
429
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', ' jst-rght', '');
429
+        $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
430 430
         // empty td (price)
431 431
         $html .= EEH_HTML::td(EEH_HTML::nbsp());
432 432
         // total td
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                     $registration_payments += $registration->registration_payments();
568 568
                 }
569 569
             }
570
-            if (! empty($registration_payments)) {
570
+            if ( ! empty($registration_payments)) {
571 571
                 foreach ($registration_payments as $registration_payment) {
572 572
                     if ($registration_payment instanceof EE_Registration_Payment) {
573 573
                         $owing -= $registration_payment->amount();
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                             $payment_desc = sprintf(
578 578
                                 esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
579 579
                                 $payment->txn_id_chq_nmbr() !== ''
580
-                                    ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
580
+                                    ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
581 581
                                     : '',
582 582
                                 $payment->timestamp()
583 583
                             );
Please login to merge, or discard this patch.
core/domain/entities/shortcodes/EspressoEventAttendees.php 1 patch
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -28,245 +28,245 @@
 block discarded – undo
28 28
 class EspressoEventAttendees extends EspressoShortcode
29 29
 {
30 30
 
31
-    private $query_params = array(
32
-        0 => array()
33
-    );
34
-
35
-    private $template_args = array(
36
-        'contacts'      => array(),
37
-        'event'         => null,
38
-        'datetime'      => null,
39
-        'ticket'        => null,
40
-    );
41
-
42
-    /**
43
-     * the actual shortcode tag that gets registered with WordPress
44
-     *
45
-     * @return string
46
-     */
47
-    public function getTag()
48
-    {
49
-        return 'ESPRESSO_EVENT_ATTENDEES';
50
-    }
51
-
52
-
53
-
54
-    /**
55
-     * the time in seconds to cache the results of the processShortcode() method
56
-     * 0 means the processShortcode() results will NOT be cached at all
57
-     *
58
-     * @return int
59
-     */
60
-    public function cacheExpiration()
61
-    {
62
-        return 0;
63
-    }
64
-
65
-
66
-
67
-    /**
68
-     * a place for adding any initialization code that needs to run prior to wp_header().
69
-     * this may be required for shortcodes that utilize a corresponding module,
70
-     * and need to enqueue assets for that module
71
-     *
72
-     * @return void
73
-     */
74
-    public function initializeShortcode()
75
-    {
76
-        $this->shortcodeHasBeenInitialized();
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
-     *  [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event.
84
-     *  [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event.
85
-     *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime.
86
-     *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket.
87
-     *  [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees
88
-     *                                          regardless of status.  Note default is to only return approved attendees
89
-     *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar.  Otherwise if this is set
90
-     *                                                  then return gravatar for email address given.
91
-     *  Note: because of the relationship between event_id, ticket_id, and datetime_id.
92
-     * If more than one of those params is included then preference is given to the following:
93
-     *  - event_id is used whenever its present and any others are ignored.
94
-     *  - if no event_id then datetime is used whenever its present and any others are ignored.
95
-     *  - otherwise ticket_id is used if present.
96
-     *
97
-     * @param array $attributes
98
-     * @return string
99
-     * @throws \EE_Error
100
-     */
101
-    public function processShortcode($attributes = array())
102
-    {
103
-        // grab attributes and merge with defaults
104
-        $attributes = $this->getAttributes((array)$attributes);
105
-        // add attributes to template args
106
-        $this->template_args['show_gravatar'] = $attributes['show_gravatar'];
107
-        // add required objects: event, datetime, and ticket
108
-        $this->template_args['event'] = $this->getEventAndQueryParams($attributes);
109
-        $this->template_args['datetime'] = $this->getDatetimeAndQueryParams($attributes);
110
-        $this->template_args['ticket'] = $this->getTicketAndQueryParams($attributes);
111
-
112
-        // if any of the above objects is invalid or missing,
113
-        // then there was an invalid parameter or the shortcode was used incorrectly
114
-        // so when WP_DEBUG is set and true, we'll show a message,
115
-        // otherwise we'll just return an empty string.
116
-         if (
117
-            ! $this->template_args['event'] instanceof EE_Event
118
-            || empty($this->query_params[0])
119
-            || ($attributes['datetime_id'] && ! $this->template_args['datetime'] instanceof EE_Datetime)
120
-            || ($attributes['ticket_id'] && ! $this->template_args['ticket'] instanceof EE_Ticket)
121
-        ) {
122
-            if (WP_DEBUG) {
123
-                return '<div class="important-notice ee-attention">'
124
-                       . esc_html__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.',
125
-                        'event_espresso')
126
-                       . '</div>';
127
-            } else {
128
-                return '';
129
-            }
130
-        }
131
-        $this->setAdditionalQueryParams($attributes);
132
-        //get contacts!
133
-        $this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
134
-        //all set let's load up the template and return.
135
-        return EEH_Template::locate_template('loop-espresso_event_attendees.php', $this->template_args, true, true);
136
-    }
137
-
138
-
139
-
140
-    /**
141
-     * merge incoming attributes with filtered defaults
142
-     *
143
-     * @param array $attributes
144
-     * @return array
145
-     */
146
-    private function getAttributes(array $attributes)
147
-    {
148
-        return array_merge(
149
-            (array) apply_filters(
150
-                'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
151
-                array(
152
-                    'event_id'      => null,
153
-                    'datetime_id'   => null,
154
-                    'ticket_id'     => null,
155
-                    'status'        => EEM_Registration::status_id_approved,
156
-                    'show_gravatar' => false
157
-                )
158
-            ),
159
-            $attributes
160
-        );
161
-    }
162
-
163
-
164
-
165
-    /**
166
-     * @param array $attributes
167
-     * @return EE_Event|null
168
-     * @throws \EE_Error
169
-     */
170
-    private function getEventAndQueryParams(array $attributes){
171
-        if ( ! empty($attributes['event_id'])) {
172
-            $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
173
-            if ($event instanceof EE_Event) {
174
-                $this->query_params[0]['Registration.EVT_ID'] = $attributes['event_id'];
175
-                return $event;
176
-            }
177
-        }
178
-        //seems like is_espresso_event_single() isn't working as expected. So using alternate method.
179
-        if (is_single() && is_espresso_event()) {
180
-            $event = EEH_Event_View::get_event();
181
-            if ($event instanceof EE_Event) {
182
-                $this->query_params[0]['Registration.EVT_ID'] = $event->ID();
183
-                return $event;
184
-            }
185
-        }
186
-        // one last shot...
187
-        // try getting the earliest active event
188
-        $events = EEM_Event::instance()->get_active_events(array(
189
-            'limit'    => 1,
190
-            'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
191
-        ));
192
-        //  if none then get the next upcoming
193
-        $events = empty($events)
194
-            ? EEM_Event::instance()->get_upcoming_events(array(
195
-                'limit'    => 1,
196
-                'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
197
-            ))
198
-            : $events;
199
-        $event = reset($events);
200
-        if ($event instanceof EE_Event) {
201
-            $this->query_params[0]['Registration.EVT_ID'] = $event->ID();
202
-            return $event;
203
-        }
204
-        return null;
205
-    }
206
-
207
-
208
-
209
-    /**
210
-     * @param array $attributes
211
-     * @return EE_Datetime|null
212
-     */
213
-    private function getDatetimeAndQueryParams(array $attributes)
214
-    {
215
-        if ( ! empty($attributes['datetime_id'])) {
216
-            $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
217
-            if ($datetime instanceof EE_Datetime) {
218
-                $this->query_params[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
219
-                $this->query_params['default_where_conditions'] = 'this_model_only';
220
-                if ( ! $this->template_args['event'] instanceof EE_Event) {
221
-                    $this->template_args['event'] = $datetime->event();
222
-                }
223
-                return $datetime;
224
-            }
225
-        }
226
-        return null;
227
-    }
228
-
229
-
230
-
231
-    /**
232
-     * @param array $attributes
233
-     * @return \EE_Base_Class|null
234
-     * @throws \EE_Error
235
-     */
236
-    private function getTicketAndQueryParams(array $attributes)
237
-    {
238
-        if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
239
-            $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
240
-            if ($ticket instanceof EE_Ticket) {
241
-                $this->query_params[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
242
-                if ( ! $this->template_args['event'] instanceof EE_Event) {
243
-                    $this->template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime
244
-                        ? $ticket->first_datetime()->event()
245
-                        : null;
246
-                }
247
-                return $ticket;
248
-            }
249
-        }
250
-        return null;
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * @param array $attributes
257
-     */
258
-    private function setAdditionalQueryParams(array $attributes)
259
-    {
260
-        $reg_status_array = EEM_Registration::reg_status_array();
261
-        if ($attributes['status'] !== 'all' && isset($reg_status_array[$attributes['status']])) {
262
-            $this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
263
-        }
264
-        $this->query_params['group_by'] = array('ATT_ID');
265
-        $this->query_params['order_by'] = (array) apply_filters(
266
-            'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
267
-            array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
268
-        );
269
-    }
31
+	private $query_params = array(
32
+		0 => array()
33
+	);
34
+
35
+	private $template_args = array(
36
+		'contacts'      => array(),
37
+		'event'         => null,
38
+		'datetime'      => null,
39
+		'ticket'        => null,
40
+	);
41
+
42
+	/**
43
+	 * the actual shortcode tag that gets registered with WordPress
44
+	 *
45
+	 * @return string
46
+	 */
47
+	public function getTag()
48
+	{
49
+		return 'ESPRESSO_EVENT_ATTENDEES';
50
+	}
51
+
52
+
53
+
54
+	/**
55
+	 * the time in seconds to cache the results of the processShortcode() method
56
+	 * 0 means the processShortcode() results will NOT be cached at all
57
+	 *
58
+	 * @return int
59
+	 */
60
+	public function cacheExpiration()
61
+	{
62
+		return 0;
63
+	}
64
+
65
+
66
+
67
+	/**
68
+	 * a place for adding any initialization code that needs to run prior to wp_header().
69
+	 * this may be required for shortcodes that utilize a corresponding module,
70
+	 * and need to enqueue assets for that module
71
+	 *
72
+	 * @return void
73
+	 */
74
+	public function initializeShortcode()
75
+	{
76
+		$this->shortcodeHasBeenInitialized();
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
+	 *  [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event.
84
+	 *  [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event.
85
+	 *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime.
86
+	 *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket.
87
+	 *  [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees
88
+	 *                                          regardless of status.  Note default is to only return approved attendees
89
+	 *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar.  Otherwise if this is set
90
+	 *                                                  then return gravatar for email address given.
91
+	 *  Note: because of the relationship between event_id, ticket_id, and datetime_id.
92
+	 * If more than one of those params is included then preference is given to the following:
93
+	 *  - event_id is used whenever its present and any others are ignored.
94
+	 *  - if no event_id then datetime is used whenever its present and any others are ignored.
95
+	 *  - otherwise ticket_id is used if present.
96
+	 *
97
+	 * @param array $attributes
98
+	 * @return string
99
+	 * @throws \EE_Error
100
+	 */
101
+	public function processShortcode($attributes = array())
102
+	{
103
+		// grab attributes and merge with defaults
104
+		$attributes = $this->getAttributes((array)$attributes);
105
+		// add attributes to template args
106
+		$this->template_args['show_gravatar'] = $attributes['show_gravatar'];
107
+		// add required objects: event, datetime, and ticket
108
+		$this->template_args['event'] = $this->getEventAndQueryParams($attributes);
109
+		$this->template_args['datetime'] = $this->getDatetimeAndQueryParams($attributes);
110
+		$this->template_args['ticket'] = $this->getTicketAndQueryParams($attributes);
111
+
112
+		// if any of the above objects is invalid or missing,
113
+		// then there was an invalid parameter or the shortcode was used incorrectly
114
+		// so when WP_DEBUG is set and true, we'll show a message,
115
+		// otherwise we'll just return an empty string.
116
+		 if (
117
+			! $this->template_args['event'] instanceof EE_Event
118
+			|| empty($this->query_params[0])
119
+			|| ($attributes['datetime_id'] && ! $this->template_args['datetime'] instanceof EE_Datetime)
120
+			|| ($attributes['ticket_id'] && ! $this->template_args['ticket'] instanceof EE_Ticket)
121
+		) {
122
+			if (WP_DEBUG) {
123
+				return '<div class="important-notice ee-attention">'
124
+					   . esc_html__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.',
125
+						'event_espresso')
126
+					   . '</div>';
127
+			} else {
128
+				return '';
129
+			}
130
+		}
131
+		$this->setAdditionalQueryParams($attributes);
132
+		//get contacts!
133
+		$this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
134
+		//all set let's load up the template and return.
135
+		return EEH_Template::locate_template('loop-espresso_event_attendees.php', $this->template_args, true, true);
136
+	}
137
+
138
+
139
+
140
+	/**
141
+	 * merge incoming attributes with filtered defaults
142
+	 *
143
+	 * @param array $attributes
144
+	 * @return array
145
+	 */
146
+	private function getAttributes(array $attributes)
147
+	{
148
+		return array_merge(
149
+			(array) apply_filters(
150
+				'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
151
+				array(
152
+					'event_id'      => null,
153
+					'datetime_id'   => null,
154
+					'ticket_id'     => null,
155
+					'status'        => EEM_Registration::status_id_approved,
156
+					'show_gravatar' => false
157
+				)
158
+			),
159
+			$attributes
160
+		);
161
+	}
162
+
163
+
164
+
165
+	/**
166
+	 * @param array $attributes
167
+	 * @return EE_Event|null
168
+	 * @throws \EE_Error
169
+	 */
170
+	private function getEventAndQueryParams(array $attributes){
171
+		if ( ! empty($attributes['event_id'])) {
172
+			$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
173
+			if ($event instanceof EE_Event) {
174
+				$this->query_params[0]['Registration.EVT_ID'] = $attributes['event_id'];
175
+				return $event;
176
+			}
177
+		}
178
+		//seems like is_espresso_event_single() isn't working as expected. So using alternate method.
179
+		if (is_single() && is_espresso_event()) {
180
+			$event = EEH_Event_View::get_event();
181
+			if ($event instanceof EE_Event) {
182
+				$this->query_params[0]['Registration.EVT_ID'] = $event->ID();
183
+				return $event;
184
+			}
185
+		}
186
+		// one last shot...
187
+		// try getting the earliest active event
188
+		$events = EEM_Event::instance()->get_active_events(array(
189
+			'limit'    => 1,
190
+			'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
191
+		));
192
+		//  if none then get the next upcoming
193
+		$events = empty($events)
194
+			? EEM_Event::instance()->get_upcoming_events(array(
195
+				'limit'    => 1,
196
+				'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
197
+			))
198
+			: $events;
199
+		$event = reset($events);
200
+		if ($event instanceof EE_Event) {
201
+			$this->query_params[0]['Registration.EVT_ID'] = $event->ID();
202
+			return $event;
203
+		}
204
+		return null;
205
+	}
206
+
207
+
208
+
209
+	/**
210
+	 * @param array $attributes
211
+	 * @return EE_Datetime|null
212
+	 */
213
+	private function getDatetimeAndQueryParams(array $attributes)
214
+	{
215
+		if ( ! empty($attributes['datetime_id'])) {
216
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
217
+			if ($datetime instanceof EE_Datetime) {
218
+				$this->query_params[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
219
+				$this->query_params['default_where_conditions'] = 'this_model_only';
220
+				if ( ! $this->template_args['event'] instanceof EE_Event) {
221
+					$this->template_args['event'] = $datetime->event();
222
+				}
223
+				return $datetime;
224
+			}
225
+		}
226
+		return null;
227
+	}
228
+
229
+
230
+
231
+	/**
232
+	 * @param array $attributes
233
+	 * @return \EE_Base_Class|null
234
+	 * @throws \EE_Error
235
+	 */
236
+	private function getTicketAndQueryParams(array $attributes)
237
+	{
238
+		if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
239
+			$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
240
+			if ($ticket instanceof EE_Ticket) {
241
+				$this->query_params[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
242
+				if ( ! $this->template_args['event'] instanceof EE_Event) {
243
+					$this->template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime
244
+						? $ticket->first_datetime()->event()
245
+						: null;
246
+				}
247
+				return $ticket;
248
+			}
249
+		}
250
+		return null;
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * @param array $attributes
257
+	 */
258
+	private function setAdditionalQueryParams(array $attributes)
259
+	{
260
+		$reg_status_array = EEM_Registration::reg_status_array();
261
+		if ($attributes['status'] !== 'all' && isset($reg_status_array[$attributes['status']])) {
262
+			$this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
263
+		}
264
+		$this->query_params['group_by'] = array('ATT_ID');
265
+		$this->query_params['order_by'] = (array) apply_filters(
266
+			'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
267
+			array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
268
+		);
269
+	}
270 270
 
271 271
 
272 272
 
Please login to merge, or discard this patch.
acceptance_tests/Helpers/EventsAdmin.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -14,109 +14,109 @@
 block discarded – undo
14 14
 trait EventsAdmin
15 15
 {
16 16
 
17
-    /**
18
-     * @param string $additional_params
19
-     */
20
-    public function amOnDefaultEventsListTablePage($additional_params = '')
21
-    {
22
-        $this->actor()->amOnAdminPage(EventsPage::defaultEventsListTableUrl($additional_params));
23
-    }
24
-
25
-
26
-    /**
27
-     * Triggers the publishing of the Event.
28
-     */
29
-    public function publishEvent()
30
-    {
31
-        $this->actor()->click(EventsPage::EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR);
32
-    }
33
-
34
-
35
-    /**
36
-     * Navigates the actor to the event list table page and will attempt to edit the event for the given title.
37
-     * First this will search using the given title and then attempt to edit from the results of the search.
38
-     *
39
-     * Assumes actor is already logged in.
40
-     * @param $event_title
41
-     */
42
-    public function amEditingTheEventWithTitle($event_title)
43
-    {
44
-        $this->amOnDefaultEventsListTablePage();
45
-        $this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title);
46
-        $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR);
47
-        $this->actor()->waitForText('Displaying search results for');
48
-        $this->actor()->click(EventsPage::eventListTableEventTitleEditLink($event_title));
49
-    }
50
-
51
-
52
-    /**
53
-     * Navigates the user to the single event page (frontend view) for the given event title via clicking the "View"
54
-     * link for the event in the event list table.
55
-     * Assumes the actor is already logged in and on the Event list table page.
56
-     *
57
-     * @param string $event_title
58
-     */
59
-    public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title)
60
-    {
61
-        $this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title));
62
-        $this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title));
63
-    }
64
-
65
-
66
-    /**
67
-     * This performs the click action on the gear icon that triggers the advanced settings view state.
68
-     * Assumes the actor is already logged in and editing an event.
69
-     *
70
-     * @param int $row_number  What ticket row to toggle open/close.
71
-     */
72
-    public function toggleAdvancedSettingsViewForTicketRow($row_number = 1)
73
-    {
74
-        $this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number));
75
-    }
76
-
77
-
78
-    /**
79
-     * Toggles the TKT_is_taxable checkbox for the ticket in the given row.
80
-     * Assumes the actor is already logged in and editing an event and that the advanced settings view state for that
81
-     * ticket is "open".
82
-     *
83
-     * @param int $row_number  What ticket row to toggle the checkbox for.
84
-     */
85
-    public function toggleTicketIsTaxableForTicketRow($row_number = 1)
86
-    {
87
-        $this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number));
88
-    }
89
-
90
-
91
-    /**
92
-     * Use to change the default registration status for the event.
93
-     * Assumes the view is already on the event editor.
94
-     * @param $registration_status
95
-     */
96
-    public function changeDefaultRegistrationStatusTo($registration_status)
97
-    {
98
-        $this->actor()->selectOption(
99
-            EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR,
100
-            $registration_status
101
-        );
102
-    }
103
-
104
-
105
-    /**
106
-     * Use this from the context of the event editor to select the given custom template for a given message type and
107
-     * messenger.
108
-     *
109
-     * @param string $message_type_label  The visible label for the message type (eg Registration Approved)
110
-     * @param string $messenger_slug      The slug for the messenger (eg 'email')
111
-     * @param string $custom_template_label The visible label in the select input for the custom template you want
112
-     *                                      selected.
113
-     */
114
-    public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label)
115
-    {
116
-        $this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug));
117
-        $this->actor()->selectOption(
118
-            EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label),
119
-            $custom_template_label
120
-        );
121
-    }
17
+	/**
18
+	 * @param string $additional_params
19
+	 */
20
+	public function amOnDefaultEventsListTablePage($additional_params = '')
21
+	{
22
+		$this->actor()->amOnAdminPage(EventsPage::defaultEventsListTableUrl($additional_params));
23
+	}
24
+
25
+
26
+	/**
27
+	 * Triggers the publishing of the Event.
28
+	 */
29
+	public function publishEvent()
30
+	{
31
+		$this->actor()->click(EventsPage::EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR);
32
+	}
33
+
34
+
35
+	/**
36
+	 * Navigates the actor to the event list table page and will attempt to edit the event for the given title.
37
+	 * First this will search using the given title and then attempt to edit from the results of the search.
38
+	 *
39
+	 * Assumes actor is already logged in.
40
+	 * @param $event_title
41
+	 */
42
+	public function amEditingTheEventWithTitle($event_title)
43
+	{
44
+		$this->amOnDefaultEventsListTablePage();
45
+		$this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title);
46
+		$this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR);
47
+		$this->actor()->waitForText('Displaying search results for');
48
+		$this->actor()->click(EventsPage::eventListTableEventTitleEditLink($event_title));
49
+	}
50
+
51
+
52
+	/**
53
+	 * Navigates the user to the single event page (frontend view) for the given event title via clicking the "View"
54
+	 * link for the event in the event list table.
55
+	 * Assumes the actor is already logged in and on the Event list table page.
56
+	 *
57
+	 * @param string $event_title
58
+	 */
59
+	public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title)
60
+	{
61
+		$this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title));
62
+		$this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title));
63
+	}
64
+
65
+
66
+	/**
67
+	 * This performs the click action on the gear icon that triggers the advanced settings view state.
68
+	 * Assumes the actor is already logged in and editing an event.
69
+	 *
70
+	 * @param int $row_number  What ticket row to toggle open/close.
71
+	 */
72
+	public function toggleAdvancedSettingsViewForTicketRow($row_number = 1)
73
+	{
74
+		$this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number));
75
+	}
76
+
77
+
78
+	/**
79
+	 * Toggles the TKT_is_taxable checkbox for the ticket in the given row.
80
+	 * Assumes the actor is already logged in and editing an event and that the advanced settings view state for that
81
+	 * ticket is "open".
82
+	 *
83
+	 * @param int $row_number  What ticket row to toggle the checkbox for.
84
+	 */
85
+	public function toggleTicketIsTaxableForTicketRow($row_number = 1)
86
+	{
87
+		$this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number));
88
+	}
89
+
90
+
91
+	/**
92
+	 * Use to change the default registration status for the event.
93
+	 * Assumes the view is already on the event editor.
94
+	 * @param $registration_status
95
+	 */
96
+	public function changeDefaultRegistrationStatusTo($registration_status)
97
+	{
98
+		$this->actor()->selectOption(
99
+			EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR,
100
+			$registration_status
101
+		);
102
+	}
103
+
104
+
105
+	/**
106
+	 * Use this from the context of the event editor to select the given custom template for a given message type and
107
+	 * messenger.
108
+	 *
109
+	 * @param string $message_type_label  The visible label for the message type (eg Registration Approved)
110
+	 * @param string $messenger_slug      The slug for the messenger (eg 'email')
111
+	 * @param string $custom_template_label The visible label in the select input for the custom template you want
112
+	 *                                      selected.
113
+	 */
114
+	public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label)
115
+	{
116
+		$this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug));
117
+		$this->actor()->selectOption(
118
+			EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label),
119
+			$custom_template_label
120
+		);
121
+	}
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Helpers/MessagesAdmin.php 1 patch
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -10,237 +10,237 @@
 block discarded – undo
10 10
  */
11 11
 trait MessagesAdmin
12 12
 {
13
-    /**
14
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
15
-     *                                  a string.
16
-     */
17
-    public function amOnMessagesActivityListTablePage($additional_params = '')
18
-    {
19
-        $this->actor()->amOnAdminPage(MessagesPage::messageActivityListTableUrl($additional_params));
20
-    }
21
-
22
-    /**
23
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
24
-     *                                  a string.
25
-     */
26
-    public function amOnDefaultMessageTemplateListTablePage($additional_params = '')
27
-    {
28
-        $this->actor()->amOnAdminPage(MessagesPage::defaultMessageTemplateListTableUrl($additional_params));
29
-    }
30
-
31
-
32
-    /**
33
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
34
-     *                                  a string.
35
-     */
36
-    public function amOnCustomMessageTemplateListTablePage($additional_params = '')
37
-    {
38
-        $this->actor()->amOnAdminPage(MessagesPage::customMessageTemplateListTableUrl($additional_params));
39
-    }
40
-
41
-
42
-    /**
43
-     * Directs to message settings page
44
-     */
45
-    public function amOnMessageSettingsPage()
46
-    {
47
-        $this->actor()->amOnAdminPage(MessagesPage::messageSettingsUrl());
48
-    }
49
-
50
-
51
-    public function activateMessageTypeForMessenger($message_type_slug, $messenger_slug = 'email')
52
-    {
53
-        $this->actor()->dragAndDrop(
54
-            MessagesPage::draggableSettingsBoxSelectorForMessageTypeAndMessenger($message_type_slug, $messenger_slug),
55
-            MessagesPage::MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR
56
-        );
57
-    }
58
-
59
-
60
-    /**
61
-     * Assumes you are already on the list table page that has the ui for editing the template.
62
-     * @param string $message_type_slug
63
-     * @param string $context [optional] if you want to click directly to the given context in the editor
64
-     */
65
-    public function clickToEditMessageTemplateByMessageType($message_type_slug, $context = '')
66
-    {
67
-        $this->actor()->click(MessagesPage::editMessageTemplateClassByMessageType($message_type_slug, $context));
68
-    }
69
-
70
-
71
-    /**
72
-     * Use this action to verify that the count for the given text in the specified field is as expected.  For example
73
-     * filling the condition of, "There should only be 1 instance of `[email protected]` in all the 'to' column.
74
-     *
75
-     * @param int    $expected_occurence_count
76
-     * @param string $text_to_check_for
77
-     * @param string $field
78
-     * @param string $message_type_label
79
-     * @param string $message_status
80
-     * @param string $messenger
81
-     * @param string $context
82
-     */
83
-    public function verifyMatchingCountofTextInMessageActivityListTableFor(
84
-        $expected_occurence_count,
85
-        $text_to_check_for,
86
-        $field,
87
-        $message_type_label,
88
-        $message_status = MessagesPage::MESSAGE_STATUS_SENT,
89
-        $messenger = 'Email',
90
-        $context = 'Event Admin'
91
-    ) {
92
-        $elements = $this->actor()->grabMultiple(MessagesPage::messagesActivityListTableCellSelectorFor(
93
-            $field,
94
-            $message_type_label,
95
-            $message_status,
96
-            $messenger,
97
-            $context,
98
-            $text_to_check_for,
99
-            0
100
-        ));
101
-        $actual_count = count($elements);
102
-        $this->actor()->assertEquals(
103
-            $expected_occurence_count,
104
-            $actual_count,
105
-            sprintf(
106
-                'Expected %s of the %s text for the %s field but there were actually %s counted.',
107
-                $expected_occurence_count,
108
-                $text_to_check_for,
109
-                $field,
110
-                $actual_count
111
-            )
112
-        );
113
-    }
114
-
115
-
116
-    /**
117
-     * This will create a custom message template for the given messenger and message type from the context of the
118
-     * default (global) message template list table.
119
-     * Also takes care of verifying the template was created.
120
-     * @param string $message_type_label
121
-     * @param string $messenger_label
122
-     */
123
-    public function createCustomMessageTemplateFromDefaultFor($message_type_label, $messenger_label)
124
-    {
125
-        $this->amOnDefaultMessageTemplateListTablePage();
126
-        $this->actor()->click(
127
-            MessagesPage::createCustomButtonForMessageTypeAndMessenger(
128
-                $message_type_label,
129
-                $messenger_label
130
-            )
131
-        );
132
-        $this->actor()->seeInField('#title', 'New Custom Template');
133
-    }
134
-
135
-
136
-    /**
137
-     * This switches the context of the current messages template to the given reference.
138
-     * @param string $context_reference  This should be the visible label for the option.
139
-     */
140
-    public function switchContextTo($context_reference)
141
-    {
142
-        $this->actor()->selectOption(MessagesPage::MESSAGES_CONTEXT_SWITCHER_SELECTOR, $context_reference);
143
-        $this->actor()->click(MessagesPage::MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR);
144
-        $this->actor()->waitForText($context_reference, 10, 'h1');
145
-    }
146
-
147
-
148
-    /**
149
-     * This takes care of clicking the View Message icon for the given parameters.
150
-     * Assumes you are already viewing the messages activity list table.
151
-     * @param        $message_type_label
152
-     * @param        $message_status
153
-     * @param string $messenger
154
-     * @param string $context
155
-     * @param int    $number_in_set
156
-     */
157
-    public function viewMessageInMessagesListTableFor(
158
-        $message_type_label,
159
-        $message_status = MessagesPage::MESSAGE_STATUS_SENT,
160
-        $messenger = 'Email',
161
-        $context = 'Event Admin',
162
-        $number_in_set = 1
163
-    ) {
164
-        $this->actor()->click(MessagesPage::messagesActivityListTableViewButtonSelectorFor(
165
-            $message_type_label,
166
-            $message_status,
167
-            $messenger,
168
-            $context,
169
-            $number_in_set
170
-        ));
171
-    }
172
-
173
-
174
-    /**
175
-     * Takes care of deleting a message matching the given parameters via the message activity list table.
176
-     * Assumes you are already viewing the messages activity list table.
177
-     * @param        $message_type_label
178
-     * @param        $message_status
179
-     * @param string $messenger
180
-     * @param string $context
181
-     * @param int    $number_in_set
182
-     */
183
-    public function deleteMessageInMessagesListTableFor(
184
-        $message_type_label,
185
-        $message_status = MessagesPage::MESSAGE_STATUS_SENT,
186
-        $messenger = 'Email',
187
-        $context = 'Event Admin',
188
-        $number_in_set = 1
189
-    ) {
190
-        $this->actor()->moveMouseOver(
191
-            MessagesPage::messagesActivityListTableCellSelectorFor(
192
-                'to',
193
-                $message_type_label,
194
-                $message_status,
195
-                $messenger,
196
-                $context,
197
-                '',
198
-                $number_in_set
199
-            )
200
-        );
201
-        $this->actor()->waitForElementVisible(
202
-            MessagesPage::messagesActivityListTableDeleteActionSelectorFor(
203
-                $message_type_label,
204
-                $message_status,
205
-                $messenger,
206
-                $context,
207
-                $number_in_set
208
-            )
209
-        );
210
-        $this->actor()->click(
211
-            MessagesPage::messagesActivityListTableDeleteActionSelectorFor(
212
-                $message_type_label,
213
-                $message_status,
214
-                $messenger,
215
-                $context,
216
-                $number_in_set
217
-            )
218
-        );
219
-        $this->actor()->waitForText('successfully deleted');
220
-    }
221
-
222
-
223
-    /**
224
-     * Assuming you have already triggered the view modal for a single message from the context of the message activity
225
-     * list table, this will take care of validating the given text is in that window.
226
-     * @param string $text_to_view
227
-     */
228
-    public function seeTextInViewMessageModal($text_to_view, $should_not_see = false)
229
-    {
230
-        $this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content');
231
-        $this->actor()->switchToIframe('message-view-window');
232
-        $should_not_see ? $this->actor()->dontSee($text_to_view) : $this->actor()->see($text_to_view);
233
-        $this->actor()->switchToIframe();
234
-    }
235
-
236
-
237
-    /**
238
-     * Assuming you have already triggered the view modal for a single message from the context of the message activity
239
-     * list table, this will take care of validating the given text is NOT that window.
240
-     * @param string $text_to_view
241
-     */
242
-    public function dontSeeTextInViewMessageModal($text_to_view)
243
-    {
244
-        $this->seeTextInViewMessageModal($text_to_view, true);
245
-    }
13
+	/**
14
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
15
+	 *                                  a string.
16
+	 */
17
+	public function amOnMessagesActivityListTablePage($additional_params = '')
18
+	{
19
+		$this->actor()->amOnAdminPage(MessagesPage::messageActivityListTableUrl($additional_params));
20
+	}
21
+
22
+	/**
23
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
24
+	 *                                  a string.
25
+	 */
26
+	public function amOnDefaultMessageTemplateListTablePage($additional_params = '')
27
+	{
28
+		$this->actor()->amOnAdminPage(MessagesPage::defaultMessageTemplateListTableUrl($additional_params));
29
+	}
30
+
31
+
32
+	/**
33
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
34
+	 *                                  a string.
35
+	 */
36
+	public function amOnCustomMessageTemplateListTablePage($additional_params = '')
37
+	{
38
+		$this->actor()->amOnAdminPage(MessagesPage::customMessageTemplateListTableUrl($additional_params));
39
+	}
40
+
41
+
42
+	/**
43
+	 * Directs to message settings page
44
+	 */
45
+	public function amOnMessageSettingsPage()
46
+	{
47
+		$this->actor()->amOnAdminPage(MessagesPage::messageSettingsUrl());
48
+	}
49
+
50
+
51
+	public function activateMessageTypeForMessenger($message_type_slug, $messenger_slug = 'email')
52
+	{
53
+		$this->actor()->dragAndDrop(
54
+			MessagesPage::draggableSettingsBoxSelectorForMessageTypeAndMessenger($message_type_slug, $messenger_slug),
55
+			MessagesPage::MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR
56
+		);
57
+	}
58
+
59
+
60
+	/**
61
+	 * Assumes you are already on the list table page that has the ui for editing the template.
62
+	 * @param string $message_type_slug
63
+	 * @param string $context [optional] if you want to click directly to the given context in the editor
64
+	 */
65
+	public function clickToEditMessageTemplateByMessageType($message_type_slug, $context = '')
66
+	{
67
+		$this->actor()->click(MessagesPage::editMessageTemplateClassByMessageType($message_type_slug, $context));
68
+	}
69
+
70
+
71
+	/**
72
+	 * Use this action to verify that the count for the given text in the specified field is as expected.  For example
73
+	 * filling the condition of, "There should only be 1 instance of `[email protected]` in all the 'to' column.
74
+	 *
75
+	 * @param int    $expected_occurence_count
76
+	 * @param string $text_to_check_for
77
+	 * @param string $field
78
+	 * @param string $message_type_label
79
+	 * @param string $message_status
80
+	 * @param string $messenger
81
+	 * @param string $context
82
+	 */
83
+	public function verifyMatchingCountofTextInMessageActivityListTableFor(
84
+		$expected_occurence_count,
85
+		$text_to_check_for,
86
+		$field,
87
+		$message_type_label,
88
+		$message_status = MessagesPage::MESSAGE_STATUS_SENT,
89
+		$messenger = 'Email',
90
+		$context = 'Event Admin'
91
+	) {
92
+		$elements = $this->actor()->grabMultiple(MessagesPage::messagesActivityListTableCellSelectorFor(
93
+			$field,
94
+			$message_type_label,
95
+			$message_status,
96
+			$messenger,
97
+			$context,
98
+			$text_to_check_for,
99
+			0
100
+		));
101
+		$actual_count = count($elements);
102
+		$this->actor()->assertEquals(
103
+			$expected_occurence_count,
104
+			$actual_count,
105
+			sprintf(
106
+				'Expected %s of the %s text for the %s field but there were actually %s counted.',
107
+				$expected_occurence_count,
108
+				$text_to_check_for,
109
+				$field,
110
+				$actual_count
111
+			)
112
+		);
113
+	}
114
+
115
+
116
+	/**
117
+	 * This will create a custom message template for the given messenger and message type from the context of the
118
+	 * default (global) message template list table.
119
+	 * Also takes care of verifying the template was created.
120
+	 * @param string $message_type_label
121
+	 * @param string $messenger_label
122
+	 */
123
+	public function createCustomMessageTemplateFromDefaultFor($message_type_label, $messenger_label)
124
+	{
125
+		$this->amOnDefaultMessageTemplateListTablePage();
126
+		$this->actor()->click(
127
+			MessagesPage::createCustomButtonForMessageTypeAndMessenger(
128
+				$message_type_label,
129
+				$messenger_label
130
+			)
131
+		);
132
+		$this->actor()->seeInField('#title', 'New Custom Template');
133
+	}
134
+
135
+
136
+	/**
137
+	 * This switches the context of the current messages template to the given reference.
138
+	 * @param string $context_reference  This should be the visible label for the option.
139
+	 */
140
+	public function switchContextTo($context_reference)
141
+	{
142
+		$this->actor()->selectOption(MessagesPage::MESSAGES_CONTEXT_SWITCHER_SELECTOR, $context_reference);
143
+		$this->actor()->click(MessagesPage::MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR);
144
+		$this->actor()->waitForText($context_reference, 10, 'h1');
145
+	}
146
+
147
+
148
+	/**
149
+	 * This takes care of clicking the View Message icon for the given parameters.
150
+	 * Assumes you are already viewing the messages activity list table.
151
+	 * @param        $message_type_label
152
+	 * @param        $message_status
153
+	 * @param string $messenger
154
+	 * @param string $context
155
+	 * @param int    $number_in_set
156
+	 */
157
+	public function viewMessageInMessagesListTableFor(
158
+		$message_type_label,
159
+		$message_status = MessagesPage::MESSAGE_STATUS_SENT,
160
+		$messenger = 'Email',
161
+		$context = 'Event Admin',
162
+		$number_in_set = 1
163
+	) {
164
+		$this->actor()->click(MessagesPage::messagesActivityListTableViewButtonSelectorFor(
165
+			$message_type_label,
166
+			$message_status,
167
+			$messenger,
168
+			$context,
169
+			$number_in_set
170
+		));
171
+	}
172
+
173
+
174
+	/**
175
+	 * Takes care of deleting a message matching the given parameters via the message activity list table.
176
+	 * Assumes you are already viewing the messages activity list table.
177
+	 * @param        $message_type_label
178
+	 * @param        $message_status
179
+	 * @param string $messenger
180
+	 * @param string $context
181
+	 * @param int    $number_in_set
182
+	 */
183
+	public function deleteMessageInMessagesListTableFor(
184
+		$message_type_label,
185
+		$message_status = MessagesPage::MESSAGE_STATUS_SENT,
186
+		$messenger = 'Email',
187
+		$context = 'Event Admin',
188
+		$number_in_set = 1
189
+	) {
190
+		$this->actor()->moveMouseOver(
191
+			MessagesPage::messagesActivityListTableCellSelectorFor(
192
+				'to',
193
+				$message_type_label,
194
+				$message_status,
195
+				$messenger,
196
+				$context,
197
+				'',
198
+				$number_in_set
199
+			)
200
+		);
201
+		$this->actor()->waitForElementVisible(
202
+			MessagesPage::messagesActivityListTableDeleteActionSelectorFor(
203
+				$message_type_label,
204
+				$message_status,
205
+				$messenger,
206
+				$context,
207
+				$number_in_set
208
+			)
209
+		);
210
+		$this->actor()->click(
211
+			MessagesPage::messagesActivityListTableDeleteActionSelectorFor(
212
+				$message_type_label,
213
+				$message_status,
214
+				$messenger,
215
+				$context,
216
+				$number_in_set
217
+			)
218
+		);
219
+		$this->actor()->waitForText('successfully deleted');
220
+	}
221
+
222
+
223
+	/**
224
+	 * Assuming you have already triggered the view modal for a single message from the context of the message activity
225
+	 * list table, this will take care of validating the given text is in that window.
226
+	 * @param string $text_to_view
227
+	 */
228
+	public function seeTextInViewMessageModal($text_to_view, $should_not_see = false)
229
+	{
230
+		$this->actor()->waitForElementVisible('.ee-admin-dialog-container-inner-content');
231
+		$this->actor()->switchToIframe('message-view-window');
232
+		$should_not_see ? $this->actor()->dontSee($text_to_view) : $this->actor()->see($text_to_view);
233
+		$this->actor()->switchToIframe();
234
+	}
235
+
236
+
237
+	/**
238
+	 * Assuming you have already triggered the view modal for a single message from the context of the message activity
239
+	 * list table, this will take care of validating the given text is NOT that window.
240
+	 * @param string $text_to_view
241
+	 */
242
+	public function dontSeeTextInViewMessageModal($text_to_view)
243
+	{
244
+		$this->seeTextInViewMessageModal($text_to_view, true);
245
+	}
246 246
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.43.rc.014');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.43.rc.014');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Div_Per_Section_Layout.strategy.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -14,132 +14,132 @@
 block discarded – undo
14 14
 class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base
15 15
 {
16 16
 
17
-    /**
18
-     * opening div tag for a form
19
-     *
20
-     * @return string
21
-     */
22
-    public function layout_form_begin()
23
-    {
24
-        return EEH_HTML::div(
25
-            '',
26
-            $this->_form_section->html_id(),
27
-            $this->_form_section->html_class(),
28
-            $this->_form_section->html_style()
29
-        );
30
-    }
31
-
32
-
33
-
34
-    /**
35
-     * Lays out the row for the input, including label and errors
36
-     *
37
-     * @param EE_Form_Input_Base $input
38
-     * @return string
39
-     * @throws \EE_Error
40
-     */
41
-    public function layout_input($input)
42
-    {
43
-        $html = '';
44
-        // set something unique for the id
45
-        $html_id = (string)$input->html_id() !== ''
46
-            ? (string)$input->html_id()
47
-            : spl_object_hash($input);
48
-        // and add a generic class
49
-        $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv';
50
-        if ($input instanceof EE_Hidden_Input) {
51
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
52
-        } else if ($input instanceof EE_Submit_Input) {
53
-            $html .= EEH_HTML::div(
54
-                $input->get_html_for_input(),
55
-                $html_id . '-submit-dv',
56
-                $html_class
57
-            );
58
-        } else if ($input instanceof EE_Select_Input) {
59
-            $html .= EEH_HTML::div(
60
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
61
-                EEH_HTML::nl() . $input->get_html_for_errors() .
62
-                EEH_HTML::nl() . $input->get_html_for_input() .
63
-                EEH_HTML::nl() . $input->get_html_for_help(),
64
-                $html_id . '-input-dv',
65
-                $html_class
66
-            );
67
-        } else if ($input instanceof EE_Form_Input_With_Options_Base) {
68
-            $html .= EEH_HTML::div(
69
-                EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
70
-                EEH_HTML::nl() . $input->get_html_for_errors() .
71
-                EEH_HTML::nl() . $input->get_html_for_input() .
72
-                EEH_HTML::nl() . $input->get_html_for_help(),
73
-                $html_id . '-input-dv',
74
-                $html_class
75
-            );
76
-        } else {
77
-            $html .= EEH_HTML::div(
78
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
79
-                EEH_HTML::nl() . $input->get_html_for_errors() .
80
-                EEH_HTML::nl() . $input->get_html_for_input() .
81
-                EEH_HTML::nl() . $input->get_html_for_help(),
82
-                $html_id . '-input-dv',
83
-                $html_class
84
-            );
85
-        }
86
-        return $html;
87
-    }
88
-
89
-
90
-
91
-    /**
92
-     *
93
-     * _display_label_for_option_type_question
94
-     * Gets the HTML for the 'label', which is just text for this (because labels
95
-     * should be for each input)
96
-     *
97
-     * @param EE_Form_Input_With_Options_Base $input
98
-     * @return string
99
-     */
100
-    protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input)
101
-    {
102
-        if ($input->display_html_label_text() !== '') {
103
-            return EEH_HTML::div(
104
-                $input->required()
105
-                    ? $input->html_label_text() . EEH_HTML::span('*', '', 'ee-asterisk')
106
-                    : $input->html_label_text(),
107
-                $input->html_label_id(),
108
-                $input->required()
109
-                    ? 'ee-required-label ' . $input->html_label_class()
110
-                    : $input->html_label_class(),
111
-                $input->html_label_style(),
112
-                $input->html_other_attributes()
113
-            );
114
-        }
115
-        return '';
116
-    }
117
-
118
-
119
-
120
-    /**
121
-     * Lays out a row for the subsection
122
-     *
123
-     * @param EE_Form_Section_Proper $form_section
124
-     * @return string
125
-     */
126
-    public function layout_subsection($form_section)
127
-    {
128
-        //		d( $form_section );
129
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
130
-    }
131
-
132
-
133
-
134
-    /**
135
-     * closing div tag for a form
136
-     *
137
-     * @return string
138
-     */
139
-    public function layout_form_end()
140
-    {
141
-        return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
142
-    }
17
+	/**
18
+	 * opening div tag for a form
19
+	 *
20
+	 * @return string
21
+	 */
22
+	public function layout_form_begin()
23
+	{
24
+		return EEH_HTML::div(
25
+			'',
26
+			$this->_form_section->html_id(),
27
+			$this->_form_section->html_class(),
28
+			$this->_form_section->html_style()
29
+		);
30
+	}
31
+
32
+
33
+
34
+	/**
35
+	 * Lays out the row for the input, including label and errors
36
+	 *
37
+	 * @param EE_Form_Input_Base $input
38
+	 * @return string
39
+	 * @throws \EE_Error
40
+	 */
41
+	public function layout_input($input)
42
+	{
43
+		$html = '';
44
+		// set something unique for the id
45
+		$html_id = (string)$input->html_id() !== ''
46
+			? (string)$input->html_id()
47
+			: spl_object_hash($input);
48
+		// and add a generic class
49
+		$html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv';
50
+		if ($input instanceof EE_Hidden_Input) {
51
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
52
+		} else if ($input instanceof EE_Submit_Input) {
53
+			$html .= EEH_HTML::div(
54
+				$input->get_html_for_input(),
55
+				$html_id . '-submit-dv',
56
+				$html_class
57
+			);
58
+		} else if ($input instanceof EE_Select_Input) {
59
+			$html .= EEH_HTML::div(
60
+				EEH_HTML::nl(1) . $input->get_html_for_label() .
61
+				EEH_HTML::nl() . $input->get_html_for_errors() .
62
+				EEH_HTML::nl() . $input->get_html_for_input() .
63
+				EEH_HTML::nl() . $input->get_html_for_help(),
64
+				$html_id . '-input-dv',
65
+				$html_class
66
+			);
67
+		} else if ($input instanceof EE_Form_Input_With_Options_Base) {
68
+			$html .= EEH_HTML::div(
69
+				EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
70
+				EEH_HTML::nl() . $input->get_html_for_errors() .
71
+				EEH_HTML::nl() . $input->get_html_for_input() .
72
+				EEH_HTML::nl() . $input->get_html_for_help(),
73
+				$html_id . '-input-dv',
74
+				$html_class
75
+			);
76
+		} else {
77
+			$html .= EEH_HTML::div(
78
+				EEH_HTML::nl(1) . $input->get_html_for_label() .
79
+				EEH_HTML::nl() . $input->get_html_for_errors() .
80
+				EEH_HTML::nl() . $input->get_html_for_input() .
81
+				EEH_HTML::nl() . $input->get_html_for_help(),
82
+				$html_id . '-input-dv',
83
+				$html_class
84
+			);
85
+		}
86
+		return $html;
87
+	}
88
+
89
+
90
+
91
+	/**
92
+	 *
93
+	 * _display_label_for_option_type_question
94
+	 * Gets the HTML for the 'label', which is just text for this (because labels
95
+	 * should be for each input)
96
+	 *
97
+	 * @param EE_Form_Input_With_Options_Base $input
98
+	 * @return string
99
+	 */
100
+	protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input)
101
+	{
102
+		if ($input->display_html_label_text() !== '') {
103
+			return EEH_HTML::div(
104
+				$input->required()
105
+					? $input->html_label_text() . EEH_HTML::span('*', '', 'ee-asterisk')
106
+					: $input->html_label_text(),
107
+				$input->html_label_id(),
108
+				$input->required()
109
+					? 'ee-required-label ' . $input->html_label_class()
110
+					: $input->html_label_class(),
111
+				$input->html_label_style(),
112
+				$input->html_other_attributes()
113
+			);
114
+		}
115
+		return '';
116
+	}
117
+
118
+
119
+
120
+	/**
121
+	 * Lays out a row for the subsection
122
+	 *
123
+	 * @param EE_Form_Section_Proper $form_section
124
+	 * @return string
125
+	 */
126
+	public function layout_subsection($form_section)
127
+	{
128
+		//		d( $form_section );
129
+		return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
130
+	}
131
+
132
+
133
+
134
+	/**
135
+	 * closing div tag for a form
136
+	 *
137
+	 * @return string
138
+	 */
139
+	public function layout_form_end()
140
+	{
141
+		return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
142
+	}
143 143
 
144 144
 
145 145
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,44 +42,44 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $html = '';
44 44
         // set something unique for the id
45
-        $html_id = (string)$input->html_id() !== ''
46
-            ? (string)$input->html_id()
45
+        $html_id = (string) $input->html_id() !== ''
46
+            ? (string) $input->html_id()
47 47
             : spl_object_hash($input);
48 48
         // and add a generic class
49
-        $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv';
49
+        $html_class = sanitize_key(str_replace('_', '-', get_class($input))).'-dv';
50 50
         if ($input instanceof EE_Hidden_Input) {
51
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
51
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
52 52
         } else if ($input instanceof EE_Submit_Input) {
53 53
             $html .= EEH_HTML::div(
54 54
                 $input->get_html_for_input(),
55
-                $html_id . '-submit-dv',
55
+                $html_id.'-submit-dv',
56 56
                 $html_class
57 57
             );
58 58
         } else if ($input instanceof EE_Select_Input) {
59 59
             $html .= EEH_HTML::div(
60
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
61
-                EEH_HTML::nl() . $input->get_html_for_errors() .
62
-                EEH_HTML::nl() . $input->get_html_for_input() .
63
-                EEH_HTML::nl() . $input->get_html_for_help(),
64
-                $html_id . '-input-dv',
60
+                EEH_HTML::nl(1).$input->get_html_for_label().
61
+                EEH_HTML::nl().$input->get_html_for_errors().
62
+                EEH_HTML::nl().$input->get_html_for_input().
63
+                EEH_HTML::nl().$input->get_html_for_help(),
64
+                $html_id.'-input-dv',
65 65
                 $html_class
66 66
             );
67 67
         } else if ($input instanceof EE_Form_Input_With_Options_Base) {
68 68
             $html .= EEH_HTML::div(
69
-                EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
70
-                EEH_HTML::nl() . $input->get_html_for_errors() .
71
-                EEH_HTML::nl() . $input->get_html_for_input() .
72
-                EEH_HTML::nl() . $input->get_html_for_help(),
73
-                $html_id . '-input-dv',
69
+                EEH_HTML::nl().$this->_display_label_for_option_type_question($input).
70
+                EEH_HTML::nl().$input->get_html_for_errors().
71
+                EEH_HTML::nl().$input->get_html_for_input().
72
+                EEH_HTML::nl().$input->get_html_for_help(),
73
+                $html_id.'-input-dv',
74 74
                 $html_class
75 75
             );
76 76
         } else {
77 77
             $html .= EEH_HTML::div(
78
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
79
-                EEH_HTML::nl() . $input->get_html_for_errors() .
80
-                EEH_HTML::nl() . $input->get_html_for_input() .
81
-                EEH_HTML::nl() . $input->get_html_for_help(),
82
-                $html_id . '-input-dv',
78
+                EEH_HTML::nl(1).$input->get_html_for_label().
79
+                EEH_HTML::nl().$input->get_html_for_errors().
80
+                EEH_HTML::nl().$input->get_html_for_input().
81
+                EEH_HTML::nl().$input->get_html_for_help(),
82
+                $html_id.'-input-dv',
83 83
                 $html_class
84 84
             );
85 85
         }
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
         if ($input->display_html_label_text() !== '') {
103 103
             return EEH_HTML::div(
104 104
                 $input->required()
105
-                    ? $input->html_label_text() . EEH_HTML::span('*', '', 'ee-asterisk')
105
+                    ? $input->html_label_text().EEH_HTML::span('*', '', 'ee-asterisk')
106 106
                     : $input->html_label_text(),
107 107
                 $input->html_label_id(),
108 108
                 $input->required()
109
-                    ? 'ee-required-label ' . $input->html_label_class()
109
+                    ? 'ee-required-label '.$input->html_label_class()
110 110
                     : $input->html_label_class(),
111 111
                 $input->html_label_style(),
112 112
                 $input->html_other_attributes()
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function layout_subsection($form_section)
127 127
     {
128 128
         //		d( $form_section );
129
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
129
+        return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1);
130 130
     }
131 131
 
132 132
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 2 patches
Indentation   +1414 added lines, -1414 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -24,470 +24,470 @@  discard block
 block discarded – undo
24 24
 {
25 25
 
26 26
 
27
-    /**
28
-     * This gets set in _setup_cpt
29
-     * It will contain the object for the custom post type.
30
-     *
31
-     * @var EE_CPT_Base
32
-     */
33
-    protected $_cpt_object;
34
-
35
-
36
-
37
-    /**
38
-     * a boolean flag to set whether the current route is a cpt route or not.
39
-     *
40
-     * @var bool
41
-     */
42
-    protected $_cpt_route = false;
43
-
44
-
45
-
46
-    /**
47
-     * This property allows cpt classes to define multiple routes as cpt routes.
48
-     * //in this array we define what the custom post type for this route is.
49
-     * array(
50
-     * 'route_name' => 'custom_post_type_slug'
51
-     * )
52
-     *
53
-     * @var array
54
-     */
55
-    protected $_cpt_routes = array();
56
-
27
+	/**
28
+	 * This gets set in _setup_cpt
29
+	 * It will contain the object for the custom post type.
30
+	 *
31
+	 * @var EE_CPT_Base
32
+	 */
33
+	protected $_cpt_object;
34
+
35
+
36
+
37
+	/**
38
+	 * a boolean flag to set whether the current route is a cpt route or not.
39
+	 *
40
+	 * @var bool
41
+	 */
42
+	protected $_cpt_route = false;
43
+
44
+
45
+
46
+	/**
47
+	 * This property allows cpt classes to define multiple routes as cpt routes.
48
+	 * //in this array we define what the custom post type for this route is.
49
+	 * array(
50
+	 * 'route_name' => 'custom_post_type_slug'
51
+	 * )
52
+	 *
53
+	 * @var array
54
+	 */
55
+	protected $_cpt_routes = array();
56
+
57 57
 
58 58
 
59
-    /**
60
-     * This simply defines what the corresponding routes WP will be redirected to after completing a post save/update.
61
-     * in this format:
62
-     * array(
63
-     * 'post_type_slug' => 'edit_route'
64
-     * )
65
-     *
66
-     * @var array
67
-     */
68
-    protected $_cpt_edit_routes = array();
69
-
70
-
71
-
72
-    /**
73
-     * If child classes set the name of their main model via the $_cpt_obj_models property, EE_Admin_Page_CPT will
74
-     * attempt to retrieve the related object model for the edit pages and assign it to _cpt_page_object. the
75
-     * _cpt_model_names property should be in the following format: array(
76
-     * 'route_defined_by_action_param' => 'Model_Name')
77
-     *
78
-     * @var array $_cpt_model_names
79
-     */
80
-    protected $_cpt_model_names = array();
81
-
82
-
83
-    /**
84
-     * @var EE_CPT_Base
85
-     */
86
-    protected $_cpt_model_obj = false;
87
-
88
-
89
-
90
-    /**
91
-     * This will hold an array of autosave containers that will be used to obtain input values and hook into the WP
92
-     * autosave so we can save our inputs on the save_post hook!  Children classes should add to this array by using
93
-     * the _register_autosave_containers() method so that we don't override any other containers already registered.
94
-     * Registration of containers should be done before load_page_dependencies() is run.
95
-     *
96
-     * @var array()
97
-     */
98
-    protected $_autosave_containers = array();
99
-    protected $_autosave_fields = array();
100
-
101
-    /**
102
-     * Array mapping from admin actions to their equivalent wp core pages for custom post types. So when a user visits
103
-     * a page for an action, it will appear as if they were visiting the wp core page for that custom post type
104
-     *
105
-     * @var array
106
-     */
107
-    protected $_pagenow_map;
108
-
109
-
110
-
111
-    /**
112
-     * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
113
-     * saved.  Child classes are required to declare this method.  Typically you would use this to save any additional
114
-     * data. Keep in mind also that "save_post" runs on EVERY post update to the database. ALSO very important.  When a
115
-     * post transitions from scheduled to published, the save_post action is fired but you will NOT have any _POST data
116
-     * containing any extra info you may have from other meta saves.  So MAKE sure that you handle this accordingly.
117
-     *
118
-     * @access protected
119
-     * @abstract
120
-     * @param  string $post_id The ID of the cpt that was saved (so you can link relationally)
121
-     * @param  EE_CPT_Base $post    The post object of the cpt that was saved.
122
-     * @return void
123
-     */
124
-    abstract protected function _insert_update_cpt_item($post_id, $post);
125
-
126
-
127
-
128
-    /**
129
-     * This is hooked into the WordPress do_action('trashed_post') hook and runs after a cpt has been trashed.
130
-     *
131
-     * @abstract
132
-     * @access public
133
-     * @param  string $post_id The ID of the cpt that was trashed
134
-     * @return void
135
-     */
136
-    abstract public function trash_cpt_item($post_id);
137
-
138
-
139
-
140
-    /**
141
-     * This is hooked into the WordPress do_action('untrashed_post') hook and runs after a cpt has been untrashed
142
-     *
143
-     * @param  string $post_id theID of the cpt that was untrashed
144
-     * @return void
145
-     */
146
-    abstract public function restore_cpt_item($post_id);
147
-
148
-
149
-
150
-    /**
151
-     * This is hooked into the WordPress do_action('delete_cpt_item') hook and runs after a cpt has been fully deleted
152
-     * from the db
153
-     *
154
-     * @param  string $post_id the ID of the cpt that was deleted
155
-     * @return void
156
-     */
157
-    abstract public function delete_cpt_item($post_id);
158
-
159
-
160
-
161
-    /**
162
-     * Just utilizing the method EE_Admin exposes for doing things before page setup.
163
-     *
164
-     * @access protected
165
-     * @return void
166
-     */
167
-    protected function _before_page_setup()
168
-    {
169
-        $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
170
-        $this->_cpt_routes = array_merge(array(
171
-            'create_new' => $this->page_slug,
172
-            'edit'       => $this->page_slug,
173
-            'trash'      => $this->page_slug,
174
-        ), $this->_cpt_routes);
175
-        //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
176
-        $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']])
177
-            ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']])
178
-            : get_post_type_object($page);
179
-        //tweak pagenow for page loading.
180
-        if ( ! $this->_pagenow_map) {
181
-            $this->_pagenow_map = array(
182
-                'create_new' => 'post-new.php',
183
-                'edit'       => 'post.php',
184
-                'trash'      => 'post.php',
185
-            );
186
-        }
187
-        add_action('current_screen', array($this, 'modify_pagenow'));
188
-        //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
189
-        //get current page from autosave
190
-        $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'])
191
-            ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']
192
-            : null;
193
-        $this->_current_page = isset($this->_req_data['current_page'])
194
-            ? $this->_req_data['current_page']
195
-            : $current_page;
196
-        //autosave... make sure its only for the correct page
197
-        //if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
198
-            //setup autosave ajax hook
199
-            //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
200
-        //}
201
-    }
202
-
203
-
204
-
205
-    /**
206
-     * Simply ensure that we simulate the correct post route for cpt screens
207
-     *
208
-     * @param WP_Screen $current_screen
209
-     * @return void
210
-     */
211
-    public function modify_pagenow($current_screen)
212
-    {
213
-        global $pagenow, $hook_suffix;
214
-        //possibly reset pagenow.
215
-        if ( ! empty($this->_req_data['page'])
216
-             && $this->_req_data['page'] == $this->page_slug
217
-             && ! empty($this->_req_data['action'])
218
-             && isset($this->_pagenow_map[$this->_req_data['action']])
219
-        ) {
220
-            $pagenow = $this->_pagenow_map[$this->_req_data['action']];
221
-            $hook_suffix = $pagenow;
222
-        }
223
-    }
224
-
225
-
226
-
227
-    /**
228
-     * This method is used to register additional autosave containers to the _autosave_containers property.
229
-     *
230
-     * @todo We should automate this at some point by creating a wrapper for add_post_metabox and in our wrapper we
231
-     *       automatically register the id for the post metabox as a container.
232
-     * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically
233
-     *                    you would send along the id of a metabox container.
234
-     * @return void
235
-     */
236
-    protected function _register_autosave_containers($ids)
237
-    {
238
-        $this->_autosave_containers = array_merge($this->_autosave_fields, (array)$ids);
239
-    }
240
-
241
-
242
-
243
-    /**
244
-     * Something nifty.  We're going to loop through all the registered metaboxes and if the CALLBACK is an instance of
245
-     * EE_Admin_Page OR EE_Admin_Hooks, then we'll add the id to our _autosave_containers array.
246
-     */
247
-    protected function _set_autosave_containers()
248
-    {
249
-        global $wp_meta_boxes;
250
-        $containers = array();
251
-        if (empty($wp_meta_boxes)) {
252
-            return;
253
-        }
254
-        $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
255
-        foreach ($current_metaboxes as $box_context) {
256
-            foreach ($box_context as $box_details) {
257
-                foreach ($box_details as $box) {
258
-                    if (
259
-                        is_array($box['callback'])
260
-                        && (
261
-                            $box['callback'][0] instanceof EE_Admin_Page
262
-                            || $box['callback'][0] instanceof EE_Admin_Hooks
263
-                        )
264
-                    ) {
265
-                        $containers[] = $box['id'];
266
-                    }
267
-                }
268
-            }
269
-        }
270
-        $this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
271
-        //add hidden inputs container
272
-        $this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
273
-    }
274
-
275
-
276
-
277
-    protected function _load_autosave_scripts_styles()
278
-    {
279
-        /*wp_register_script('cpt-autosave', EE_ADMIN_URL . 'assets/ee-cpt-autosave.js', array('ee-serialize-full-array', 'event_editor_js'), EVENT_ESPRESSO_VERSION, TRUE );
59
+	/**
60
+	 * This simply defines what the corresponding routes WP will be redirected to after completing a post save/update.
61
+	 * in this format:
62
+	 * array(
63
+	 * 'post_type_slug' => 'edit_route'
64
+	 * )
65
+	 *
66
+	 * @var array
67
+	 */
68
+	protected $_cpt_edit_routes = array();
69
+
70
+
71
+
72
+	/**
73
+	 * If child classes set the name of their main model via the $_cpt_obj_models property, EE_Admin_Page_CPT will
74
+	 * attempt to retrieve the related object model for the edit pages and assign it to _cpt_page_object. the
75
+	 * _cpt_model_names property should be in the following format: array(
76
+	 * 'route_defined_by_action_param' => 'Model_Name')
77
+	 *
78
+	 * @var array $_cpt_model_names
79
+	 */
80
+	protected $_cpt_model_names = array();
81
+
82
+
83
+	/**
84
+	 * @var EE_CPT_Base
85
+	 */
86
+	protected $_cpt_model_obj = false;
87
+
88
+
89
+
90
+	/**
91
+	 * This will hold an array of autosave containers that will be used to obtain input values and hook into the WP
92
+	 * autosave so we can save our inputs on the save_post hook!  Children classes should add to this array by using
93
+	 * the _register_autosave_containers() method so that we don't override any other containers already registered.
94
+	 * Registration of containers should be done before load_page_dependencies() is run.
95
+	 *
96
+	 * @var array()
97
+	 */
98
+	protected $_autosave_containers = array();
99
+	protected $_autosave_fields = array();
100
+
101
+	/**
102
+	 * Array mapping from admin actions to their equivalent wp core pages for custom post types. So when a user visits
103
+	 * a page for an action, it will appear as if they were visiting the wp core page for that custom post type
104
+	 *
105
+	 * @var array
106
+	 */
107
+	protected $_pagenow_map;
108
+
109
+
110
+
111
+	/**
112
+	 * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
113
+	 * saved.  Child classes are required to declare this method.  Typically you would use this to save any additional
114
+	 * data. Keep in mind also that "save_post" runs on EVERY post update to the database. ALSO very important.  When a
115
+	 * post transitions from scheduled to published, the save_post action is fired but you will NOT have any _POST data
116
+	 * containing any extra info you may have from other meta saves.  So MAKE sure that you handle this accordingly.
117
+	 *
118
+	 * @access protected
119
+	 * @abstract
120
+	 * @param  string $post_id The ID of the cpt that was saved (so you can link relationally)
121
+	 * @param  EE_CPT_Base $post    The post object of the cpt that was saved.
122
+	 * @return void
123
+	 */
124
+	abstract protected function _insert_update_cpt_item($post_id, $post);
125
+
126
+
127
+
128
+	/**
129
+	 * This is hooked into the WordPress do_action('trashed_post') hook and runs after a cpt has been trashed.
130
+	 *
131
+	 * @abstract
132
+	 * @access public
133
+	 * @param  string $post_id The ID of the cpt that was trashed
134
+	 * @return void
135
+	 */
136
+	abstract public function trash_cpt_item($post_id);
137
+
138
+
139
+
140
+	/**
141
+	 * This is hooked into the WordPress do_action('untrashed_post') hook and runs after a cpt has been untrashed
142
+	 *
143
+	 * @param  string $post_id theID of the cpt that was untrashed
144
+	 * @return void
145
+	 */
146
+	abstract public function restore_cpt_item($post_id);
147
+
148
+
149
+
150
+	/**
151
+	 * This is hooked into the WordPress do_action('delete_cpt_item') hook and runs after a cpt has been fully deleted
152
+	 * from the db
153
+	 *
154
+	 * @param  string $post_id the ID of the cpt that was deleted
155
+	 * @return void
156
+	 */
157
+	abstract public function delete_cpt_item($post_id);
158
+
159
+
160
+
161
+	/**
162
+	 * Just utilizing the method EE_Admin exposes for doing things before page setup.
163
+	 *
164
+	 * @access protected
165
+	 * @return void
166
+	 */
167
+	protected function _before_page_setup()
168
+	{
169
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
170
+		$this->_cpt_routes = array_merge(array(
171
+			'create_new' => $this->page_slug,
172
+			'edit'       => $this->page_slug,
173
+			'trash'      => $this->page_slug,
174
+		), $this->_cpt_routes);
175
+		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
176
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']])
177
+			? get_post_type_object($this->_cpt_routes[$this->_req_data['action']])
178
+			: get_post_type_object($page);
179
+		//tweak pagenow for page loading.
180
+		if ( ! $this->_pagenow_map) {
181
+			$this->_pagenow_map = array(
182
+				'create_new' => 'post-new.php',
183
+				'edit'       => 'post.php',
184
+				'trash'      => 'post.php',
185
+			);
186
+		}
187
+		add_action('current_screen', array($this, 'modify_pagenow'));
188
+		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
189
+		//get current page from autosave
190
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'])
191
+			? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']
192
+			: null;
193
+		$this->_current_page = isset($this->_req_data['current_page'])
194
+			? $this->_req_data['current_page']
195
+			: $current_page;
196
+		//autosave... make sure its only for the correct page
197
+		//if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
198
+			//setup autosave ajax hook
199
+			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
200
+		//}
201
+	}
202
+
203
+
204
+
205
+	/**
206
+	 * Simply ensure that we simulate the correct post route for cpt screens
207
+	 *
208
+	 * @param WP_Screen $current_screen
209
+	 * @return void
210
+	 */
211
+	public function modify_pagenow($current_screen)
212
+	{
213
+		global $pagenow, $hook_suffix;
214
+		//possibly reset pagenow.
215
+		if ( ! empty($this->_req_data['page'])
216
+			 && $this->_req_data['page'] == $this->page_slug
217
+			 && ! empty($this->_req_data['action'])
218
+			 && isset($this->_pagenow_map[$this->_req_data['action']])
219
+		) {
220
+			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
221
+			$hook_suffix = $pagenow;
222
+		}
223
+	}
224
+
225
+
226
+
227
+	/**
228
+	 * This method is used to register additional autosave containers to the _autosave_containers property.
229
+	 *
230
+	 * @todo We should automate this at some point by creating a wrapper for add_post_metabox and in our wrapper we
231
+	 *       automatically register the id for the post metabox as a container.
232
+	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically
233
+	 *                    you would send along the id of a metabox container.
234
+	 * @return void
235
+	 */
236
+	protected function _register_autosave_containers($ids)
237
+	{
238
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array)$ids);
239
+	}
240
+
241
+
242
+
243
+	/**
244
+	 * Something nifty.  We're going to loop through all the registered metaboxes and if the CALLBACK is an instance of
245
+	 * EE_Admin_Page OR EE_Admin_Hooks, then we'll add the id to our _autosave_containers array.
246
+	 */
247
+	protected function _set_autosave_containers()
248
+	{
249
+		global $wp_meta_boxes;
250
+		$containers = array();
251
+		if (empty($wp_meta_boxes)) {
252
+			return;
253
+		}
254
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
255
+		foreach ($current_metaboxes as $box_context) {
256
+			foreach ($box_context as $box_details) {
257
+				foreach ($box_details as $box) {
258
+					if (
259
+						is_array($box['callback'])
260
+						&& (
261
+							$box['callback'][0] instanceof EE_Admin_Page
262
+							|| $box['callback'][0] instanceof EE_Admin_Hooks
263
+						)
264
+					) {
265
+						$containers[] = $box['id'];
266
+					}
267
+				}
268
+			}
269
+		}
270
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
271
+		//add hidden inputs container
272
+		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
273
+	}
274
+
275
+
276
+
277
+	protected function _load_autosave_scripts_styles()
278
+	{
279
+		/*wp_register_script('cpt-autosave', EE_ADMIN_URL . 'assets/ee-cpt-autosave.js', array('ee-serialize-full-array', 'event_editor_js'), EVENT_ESPRESSO_VERSION, TRUE );
280 280
         wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
281 281
 
282
-        //filter _autosave_containers
283
-        $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers',
284
-            $this->_autosave_containers, $this);
285
-        $containers = apply_filters('FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers',
286
-            $containers, $this);
287
-
288
-        wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS',
289
-            $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
290
-
291
-        $unsaved_data_msg = array(
292
-            'eventmsg'     => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.",
293
-                'event_espresso'), $this->_cpt_object->labels->singular_name),
294
-            'inputChanged' => 0,
295
-        );
296
-        wp_localize_script('event_editor_js', 'UNSAVED_DATA_MSG', $unsaved_data_msg);
297
-    }
298
-
299
-
300
-
301
-    public function load_page_dependencies()
302
-    {
303
-        try {
304
-            $this->_load_page_dependencies();
305
-        } catch (EE_Error $e) {
306
-            $e->get_error();
307
-        }
308
-    }
309
-
310
-
311
-
312
-    /**
313
-     * overloading the EE_Admin_Page parent load_page_dependencies so we can get the cpt stuff added in appropriately
314
-     *
315
-     * @access protected
316
-     * @return void
317
-     */
318
-    protected function _load_page_dependencies()
319
-    {
320
-        //we only add stuff if this is a cpt_route!
321
-        if ( ! $this->_cpt_route) {
322
-            parent::_load_page_dependencies();
323
-            return;
324
-        }
325
-        // now let's do some automatic filters into the wp_system
326
-        // and we'll check to make sure the CHILD class
327
-        // automatically has the required methods in place.
328
-        // the following filters are for setting all the redirects
329
-        // on DEFAULT WP custom post type actions
330
-        // let's add a hidden input to the post-edit form
331
-        // so we know when we have to trigger our custom redirects!
332
-        // Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
333
-        add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
334
-        // inject our Admin page nav tabs...
335
-        // let's make sure the nav tabs are set if they aren't already
336
-        // if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
337
-        add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
338
-        // modify the post_updated messages array
339
-        add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
340
-        // add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE,
341
-        // cpts use the same format for shortlinks as posts!
342
-        add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
343
-        // This basically allows us to change the title of the "publish" metabox area
344
-        // on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
345
-        if ( ! empty($this->_labels['publishbox'])) {
346
-            $box_label = is_array($this->_labels['publishbox'])
347
-                         && isset($this->_labels['publishbox'][$this->_req_action])
348
-                    ? $this->_labels['publishbox'][$this->_req_action]
349
-                    : $this->_labels['publishbox'];
350
-            add_meta_box(
351
-                'submitdiv',
352
-                $box_label,
353
-                'post_submit_meta_box',
354
-                $this->_cpt_routes[$this->_req_action],
355
-                'side',
356
-                'core'
357
-            );
358
-        }
359
-        //let's add page_templates metabox if this cpt added support for it.
360
-        if ($this->_supports_page_templates($this->_cpt_object->name)) {
361
-            add_meta_box(
362
-                'page_templates',
363
-                __('Page Template', 'event_espresso'),
364
-                array($this, 'page_template_meta_box'),
365
-                $this->_cpt_routes[$this->_req_action],
366
-                'side',
367
-                'default'
368
-            );
369
-        }
370
-        //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
371
-        if (method_exists($this, 'extra_permalink_field_buttons')) {
372
-            add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
373
-        }
374
-        //add preview button
375
-        add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
376
-        //insert our own post_stati dropdown
377
-        add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
378
-        //This allows adding additional information to the publish post submitbox on the wp post edit form
379
-        if (method_exists($this, 'extra_misc_actions_publish_box')) {
380
-            add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
381
-        }
382
-        // This allows for adding additional stuff after the title field on the wp post edit form.
383
-        // This is also before the wp_editor for post description field.
384
-        if (method_exists($this, 'edit_form_after_title')) {
385
-            add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
386
-        }
387
-        /**
388
-         * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
389
-         */
390
-        add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
391
-        parent::_load_page_dependencies();
392
-        // notice we are ALSO going to load the pagenow hook set for this route
393
-        // (see _before_page_setup for the reset of the pagenow global ).
394
-        // This is for any plugins that are doing things properly
395
-        // and hooking into the load page hook for core wp cpt routes.
396
-        global $pagenow;
397
-        do_action('load-' . $pagenow);
398
-        $this->modify_current_screen();
399
-        add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
400
-        //we route REALLY early.
401
-        try {
402
-            $this->_route_admin_request();
403
-        } catch (EE_Error $e) {
404
-            $e->get_error();
405
-        }
406
-    }
407
-
408
-
409
-
410
-    /**
411
-     * Since we don't want users going to default core wp routes, this will check any wp urls run through the
412
-     * esc_url() method and if we see a url matching a pattern for our routes, we'll modify it to point to OUR
413
-     * route instead.
414
-     *
415
-     * @param string $good_protocol_url The escaped url.
416
-     * @param string $original_url      The original url.
417
-     * @param string $_context          The context sent to the esc_url method.
418
-     * @return string possibly a new url for our route.
419
-     */
420
-    public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context)
421
-    {
422
-        $routes_to_match = array(
423
-            0 => array(
424
-                'edit.php?post_type=espresso_attendees',
425
-                'admin.php?page=espresso_registrations&action=contact_list',
426
-            ),
427
-            1 => array(
428
-                'edit.php?post_type=' . $this->_cpt_object->name,
429
-                'admin.php?page=' . $this->_cpt_object->name,
430
-            ),
431
-        );
432
-        foreach ($routes_to_match as $route_matches) {
433
-            if (strpos($good_protocol_url, $route_matches[0]) !== false) {
434
-                return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
435
-            }
436
-        }
437
-        return $good_protocol_url;
438
-    }
439
-
440
-
441
-
442
-    /**
443
-     * Determine whether the current cpt supports page templates or not.
444
-     *
445
-     * @since %VER%
446
-     * @param string $cpt_name The cpt slug we're checking on.
447
-     * @return bool True supported, false not.
448
-     */
449
-    private function _supports_page_templates($cpt_name)
450
-    {
451
-
452
-        $cpt_args = EE_Register_CPTs::get_CPTs();
453
-        $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
454
-        $cpt_has_support = ! empty($cpt_args['page_templates']);
455
-
456
-        //if the installed version of WP is > 4.7 we do some additional checks.
457
-        if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
458
-            $post_templates = wp_get_theme()->get_post_templates();
459
-            //if there are $post_templates for this cpt, then we return false for this method because
460
-            //that means we aren't going to load our page template manager and leave that up to the native
461
-            //cpt template manager.
462
-            $cpt_has_support = ! isset($post_templates[$cpt_name]) ? $cpt_has_support : false;
463
-        }
464
-
465
-        return $cpt_has_support;
466
-    }
467
-
468
-
469
-    /**
470
-     * Callback for the page_templates metabox selector.
471
-     *
472
-     * @since %VER%
473
-     * @return void
474
-     */
475
-    public function page_template_meta_box()
476
-    {
477
-        global $post;
478
-        $template = '';
479
-
480
-        if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
481
-            $page_template_count = count(get_page_templates());
482
-        } else {
483
-            $page_template_count = count(get_page_templates($post));
484
-        };
485
-
486
-        if ($page_template_count) {
487
-            $page_template = get_post_meta($post->ID, '_wp_page_template', true);
488
-            $template      = ! empty($page_template) ? $page_template : '';
489
-        }
490
-        ?>
282
+		//filter _autosave_containers
283
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers',
284
+			$this->_autosave_containers, $this);
285
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers',
286
+			$containers, $this);
287
+
288
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS',
289
+			$containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
290
+
291
+		$unsaved_data_msg = array(
292
+			'eventmsg'     => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.",
293
+				'event_espresso'), $this->_cpt_object->labels->singular_name),
294
+			'inputChanged' => 0,
295
+		);
296
+		wp_localize_script('event_editor_js', 'UNSAVED_DATA_MSG', $unsaved_data_msg);
297
+	}
298
+
299
+
300
+
301
+	public function load_page_dependencies()
302
+	{
303
+		try {
304
+			$this->_load_page_dependencies();
305
+		} catch (EE_Error $e) {
306
+			$e->get_error();
307
+		}
308
+	}
309
+
310
+
311
+
312
+	/**
313
+	 * overloading the EE_Admin_Page parent load_page_dependencies so we can get the cpt stuff added in appropriately
314
+	 *
315
+	 * @access protected
316
+	 * @return void
317
+	 */
318
+	protected function _load_page_dependencies()
319
+	{
320
+		//we only add stuff if this is a cpt_route!
321
+		if ( ! $this->_cpt_route) {
322
+			parent::_load_page_dependencies();
323
+			return;
324
+		}
325
+		// now let's do some automatic filters into the wp_system
326
+		// and we'll check to make sure the CHILD class
327
+		// automatically has the required methods in place.
328
+		// the following filters are for setting all the redirects
329
+		// on DEFAULT WP custom post type actions
330
+		// let's add a hidden input to the post-edit form
331
+		// so we know when we have to trigger our custom redirects!
332
+		// Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
333
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
334
+		// inject our Admin page nav tabs...
335
+		// let's make sure the nav tabs are set if they aren't already
336
+		// if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
337
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
338
+		// modify the post_updated messages array
339
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
340
+		// add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE,
341
+		// cpts use the same format for shortlinks as posts!
342
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
343
+		// This basically allows us to change the title of the "publish" metabox area
344
+		// on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
345
+		if ( ! empty($this->_labels['publishbox'])) {
346
+			$box_label = is_array($this->_labels['publishbox'])
347
+						 && isset($this->_labels['publishbox'][$this->_req_action])
348
+					? $this->_labels['publishbox'][$this->_req_action]
349
+					: $this->_labels['publishbox'];
350
+			add_meta_box(
351
+				'submitdiv',
352
+				$box_label,
353
+				'post_submit_meta_box',
354
+				$this->_cpt_routes[$this->_req_action],
355
+				'side',
356
+				'core'
357
+			);
358
+		}
359
+		//let's add page_templates metabox if this cpt added support for it.
360
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
361
+			add_meta_box(
362
+				'page_templates',
363
+				__('Page Template', 'event_espresso'),
364
+				array($this, 'page_template_meta_box'),
365
+				$this->_cpt_routes[$this->_req_action],
366
+				'side',
367
+				'default'
368
+			);
369
+		}
370
+		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
371
+		if (method_exists($this, 'extra_permalink_field_buttons')) {
372
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
373
+		}
374
+		//add preview button
375
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
376
+		//insert our own post_stati dropdown
377
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
378
+		//This allows adding additional information to the publish post submitbox on the wp post edit form
379
+		if (method_exists($this, 'extra_misc_actions_publish_box')) {
380
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
381
+		}
382
+		// This allows for adding additional stuff after the title field on the wp post edit form.
383
+		// This is also before the wp_editor for post description field.
384
+		if (method_exists($this, 'edit_form_after_title')) {
385
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
386
+		}
387
+		/**
388
+		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
389
+		 */
390
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
391
+		parent::_load_page_dependencies();
392
+		// notice we are ALSO going to load the pagenow hook set for this route
393
+		// (see _before_page_setup for the reset of the pagenow global ).
394
+		// This is for any plugins that are doing things properly
395
+		// and hooking into the load page hook for core wp cpt routes.
396
+		global $pagenow;
397
+		do_action('load-' . $pagenow);
398
+		$this->modify_current_screen();
399
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
400
+		//we route REALLY early.
401
+		try {
402
+			$this->_route_admin_request();
403
+		} catch (EE_Error $e) {
404
+			$e->get_error();
405
+		}
406
+	}
407
+
408
+
409
+
410
+	/**
411
+	 * Since we don't want users going to default core wp routes, this will check any wp urls run through the
412
+	 * esc_url() method and if we see a url matching a pattern for our routes, we'll modify it to point to OUR
413
+	 * route instead.
414
+	 *
415
+	 * @param string $good_protocol_url The escaped url.
416
+	 * @param string $original_url      The original url.
417
+	 * @param string $_context          The context sent to the esc_url method.
418
+	 * @return string possibly a new url for our route.
419
+	 */
420
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context)
421
+	{
422
+		$routes_to_match = array(
423
+			0 => array(
424
+				'edit.php?post_type=espresso_attendees',
425
+				'admin.php?page=espresso_registrations&action=contact_list',
426
+			),
427
+			1 => array(
428
+				'edit.php?post_type=' . $this->_cpt_object->name,
429
+				'admin.php?page=' . $this->_cpt_object->name,
430
+			),
431
+		);
432
+		foreach ($routes_to_match as $route_matches) {
433
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
434
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
435
+			}
436
+		}
437
+		return $good_protocol_url;
438
+	}
439
+
440
+
441
+
442
+	/**
443
+	 * Determine whether the current cpt supports page templates or not.
444
+	 *
445
+	 * @since %VER%
446
+	 * @param string $cpt_name The cpt slug we're checking on.
447
+	 * @return bool True supported, false not.
448
+	 */
449
+	private function _supports_page_templates($cpt_name)
450
+	{
451
+
452
+		$cpt_args = EE_Register_CPTs::get_CPTs();
453
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
454
+		$cpt_has_support = ! empty($cpt_args['page_templates']);
455
+
456
+		//if the installed version of WP is > 4.7 we do some additional checks.
457
+		if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
458
+			$post_templates = wp_get_theme()->get_post_templates();
459
+			//if there are $post_templates for this cpt, then we return false for this method because
460
+			//that means we aren't going to load our page template manager and leave that up to the native
461
+			//cpt template manager.
462
+			$cpt_has_support = ! isset($post_templates[$cpt_name]) ? $cpt_has_support : false;
463
+		}
464
+
465
+		return $cpt_has_support;
466
+	}
467
+
468
+
469
+	/**
470
+	 * Callback for the page_templates metabox selector.
471
+	 *
472
+	 * @since %VER%
473
+	 * @return void
474
+	 */
475
+	public function page_template_meta_box()
476
+	{
477
+		global $post;
478
+		$template = '';
479
+
480
+		if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
481
+			$page_template_count = count(get_page_templates());
482
+		} else {
483
+			$page_template_count = count(get_page_templates($post));
484
+		};
485
+
486
+		if ($page_template_count) {
487
+			$page_template = get_post_meta($post->ID, '_wp_page_template', true);
488
+			$template      = ! empty($page_template) ? $page_template : '';
489
+		}
490
+		?>
491 491
         <p><strong><?php _e('Template') ?></strong></p>
492 492
         <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select
493 493
             name="page_template" id="page_template">
@@ -495,450 +495,450 @@  discard block
 block discarded – undo
495 495
         <?php page_template_dropdown($template); ?>
496 496
     </select>
497 497
         <?php
498
-    }
499
-
500
-
501
-
502
-    /**
503
-     * if this post is a draft or scheduled post then we provide a preview button for user to click
504
-     * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
505
-     *
506
-     * @param  string $return    the current html
507
-     * @param  int    $id        the post id for the page
508
-     * @param  string $new_title What the title is
509
-     * @param  string $new_slug  what the slug is
510
-     * @return string            The new html string for the permalink area
511
-     */
512
-    public function preview_button_html($return, $id, $new_title, $new_slug)
513
-    {
514
-        $post = get_post($id);
515
-        if ('publish' !== get_post_status($post)) {
516
-            //include shims for the `get_preview_post_link` function
517
-            require_once( EE_CORE . 'wordpress-shims.php' );
518
-            $return .= '<span_id="view-post-btn"><a target="_blank" href="'
519
-                       . get_preview_post_link($id)
520
-                       . '" class="button button-small">'
521
-                       . __('Preview', 'event_espresso')
522
-                       . '</a></span>'
523
-                       . "\n";
524
-        }
525
-        return $return;
526
-    }
527
-
528
-
529
-
530
-    /**
531
-     * add our custom post stati dropdown on the wp post page for this cpt
532
-     *
533
-     * @return void
534
-     */
535
-    public function custom_post_stati_dropdown()
536
-    {
537
-
538
-        $statuses         = $this->_cpt_model_obj->get_custom_post_statuses();
539
-        $cur_status_label = array_key_exists($this->_cpt_model_obj->status(), $statuses)
540
-            ? $statuses[$this->_cpt_model_obj->status()]
541
-            : '';
542
-        $template_args    = array(
543
-            'cur_status'            => $this->_cpt_model_obj->status(),
544
-            'statuses'              => $statuses,
545
-            'cur_status_label'      => $cur_status_label,
546
-            'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label),
547
-        );
548
-        //we'll add a trash post status (WP doesn't add one for some reason)
549
-        if ($this->_cpt_model_obj->status() === 'trash') {
550
-            $template_args['cur_status_label'] = __('Trashed', 'event_espresso');
551
-            $statuses['trash']                 = __('Trashed', 'event_espresso');
552
-            $template_args['statuses']         = $statuses;
553
-        }
554
-
555
-        $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
556
-        EEH_Template::display_template($template, $template_args);
557
-    }
558
-
559
-
560
-
561
-    public function setup_autosave_hooks()
562
-    {
563
-        $this->_set_autosave_containers();
564
-        $this->_load_autosave_scripts_styles();
565
-    }
566
-
567
-
568
-
569
-    /**
570
-     * This is run on all WordPress autosaves AFTER the autosave is complete and sends along a $_POST object (available
571
-     * in $this->_req_data) containing: post_ID of the saved post autosavenonce for the saved post We'll do the check
572
-     * for the nonce in here, but then this method looks for two things:
573
-     * 1. Execute a method (if exists) matching 'ee_autosave_' and appended with the given route. OR
574
-     * 2. do_actions() for global or class specific actions that have been registered (for plugins/addons not in an
575
-     * EE_Admin_Page class. PLEASE NOTE: Data will be returned using the _return_json() object and so the
576
-     * $_template_args property should be used to hold the $data array.  We're expecting the following things set in
577
-     * template args.
578
-     *    1. $template_args['error'] = IF there is an error you can add the message in here.
579
-     *    2. $template_args['data']['items'] = an array of items that are setup in key index pairs of 'where_values_go'
580
-     *    => 'values_to_add'.  In other words, for the datetime metabox we'll have something like
581
-     *    $this->_template_args['data']['items'] = array(
582
-     *        'event-datetime-ids' => '1,2,3';
583
-     *    );
584
-     *    Keep in mind the following things:
585
-     *    - "where" index is for the input with the id as that string.
586
-     *    - "what" index is what will be used for the value of that input.
587
-     *
588
-     * @return void
589
-     */
590
-    public function do_extra_autosave_stuff()
591
-    {
592
-        //next let's check for the autosave nonce (we'll use _verify_nonce )
593
-        $nonce = isset($this->_req_data['autosavenonce'])
594
-                ? $this->_req_data['autosavenonce']
595
-                : null;
596
-        $this->_verify_nonce($nonce, 'autosave');
597
-        //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
598
-        if ( ! defined('DOING_AUTOSAVE')) {
599
-            define('DOING_AUTOSAVE', true);
600
-        }
601
-        //if we made it here then the nonce checked out.  Let's run our methods and actions
602
-        $autosave = "_ee_autosave_{$this->_current_view}";
603
-        if (method_exists($this, $autosave)) {
604
-            $this->$autosave();
605
-        } else {
606
-            $this->_template_args['success'] = true;
607
-        }
608
-        do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
609
-        do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class($this), $this);
610
-        //now let's return json
611
-        $this->_return_json();
612
-    }
613
-
614
-
615
-
616
-    /**
617
-     * This takes care of setting up default routes and pages that utilize the core WP admin pages.
618
-     * Child classes can override the defaults (in cases for adding metaboxes etc.)
619
-     * but take care that you include the defaults here otherwise your core WP admin pages for the cpt won't work!
620
-     *
621
-     * @access protected
622
-     * @throws EE_Error
623
-     * @return void
624
-     */
625
-    protected function _extend_page_config_for_cpt()
626
-    {
627
-        //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
628
-        if (isset($this->_req_data['page']) && $this->_req_data['page'] !== $this->page_slug) {
629
-            return;
630
-        }
631
-        //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
632
-        if ( ! empty($this->_cpt_object)) {
633
-            $this->_page_routes = array_merge(array(
634
-                'create_new' => '_create_new_cpt_item',
635
-                'edit'       => '_edit_cpt_item',
636
-            ), $this->_page_routes);
637
-            $this->_page_config = array_merge(array(
638
-                'create_new' => array(
639
-                    'nav'           => array(
640
-                        'label' => $this->_cpt_object->labels->add_new_item,
641
-                        'order' => 5,
642
-                    ),
643
-                    'require_nonce' => false,
644
-                ),
645
-                'edit'       => array(
646
-                    'nav'           => array(
647
-                        'label'      => $this->_cpt_object->labels->edit_item,
648
-                        'order'      => 5,
649
-                        'persistent' => false,
650
-                        'url'        => '',
651
-                    ),
652
-                    'require_nonce' => false,
653
-                ),
654
-            ),
655
-                $this->_page_config
656
-            );
657
-        }
658
-        //load the next section only if this is a matching cpt route as set in the cpt routes array.
659
-        if ( ! isset($this->_cpt_routes[$this->_req_action])) {
660
-            return;
661
-        }
662
-        $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? true : false;
663
-        //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
664
-        if (empty($this->_cpt_object)) {
665
-            $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'),
666
-                $this->page_slug, $this->_req_action, get_class($this));
667
-            throw new EE_Error($msg);
668
-        }
669
-        if ($this->_cpt_route) {
670
-            $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
671
-            $this->_set_model_object($id);
672
-        }
673
-    }
674
-
675
-
676
-
677
-    /**
678
-     * Sets the _cpt_model_object property using what has been set for the _cpt_model_name and a given id.
679
-     *
680
-     * @access protected
681
-     * @param int  $id The id to retrieve the model object for. If empty we set a default object.
682
-     * @param bool $ignore_route_check
683
-     * @param string $req_type whether the current route is for inserting, updating, or deleting the CPT
684
-     * @throws EE_Error
685
-     */
686
-    protected function _set_model_object($id = null, $ignore_route_check = false, $req_type = '')
687
-    {
688
-        $model = null;
689
-        if (
690
-            empty($this->_cpt_model_names)
691
-            || (
692
-                ! $ignore_route_check
693
-                && ! isset($this->_cpt_routes[$this->_req_action])
694
-            ) || (
695
-                $this->_cpt_model_obj instanceof EE_CPT_Base
696
-                && $this->_cpt_model_obj->ID() === $id
697
-            )
698
-        ) {
699
-            //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
700
-            return;
701
-        }
702
-        //if ignore_route_check is true, then get the model name via EE_Register_CPTs
703
-        if ($ignore_route_check) {
704
-            $model_names = EE_Register_CPTs::get_cpt_model_names();
705
-            $post_type   = get_post_type($id);
706
-            if (isset($model_names[$post_type])) {
707
-                $model = EE_Registry::instance()->load_model($model_names[$post_type]);
708
-            }
709
-        } else {
710
-            $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
711
-        }
712
-        if ($model instanceof EEM_Base) {
713
-            $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
714
-        }
715
-        do_action(
716
-            'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
717
-            $this->_cpt_model_obj,
718
-            $req_type
719
-        );
720
-    }
721
-
722
-
723
-
724
-    /**
725
-     * admin_init_global
726
-     * This runs all the code that we want executed within the WP admin_init hook.
727
-     * This method executes for ALL EE Admin pages.
728
-     *
729
-     * @access public
730
-     * @return void
731
-     */
732
-    public function admin_init_global()
733
-    {
734
-        $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : null;
735
-        //its possible this is a new save so let's catch that instead
736
-        $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
737
-        $post_type = $post ? $post->post_type : false;
738
-        $current_route = isset($this->_req_data['current_route'])
739
-            ? $this->_req_data['current_route']
740
-            : 'shouldneverwork';
741
-        $route_to_check = $post_type && isset($this->_cpt_routes[$current_route])
742
-            ? $this->_cpt_routes[$current_route]
743
-            : '';
744
-        add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
745
-        add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
746
-        if ($post_type === $route_to_check) {
747
-            add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
748
-        }
749
-        //now let's filter redirect if we're on a revision page and the revision is for an event CPT.
750
-        $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : null;
751
-        if ( ! empty($revision)) {
752
-            $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : null;
753
-            //doing a restore?
754
-            if ( ! empty($action) && $action === 'restore') {
755
-                //get post for revision
756
-                $rev_post = get_post($revision);
757
-                $rev_parent = get_post($rev_post->post_parent);
758
-                //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
759
-                if ($rev_parent && $rev_parent->post_type === $this->page_slug) {
760
-                    add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
761
-                    //restores of revisions
762
-                    add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
763
-                }
764
-            }
765
-        }
766
-        //NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
767
-        if ($post_type && $post_type === $route_to_check) {
768
-            //$post_id, $post
769
-            add_action('save_post', array($this, 'insert_update'), 10, 3);
770
-            //$post_id
771
-            add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10);
772
-            add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
773
-            add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10);
774
-            add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10);
775
-        }
776
-    }
777
-
778
-
779
-
780
-    /**
781
-     * Callback for the WordPress trashed_post hook.
782
-     * Execute some basic checks before calling the trash_cpt_item declared in the child class.
783
-     *
784
-     * @param int $post_id
785
-     * @throws \EE_Error
786
-     */
787
-    public function before_trash_cpt_item($post_id)
788
-    {
789
-        $this->_set_model_object($post_id, true, 'trash');
790
-        //if our cpt object isn't existent then get out immediately.
791
-        if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
792
-            return;
793
-        }
794
-        $this->trash_cpt_item($post_id);
795
-    }
796
-
797
-
798
-
799
-    /**
800
-     * Callback for the WordPress untrashed_post hook.
801
-     * Execute some basic checks before calling the restore_cpt_method in the child class.
802
-     *
803
-     * @param $post_id
804
-     * @throws \EE_Error
805
-     */
806
-    public function before_restore_cpt_item($post_id)
807
-    {
808
-        $this->_set_model_object($post_id, true, 'restore');
809
-        //if our cpt object isn't existent then get out immediately.
810
-        if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
811
-            return;
812
-        }
813
-        $this->restore_cpt_item($post_id);
814
-    }
815
-
816
-
817
-
818
-    /**
819
-     * Callback for the WordPress after_delete_post hook.
820
-     * Execute some basic checks before calling the delete_cpt_item method in the child class.
821
-     *
822
-     * @param $post_id
823
-     * @throws \EE_Error
824
-     */
825
-    public function before_delete_cpt_item($post_id)
826
-    {
827
-        $this->_set_model_object($post_id, true, 'delete');
828
-        //if our cpt object isn't existent then get out immediately.
829
-        if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
830
-            return;
831
-        }
832
-        $this->delete_cpt_item($post_id);
833
-    }
834
-
835
-
836
-
837
-    /**
838
-     * This simply verifies if the cpt_model_object is instantiated for the given page and throws an error message
839
-     * accordingly.
840
-     *
841
-     * @access public
842
-     * @throws EE_Error
843
-     * @return void
844
-     */
845
-    public function verify_cpt_object()
846
-    {
847
-        $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
848
-        // verify event object
849
-        if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
850
-            throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page',
851
-                    'event_espresso'), $label));
852
-        }
853
-        //if auto-draft then throw an error
854
-        if ($this->_cpt_model_obj->get('status') === 'auto-draft') {
855
-            EE_Error::overwrite_errors();
856
-            EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'),
857
-                    $label), __FILE__, __FUNCTION__, __LINE__);
858
-        }
859
-    }
860
-
861
-
862
-
863
-    /**
864
-     * admin_footer_scripts_global
865
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
866
-     * will apply on ALL EE_Admin pages.
867
-     *
868
-     * @access public
869
-     * @return void
870
-     */
871
-    public function admin_footer_scripts_global()
872
-    {
873
-        $this->_add_admin_page_ajax_loading_img();
874
-        $this->_add_admin_page_overlay();
875
-    }
876
-
877
-
878
-
879
-    /**
880
-     * add in any global scripts for cpt routes
881
-     *
882
-     * @return void
883
-     */
884
-    public function load_global_scripts_styles()
885
-    {
886
-        parent::load_global_scripts_styles();
887
-        if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
888
-            //setup custom post status object for localize script but only if we've got a cpt object
889
-            $statuses = $this->_cpt_model_obj->get_custom_post_statuses();
890
-            if ( ! empty($statuses)) {
891
-                //get ALL statuses!
892
-                $statuses = $this->_cpt_model_obj->get_all_post_statuses();
893
-                //setup object
894
-                $ee_cpt_statuses = array();
895
-                foreach ($statuses as $status => $label) {
896
-                    $ee_cpt_statuses[$status] = array(
897
-                        'label'      => $label,
898
-                        'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label),
899
-                    );
900
-                }
901
-                wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
902
-            }
903
-        }
904
-    }
905
-
906
-
907
-
908
-    /**
909
-     * This is a wrapper for the insert/update routes for cpt items so we can add things that are common to ALL
910
-     * insert/updates
911
-     *
912
-     * @param  int     $post_id ID of post being updated
913
-     * @param  WP_Post $post    Post object from WP
914
-     * @param  bool    $update  Whether this is an update or a new save.
915
-     * @return void
916
-     * @throws \EE_Error
917
-     */
918
-    public function insert_update($post_id, $post, $update)
919
-    {
920
-        //make sure that if this is a revision OR trash action that we don't do any updates!
921
-        if (
922
-            isset($this->_req_data['action'])
923
-            && (
924
-                $this->_req_data['action'] === 'restore'
925
-                || $this->_req_data['action'] === 'trash'
926
-            )
927
-        ) {
928
-            return;
929
-        }
930
-        $this->_set_model_object($post_id, true, 'insert_update');
931
-        //if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
932
-        if ($update
933
-            && (
934
-                ! $this->_cpt_model_obj instanceof EE_CPT_Base
935
-                || $this->_cpt_model_obj->ID() !== $post_id
936
-            )
937
-        ) {
938
-            return;
939
-        }
940
-        //check for autosave and update our req_data property accordingly.
941
-        /*if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE && isset( $this->_req_data['ee_autosave_data'] ) ) {
498
+	}
499
+
500
+
501
+
502
+	/**
503
+	 * if this post is a draft or scheduled post then we provide a preview button for user to click
504
+	 * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
505
+	 *
506
+	 * @param  string $return    the current html
507
+	 * @param  int    $id        the post id for the page
508
+	 * @param  string $new_title What the title is
509
+	 * @param  string $new_slug  what the slug is
510
+	 * @return string            The new html string for the permalink area
511
+	 */
512
+	public function preview_button_html($return, $id, $new_title, $new_slug)
513
+	{
514
+		$post = get_post($id);
515
+		if ('publish' !== get_post_status($post)) {
516
+			//include shims for the `get_preview_post_link` function
517
+			require_once( EE_CORE . 'wordpress-shims.php' );
518
+			$return .= '<span_id="view-post-btn"><a target="_blank" href="'
519
+					   . get_preview_post_link($id)
520
+					   . '" class="button button-small">'
521
+					   . __('Preview', 'event_espresso')
522
+					   . '</a></span>'
523
+					   . "\n";
524
+		}
525
+		return $return;
526
+	}
527
+
528
+
529
+
530
+	/**
531
+	 * add our custom post stati dropdown on the wp post page for this cpt
532
+	 *
533
+	 * @return void
534
+	 */
535
+	public function custom_post_stati_dropdown()
536
+	{
537
+
538
+		$statuses         = $this->_cpt_model_obj->get_custom_post_statuses();
539
+		$cur_status_label = array_key_exists($this->_cpt_model_obj->status(), $statuses)
540
+			? $statuses[$this->_cpt_model_obj->status()]
541
+			: '';
542
+		$template_args    = array(
543
+			'cur_status'            => $this->_cpt_model_obj->status(),
544
+			'statuses'              => $statuses,
545
+			'cur_status_label'      => $cur_status_label,
546
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label),
547
+		);
548
+		//we'll add a trash post status (WP doesn't add one for some reason)
549
+		if ($this->_cpt_model_obj->status() === 'trash') {
550
+			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
551
+			$statuses['trash']                 = __('Trashed', 'event_espresso');
552
+			$template_args['statuses']         = $statuses;
553
+		}
554
+
555
+		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
556
+		EEH_Template::display_template($template, $template_args);
557
+	}
558
+
559
+
560
+
561
+	public function setup_autosave_hooks()
562
+	{
563
+		$this->_set_autosave_containers();
564
+		$this->_load_autosave_scripts_styles();
565
+	}
566
+
567
+
568
+
569
+	/**
570
+	 * This is run on all WordPress autosaves AFTER the autosave is complete and sends along a $_POST object (available
571
+	 * in $this->_req_data) containing: post_ID of the saved post autosavenonce for the saved post We'll do the check
572
+	 * for the nonce in here, but then this method looks for two things:
573
+	 * 1. Execute a method (if exists) matching 'ee_autosave_' and appended with the given route. OR
574
+	 * 2. do_actions() for global or class specific actions that have been registered (for plugins/addons not in an
575
+	 * EE_Admin_Page class. PLEASE NOTE: Data will be returned using the _return_json() object and so the
576
+	 * $_template_args property should be used to hold the $data array.  We're expecting the following things set in
577
+	 * template args.
578
+	 *    1. $template_args['error'] = IF there is an error you can add the message in here.
579
+	 *    2. $template_args['data']['items'] = an array of items that are setup in key index pairs of 'where_values_go'
580
+	 *    => 'values_to_add'.  In other words, for the datetime metabox we'll have something like
581
+	 *    $this->_template_args['data']['items'] = array(
582
+	 *        'event-datetime-ids' => '1,2,3';
583
+	 *    );
584
+	 *    Keep in mind the following things:
585
+	 *    - "where" index is for the input with the id as that string.
586
+	 *    - "what" index is what will be used for the value of that input.
587
+	 *
588
+	 * @return void
589
+	 */
590
+	public function do_extra_autosave_stuff()
591
+	{
592
+		//next let's check for the autosave nonce (we'll use _verify_nonce )
593
+		$nonce = isset($this->_req_data['autosavenonce'])
594
+				? $this->_req_data['autosavenonce']
595
+				: null;
596
+		$this->_verify_nonce($nonce, 'autosave');
597
+		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
598
+		if ( ! defined('DOING_AUTOSAVE')) {
599
+			define('DOING_AUTOSAVE', true);
600
+		}
601
+		//if we made it here then the nonce checked out.  Let's run our methods and actions
602
+		$autosave = "_ee_autosave_{$this->_current_view}";
603
+		if (method_exists($this, $autosave)) {
604
+			$this->$autosave();
605
+		} else {
606
+			$this->_template_args['success'] = true;
607
+		}
608
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
609
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class($this), $this);
610
+		//now let's return json
611
+		$this->_return_json();
612
+	}
613
+
614
+
615
+
616
+	/**
617
+	 * This takes care of setting up default routes and pages that utilize the core WP admin pages.
618
+	 * Child classes can override the defaults (in cases for adding metaboxes etc.)
619
+	 * but take care that you include the defaults here otherwise your core WP admin pages for the cpt won't work!
620
+	 *
621
+	 * @access protected
622
+	 * @throws EE_Error
623
+	 * @return void
624
+	 */
625
+	protected function _extend_page_config_for_cpt()
626
+	{
627
+		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
628
+		if (isset($this->_req_data['page']) && $this->_req_data['page'] !== $this->page_slug) {
629
+			return;
630
+		}
631
+		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
632
+		if ( ! empty($this->_cpt_object)) {
633
+			$this->_page_routes = array_merge(array(
634
+				'create_new' => '_create_new_cpt_item',
635
+				'edit'       => '_edit_cpt_item',
636
+			), $this->_page_routes);
637
+			$this->_page_config = array_merge(array(
638
+				'create_new' => array(
639
+					'nav'           => array(
640
+						'label' => $this->_cpt_object->labels->add_new_item,
641
+						'order' => 5,
642
+					),
643
+					'require_nonce' => false,
644
+				),
645
+				'edit'       => array(
646
+					'nav'           => array(
647
+						'label'      => $this->_cpt_object->labels->edit_item,
648
+						'order'      => 5,
649
+						'persistent' => false,
650
+						'url'        => '',
651
+					),
652
+					'require_nonce' => false,
653
+				),
654
+			),
655
+				$this->_page_config
656
+			);
657
+		}
658
+		//load the next section only if this is a matching cpt route as set in the cpt routes array.
659
+		if ( ! isset($this->_cpt_routes[$this->_req_action])) {
660
+			return;
661
+		}
662
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? true : false;
663
+		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
664
+		if (empty($this->_cpt_object)) {
665
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'),
666
+				$this->page_slug, $this->_req_action, get_class($this));
667
+			throw new EE_Error($msg);
668
+		}
669
+		if ($this->_cpt_route) {
670
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
671
+			$this->_set_model_object($id);
672
+		}
673
+	}
674
+
675
+
676
+
677
+	/**
678
+	 * Sets the _cpt_model_object property using what has been set for the _cpt_model_name and a given id.
679
+	 *
680
+	 * @access protected
681
+	 * @param int  $id The id to retrieve the model object for. If empty we set a default object.
682
+	 * @param bool $ignore_route_check
683
+	 * @param string $req_type whether the current route is for inserting, updating, or deleting the CPT
684
+	 * @throws EE_Error
685
+	 */
686
+	protected function _set_model_object($id = null, $ignore_route_check = false, $req_type = '')
687
+	{
688
+		$model = null;
689
+		if (
690
+			empty($this->_cpt_model_names)
691
+			|| (
692
+				! $ignore_route_check
693
+				&& ! isset($this->_cpt_routes[$this->_req_action])
694
+			) || (
695
+				$this->_cpt_model_obj instanceof EE_CPT_Base
696
+				&& $this->_cpt_model_obj->ID() === $id
697
+			)
698
+		) {
699
+			//get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
700
+			return;
701
+		}
702
+		//if ignore_route_check is true, then get the model name via EE_Register_CPTs
703
+		if ($ignore_route_check) {
704
+			$model_names = EE_Register_CPTs::get_cpt_model_names();
705
+			$post_type   = get_post_type($id);
706
+			if (isset($model_names[$post_type])) {
707
+				$model = EE_Registry::instance()->load_model($model_names[$post_type]);
708
+			}
709
+		} else {
710
+			$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
711
+		}
712
+		if ($model instanceof EEM_Base) {
713
+			$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
714
+		}
715
+		do_action(
716
+			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
717
+			$this->_cpt_model_obj,
718
+			$req_type
719
+		);
720
+	}
721
+
722
+
723
+
724
+	/**
725
+	 * admin_init_global
726
+	 * This runs all the code that we want executed within the WP admin_init hook.
727
+	 * This method executes for ALL EE Admin pages.
728
+	 *
729
+	 * @access public
730
+	 * @return void
731
+	 */
732
+	public function admin_init_global()
733
+	{
734
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : null;
735
+		//its possible this is a new save so let's catch that instead
736
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
737
+		$post_type = $post ? $post->post_type : false;
738
+		$current_route = isset($this->_req_data['current_route'])
739
+			? $this->_req_data['current_route']
740
+			: 'shouldneverwork';
741
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route])
742
+			? $this->_cpt_routes[$current_route]
743
+			: '';
744
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
745
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
746
+		if ($post_type === $route_to_check) {
747
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
748
+		}
749
+		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
750
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : null;
751
+		if ( ! empty($revision)) {
752
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : null;
753
+			//doing a restore?
754
+			if ( ! empty($action) && $action === 'restore') {
755
+				//get post for revision
756
+				$rev_post = get_post($revision);
757
+				$rev_parent = get_post($rev_post->post_parent);
758
+				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
759
+				if ($rev_parent && $rev_parent->post_type === $this->page_slug) {
760
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
761
+					//restores of revisions
762
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
763
+				}
764
+			}
765
+		}
766
+		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
767
+		if ($post_type && $post_type === $route_to_check) {
768
+			//$post_id, $post
769
+			add_action('save_post', array($this, 'insert_update'), 10, 3);
770
+			//$post_id
771
+			add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10);
772
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
773
+			add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10);
774
+			add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10);
775
+		}
776
+	}
777
+
778
+
779
+
780
+	/**
781
+	 * Callback for the WordPress trashed_post hook.
782
+	 * Execute some basic checks before calling the trash_cpt_item declared in the child class.
783
+	 *
784
+	 * @param int $post_id
785
+	 * @throws \EE_Error
786
+	 */
787
+	public function before_trash_cpt_item($post_id)
788
+	{
789
+		$this->_set_model_object($post_id, true, 'trash');
790
+		//if our cpt object isn't existent then get out immediately.
791
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
792
+			return;
793
+		}
794
+		$this->trash_cpt_item($post_id);
795
+	}
796
+
797
+
798
+
799
+	/**
800
+	 * Callback for the WordPress untrashed_post hook.
801
+	 * Execute some basic checks before calling the restore_cpt_method in the child class.
802
+	 *
803
+	 * @param $post_id
804
+	 * @throws \EE_Error
805
+	 */
806
+	public function before_restore_cpt_item($post_id)
807
+	{
808
+		$this->_set_model_object($post_id, true, 'restore');
809
+		//if our cpt object isn't existent then get out immediately.
810
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
811
+			return;
812
+		}
813
+		$this->restore_cpt_item($post_id);
814
+	}
815
+
816
+
817
+
818
+	/**
819
+	 * Callback for the WordPress after_delete_post hook.
820
+	 * Execute some basic checks before calling the delete_cpt_item method in the child class.
821
+	 *
822
+	 * @param $post_id
823
+	 * @throws \EE_Error
824
+	 */
825
+	public function before_delete_cpt_item($post_id)
826
+	{
827
+		$this->_set_model_object($post_id, true, 'delete');
828
+		//if our cpt object isn't existent then get out immediately.
829
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
830
+			return;
831
+		}
832
+		$this->delete_cpt_item($post_id);
833
+	}
834
+
835
+
836
+
837
+	/**
838
+	 * This simply verifies if the cpt_model_object is instantiated for the given page and throws an error message
839
+	 * accordingly.
840
+	 *
841
+	 * @access public
842
+	 * @throws EE_Error
843
+	 * @return void
844
+	 */
845
+	public function verify_cpt_object()
846
+	{
847
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
848
+		// verify event object
849
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
850
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page',
851
+					'event_espresso'), $label));
852
+		}
853
+		//if auto-draft then throw an error
854
+		if ($this->_cpt_model_obj->get('status') === 'auto-draft') {
855
+			EE_Error::overwrite_errors();
856
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'),
857
+					$label), __FILE__, __FUNCTION__, __LINE__);
858
+		}
859
+	}
860
+
861
+
862
+
863
+	/**
864
+	 * admin_footer_scripts_global
865
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
866
+	 * will apply on ALL EE_Admin pages.
867
+	 *
868
+	 * @access public
869
+	 * @return void
870
+	 */
871
+	public function admin_footer_scripts_global()
872
+	{
873
+		$this->_add_admin_page_ajax_loading_img();
874
+		$this->_add_admin_page_overlay();
875
+	}
876
+
877
+
878
+
879
+	/**
880
+	 * add in any global scripts for cpt routes
881
+	 *
882
+	 * @return void
883
+	 */
884
+	public function load_global_scripts_styles()
885
+	{
886
+		parent::load_global_scripts_styles();
887
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
888
+			//setup custom post status object for localize script but only if we've got a cpt object
889
+			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
890
+			if ( ! empty($statuses)) {
891
+				//get ALL statuses!
892
+				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
893
+				//setup object
894
+				$ee_cpt_statuses = array();
895
+				foreach ($statuses as $status => $label) {
896
+					$ee_cpt_statuses[$status] = array(
897
+						'label'      => $label,
898
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label),
899
+					);
900
+				}
901
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
902
+			}
903
+		}
904
+	}
905
+
906
+
907
+
908
+	/**
909
+	 * This is a wrapper for the insert/update routes for cpt items so we can add things that are common to ALL
910
+	 * insert/updates
911
+	 *
912
+	 * @param  int     $post_id ID of post being updated
913
+	 * @param  WP_Post $post    Post object from WP
914
+	 * @param  bool    $update  Whether this is an update or a new save.
915
+	 * @return void
916
+	 * @throws \EE_Error
917
+	 */
918
+	public function insert_update($post_id, $post, $update)
919
+	{
920
+		//make sure that if this is a revision OR trash action that we don't do any updates!
921
+		if (
922
+			isset($this->_req_data['action'])
923
+			&& (
924
+				$this->_req_data['action'] === 'restore'
925
+				|| $this->_req_data['action'] === 'trash'
926
+			)
927
+		) {
928
+			return;
929
+		}
930
+		$this->_set_model_object($post_id, true, 'insert_update');
931
+		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
932
+		if ($update
933
+			&& (
934
+				! $this->_cpt_model_obj instanceof EE_CPT_Base
935
+				|| $this->_cpt_model_obj->ID() !== $post_id
936
+			)
937
+		) {
938
+			return;
939
+		}
940
+		//check for autosave and update our req_data property accordingly.
941
+		/*if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE && isset( $this->_req_data['ee_autosave_data'] ) ) {
942 942
             foreach( (array) $this->_req_data['ee_autosave_data'] as $id => $values ) {
943 943
 
944 944
                 foreach ( (array) $values as $key => $value ) {
@@ -948,524 +948,524 @@  discard block
 block discarded – undo
948 948
 
949 949
         }/**/ //TODO reactivate after autosave is implemented in 4.2
950 950
 
951
-        //take care of updating any selected page_template IF this cpt supports it.
952
-        if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
953
-            //wp version aware.
954
-            if (EE_Recommended_Versions::check_wp_version('4.7', '>=')) {
955
-                $page_templates = wp_get_theme()->get_page_templates();
956
-            } else {
957
-                $post->page_template = $this->_req_data['page_template'];
958
-                $page_templates      = wp_get_theme()->get_page_templates($post);
959
-            }
960
-            if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
961
-                EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
962
-            } else {
963
-                update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
964
-            }
965
-        }
966
-        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
967
-            return;
968
-        } //TODO we'll remove this after reimplementing autosave in 4.2
969
-        $this->_insert_update_cpt_item($post_id, $post);
970
-    }
971
-
972
-
973
-
974
-    /**
975
-     * This hooks into the wp_trash_post() function and removes the `_wp_trash_meta_status` and `_wp_trash_meta_time`
976
-     * post meta IF the trashed post is one of our CPT's - note this method should only be called with our cpt routes
977
-     * so we don't have to check for our CPT.
978
-     *
979
-     * @param  int $post_id ID of the post
980
-     * @return void
981
-     */
982
-    public function dont_permanently_delete_ee_cpts($post_id)
983
-    {
984
-        //only do this if we're actually processing one of our CPTs
985
-        //if our cpt object isn't existent then get out immediately.
986
-        if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
987
-            return;
988
-        }
989
-        delete_post_meta($post_id, '_wp_trash_meta_status');
990
-        delete_post_meta($post_id, '_wp_trash_meta_time');
991
-        //our cpts may have comments so let's take care of that too
992
-        delete_post_meta($post_id, '_wp_trash_meta_comments_status');
993
-    }
994
-
995
-
996
-
997
-    /**
998
-     * This is a wrapper for the restore_cpt_revision route for cpt items so we can make sure that when a revision is
999
-     * triggered that we restore related items.  In order to work cpt classes MUST have a restore_cpt_revision method
1000
-     * in them. We also have our OWN action in here so addons can hook into the restore process easily.
1001
-     *
1002
-     * @param  int $post_id     ID of cpt item
1003
-     * @param  int $revision_id ID of revision being restored
1004
-     * @return void
1005
-     */
1006
-    public function restore_revision($post_id, $revision_id)
1007
-    {
1008
-        $this->_restore_cpt_item($post_id, $revision_id);
1009
-        //global action
1010
-        do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
1011
-        //class specific action so you can limit hooking into a specific page.
1012
-        do_action('AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id);
1013
-    }
1014
-
1015
-
1016
-
1017
-    /**
1018
-     * @see restore_revision() for details
1019
-     * @param  int $post_id     ID of cpt item
1020
-     * @param  int $revision_id ID of revision for item
1021
-     * @return void
1022
-     */
1023
-    abstract protected function _restore_cpt_item($post_id, $revision_id);
1024
-
1025
-
1026
-
1027
-    /**
1028
-     * Execution of this method is added to the end of the load_page_dependencies method in the parent
1029
-     * so that we can fix a bug where default core metaboxes were not being called in the sidebar.
1030
-     * To fix we have to reset the current_screen using the page_slug
1031
-     * (which is identical - or should be - to our registered_post_type id.)
1032
-     * Also, since the core WP file loads the admin_header.php for WP
1033
-     * (and there are a bunch of other things edit-form-advanced.php loads that need to happen really early)
1034
-     * we need to load it NOW, hence our _route_admin_request in here. (Otherwise screen options won't be set).
1035
-     *
1036
-     * @return void
1037
-     */
1038
-    public function modify_current_screen()
1039
-    {
1040
-        //ONLY do this if the current page_route IS a cpt route
1041
-        if ( ! $this->_cpt_route) {
1042
-            return;
1043
-        }
1044
-        //routing things REALLY early b/c this is a cpt admin page
1045
-        set_current_screen($this->_cpt_routes[$this->_req_action]);
1046
-        $this->_current_screen       = get_current_screen();
1047
-        $this->_current_screen->base = 'event-espresso';
1048
-        $this->_add_help_tabs(); //we make sure we add any help tabs back in!
1049
-        /*try {
951
+		//take care of updating any selected page_template IF this cpt supports it.
952
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
953
+			//wp version aware.
954
+			if (EE_Recommended_Versions::check_wp_version('4.7', '>=')) {
955
+				$page_templates = wp_get_theme()->get_page_templates();
956
+			} else {
957
+				$post->page_template = $this->_req_data['page_template'];
958
+				$page_templates      = wp_get_theme()->get_page_templates($post);
959
+			}
960
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
961
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
962
+			} else {
963
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
964
+			}
965
+		}
966
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
967
+			return;
968
+		} //TODO we'll remove this after reimplementing autosave in 4.2
969
+		$this->_insert_update_cpt_item($post_id, $post);
970
+	}
971
+
972
+
973
+
974
+	/**
975
+	 * This hooks into the wp_trash_post() function and removes the `_wp_trash_meta_status` and `_wp_trash_meta_time`
976
+	 * post meta IF the trashed post is one of our CPT's - note this method should only be called with our cpt routes
977
+	 * so we don't have to check for our CPT.
978
+	 *
979
+	 * @param  int $post_id ID of the post
980
+	 * @return void
981
+	 */
982
+	public function dont_permanently_delete_ee_cpts($post_id)
983
+	{
984
+		//only do this if we're actually processing one of our CPTs
985
+		//if our cpt object isn't existent then get out immediately.
986
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
987
+			return;
988
+		}
989
+		delete_post_meta($post_id, '_wp_trash_meta_status');
990
+		delete_post_meta($post_id, '_wp_trash_meta_time');
991
+		//our cpts may have comments so let's take care of that too
992
+		delete_post_meta($post_id, '_wp_trash_meta_comments_status');
993
+	}
994
+
995
+
996
+
997
+	/**
998
+	 * This is a wrapper for the restore_cpt_revision route for cpt items so we can make sure that when a revision is
999
+	 * triggered that we restore related items.  In order to work cpt classes MUST have a restore_cpt_revision method
1000
+	 * in them. We also have our OWN action in here so addons can hook into the restore process easily.
1001
+	 *
1002
+	 * @param  int $post_id     ID of cpt item
1003
+	 * @param  int $revision_id ID of revision being restored
1004
+	 * @return void
1005
+	 */
1006
+	public function restore_revision($post_id, $revision_id)
1007
+	{
1008
+		$this->_restore_cpt_item($post_id, $revision_id);
1009
+		//global action
1010
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
1011
+		//class specific action so you can limit hooking into a specific page.
1012
+		do_action('AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id);
1013
+	}
1014
+
1015
+
1016
+
1017
+	/**
1018
+	 * @see restore_revision() for details
1019
+	 * @param  int $post_id     ID of cpt item
1020
+	 * @param  int $revision_id ID of revision for item
1021
+	 * @return void
1022
+	 */
1023
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
1024
+
1025
+
1026
+
1027
+	/**
1028
+	 * Execution of this method is added to the end of the load_page_dependencies method in the parent
1029
+	 * so that we can fix a bug where default core metaboxes were not being called in the sidebar.
1030
+	 * To fix we have to reset the current_screen using the page_slug
1031
+	 * (which is identical - or should be - to our registered_post_type id.)
1032
+	 * Also, since the core WP file loads the admin_header.php for WP
1033
+	 * (and there are a bunch of other things edit-form-advanced.php loads that need to happen really early)
1034
+	 * we need to load it NOW, hence our _route_admin_request in here. (Otherwise screen options won't be set).
1035
+	 *
1036
+	 * @return void
1037
+	 */
1038
+	public function modify_current_screen()
1039
+	{
1040
+		//ONLY do this if the current page_route IS a cpt route
1041
+		if ( ! $this->_cpt_route) {
1042
+			return;
1043
+		}
1044
+		//routing things REALLY early b/c this is a cpt admin page
1045
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
1046
+		$this->_current_screen       = get_current_screen();
1047
+		$this->_current_screen->base = 'event-espresso';
1048
+		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
1049
+		/*try {
1050 1050
             $this->_route_admin_request();
1051 1051
         } catch ( EE_Error $e ) {
1052 1052
             $e->get_error();
1053 1053
         }/**/
1054
-    }
1055
-
1056
-
1057
-
1058
-    /**
1059
-     * This allows child classes to modify the default editor title that appears when people add a new or edit an
1060
-     * existing CPT item.     * This uses the _labels property set by the child class via _define_page_props. Just make
1061
-     * sure you have a key in _labels property that equals 'editor_title' and the value can be whatever you want the
1062
-     * default to be.
1063
-     *
1064
-     * @param string $title The new title (or existing if there is no editor_title defined)
1065
-     * @return string
1066
-     */
1067
-    public function add_custom_editor_default_title($title)
1068
-    {
1069
-        return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]])
1070
-            ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]
1071
-            : $title;
1072
-    }
1073
-
1074
-
1075
-
1076
-    /**
1077
-     * hooks into the wp_get_shortlink button and makes sure that the shortlink gets generated
1078
-     *
1079
-     * @param string $shortlink   The already generated shortlink
1080
-     * @param int    $id          Post ID for this item
1081
-     * @param string $context     The context for the link
1082
-     * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
1083
-     * @return string
1084
-     */
1085
-    public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs)
1086
-    {
1087
-        if ( ! empty($id) && get_option('permalink_structure') !== '') {
1088
-            $post = get_post($id);
1089
-            if (isset($post->post_type) && $this->page_slug === $post->post_type) {
1090
-                $shortlink = home_url('?p=' . $post->ID);
1091
-            }
1092
-        }
1093
-        return $shortlink;
1094
-    }
1095
-
1096
-
1097
-
1098
-    /**
1099
-     * overriding the parent route_admin_request method so we DON'T run the route twice on cpt core page loads (it's
1100
-     * already run in modify_current_screen())
1101
-     *
1102
-     * @return void
1103
-     */
1104
-    public function route_admin_request()
1105
-    {
1106
-        if ($this->_cpt_route) {
1107
-            return;
1108
-        }
1109
-        try {
1110
-            $this->_route_admin_request();
1111
-        } catch (EE_Error $e) {
1112
-            $e->get_error();
1113
-        }
1114
-    }
1115
-
1116
-
1117
-
1118
-    /**
1119
-     * Add a hidden form input to cpt core pages so that we know to do redirects to our routes on saves
1120
-     *
1121
-     * @return void
1122
-     */
1123
-    public function cpt_post_form_hidden_input()
1124
-    {
1125
-        echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1126
-        //we're also going to add the route value and the current page so we can direct autosave parsing correctly
1127
-        echo '<div id="ee-cpt-hidden-inputs">';
1128
-        echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1129
-        echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1130
-        echo '</div>';
1131
-    }
1132
-
1133
-
1134
-
1135
-    /**
1136
-     * This allows us to redirect the location of revision restores when they happen so it goes to our CPT routes.
1137
-     *
1138
-     * @param  string $location Original location url
1139
-     * @param  int    $status   Status for http header
1140
-     * @return string           new (or original) url to redirect to.
1141
-     */
1142
-    public function revision_redirect($location, $status)
1143
-    {
1144
-        //get revision
1145
-        $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : null;
1146
-        //can't do anything without revision so let's get out if not present
1147
-        if (empty($rev_id)) {
1148
-            return $location;
1149
-        }
1150
-        //get rev_post_data
1151
-        $rev = get_post($rev_id);
1152
-        $admin_url = $this->_admin_base_url;
1153
-        $query_args = array(
1154
-            'action'   => 'edit',
1155
-            'post'     => $rev->post_parent,
1156
-            'revision' => $rev_id,
1157
-            'message'  => 5,
1158
-        );
1159
-        $this->_process_notices($query_args, true);
1160
-        return self::add_query_args_and_nonce($query_args, $admin_url);
1161
-    }
1162
-
1163
-
1164
-
1165
-    /**
1166
-     * Modify the edit post link generated by wp core function so that EE CPTs get setup differently.
1167
-     *
1168
-     * @param  string $link    the original generated link
1169
-     * @param  int    $id      post id
1170
-     * @param  string $context optional, defaults to display.  How to write the '&'
1171
-     * @return string          the link
1172
-     */
1173
-    public function modify_edit_post_link($link, $id, $context)
1174
-    {
1175
-        $post = get_post($id);
1176
-        if ( ! isset($this->_req_data['action'])
1177
-             || ! isset($this->_cpt_routes[$this->_req_data['action']])
1178
-             || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]
1179
-        ) {
1180
-            return $link;
1181
-        }
1182
-        $query_args = array(
1183
-            'action' => isset($this->_cpt_edit_routes[$post->post_type])
1184
-                ? $this->_cpt_edit_routes[$post->post_type]
1185
-                : 'edit',
1186
-            'post'   => $id,
1187
-        );
1188
-        return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1189
-    }
1190
-
1191
-
1192
-    /**
1193
-     * Modify the trash link on our cpt edit pages so it has the required query var for triggering redirect properly on
1194
-     * our routes.
1195
-     *
1196
-     * @param  string $delete_link  original delete link
1197
-     * @param  int    $post_id      id of cpt object
1198
-     * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1199
-     * @return string new delete link
1200
-     * @throws EE_Error
1201
-     */
1202
-    public function modify_delete_post_link($delete_link, $post_id, $force_delete)
1203
-    {
1204
-        $post = get_post($post_id);
1205
-        if (! isset($this->_req_data['action'], $this->_req_data['post'])
1206
-             || (isset($this->_cpt_routes[$this->_req_data['action']])
1207
-                 && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1208
-        ) {
1209
-            return $delete_link;
1210
-        }
1211
-        $this->_set_model_object($this->_req_data['post'], true);
1212
-        //returns something like `trash_event` or `trash_attendee` or `trash_venue`
1213
-        $action = 'trash_' . str_replace('ee_', '', strtolower(get_class($this->_cpt_model_obj)));
1214
-
1215
-        return EE_Admin_Page::add_query_args_and_nonce(
1216
-            array(
1217
-                'page' => $this->_req_data['page'],
1218
-                'action' => $action,
1219
-                $this->_cpt_model_obj->get_model()->get_primary_key_field()->get_name()
1220
-                    => $this->_req_data['post']
1221
-            ),
1222
-            admin_url()
1223
-        );
1224
-    }
1225
-
1226
-
1227
-
1228
-    /**
1229
-     * This is the callback for the 'redirect_post_location' filter in wp-admin/post.php
1230
-     * so that we can hijack the default redirect locations for wp custom post types
1231
-     * that WE'RE using and send back to OUR routes.  This should only be hooked in on the right route.
1232
-     *
1233
-     * @param  string $location This is the incoming currently set redirect location
1234
-     * @param  string $post_id  This is the 'ID' value of the wp_posts table
1235
-     * @return string           the new location to redirect to
1236
-     */
1237
-    public function cpt_post_location_redirect($location, $post_id)
1238
-    {
1239
-        //we DO have a match so let's setup the url
1240
-        //we have to get the post to determine our route
1241
-        $post       = get_post($post_id);
1242
-        $edit_route = $this->_cpt_edit_routes[$post->post_type];
1243
-        //shared query_args
1244
-        $query_args = array('action' => $edit_route, 'post' => $post_id);
1245
-        $admin_url  = $this->_admin_base_url;
1246
-        if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1247
-            $status = get_post_status($post_id);
1248
-            if (isset($this->_req_data['publish'])) {
1249
-                switch ($status) {
1250
-                    case 'pending':
1251
-                        $message = 8;
1252
-                        break;
1253
-                    case 'future':
1254
-                        $message = 9;
1255
-                        break;
1256
-                    default:
1257
-                        $message = 6;
1258
-                }
1259
-            } else {
1260
-                $message = 'draft' === $status ? 10 : 1;
1261
-            }
1262
-        } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1263
-            $message = 2;
1264
-            //			$append = '#postcustom';
1265
-        } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1266
-            $message = 3;
1267
-            //			$append = '#postcustom';
1268
-        } elseif ($this->_req_data['action'] === 'post-quickpress-save-cont') {
1269
-            $message = 7;
1270
-        } else {
1271
-            $message = 4;
1272
-        }
1273
-        //change the message if the post type is not viewable on the frontend
1274
-        $this->_cpt_object = get_post_type_object($post->post_type);
1275
-        $message           = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1276
-        $query_args = array_merge(array('message' => $message), $query_args);
1277
-        $this->_process_notices($query_args, true);
1278
-        return self::add_query_args_and_nonce($query_args, $admin_url);
1279
-    }
1280
-
1281
-
1282
-
1283
-    /**
1284
-     * This method is called to inject nav tabs on core WP cpt pages
1285
-     *
1286
-     * @access public
1287
-     * @return void
1288
-     */
1289
-    public function inject_nav_tabs()
1290
-    {
1291
-        //can we hijack and insert the nav_tabs?
1292
-        $nav_tabs = $this->_get_main_nav_tabs();
1293
-        //first close off existing form tag
1294
-        $html = '>';
1295
-        $html .= $nav_tabs;
1296
-        //now let's handle the remaining tag ( missing ">" is CORRECT )
1297
-        $html .= '<span></span';
1298
-        echo $html;
1299
-    }
1300
-
1301
-
1302
-
1303
-    /**
1304
-     * This just sets up the post update messages when an update form is loaded
1305
-     *
1306
-     * @access public
1307
-     * @param  array $messages the original messages array
1308
-     * @return array           the new messages array
1309
-     */
1310
-    public function post_update_messages($messages)
1311
-    {
1312
-        global $post;
1313
-        $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
1314
-        $id = empty($id) && is_object($post) ? $post->ID : null;
1315
-        //		$post_type = $post ? $post->post_type : false;
1316
-        /*$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
1054
+	}
1055
+
1056
+
1057
+
1058
+	/**
1059
+	 * This allows child classes to modify the default editor title that appears when people add a new or edit an
1060
+	 * existing CPT item.     * This uses the _labels property set by the child class via _define_page_props. Just make
1061
+	 * sure you have a key in _labels property that equals 'editor_title' and the value can be whatever you want the
1062
+	 * default to be.
1063
+	 *
1064
+	 * @param string $title The new title (or existing if there is no editor_title defined)
1065
+	 * @return string
1066
+	 */
1067
+	public function add_custom_editor_default_title($title)
1068
+	{
1069
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]])
1070
+			? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]
1071
+			: $title;
1072
+	}
1073
+
1074
+
1075
+
1076
+	/**
1077
+	 * hooks into the wp_get_shortlink button and makes sure that the shortlink gets generated
1078
+	 *
1079
+	 * @param string $shortlink   The already generated shortlink
1080
+	 * @param int    $id          Post ID for this item
1081
+	 * @param string $context     The context for the link
1082
+	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
1083
+	 * @return string
1084
+	 */
1085
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs)
1086
+	{
1087
+		if ( ! empty($id) && get_option('permalink_structure') !== '') {
1088
+			$post = get_post($id);
1089
+			if (isset($post->post_type) && $this->page_slug === $post->post_type) {
1090
+				$shortlink = home_url('?p=' . $post->ID);
1091
+			}
1092
+		}
1093
+		return $shortlink;
1094
+	}
1095
+
1096
+
1097
+
1098
+	/**
1099
+	 * overriding the parent route_admin_request method so we DON'T run the route twice on cpt core page loads (it's
1100
+	 * already run in modify_current_screen())
1101
+	 *
1102
+	 * @return void
1103
+	 */
1104
+	public function route_admin_request()
1105
+	{
1106
+		if ($this->_cpt_route) {
1107
+			return;
1108
+		}
1109
+		try {
1110
+			$this->_route_admin_request();
1111
+		} catch (EE_Error $e) {
1112
+			$e->get_error();
1113
+		}
1114
+	}
1115
+
1116
+
1117
+
1118
+	/**
1119
+	 * Add a hidden form input to cpt core pages so that we know to do redirects to our routes on saves
1120
+	 *
1121
+	 * @return void
1122
+	 */
1123
+	public function cpt_post_form_hidden_input()
1124
+	{
1125
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1126
+		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
1127
+		echo '<div id="ee-cpt-hidden-inputs">';
1128
+		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1129
+		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1130
+		echo '</div>';
1131
+	}
1132
+
1133
+
1134
+
1135
+	/**
1136
+	 * This allows us to redirect the location of revision restores when they happen so it goes to our CPT routes.
1137
+	 *
1138
+	 * @param  string $location Original location url
1139
+	 * @param  int    $status   Status for http header
1140
+	 * @return string           new (or original) url to redirect to.
1141
+	 */
1142
+	public function revision_redirect($location, $status)
1143
+	{
1144
+		//get revision
1145
+		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : null;
1146
+		//can't do anything without revision so let's get out if not present
1147
+		if (empty($rev_id)) {
1148
+			return $location;
1149
+		}
1150
+		//get rev_post_data
1151
+		$rev = get_post($rev_id);
1152
+		$admin_url = $this->_admin_base_url;
1153
+		$query_args = array(
1154
+			'action'   => 'edit',
1155
+			'post'     => $rev->post_parent,
1156
+			'revision' => $rev_id,
1157
+			'message'  => 5,
1158
+		);
1159
+		$this->_process_notices($query_args, true);
1160
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1161
+	}
1162
+
1163
+
1164
+
1165
+	/**
1166
+	 * Modify the edit post link generated by wp core function so that EE CPTs get setup differently.
1167
+	 *
1168
+	 * @param  string $link    the original generated link
1169
+	 * @param  int    $id      post id
1170
+	 * @param  string $context optional, defaults to display.  How to write the '&'
1171
+	 * @return string          the link
1172
+	 */
1173
+	public function modify_edit_post_link($link, $id, $context)
1174
+	{
1175
+		$post = get_post($id);
1176
+		if ( ! isset($this->_req_data['action'])
1177
+			 || ! isset($this->_cpt_routes[$this->_req_data['action']])
1178
+			 || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]
1179
+		) {
1180
+			return $link;
1181
+		}
1182
+		$query_args = array(
1183
+			'action' => isset($this->_cpt_edit_routes[$post->post_type])
1184
+				? $this->_cpt_edit_routes[$post->post_type]
1185
+				: 'edit',
1186
+			'post'   => $id,
1187
+		);
1188
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1189
+	}
1190
+
1191
+
1192
+	/**
1193
+	 * Modify the trash link on our cpt edit pages so it has the required query var for triggering redirect properly on
1194
+	 * our routes.
1195
+	 *
1196
+	 * @param  string $delete_link  original delete link
1197
+	 * @param  int    $post_id      id of cpt object
1198
+	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1199
+	 * @return string new delete link
1200
+	 * @throws EE_Error
1201
+	 */
1202
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete)
1203
+	{
1204
+		$post = get_post($post_id);
1205
+		if (! isset($this->_req_data['action'], $this->_req_data['post'])
1206
+			 || (isset($this->_cpt_routes[$this->_req_data['action']])
1207
+				 && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1208
+		) {
1209
+			return $delete_link;
1210
+		}
1211
+		$this->_set_model_object($this->_req_data['post'], true);
1212
+		//returns something like `trash_event` or `trash_attendee` or `trash_venue`
1213
+		$action = 'trash_' . str_replace('ee_', '', strtolower(get_class($this->_cpt_model_obj)));
1214
+
1215
+		return EE_Admin_Page::add_query_args_and_nonce(
1216
+			array(
1217
+				'page' => $this->_req_data['page'],
1218
+				'action' => $action,
1219
+				$this->_cpt_model_obj->get_model()->get_primary_key_field()->get_name()
1220
+					=> $this->_req_data['post']
1221
+			),
1222
+			admin_url()
1223
+		);
1224
+	}
1225
+
1226
+
1227
+
1228
+	/**
1229
+	 * This is the callback for the 'redirect_post_location' filter in wp-admin/post.php
1230
+	 * so that we can hijack the default redirect locations for wp custom post types
1231
+	 * that WE'RE using and send back to OUR routes.  This should only be hooked in on the right route.
1232
+	 *
1233
+	 * @param  string $location This is the incoming currently set redirect location
1234
+	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1235
+	 * @return string           the new location to redirect to
1236
+	 */
1237
+	public function cpt_post_location_redirect($location, $post_id)
1238
+	{
1239
+		//we DO have a match so let's setup the url
1240
+		//we have to get the post to determine our route
1241
+		$post       = get_post($post_id);
1242
+		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1243
+		//shared query_args
1244
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1245
+		$admin_url  = $this->_admin_base_url;
1246
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1247
+			$status = get_post_status($post_id);
1248
+			if (isset($this->_req_data['publish'])) {
1249
+				switch ($status) {
1250
+					case 'pending':
1251
+						$message = 8;
1252
+						break;
1253
+					case 'future':
1254
+						$message = 9;
1255
+						break;
1256
+					default:
1257
+						$message = 6;
1258
+				}
1259
+			} else {
1260
+				$message = 'draft' === $status ? 10 : 1;
1261
+			}
1262
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1263
+			$message = 2;
1264
+			//			$append = '#postcustom';
1265
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1266
+			$message = 3;
1267
+			//			$append = '#postcustom';
1268
+		} elseif ($this->_req_data['action'] === 'post-quickpress-save-cont') {
1269
+			$message = 7;
1270
+		} else {
1271
+			$message = 4;
1272
+		}
1273
+		//change the message if the post type is not viewable on the frontend
1274
+		$this->_cpt_object = get_post_type_object($post->post_type);
1275
+		$message           = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1276
+		$query_args = array_merge(array('message' => $message), $query_args);
1277
+		$this->_process_notices($query_args, true);
1278
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1279
+	}
1280
+
1281
+
1282
+
1283
+	/**
1284
+	 * This method is called to inject nav tabs on core WP cpt pages
1285
+	 *
1286
+	 * @access public
1287
+	 * @return void
1288
+	 */
1289
+	public function inject_nav_tabs()
1290
+	{
1291
+		//can we hijack and insert the nav_tabs?
1292
+		$nav_tabs = $this->_get_main_nav_tabs();
1293
+		//first close off existing form tag
1294
+		$html = '>';
1295
+		$html .= $nav_tabs;
1296
+		//now let's handle the remaining tag ( missing ">" is CORRECT )
1297
+		$html .= '<span></span';
1298
+		echo $html;
1299
+	}
1300
+
1301
+
1302
+
1303
+	/**
1304
+	 * This just sets up the post update messages when an update form is loaded
1305
+	 *
1306
+	 * @access public
1307
+	 * @param  array $messages the original messages array
1308
+	 * @return array           the new messages array
1309
+	 */
1310
+	public function post_update_messages($messages)
1311
+	{
1312
+		global $post;
1313
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
1314
+		$id = empty($id) && is_object($post) ? $post->ID : null;
1315
+		//		$post_type = $post ? $post->post_type : false;
1316
+		/*$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
1317 1317
 
1318 1318
         $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';/**/
1319
-        $messages[$post->post_type] = array(
1320
-            0 => '', //Unused. Messages start at index 1.
1321
-            1 => sprintf(
1322
-                __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1323
-                $this->_cpt_object->labels->singular_name,
1324
-                '<a href="' . esc_url(get_permalink($id)) . '">',
1325
-                '</a>'
1326
-            ),
1327
-            2 => __('Custom field updated'),
1328
-            3 => __('Custom field deleted.'),
1329
-            4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1330
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'),
1331
-                $this->_cpt_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false))
1332
-                : false,
1333
-            6 => sprintf(
1334
-                __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1335
-                $this->_cpt_object->labels->singular_name,
1336
-                '<a href="' . esc_url(get_permalink($id)) . '">',
1337
-                '</a>'
1338
-            ),
1339
-            7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1340
-            8 => sprintf(
1341
-                __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1342
-                $this->_cpt_object->labels->singular_name,
1343
-                '<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))) . '">',
1344
-                '</a>'
1345
-            ),
1346
-            9 => sprintf(
1347
-                __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1348
-                $this->_cpt_object->labels->singular_name,
1349
-                '<strong>' . date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)) . '</strong>',
1350
-                '<a target="_blank" href="' . esc_url(get_permalink($id)),
1351
-                '</a>'
1352
-            ),
1353
-            10 => sprintf(
1354
-                __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1355
-                $this->_cpt_object->labels->singular_name,
1356
-                '<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1357
-                '</a>'
1358
-            ),
1359
-        );
1360
-        return $messages;
1361
-    }
1362
-
1363
-
1364
-
1365
-    /**
1366
-     * default method for the 'create_new' route for cpt admin pages.
1367
-     * For reference what to include in here, see wp-admin/post-new.php
1368
-     *
1369
-     * @access  protected
1370
-     * @return void
1371
-     */
1372
-    protected function _create_new_cpt_item()
1373
-    {
1374
-        // gather template vars for WP_ADMIN_PATH . 'edit-form-advanced.php'
1375
-        global $post, $title, $is_IE, $post_type, $post_type_object;
1376
-        $post_type        = $this->_cpt_routes[$this->_req_action];
1377
-        $post_type_object = $this->_cpt_object;
1378
-        $title            = $post_type_object->labels->add_new_item;
1379
-        $editing          = true;
1380
-        wp_enqueue_script('autosave');
1381
-        $post    = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], true);
1382
-        $post_ID = $post->ID;
1383
-        add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1384
-        //modify the default editor title field with default title.
1385
-        add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1386
-        include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1387
-    }
1388
-
1389
-
1390
-
1391
-    public function add_new_admin_page_global()
1392
-    {
1393
-        $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1394
-        ?>
1319
+		$messages[$post->post_type] = array(
1320
+			0 => '', //Unused. Messages start at index 1.
1321
+			1 => sprintf(
1322
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1323
+				$this->_cpt_object->labels->singular_name,
1324
+				'<a href="' . esc_url(get_permalink($id)) . '">',
1325
+				'</a>'
1326
+			),
1327
+			2 => __('Custom field updated'),
1328
+			3 => __('Custom field deleted.'),
1329
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1330
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'),
1331
+				$this->_cpt_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false))
1332
+				: false,
1333
+			6 => sprintf(
1334
+				__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1335
+				$this->_cpt_object->labels->singular_name,
1336
+				'<a href="' . esc_url(get_permalink($id)) . '">',
1337
+				'</a>'
1338
+			),
1339
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1340
+			8 => sprintf(
1341
+				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1342
+				$this->_cpt_object->labels->singular_name,
1343
+				'<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))) . '">',
1344
+				'</a>'
1345
+			),
1346
+			9 => sprintf(
1347
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1348
+				$this->_cpt_object->labels->singular_name,
1349
+				'<strong>' . date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)) . '</strong>',
1350
+				'<a target="_blank" href="' . esc_url(get_permalink($id)),
1351
+				'</a>'
1352
+			),
1353
+			10 => sprintf(
1354
+				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1355
+				$this->_cpt_object->labels->singular_name,
1356
+				'<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1357
+				'</a>'
1358
+			),
1359
+		);
1360
+		return $messages;
1361
+	}
1362
+
1363
+
1364
+
1365
+	/**
1366
+	 * default method for the 'create_new' route for cpt admin pages.
1367
+	 * For reference what to include in here, see wp-admin/post-new.php
1368
+	 *
1369
+	 * @access  protected
1370
+	 * @return void
1371
+	 */
1372
+	protected function _create_new_cpt_item()
1373
+	{
1374
+		// gather template vars for WP_ADMIN_PATH . 'edit-form-advanced.php'
1375
+		global $post, $title, $is_IE, $post_type, $post_type_object;
1376
+		$post_type        = $this->_cpt_routes[$this->_req_action];
1377
+		$post_type_object = $this->_cpt_object;
1378
+		$title            = $post_type_object->labels->add_new_item;
1379
+		$editing          = true;
1380
+		wp_enqueue_script('autosave');
1381
+		$post    = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], true);
1382
+		$post_ID = $post->ID;
1383
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1384
+		//modify the default editor title field with default title.
1385
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1386
+		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1387
+	}
1388
+
1389
+
1390
+
1391
+	public function add_new_admin_page_global()
1392
+	{
1393
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1394
+		?>
1395 1395
         <script type="text/javascript">
1396 1396
             adminpage = '<?php echo $admin_page; ?>';
1397 1397
         </script>
1398 1398
         <?php
1399
-    }
1400
-
1401
-
1402
-
1403
-    /**
1404
-     * default method for the 'edit' route for cpt admin pages
1405
-     * For reference on what to put in here, refer to wp-admin/post.php
1406
-     *
1407
-     * @access protected
1408
-     * @return string   template for edit cpt form
1409
-     */
1410
-    protected function _edit_cpt_item()
1411
-    {
1412
-        global $post, $title, $is_IE, $post_type, $post_type_object;
1413
-        $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
1414
-        $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : null;
1415
-        if (empty ($post)) {
1416
-            wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1417
-        }
1418
-        if ( ! empty($_GET['get-post-lock'])) {
1419
-            wp_set_post_lock($post_id);
1420
-            wp_redirect(get_edit_post_link($post_id, 'url'));
1421
-            exit();
1422
-        }
1423
-
1424
-        // template vars for WP_ADMIN_PATH . 'edit-form-advanced.php'
1425
-        $editing          = true;
1426
-        $post_ID          = $post_id;
1427
-        $post_type        = $this->_cpt_routes[$this->_req_action];
1428
-        $post_type_object = $this->_cpt_object;
1429
-
1430
-        if ( ! wp_check_post_lock($post->ID)) {
1431
-            $active_post_lock = wp_set_post_lock($post->ID);
1432
-            //wp_enqueue_script('autosave');
1433
-        }
1434
-        $title = $this->_cpt_object->labels->edit_item;
1435
-        add_action('admin_footer', '_admin_notice_post_locked');
1436
-        if (isset($this->_cpt_routes[$this->_req_data['action']])
1437
-            && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])
1438
-        ) {
1439
-            $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action',
1440
-                'create_new', $this);
1441
-            $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array(
1442
-                'action' => $create_new_action,
1443
-                'page'   => $this->page_slug,
1444
-            ), 'admin.php');
1445
-        }
1446
-        if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1447
-            wp_enqueue_script('admin-comments');
1448
-            enqueue_comment_hotkeys_js();
1449
-        }
1450
-        add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1451
-        //modify the default editor title field with default title.
1452
-        add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1453
-        include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1454
-    }
1455
-
1456
-
1457
-
1458
-    /**
1459
-     * some getters
1460
-     */
1461
-    /**
1462
-     * This returns the protected _cpt_model_obj property
1463
-     *
1464
-     * @return EE_CPT_Base
1465
-     */
1466
-    public function get_cpt_model_obj()
1467
-    {
1468
-        return $this->_cpt_model_obj;
1469
-    }
1399
+	}
1400
+
1401
+
1402
+
1403
+	/**
1404
+	 * default method for the 'edit' route for cpt admin pages
1405
+	 * For reference on what to put in here, refer to wp-admin/post.php
1406
+	 *
1407
+	 * @access protected
1408
+	 * @return string   template for edit cpt form
1409
+	 */
1410
+	protected function _edit_cpt_item()
1411
+	{
1412
+		global $post, $title, $is_IE, $post_type, $post_type_object;
1413
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : null;
1414
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : null;
1415
+		if (empty ($post)) {
1416
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1417
+		}
1418
+		if ( ! empty($_GET['get-post-lock'])) {
1419
+			wp_set_post_lock($post_id);
1420
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1421
+			exit();
1422
+		}
1423
+
1424
+		// template vars for WP_ADMIN_PATH . 'edit-form-advanced.php'
1425
+		$editing          = true;
1426
+		$post_ID          = $post_id;
1427
+		$post_type        = $this->_cpt_routes[$this->_req_action];
1428
+		$post_type_object = $this->_cpt_object;
1429
+
1430
+		if ( ! wp_check_post_lock($post->ID)) {
1431
+			$active_post_lock = wp_set_post_lock($post->ID);
1432
+			//wp_enqueue_script('autosave');
1433
+		}
1434
+		$title = $this->_cpt_object->labels->edit_item;
1435
+		add_action('admin_footer', '_admin_notice_post_locked');
1436
+		if (isset($this->_cpt_routes[$this->_req_data['action']])
1437
+			&& ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])
1438
+		) {
1439
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action',
1440
+				'create_new', $this);
1441
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array(
1442
+				'action' => $create_new_action,
1443
+				'page'   => $this->page_slug,
1444
+			), 'admin.php');
1445
+		}
1446
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1447
+			wp_enqueue_script('admin-comments');
1448
+			enqueue_comment_hotkeys_js();
1449
+		}
1450
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1451
+		//modify the default editor title field with default title.
1452
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1453
+		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1454
+	}
1455
+
1456
+
1457
+
1458
+	/**
1459
+	 * some getters
1460
+	 */
1461
+	/**
1462
+	 * This returns the protected _cpt_model_obj property
1463
+	 *
1464
+	 * @return EE_CPT_Base
1465
+	 */
1466
+	public function get_cpt_model_obj()
1467
+	{
1468
+		return $this->_cpt_model_obj;
1469
+	}
1470 1470
 
1471 1471
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     protected function _register_autosave_containers($ids)
237 237
     {
238
-        $this->_autosave_containers = array_merge($this->_autosave_fields, (array)$ids);
238
+        $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
239 239
     }
240 240
 
241 241
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         //filter _autosave_containers
283 283
         $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers',
284 284
             $this->_autosave_containers, $this);
285
-        $containers = apply_filters('FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers',
285
+        $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers',
286 286
             $containers, $this);
287 287
 
288 288
         wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS',
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         // This is for any plugins that are doing things properly
395 395
         // and hooking into the load page hook for core wp cpt routes.
396 396
         global $pagenow;
397
-        do_action('load-' . $pagenow);
397
+        do_action('load-'.$pagenow);
398 398
         $this->modify_current_screen();
399 399
         add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
400 400
         //we route REALLY early.
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
                 'admin.php?page=espresso_registrations&action=contact_list',
426 426
             ),
427 427
             1 => array(
428
-                'edit.php?post_type=' . $this->_cpt_object->name,
429
-                'admin.php?page=' . $this->_cpt_object->name,
428
+                'edit.php?post_type='.$this->_cpt_object->name,
429
+                'admin.php?page='.$this->_cpt_object->name,
430 430
             ),
431 431
         );
432 432
         foreach ($routes_to_match as $route_matches) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         $cpt_has_support = ! empty($cpt_args['page_templates']);
455 455
 
456 456
         //if the installed version of WP is > 4.7 we do some additional checks.
457
-        if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
457
+        if (EE_Recommended_Versions::check_wp_version('4.7', '>=')) {
458 458
             $post_templates = wp_get_theme()->get_post_templates();
459 459
             //if there are $post_templates for this cpt, then we return false for this method because
460 460
             //that means we aren't going to load our page template manager and leave that up to the native
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         global $post;
478 478
         $template = '';
479 479
 
480
-        if (EE_Recommended_Versions::check_wp_version('4.7','>=')) {
480
+        if (EE_Recommended_Versions::check_wp_version('4.7', '>=')) {
481 481
             $page_template_count = count(get_page_templates());
482 482
         } else {
483 483
             $page_template_count = count(get_page_templates($post));
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $post = get_post($id);
515 515
         if ('publish' !== get_post_status($post)) {
516 516
             //include shims for the `get_preview_post_link` function
517
-            require_once( EE_CORE . 'wordpress-shims.php' );
517
+            require_once(EE_CORE.'wordpress-shims.php');
518 518
             $return .= '<span_id="view-post-btn"><a target="_blank" href="'
519 519
                        . get_preview_post_link($id)
520 520
                        . '" class="button button-small">'
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
             $template_args['statuses']         = $statuses;
553 553
         }
554 554
 
555
-        $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
555
+        $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
556 556
         EEH_Template::display_template($template, $template_args);
557 557
     }
558 558
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
             $this->_template_args['success'] = true;
607 607
         }
608 608
         do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
609
-        do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class($this), $this);
609
+        do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
610 610
         //now let's return json
611 611
         $this->_return_json();
612 612
     }
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
         //global action
1010 1010
         do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
1011 1011
         //class specific action so you can limit hooking into a specific page.
1012
-        do_action('AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id);
1012
+        do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
1013 1013
     }
1014 1014
 
1015 1015
 
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
         if ( ! empty($id) && get_option('permalink_structure') !== '') {
1088 1088
             $post = get_post($id);
1089 1089
             if (isset($post->post_type) && $this->page_slug === $post->post_type) {
1090
-                $shortlink = home_url('?p=' . $post->ID);
1090
+                $shortlink = home_url('?p='.$post->ID);
1091 1091
             }
1092 1092
         }
1093 1093
         return $shortlink;
@@ -1122,11 +1122,11 @@  discard block
 block discarded – undo
1122 1122
      */
1123 1123
     public function cpt_post_form_hidden_input()
1124 1124
     {
1125
-        echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1125
+        echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
1126 1126
         //we're also going to add the route value and the current page so we can direct autosave parsing correctly
1127 1127
         echo '<div id="ee-cpt-hidden-inputs">';
1128
-        echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1129
-        echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1128
+        echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
1129
+        echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
1130 1130
         echo '</div>';
1131 1131
     }
1132 1132
 
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
     public function modify_delete_post_link($delete_link, $post_id, $force_delete)
1203 1203
     {
1204 1204
         $post = get_post($post_id);
1205
-        if (! isset($this->_req_data['action'], $this->_req_data['post'])
1205
+        if ( ! isset($this->_req_data['action'], $this->_req_data['post'])
1206 1206
              || (isset($this->_cpt_routes[$this->_req_data['action']])
1207 1207
                  && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1208 1208
         ) {
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
         }
1211 1211
         $this->_set_model_object($this->_req_data['post'], true);
1212 1212
         //returns something like `trash_event` or `trash_attendee` or `trash_venue`
1213
-        $action = 'trash_' . str_replace('ee_', '', strtolower(get_class($this->_cpt_model_obj)));
1213
+        $action = 'trash_'.str_replace('ee_', '', strtolower(get_class($this->_cpt_model_obj)));
1214 1214
 
1215 1215
         return EE_Admin_Page::add_query_args_and_nonce(
1216 1216
             array(
@@ -1321,39 +1321,39 @@  discard block
 block discarded – undo
1321 1321
             1 => sprintf(
1322 1322
                 __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1323 1323
                 $this->_cpt_object->labels->singular_name,
1324
-                '<a href="' . esc_url(get_permalink($id)) . '">',
1324
+                '<a href="'.esc_url(get_permalink($id)).'">',
1325 1325
                 '</a>'
1326 1326
             ),
1327 1327
             2 => __('Custom field updated'),
1328 1328
             3 => __('Custom field deleted.'),
1329 1329
             4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1330 1330
             5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'),
1331
-                $this->_cpt_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false))
1331
+                $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false))
1332 1332
                 : false,
1333 1333
             6 => sprintf(
1334 1334
                 __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1335 1335
                 $this->_cpt_object->labels->singular_name,
1336
-                '<a href="' . esc_url(get_permalink($id)) . '">',
1336
+                '<a href="'.esc_url(get_permalink($id)).'">',
1337 1337
                 '</a>'
1338 1338
             ),
1339 1339
             7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1340 1340
             8 => sprintf(
1341 1341
                 __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1342 1342
                 $this->_cpt_object->labels->singular_name,
1343
-                '<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))) . '">',
1343
+                '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1344 1344
                 '</a>'
1345 1345
             ),
1346 1346
             9 => sprintf(
1347 1347
                 __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1348 1348
                 $this->_cpt_object->labels->singular_name,
1349
-                '<strong>' . date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)) . '</strong>',
1350
-                '<a target="_blank" href="' . esc_url(get_permalink($id)),
1349
+                '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1350
+                '<a target="_blank" href="'.esc_url(get_permalink($id)),
1351 1351
                 '</a>'
1352 1352
             ),
1353 1353
             10 => sprintf(
1354 1354
                 __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1355 1355
                 $this->_cpt_object->labels->singular_name,
1356
-                '<a target="_blank" href="' . esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1356
+                '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1357 1357
                 '</a>'
1358 1358
             ),
1359 1359
         );
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
         add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1384 1384
         //modify the default editor title field with default title.
1385 1385
         add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1386
-        include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1386
+        include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1387 1387
     }
1388 1388
 
1389 1389
 
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
         add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1451 1451
         //modify the default editor title field with default title.
1452 1452
         add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1453
-        include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1453
+        include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1454 1454
     }
1455 1455
 
1456 1456
 
Please login to merge, or discard this patch.