Completed
Branch FET-10766-extract-activation-d... (99f7dd)
by
unknown
134:15 queued 121:56
created
form_sections/strategies/layout/EE_Form_Section_Layout_Base.strategy.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -14,248 +14,248 @@
 block discarded – undo
14 14
 abstract class EE_Form_Section_Layout_Base
15 15
 {
16 16
 
17
-    /**
18
-     * Form form section to lay out
19
-     *
20
-     * @var EE_Form_Section_Proper
21
-     */
22
-    protected $_form_section;
23
-
24
-
25
-
26
-    /**
27
-     *  __construct
28
-     */
29
-    function __construct()
30
-    {
31
-    }
32
-
33
-
34
-
35
-    /**
36
-     * The form section on which this strategy is to perform
37
-     *
38
-     * @param EE_Form_Section_Proper $form
39
-     */
40
-    public function _construct_finalize(EE_Form_Section_Proper $form)
41
-    {
42
-        $this->_form_section = $form;
43
-    }
44
-
45
-
46
-
47
-    /**
48
-     * @return \EE_Form_Section_Proper
49
-     */
50
-    public function form_section()
51
-    {
52
-        return $this->_form_section;
53
-    }
54
-
55
-
56
-
57
-    /**
58
-     * Also has teh side effect of enqueuing any needed JS and CSS for
59
-     * this form.
60
-     * Creates all the HTML necessary for displaying this form, its inputs, and
61
-     * proper subsections.
62
-     * Returns the HTML
63
-     *
64
-     * @return string HTML for displaying
65
-     */
66
-    public function layout_form()
67
-    {
68
-        $html = '';
69
-        // layout_form_begin
70
-        $html .= apply_filters(
71
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
72
-            $this->layout_form_begin(),
73
-            $this->_form_section
74
-        );
75
-        // layout_form_loop
76
-        $html .= apply_filters(
77
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
78
-            $this->layout_form_loop(),
79
-            $this->_form_section
80
-        );
81
-        // layout_form_end
82
-        $html .= apply_filters(
83
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
84
-            $this->layout_form_end(),
85
-            $this->_form_section
86
-        );
87
-        $html = $this->add_form_section_hooks_and_filters($html);
88
-        return $html;
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * @return string
95
-     */
96
-    public function layout_form_loop()
97
-    {
98
-        $html = '';
99
-        foreach ($this->_form_section->subsections() as $name => $subsection) {
100
-            if ($subsection instanceof EE_Form_Input_Base) {
101
-                $html .= apply_filters(
102
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(),
103
-                    $this->layout_input($subsection),
104
-                    $this->_form_section,
105
-                    $subsection
106
-                );
107
-            } elseif ($subsection instanceof EE_Form_Section_Base) {
108
-                $html .= apply_filters(
109
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(),
110
-                    $this->layout_subsection($subsection),
111
-                    $this->_form_section,
112
-                    $subsection
113
-                );
114
-            }
115
-        }
116
-        return $html;
117
-    }
118
-
119
-
120
-
121
-    /**
122
-     * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
123
-     *
124
-     * @return string
125
-     */
126
-    abstract public function layout_form_begin();
127
-
128
-
129
-
130
-    /**
131
-     * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
132
-     *
133
-     * @return string
134
-     */
135
-    abstract public function layout_form_end();
136
-
137
-
138
-
139
-    /**
140
-     * Should be used internally by layout_form() to layout each input (eg, if this layout
141
-     * is putting each input in a row of its own, this should probably be called by a
142
-     *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
143
-     * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
144
-     * customize the form's layout, but would like to make use of it for laying out
145
-     * 'easy-to-layout' inputs
146
-     *
147
-     * @param EE_Form_Input_Base $input
148
-     * @return string html
149
-     */
150
-    abstract public function layout_input($input);
151
-
152
-
153
-
154
-    /**
155
-     * Similar to layout_input(), should be used internally by layout_form() within a
156
-     * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
157
-     * that the proper subsection will layout its container, label, etc on its own.
158
-     *
159
-     * @param EE_Form_Section_Base $subsection
160
-     * @return string html
161
-     */
162
-    abstract public function layout_subsection($subsection);
163
-
164
-
165
-
166
-    /**
167
-     * Gets the HTML for the label tag and its contents for the input
168
-     *
169
-     * @param EE_Form_Input_Base $input
170
-     * @return string
171
-     */
172
-    public function display_label($input)
173
-    {
174
-        $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class();
175
-        $label_text = $input->required()
176
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
177
-            : $input->html_label_text();
178
-        return '<label id="'
179
-               . $input->html_label_id()
180
-               . '" class="'
181
-               . $class
182
-               . '" style="'
183
-               . $input->html_label_style()
184
-               . '" for="' . $input->html_name()
185
-               . '">'
186
-               . $label_text
187
-               . '</label>';
188
-    }
189
-
190
-
191
-
192
-    /**
193
-     * returns the HTML for the server-side validation errors for the specified input
194
-     * Note that if JS is enabled, it should remove these and instead
195
-     * populate the form's errors in the jquery validate fashion
196
-     * using the localized data provided to the JS
197
-     *
198
-     * @param EE_Form_Input_Base $input
199
-     * @return string
200
-     */
201
-    public function display_errors($input)
202
-    {
203
-        if ($input->get_validation_errors()) {
204
-            return "<label  id='"
205
-                   . $input->html_id()
206
-                   . "-error' class='error' for='{$input->html_name()}'>"
207
-                   . $input->get_validation_error_string()
208
-                   . "</label>";
209
-        } else {
210
-            return '';
211
-        }
212
-    }
213
-
214
-
215
-
216
-    /**
217
-     * Displays the help span for the specified input
218
-     *
219
-     * @param EE_Form_Input_Base $input
220
-     * @return string
221
-     */
222
-    public function display_help_text($input)
223
-    {
224
-        if ($input->html_help_text() != '') {
225
-            $tag = is_admin() ? 'p' : 'span';
226
-            return '<'
227
-                   . $tag
228
-                   . ' id="'
229
-                   . $input->html_id()
230
-                   . '-help" class="'
231
-                   . $input->html_help_class()
232
-                   . '" style="'
233
-                   . $input->html_help_style()
234
-                   . '">'
235
-                   . $input->html_help_text()
236
-                   . '</'
237
-                   . $tag
238
-                   . '>';
239
-        }
240
-        return '';
241
-    }
242
-
243
-
244
-
245
-    /**
246
-     * Does an action and hook onto the end of teh form
247
-     *
248
-     * @param string $html
249
-     * @return string
250
-     */
251
-    public function add_form_section_hooks_and_filters($html)
252
-    {
253
-        // replace dashes and spaces with underscores
254
-        $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
255
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
256
-        $html = apply_filters('AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section);
257
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
258
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
259
-        return $html;
260
-    }
17
+	/**
18
+	 * Form form section to lay out
19
+	 *
20
+	 * @var EE_Form_Section_Proper
21
+	 */
22
+	protected $_form_section;
23
+
24
+
25
+
26
+	/**
27
+	 *  __construct
28
+	 */
29
+	function __construct()
30
+	{
31
+	}
32
+
33
+
34
+
35
+	/**
36
+	 * The form section on which this strategy is to perform
37
+	 *
38
+	 * @param EE_Form_Section_Proper $form
39
+	 */
40
+	public function _construct_finalize(EE_Form_Section_Proper $form)
41
+	{
42
+		$this->_form_section = $form;
43
+	}
44
+
45
+
46
+
47
+	/**
48
+	 * @return \EE_Form_Section_Proper
49
+	 */
50
+	public function form_section()
51
+	{
52
+		return $this->_form_section;
53
+	}
54
+
55
+
56
+
57
+	/**
58
+	 * Also has teh side effect of enqueuing any needed JS and CSS for
59
+	 * this form.
60
+	 * Creates all the HTML necessary for displaying this form, its inputs, and
61
+	 * proper subsections.
62
+	 * Returns the HTML
63
+	 *
64
+	 * @return string HTML for displaying
65
+	 */
66
+	public function layout_form()
67
+	{
68
+		$html = '';
69
+		// layout_form_begin
70
+		$html .= apply_filters(
71
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
72
+			$this->layout_form_begin(),
73
+			$this->_form_section
74
+		);
75
+		// layout_form_loop
76
+		$html .= apply_filters(
77
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
78
+			$this->layout_form_loop(),
79
+			$this->_form_section
80
+		);
81
+		// layout_form_end
82
+		$html .= apply_filters(
83
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
84
+			$this->layout_form_end(),
85
+			$this->_form_section
86
+		);
87
+		$html = $this->add_form_section_hooks_and_filters($html);
88
+		return $html;
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * @return string
95
+	 */
96
+	public function layout_form_loop()
97
+	{
98
+		$html = '';
99
+		foreach ($this->_form_section->subsections() as $name => $subsection) {
100
+			if ($subsection instanceof EE_Form_Input_Base) {
101
+				$html .= apply_filters(
102
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(),
103
+					$this->layout_input($subsection),
104
+					$this->_form_section,
105
+					$subsection
106
+				);
107
+			} elseif ($subsection instanceof EE_Form_Section_Base) {
108
+				$html .= apply_filters(
109
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(),
110
+					$this->layout_subsection($subsection),
111
+					$this->_form_section,
112
+					$subsection
113
+				);
114
+			}
115
+		}
116
+		return $html;
117
+	}
118
+
119
+
120
+
121
+	/**
122
+	 * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
123
+	 *
124
+	 * @return string
125
+	 */
126
+	abstract public function layout_form_begin();
127
+
128
+
129
+
130
+	/**
131
+	 * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
132
+	 *
133
+	 * @return string
134
+	 */
135
+	abstract public function layout_form_end();
136
+
137
+
138
+
139
+	/**
140
+	 * Should be used internally by layout_form() to layout each input (eg, if this layout
141
+	 * is putting each input in a row of its own, this should probably be called by a
142
+	 *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
143
+	 * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
144
+	 * customize the form's layout, but would like to make use of it for laying out
145
+	 * 'easy-to-layout' inputs
146
+	 *
147
+	 * @param EE_Form_Input_Base $input
148
+	 * @return string html
149
+	 */
150
+	abstract public function layout_input($input);
151
+
152
+
153
+
154
+	/**
155
+	 * Similar to layout_input(), should be used internally by layout_form() within a
156
+	 * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
157
+	 * that the proper subsection will layout its container, label, etc on its own.
158
+	 *
159
+	 * @param EE_Form_Section_Base $subsection
160
+	 * @return string html
161
+	 */
162
+	abstract public function layout_subsection($subsection);
163
+
164
+
165
+
166
+	/**
167
+	 * Gets the HTML for the label tag and its contents for the input
168
+	 *
169
+	 * @param EE_Form_Input_Base $input
170
+	 * @return string
171
+	 */
172
+	public function display_label($input)
173
+	{
174
+		$class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class();
175
+		$label_text = $input->required()
176
+			? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
177
+			: $input->html_label_text();
178
+		return '<label id="'
179
+			   . $input->html_label_id()
180
+			   . '" class="'
181
+			   . $class
182
+			   . '" style="'
183
+			   . $input->html_label_style()
184
+			   . '" for="' . $input->html_name()
185
+			   . '">'
186
+			   . $label_text
187
+			   . '</label>';
188
+	}
189
+
190
+
191
+
192
+	/**
193
+	 * returns the HTML for the server-side validation errors for the specified input
194
+	 * Note that if JS is enabled, it should remove these and instead
195
+	 * populate the form's errors in the jquery validate fashion
196
+	 * using the localized data provided to the JS
197
+	 *
198
+	 * @param EE_Form_Input_Base $input
199
+	 * @return string
200
+	 */
201
+	public function display_errors($input)
202
+	{
203
+		if ($input->get_validation_errors()) {
204
+			return "<label  id='"
205
+				   . $input->html_id()
206
+				   . "-error' class='error' for='{$input->html_name()}'>"
207
+				   . $input->get_validation_error_string()
208
+				   . "</label>";
209
+		} else {
210
+			return '';
211
+		}
212
+	}
213
+
214
+
215
+
216
+	/**
217
+	 * Displays the help span for the specified input
218
+	 *
219
+	 * @param EE_Form_Input_Base $input
220
+	 * @return string
221
+	 */
222
+	public function display_help_text($input)
223
+	{
224
+		if ($input->html_help_text() != '') {
225
+			$tag = is_admin() ? 'p' : 'span';
226
+			return '<'
227
+				   . $tag
228
+				   . ' id="'
229
+				   . $input->html_id()
230
+				   . '-help" class="'
231
+				   . $input->html_help_class()
232
+				   . '" style="'
233
+				   . $input->html_help_style()
234
+				   . '">'
235
+				   . $input->html_help_text()
236
+				   . '</'
237
+				   . $tag
238
+				   . '>';
239
+		}
240
+		return '';
241
+	}
242
+
243
+
244
+
245
+	/**
246
+	 * Does an action and hook onto the end of teh form
247
+	 *
248
+	 * @param string $html
249
+	 * @return string
250
+	 */
251
+	public function add_form_section_hooks_and_filters($html)
252
+	{
253
+		// replace dashes and spaces with underscores
254
+		$hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
255
+		do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
256
+		$html = apply_filters('AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section);
257
+		$html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
258
+		$html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
259
+		return $html;
260
+	}
261 261
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
         $html = '';
69 69
         // layout_form_begin
70 70
         $html .= apply_filters(
71
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
71
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(),
72 72
             $this->layout_form_begin(),
73 73
             $this->_form_section
74 74
         );
75 75
         // layout_form_loop
76 76
         $html .= apply_filters(
77
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
77
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(),
78 78
             $this->layout_form_loop(),
79 79
             $this->_form_section
80 80
         );
81 81
         // layout_form_end
82 82
         $html .= apply_filters(
83
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
83
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(),
84 84
             $this->layout_form_end(),
85 85
             $this->_form_section
86 86
         );
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
         foreach ($this->_form_section->subsections() as $name => $subsection) {
100 100
             if ($subsection instanceof EE_Form_Input_Base) {
101 101
                 $html .= apply_filters(
102
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(),
102
+                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'.$name.'__in_'.$this->_form_section->name(),
103 103
                     $this->layout_input($subsection),
104 104
                     $this->_form_section,
105 105
                     $subsection
106 106
                 );
107 107
             } elseif ($subsection instanceof EE_Form_Section_Base) {
108 108
                 $html .= apply_filters(
109
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(),
109
+                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'.$name.'__in_'.$this->_form_section->name(),
110 110
                     $this->layout_subsection($subsection),
111 111
                     $this->_form_section,
112 112
                     $subsection
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function display_label($input)
173 173
     {
174
-        $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class();
174
+        $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class();
175 175
         $label_text = $input->required()
176
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
176
+            ? $input->html_label_text().'<span class="ee-asterisk">*</span>'
177 177
             : $input->html_label_text();
178 178
         return '<label id="'
179 179
                . $input->html_label_id()
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                . $class
182 182
                . '" style="'
183 183
                . $input->html_label_style()
184
-               . '" for="' . $input->html_name()
184
+               . '" for="'.$input->html_name()
185 185
                . '">'
186 186
                . $label_text
187 187
                . '</label>';
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
     {
253 253
         // replace dashes and spaces with underscores
254 254
         $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
255
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
256
-        $html = apply_filters('AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section);
257
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
258
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
255
+        do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section);
256
+        $html = apply_filters('AFEE__Form_Section_Layout__'.$hook_name.'__html', $html, $this->_form_section);
257
+        $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->';
258
+        $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->';
259 259
         return $html;
260 260
     }
261 261
 }
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Admin_Two_Column_Layout.strategy.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -9,69 +9,69 @@
 block discarded – undo
9 9
 class EE_Admin_Two_Column_Layout extends EE_Two_Column_Layout
10 10
 {
11 11
 
12
-    /**
13
-     * Overriding the parent table layout to include <tbody> tags
14
-     *
15
-     * @param array $additional_args
16
-     * @return string
17
-     */
18
-    public function layout_form_begin($additional_args = array())
19
-    {
20
-        $this->_form_section->set_html_class('form-table');
21
-        return parent::layout_form_begin($additional_args);
22
-    }
12
+	/**
13
+	 * Overriding the parent table layout to include <tbody> tags
14
+	 *
15
+	 * @param array $additional_args
16
+	 * @return string
17
+	 */
18
+	public function layout_form_begin($additional_args = array())
19
+	{
20
+		$this->_form_section->set_html_class('form-table');
21
+		return parent::layout_form_begin($additional_args);
22
+	}
23 23
 
24 24
 
25 25
 
26
-    /**
27
-     * Lays out a row for the subsection
28
-     *
29
-     * @param EE_Form_Section_Proper $form_section
30
-     * @return string
31
-     */
32
-    public function layout_subsection($form_section)
33
-    {
34
-        if ($form_section instanceof EE_Form_Section_Proper) {
35
-            return EEH_HTML::no_row($form_section->get_html(), 2);
36
-        } elseif ($form_section instanceof EE_Form_Section_HTML) {
37
-            return EEH_HTML::no_row($form_section->get_html(), 2);
38
-        }
39
-        return '';
40
-    }
26
+	/**
27
+	 * Lays out a row for the subsection
28
+	 *
29
+	 * @param EE_Form_Section_Proper $form_section
30
+	 * @return string
31
+	 */
32
+	public function layout_subsection($form_section)
33
+	{
34
+		if ($form_section instanceof EE_Form_Section_Proper) {
35
+			return EEH_HTML::no_row($form_section->get_html(), 2);
36
+		} elseif ($form_section instanceof EE_Form_Section_HTML) {
37
+			return EEH_HTML::no_row($form_section->get_html(), 2);
38
+		}
39
+		return '';
40
+	}
41 41
 
42 42
 
43 43
 
44
-    /**
45
-     * Lays out the row for the input, including label and errors
46
-     *
47
-     * @param EE_Form_Input_Base $input
48
-     * @return string
49
-     */
50
-    public function layout_input($input)
51
-    {
52
-        if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
53
-            || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
54
-            || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
55
-        ) {
56
-            $input->set_html_class($input->html_class() . ' large-text');
57
-        }
58
-        if ($input instanceof EE_Text_Area_Input) {
59
-            $input->set_rows(4);
60
-            $input->set_cols(60);
61
-        }
62
-        $input_html = $input->get_html_for_input();
63
-        // maybe add errors and help text ?
64
-        $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : '';
65
-        $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
66
-        //overriding parent to add wp admin specific things.
67
-        $html = '';
68
-        if ($input instanceof EE_Hidden_Input) {
69
-            $html .= EEH_HTML::no_row($input->get_html_for_input(), 2);
70
-        } else {
71
-            $html .= EEH_HTML::tr(
72
-                EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"') . EEH_HTML::td($input_html)
73
-            );
74
-        }
75
-        return $html;
76
-    }
44
+	/**
45
+	 * Lays out the row for the input, including label and errors
46
+	 *
47
+	 * @param EE_Form_Input_Base $input
48
+	 * @return string
49
+	 */
50
+	public function layout_input($input)
51
+	{
52
+		if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
53
+			|| $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
54
+			|| $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
55
+		) {
56
+			$input->set_html_class($input->html_class() . ' large-text');
57
+		}
58
+		if ($input instanceof EE_Text_Area_Input) {
59
+			$input->set_rows(4);
60
+			$input->set_cols(60);
61
+		}
62
+		$input_html = $input->get_html_for_input();
63
+		// maybe add errors and help text ?
64
+		$input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : '';
65
+		$input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
66
+		//overriding parent to add wp admin specific things.
67
+		$html = '';
68
+		if ($input instanceof EE_Hidden_Input) {
69
+			$html .= EEH_HTML::no_row($input->get_html_for_input(), 2);
70
+		} else {
71
+			$html .= EEH_HTML::tr(
72
+				EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"') . EEH_HTML::td($input_html)
73
+			);
74
+		}
75
+		return $html;
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
54 54
             || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
55 55
         ) {
56
-            $input->set_html_class($input->html_class() . ' large-text');
56
+            $input->set_html_class($input->html_class().' large-text');
57 57
         }
58 58
         if ($input instanceof EE_Text_Area_Input) {
59 59
             $input->set_rows(4);
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
         }
62 62
         $input_html = $input->get_html_for_input();
63 63
         // maybe add errors and help text ?
64
-        $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : '';
65
-        $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
64
+        $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : '';
65
+        $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : '';
66 66
         //overriding parent to add wp admin specific things.
67 67
         $html = '';
68 68
         if ($input instanceof EE_Hidden_Input) {
69 69
             $html .= EEH_HTML::no_row($input->get_html_for_input(), 2);
70 70
         } else {
71 71
             $html .= EEH_HTML::tr(
72
-                EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"') . EEH_HTML::td($input_html)
72
+                EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html)
73 73
             );
74 74
         }
75 75
         return $html;
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Div_Per_Section_Layout.strategy.php 2 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -14,123 +14,123 @@
 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
-     */
40
-    public function layout_input($input)
41
-    {
42
-        $html = '';
43
-        if ($input instanceof EE_Hidden_Input) {
44
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
45
-        } elseif ($input instanceof EE_Submit_Input) {
46
-            $html .= EEH_HTML::div(
47
-                $input->get_html_for_input(),
48
-                $input->html_id() . '-submit-dv',
49
-                $input->html_class() . '-submit-dv'
50
-            );
51
-        } elseif ($input instanceof EE_Select_Input) {
52
-            $html .= EEH_HTML::div(
53
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
54
-                EEH_HTML::nl() . $input->get_html_for_errors() .
55
-                EEH_HTML::nl() . $input->get_html_for_input() .
56
-                EEH_HTML::nl() . $input->get_html_for_help(),
57
-                $input->html_id() . '-input-dv',
58
-                $input->html_class() . '-input-dv'
59
-            );
60
-        } elseif ($input instanceof EE_Form_Input_With_Options_Base) {
61
-            $html .= EEH_HTML::div(
62
-                EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
63
-                EEH_HTML::nl() . $input->get_html_for_errors() .
64
-                EEH_HTML::nl() . $input->get_html_for_input() .
65
-                EEH_HTML::nl() . $input->get_html_for_help(),
66
-                $input->html_id() . '-input-dv',
67
-                $input->html_class() . '-input-dv'
68
-            );
69
-        } else {
70
-            $html .= EEH_HTML::div(
71
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
72
-                EEH_HTML::nl() . $input->get_html_for_errors() .
73
-                EEH_HTML::nl() . $input->get_html_for_input() .
74
-                EEH_HTML::nl() . $input->get_html_for_help(),
75
-                $input->html_id() . '-input-dv',
76
-                $input->html_class() . '-input-dv'
77
-            );
78
-        }
79
-        return $html;
80
-    }
81
-
82
-
83
-
84
-    /**
85
-     * _display_label_for_option_type_question
86
-     * Gets the HTML for the 'label', which is just text for this (because labels
87
-     * should be for each input)
88
-     *
89
-     * @param EE_Form_Input_With_Options_Base $input
90
-     * @return string
91
-     */
92
-    protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input)
93
-    {
94
-        if ($input->display_html_label_text() != '') {
95
-            $class = $input->required()
96
-                ? 'ee-required-label ' . $input->html_label_class()
97
-                : $input->html_label_class();
98
-            $label_text = $input->required()
99
-                ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
100
-                : $input->html_label_text();
101
-            $html = '<div id="' . $input->html_label_id() . '"';
102
-            $html .= ' class="' . $class . '"';
103
-            $html .= ' style="' . $input->html_label_style() . '">';
104
-            $html .= $label_text . '</div>';
105
-            return $html;
106
-        } else {
107
-            return '';
108
-        }
109
-    }
110
-
111
-
112
-
113
-    /**
114
-     * Lays out a row for the subsection
115
-     *
116
-     * @param EE_Form_Section_Proper $form_section
117
-     * @return string
118
-     */
119
-    public function layout_subsection($form_section)
120
-    {
121
-        //		d( $form_section );
122
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
123
-    }
124
-
125
-
126
-
127
-    /**
128
-     * closing div tag for a form
129
-     *
130
-     * @return string
131
-     */
132
-    public function layout_form_end()
133
-    {
134
-        return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
135
-    }
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
+	 */
40
+	public function layout_input($input)
41
+	{
42
+		$html = '';
43
+		if ($input instanceof EE_Hidden_Input) {
44
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
45
+		} elseif ($input instanceof EE_Submit_Input) {
46
+			$html .= EEH_HTML::div(
47
+				$input->get_html_for_input(),
48
+				$input->html_id() . '-submit-dv',
49
+				$input->html_class() . '-submit-dv'
50
+			);
51
+		} elseif ($input instanceof EE_Select_Input) {
52
+			$html .= EEH_HTML::div(
53
+				EEH_HTML::nl(1) . $input->get_html_for_label() .
54
+				EEH_HTML::nl() . $input->get_html_for_errors() .
55
+				EEH_HTML::nl() . $input->get_html_for_input() .
56
+				EEH_HTML::nl() . $input->get_html_for_help(),
57
+				$input->html_id() . '-input-dv',
58
+				$input->html_class() . '-input-dv'
59
+			);
60
+		} elseif ($input instanceof EE_Form_Input_With_Options_Base) {
61
+			$html .= EEH_HTML::div(
62
+				EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
63
+				EEH_HTML::nl() . $input->get_html_for_errors() .
64
+				EEH_HTML::nl() . $input->get_html_for_input() .
65
+				EEH_HTML::nl() . $input->get_html_for_help(),
66
+				$input->html_id() . '-input-dv',
67
+				$input->html_class() . '-input-dv'
68
+			);
69
+		} else {
70
+			$html .= EEH_HTML::div(
71
+				EEH_HTML::nl(1) . $input->get_html_for_label() .
72
+				EEH_HTML::nl() . $input->get_html_for_errors() .
73
+				EEH_HTML::nl() . $input->get_html_for_input() .
74
+				EEH_HTML::nl() . $input->get_html_for_help(),
75
+				$input->html_id() . '-input-dv',
76
+				$input->html_class() . '-input-dv'
77
+			);
78
+		}
79
+		return $html;
80
+	}
81
+
82
+
83
+
84
+	/**
85
+	 * _display_label_for_option_type_question
86
+	 * Gets the HTML for the 'label', which is just text for this (because labels
87
+	 * should be for each input)
88
+	 *
89
+	 * @param EE_Form_Input_With_Options_Base $input
90
+	 * @return string
91
+	 */
92
+	protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input)
93
+	{
94
+		if ($input->display_html_label_text() != '') {
95
+			$class = $input->required()
96
+				? 'ee-required-label ' . $input->html_label_class()
97
+				: $input->html_label_class();
98
+			$label_text = $input->required()
99
+				? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
100
+				: $input->html_label_text();
101
+			$html = '<div id="' . $input->html_label_id() . '"';
102
+			$html .= ' class="' . $class . '"';
103
+			$html .= ' style="' . $input->html_label_style() . '">';
104
+			$html .= $label_text . '</div>';
105
+			return $html;
106
+		} else {
107
+			return '';
108
+		}
109
+	}
110
+
111
+
112
+
113
+	/**
114
+	 * Lays out a row for the subsection
115
+	 *
116
+	 * @param EE_Form_Section_Proper $form_section
117
+	 * @return string
118
+	 */
119
+	public function layout_subsection($form_section)
120
+	{
121
+		//		d( $form_section );
122
+		return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
123
+	}
124
+
125
+
126
+
127
+	/**
128
+	 * closing div tag for a form
129
+	 *
130
+	 * @return string
131
+	 */
132
+	public function layout_form_end()
133
+	{
134
+		return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
135
+	}
136 136
 }
137 137
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,39 +41,39 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $html = '';
43 43
         if ($input instanceof EE_Hidden_Input) {
44
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
44
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
45 45
         } elseif ($input instanceof EE_Submit_Input) {
46 46
             $html .= EEH_HTML::div(
47 47
                 $input->get_html_for_input(),
48
-                $input->html_id() . '-submit-dv',
49
-                $input->html_class() . '-submit-dv'
48
+                $input->html_id().'-submit-dv',
49
+                $input->html_class().'-submit-dv'
50 50
             );
51 51
         } elseif ($input instanceof EE_Select_Input) {
52 52
             $html .= EEH_HTML::div(
53
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
54
-                EEH_HTML::nl() . $input->get_html_for_errors() .
55
-                EEH_HTML::nl() . $input->get_html_for_input() .
56
-                EEH_HTML::nl() . $input->get_html_for_help(),
57
-                $input->html_id() . '-input-dv',
58
-                $input->html_class() . '-input-dv'
53
+                EEH_HTML::nl(1).$input->get_html_for_label().
54
+                EEH_HTML::nl().$input->get_html_for_errors().
55
+                EEH_HTML::nl().$input->get_html_for_input().
56
+                EEH_HTML::nl().$input->get_html_for_help(),
57
+                $input->html_id().'-input-dv',
58
+                $input->html_class().'-input-dv'
59 59
             );
60 60
         } elseif ($input instanceof EE_Form_Input_With_Options_Base) {
61 61
             $html .= EEH_HTML::div(
62
-                EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) .
63
-                EEH_HTML::nl() . $input->get_html_for_errors() .
64
-                EEH_HTML::nl() . $input->get_html_for_input() .
65
-                EEH_HTML::nl() . $input->get_html_for_help(),
66
-                $input->html_id() . '-input-dv',
67
-                $input->html_class() . '-input-dv'
62
+                EEH_HTML::nl().$this->_display_label_for_option_type_question($input).
63
+                EEH_HTML::nl().$input->get_html_for_errors().
64
+                EEH_HTML::nl().$input->get_html_for_input().
65
+                EEH_HTML::nl().$input->get_html_for_help(),
66
+                $input->html_id().'-input-dv',
67
+                $input->html_class().'-input-dv'
68 68
             );
69 69
         } else {
70 70
             $html .= EEH_HTML::div(
71
-                EEH_HTML::nl(1) . $input->get_html_for_label() .
72
-                EEH_HTML::nl() . $input->get_html_for_errors() .
73
-                EEH_HTML::nl() . $input->get_html_for_input() .
74
-                EEH_HTML::nl() . $input->get_html_for_help(),
75
-                $input->html_id() . '-input-dv',
76
-                $input->html_class() . '-input-dv'
71
+                EEH_HTML::nl(1).$input->get_html_for_label().
72
+                EEH_HTML::nl().$input->get_html_for_errors().
73
+                EEH_HTML::nl().$input->get_html_for_input().
74
+                EEH_HTML::nl().$input->get_html_for_help(),
75
+                $input->html_id().'-input-dv',
76
+                $input->html_class().'-input-dv'
77 77
             );
78 78
         }
79 79
         return $html;
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
     {
94 94
         if ($input->display_html_label_text() != '') {
95 95
             $class = $input->required()
96
-                ? 'ee-required-label ' . $input->html_label_class()
96
+                ? 'ee-required-label '.$input->html_label_class()
97 97
                 : $input->html_label_class();
98 98
             $label_text = $input->required()
99
-                ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
99
+                ? $input->html_label_text().'<span class="ee-asterisk">*</span>'
100 100
                 : $input->html_label_text();
101
-            $html = '<div id="' . $input->html_label_id() . '"';
102
-            $html .= ' class="' . $class . '"';
103
-            $html .= ' style="' . $input->html_label_style() . '">';
104
-            $html .= $label_text . '</div>';
101
+            $html = '<div id="'.$input->html_label_id().'"';
102
+            $html .= ' class="'.$class.'"';
103
+            $html .= ' style="'.$input->html_label_style().'">';
104
+            $html .= $label_text.'</div>';
105 105
             return $html;
106 106
         } else {
107 107
             return '';
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function layout_subsection($form_section)
120 120
     {
121 121
         //		d( $form_section );
122
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
122
+        return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1);
123 123
     }
124 124
 
125 125
 
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Fieldset_Section_Layout.strategy.php 2 patches
Indentation   +104 added lines, -104 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
 
@@ -16,109 +16,109 @@  discard block
 block discarded – undo
16 16
 class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout
17 17
 {
18 18
 
19
-    /**
20
-     * legend_class
21
-     *
22
-     * @var string
23
-     */
24
-    protected $_legend_class;
25
-
26
-    /**
27
-     * legend_text
28
-     *
29
-     * @var string
30
-     */
31
-    protected $_legend_text;
32
-
33
-
34
-
35
-    /**
36
-     *    construct
37
-     *
38
-     * @param array $options
39
-     */
40
-    public function __construct($options = array())
41
-    {
42
-        foreach ($options as $key => $value) {
43
-            $key = '_' . $key;
44
-            if (property_exists($this, $key)) {
45
-                $this->{$key} = $value;
46
-            }
47
-        }
48
-    }
49
-
50
-
51
-
52
-    /**
53
-     * opening div tag for a form
54
-     *
55
-     * @return string
56
-     */
57
-    public function layout_form_begin()
58
-    {
59
-        $html = EEH_HTML::nl(1)
60
-                . '<fieldset id="'
61
-                . $this->_form_section->html_id()
62
-                . '" class="'
63
-                . $this->_form_section->html_class()
64
-                . '" style="'
65
-                . $this->_form_section->html_style()
66
-                . '">';
67
-        $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>';
68
-        return $html;
69
-    }
70
-
71
-
72
-
73
-    /**
74
-     * closing div tag for a form
75
-     *
76
-     * @return string
77
-     */
78
-    public function layout_form_end()
79
-    {
80
-        return EEH_HTML::nl(-1) . '</fieldset>';
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     * @param string $legend_class
87
-     */
88
-    public function set_legend_class($legend_class)
89
-    {
90
-        $this->_legend_class = $legend_class;
91
-    }
92
-
93
-
94
-
95
-    /**
96
-     * @return string
97
-     */
98
-    public function legend_class()
99
-    {
100
-        return $this->_legend_class;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * @param string $legend_text
107
-     */
108
-    public function set_legend_text($legend_text)
109
-    {
110
-        $this->_legend_text = $legend_text;
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * @return string
117
-     */
118
-    public function legend_text()
119
-    {
120
-        return $this->_legend_text;
121
-    }
19
+	/**
20
+	 * legend_class
21
+	 *
22
+	 * @var string
23
+	 */
24
+	protected $_legend_class;
25
+
26
+	/**
27
+	 * legend_text
28
+	 *
29
+	 * @var string
30
+	 */
31
+	protected $_legend_text;
32
+
33
+
34
+
35
+	/**
36
+	 *    construct
37
+	 *
38
+	 * @param array $options
39
+	 */
40
+	public function __construct($options = array())
41
+	{
42
+		foreach ($options as $key => $value) {
43
+			$key = '_' . $key;
44
+			if (property_exists($this, $key)) {
45
+				$this->{$key} = $value;
46
+			}
47
+		}
48
+	}
49
+
50
+
51
+
52
+	/**
53
+	 * opening div tag for a form
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function layout_form_begin()
58
+	{
59
+		$html = EEH_HTML::nl(1)
60
+				. '<fieldset id="'
61
+				. $this->_form_section->html_id()
62
+				. '" class="'
63
+				. $this->_form_section->html_class()
64
+				. '" style="'
65
+				. $this->_form_section->html_style()
66
+				. '">';
67
+		$html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>';
68
+		return $html;
69
+	}
70
+
71
+
72
+
73
+	/**
74
+	 * closing div tag for a form
75
+	 *
76
+	 * @return string
77
+	 */
78
+	public function layout_form_end()
79
+	{
80
+		return EEH_HTML::nl(-1) . '</fieldset>';
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 * @param string $legend_class
87
+	 */
88
+	public function set_legend_class($legend_class)
89
+	{
90
+		$this->_legend_class = $legend_class;
91
+	}
92
+
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 */
98
+	public function legend_class()
99
+	{
100
+		return $this->_legend_class;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * @param string $legend_text
107
+	 */
108
+	public function set_legend_text($legend_text)
109
+	{
110
+		$this->_legend_text = $legend_text;
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * @return string
117
+	 */
118
+	public function legend_text()
119
+	{
120
+		return $this->_legend_text;
121
+	}
122 122
 
123 123
 
124 124
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 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
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function __construct($options = array())
41 41
     {
42 42
         foreach ($options as $key => $value) {
43
-            $key = '_' . $key;
43
+            $key = '_'.$key;
44 44
             if (property_exists($this, $key)) {
45 45
                 $this->{$key} = $value;
46 46
             }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 . '" style="'
65 65
                 . $this->_form_section->html_style()
66 66
                 . '">';
67
-        $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>';
67
+        $html .= '<legend class="'.$this->legend_class().'">'.$this->legend_text().'</legend>';
68 68
         return $html;
69 69
     }
70 70
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function layout_form_end()
79 79
     {
80
-        return EEH_HTML::nl(-1) . '</fieldset>';
80
+        return EEH_HTML::nl(-1).'</fieldset>';
81 81
     }
82 82
 
83 83
 
Please login to merge, or discard this patch.
core/libraries/form_sections/strategies/layout/EE_No_Layout.strategy.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -15,117 +15,117 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    /**
19
-     * This is a flag indicating whether to use '<br>' tags after each input in the layout
20
-     * strategy.
21
-     *
22
-     * @var bool
23
-     */
24
-    protected $_use_break_tags = true;
25
-
26
-
27
-
28
-    /**
29
-     * EE_No_Layout constructor.
30
-     *
31
-     * @param array $options  Currently if this has a 'use_break_tags' key that is used to set the _use_break_tags
32
-     *                        property on the class.
33
-     */
34
-    public function __construct($options = array())
35
-    {
36
-        $this->_use_break_tags = is_array($options) && isset($options['use_break_tags'])
37
-            ? filter_var($options['use_break_tags'], FILTER_VALIDATE_BOOLEAN)
38
-            : $this->_use_break_tags;
39
-        parent::__construct();
40
-    }
41
-
42
-
43
-
44
-    /**
45
-     * Add line break at beginning of form
46
-     *
47
-     * @return string
48
-     */
49
-    public function layout_form_begin()
50
-    {
51
-        return EEH_HTML::nl(1);
52
-    }
53
-
54
-
55
-
56
-    /**
57
-     * Lays out the row for the input, including label and errors
58
-     *
59
-     * @param EE_Form_Input_Base $input
60
-     * @return string
61
-     * @throws \EE_Error
62
-     */
63
-    public function layout_input($input)
64
-    {
65
-        $html = '';
66
-        if ($input instanceof EE_Hidden_Input) {
67
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
68
-        } elseif ($input instanceof EE_Submit_Input) {
69
-            $html .= $this->br();
70
-            $html .= $input->get_html_for_input();
71
-        } elseif ($input instanceof EE_Select_Input) {
72
-            $html .= $this->br();
73
-            $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
74
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
75
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
76
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
77
-            $html .= $this->br();
78
-        } elseif ($input instanceof EE_Form_Input_With_Options_Base) {
79
-            $html .= $this->br();
80
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
81
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
82
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
83
-        } else {
84
-            $html .= $this->br();
85
-            $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
86
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
87
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
88
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
89
-        }
90
-        $html .= EEH_HTML::nl(-1);
91
-        return $html;
92
-    }
93
-
94
-
95
-
96
-    /**
97
-     * Lays out a row for the subsection
98
-     *
99
-     * @param EE_Form_Section_Proper $form_section
100
-     * @return string
101
-     */
102
-    public function layout_subsection($form_section)
103
-    {
104
-        //		d( $form_section );
105
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
106
-    }
107
-
108
-
109
-
110
-    /**
111
-     * Add line break at end of form.
112
-     *
113
-     * @return string
114
-     */
115
-    public function layout_form_end()
116
-    {
117
-        return EEH_HTML::nl(-1);
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * This returns a break tag or an empty string depending on the value of the `_use_break_tags` property.
124
-     *
125
-     * @return string
126
-     */
127
-    protected function br()
128
-    {
129
-        return $this->_use_break_tags ? EEH_HTML::br() : '';
130
-    }
18
+	/**
19
+	 * This is a flag indicating whether to use '<br>' tags after each input in the layout
20
+	 * strategy.
21
+	 *
22
+	 * @var bool
23
+	 */
24
+	protected $_use_break_tags = true;
25
+
26
+
27
+
28
+	/**
29
+	 * EE_No_Layout constructor.
30
+	 *
31
+	 * @param array $options  Currently if this has a 'use_break_tags' key that is used to set the _use_break_tags
32
+	 *                        property on the class.
33
+	 */
34
+	public function __construct($options = array())
35
+	{
36
+		$this->_use_break_tags = is_array($options) && isset($options['use_break_tags'])
37
+			? filter_var($options['use_break_tags'], FILTER_VALIDATE_BOOLEAN)
38
+			: $this->_use_break_tags;
39
+		parent::__construct();
40
+	}
41
+
42
+
43
+
44
+	/**
45
+	 * Add line break at beginning of form
46
+	 *
47
+	 * @return string
48
+	 */
49
+	public function layout_form_begin()
50
+	{
51
+		return EEH_HTML::nl(1);
52
+	}
53
+
54
+
55
+
56
+	/**
57
+	 * Lays out the row for the input, including label and errors
58
+	 *
59
+	 * @param EE_Form_Input_Base $input
60
+	 * @return string
61
+	 * @throws \EE_Error
62
+	 */
63
+	public function layout_input($input)
64
+	{
65
+		$html = '';
66
+		if ($input instanceof EE_Hidden_Input) {
67
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
68
+		} elseif ($input instanceof EE_Submit_Input) {
69
+			$html .= $this->br();
70
+			$html .= $input->get_html_for_input();
71
+		} elseif ($input instanceof EE_Select_Input) {
72
+			$html .= $this->br();
73
+			$html .= EEH_HTML::nl(1) . $input->get_html_for_label();
74
+			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
75
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
76
+			$html .= EEH_HTML::nl() . $input->get_html_for_help();
77
+			$html .= $this->br();
78
+		} elseif ($input instanceof EE_Form_Input_With_Options_Base) {
79
+			$html .= $this->br();
80
+			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
81
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
82
+			$html .= EEH_HTML::nl() . $input->get_html_for_help();
83
+		} else {
84
+			$html .= $this->br();
85
+			$html .= EEH_HTML::nl(1) . $input->get_html_for_label();
86
+			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
87
+			$html .= EEH_HTML::nl() . $input->get_html_for_input();
88
+			$html .= EEH_HTML::nl() . $input->get_html_for_help();
89
+		}
90
+		$html .= EEH_HTML::nl(-1);
91
+		return $html;
92
+	}
93
+
94
+
95
+
96
+	/**
97
+	 * Lays out a row for the subsection
98
+	 *
99
+	 * @param EE_Form_Section_Proper $form_section
100
+	 * @return string
101
+	 */
102
+	public function layout_subsection($form_section)
103
+	{
104
+		//		d( $form_section );
105
+		return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
106
+	}
107
+
108
+
109
+
110
+	/**
111
+	 * Add line break at end of form.
112
+	 *
113
+	 * @return string
114
+	 */
115
+	public function layout_form_end()
116
+	{
117
+		return EEH_HTML::nl(-1);
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * This returns a break tag or an empty string depending on the value of the `_use_break_tags` property.
124
+	 *
125
+	 * @return string
126
+	 */
127
+	protected function br()
128
+	{
129
+		return $this->_use_break_tags ? EEH_HTML::br() : '';
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $html = '';
66 66
         if ($input instanceof EE_Hidden_Input) {
67
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
67
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
68 68
         } elseif ($input instanceof EE_Submit_Input) {
69 69
             $html .= $this->br();
70 70
             $html .= $input->get_html_for_input();
71 71
         } elseif ($input instanceof EE_Select_Input) {
72 72
             $html .= $this->br();
73
-            $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
74
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
75
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
76
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
73
+            $html .= EEH_HTML::nl(1).$input->get_html_for_label();
74
+            $html .= EEH_HTML::nl().$input->get_html_for_errors();
75
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
76
+            $html .= EEH_HTML::nl().$input->get_html_for_help();
77 77
             $html .= $this->br();
78 78
         } elseif ($input instanceof EE_Form_Input_With_Options_Base) {
79 79
             $html .= $this->br();
80
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
81
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
82
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
80
+            $html .= EEH_HTML::nl().$input->get_html_for_errors();
81
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
82
+            $html .= EEH_HTML::nl().$input->get_html_for_help();
83 83
         } else {
84 84
             $html .= $this->br();
85
-            $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
86
-            $html .= EEH_HTML::nl() . $input->get_html_for_errors();
87
-            $html .= EEH_HTML::nl() . $input->get_html_for_input();
88
-            $html .= EEH_HTML::nl() . $input->get_html_for_help();
85
+            $html .= EEH_HTML::nl(1).$input->get_html_for_label();
86
+            $html .= EEH_HTML::nl().$input->get_html_for_errors();
87
+            $html .= EEH_HTML::nl().$input->get_html_for_input();
88
+            $html .= EEH_HTML::nl().$input->get_html_for_help();
89 89
         }
90 90
         $html .= EEH_HTML::nl(-1);
91 91
         return $html;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     public function layout_subsection($form_section)
103 103
     {
104 104
         //		d( $form_section );
105
-        return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
105
+        return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1);
106 106
     }
107 107
 
108 108
 
Please login to merge, or discard this patch.
libraries/form_sections/strategies/layout/EE_Two_Column_Layout.strategy.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -5,80 +5,80 @@
 block discarded – undo
5 5
 class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base
6 6
 {
7 7
 
8
-    /**
9
-     * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
10
-     *
11
-     * @param array $additional_args
12
-     * @return string
13
-     */
14
-    public function layout_form_begin($additional_args = array())
15
-    {
16
-        return EEH_HTML::table(
17
-            '',
18
-            $this->_form_section->html_id(),
19
-            $this->_form_section->html_class(),
20
-            $this->_form_section->html_style()
21
-        ) . EEH_HTML::tbody();
22
-    }
8
+	/**
9
+	 * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
10
+	 *
11
+	 * @param array $additional_args
12
+	 * @return string
13
+	 */
14
+	public function layout_form_begin($additional_args = array())
15
+	{
16
+		return EEH_HTML::table(
17
+			'',
18
+			$this->_form_section->html_id(),
19
+			$this->_form_section->html_class(),
20
+			$this->_form_section->html_style()
21
+		) . EEH_HTML::tbody();
22
+	}
23 23
 
24 24
 
25 25
 
26
-    /**
27
-     * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
28
-     *
29
-     * @param array $additional_args
30
-     * @return string
31
-     */
32
-    public function layout_form_end($additional_args = array())
33
-    {
34
-        return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
35
-    }
26
+	/**
27
+	 * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
28
+	 *
29
+	 * @param array $additional_args
30
+	 * @return string
31
+	 */
32
+	public function layout_form_end($additional_args = array())
33
+	{
34
+		return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
35
+	}
36 36
 
37 37
 
38 38
 
39
-    /**
40
-     * Lays out the row for the input, including label and errors
41
-     *
42
-     * @param EE_Form_Input_Base $input
43
-     * @return string
44
-     */
45
-    public function layout_input($input)
46
-    {
47
-        $html = '';
48
-        if ($input instanceof EE_Hidden_Input) {
49
-            $html .= $input->get_html_for_input();
50
-        } else {
51
-            $html_for_input = $input->get_html_for_input();
52
-            $html_for_input .= $input->get_html_for_errors() != ''
53
-                ? EEH_HTML::nl() . $input->get_html_for_errors()
54
-                : '';
55
-            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
56
-            $html .= EEH_HTML::tr(
57
-                EEH_HTML::th($input->get_html_for_label()) .
58
-                EEH_HTML::td($html_for_input)
59
-            );
60
-        }
61
-        return $html;
62
-    }
39
+	/**
40
+	 * Lays out the row for the input, including label and errors
41
+	 *
42
+	 * @param EE_Form_Input_Base $input
43
+	 * @return string
44
+	 */
45
+	public function layout_input($input)
46
+	{
47
+		$html = '';
48
+		if ($input instanceof EE_Hidden_Input) {
49
+			$html .= $input->get_html_for_input();
50
+		} else {
51
+			$html_for_input = $input->get_html_for_input();
52
+			$html_for_input .= $input->get_html_for_errors() != ''
53
+				? EEH_HTML::nl() . $input->get_html_for_errors()
54
+				: '';
55
+			$html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
56
+			$html .= EEH_HTML::tr(
57
+				EEH_HTML::th($input->get_html_for_label()) .
58
+				EEH_HTML::td($html_for_input)
59
+			);
60
+		}
61
+		return $html;
62
+	}
63 63
 
64 64
 
65 65
 
66
-    /**
67
-     * Lays out a row for the subsection
68
-     *
69
-     * @param EE_Form_Section_Proper $form_section
70
-     * @return string
71
-     */
72
-    public function layout_subsection($form_section)
73
-    {
74
-        $html = '';
75
-        if ($form_section instanceof EE_Form_Section_HTML) {
76
-            $html .= $form_section->get_html();
77
-        } else {
78
-            $html .= EEH_HTML::tr(
79
-                EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"')
80
-            );
81
-        }
82
-        return $html;
83
-    }
66
+	/**
67
+	 * Lays out a row for the subsection
68
+	 *
69
+	 * @param EE_Form_Section_Proper $form_section
70
+	 * @return string
71
+	 */
72
+	public function layout_subsection($form_section)
73
+	{
74
+		$html = '';
75
+		if ($form_section instanceof EE_Form_Section_HTML) {
76
+			$html .= $form_section->get_html();
77
+		} else {
78
+			$html .= EEH_HTML::tr(
79
+				EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"')
80
+			);
81
+		}
82
+		return $html;
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             $this->_form_section->html_id(),
19 19
             $this->_form_section->html_class(),
20 20
             $this->_form_section->html_style()
21
-        ) . EEH_HTML::tbody();
21
+        ).EEH_HTML::tbody();
22 22
     }
23 23
 
24 24
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function layout_form_end($additional_args = array())
33 33
     {
34
-        return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
34
+        return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id());
35 35
     }
36 36
 
37 37
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
         } else {
51 51
             $html_for_input = $input->get_html_for_input();
52 52
             $html_for_input .= $input->get_html_for_errors() != ''
53
-                ? EEH_HTML::nl() . $input->get_html_for_errors()
53
+                ? EEH_HTML::nl().$input->get_html_for_errors()
54 54
                 : '';
55
-            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
55
+            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : '';
56 56
             $html .= EEH_HTML::tr(
57
-                EEH_HTML::th($input->get_html_for_label()) .
57
+                EEH_HTML::th($input->get_html_for_label()).
58 58
                 EEH_HTML::td($html_for_input)
59 59
             );
60 60
         }
Please login to merge, or discard this patch.
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.
espresso.php 1 patch
Indentation   +221 added lines, -221 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,245 +40,245 @@  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.005');
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.005');
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_Psr4AutoloaderInit', EE_CORE . 'EE_Psr4AutoloaderInit.core.php');
262
-        new EE_Psr4AutoloaderInit();
263
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
264
-        new EE_Bootstrap();
265
-    }
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_Psr4AutoloaderInit', EE_CORE . 'EE_Psr4AutoloaderInit.core.php');
262
+		new EE_Psr4AutoloaderInit();
263
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
264
+		new EE_Bootstrap();
265
+	}
266 266
 }
267 267
 if ( ! function_exists('espresso_deactivate_plugin')) {
268
-    /**
269
-     *    deactivate_plugin
270
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
271
-     *
272
-     * @access public
273
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
274
-     * @return    void
275
-     */
276
-    function espresso_deactivate_plugin($plugin_basename = '')
277
-    {
278
-        if ( ! function_exists('deactivate_plugins')) {
279
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
280
-        }
281
-        unset($_GET['activate'], $_REQUEST['activate']);
282
-        deactivate_plugins($plugin_basename);
283
-    }
268
+	/**
269
+	 *    deactivate_plugin
270
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
271
+	 *
272
+	 * @access public
273
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
274
+	 * @return    void
275
+	 */
276
+	function espresso_deactivate_plugin($plugin_basename = '')
277
+	{
278
+		if ( ! function_exists('deactivate_plugins')) {
279
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
280
+		}
281
+		unset($_GET['activate'], $_REQUEST['activate']);
282
+		deactivate_plugins($plugin_basename);
283
+	}
284 284
 }
285 285
\ No newline at end of file
Please login to merge, or discard this patch.