Completed
Pull Request — master (#1312)
by
unknown
12:50 queued 03:42
created
core/libraries/shortcodes/EE_Event_List_Shortcodes.lib.php 1 patch
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -21,139 +21,139 @@
 block discarded – undo
21 21
 class EE_Event_List_Shortcodes extends EE_Shortcodes
22 22
 {
23 23
 
24
-    public function __construct()
25
-    {
26
-        parent::__construct();
27
-    }
28
-
29
-
30
-    protected function _init_props()
31
-    {
32
-        $this->label = __('Event List Shortcodes', 'event_espresso');
33
-        $this->description = __('All shortcodes specific to event lists', 'event_espresso');
34
-        $this->_shortcodes = array(
35
-            '[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'),
36
-        );
37
-    }
38
-
39
-
40
-    protected function _parser($shortcode)
41
-    {
42
-        switch ($shortcode) {
43
-            case '[EVENT_LIST]':
44
-                return $this->_get_event_list();
45
-                break;
46
-        }
47
-    }
48
-
49
-
50
-    /**
51
-     * figure out what the incoming data is and then return the appropriate parsed value.
52
-     *
53
-     * @return string
54
-     */
55
-    private function _get_event_list()
56
-    {
57
-        $this->_validate_list_requirements();
58
-
59
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
60
-            return $this->_get_event_list_for_main();
61
-        } elseif ($this->_data['data'] instanceof EE_Registration) {
62
-            return $this->_get_event_list_for_registration();
63
-        } // prevent recursive loop
64
-        else {
65
-            return '';
66
-        }
67
-    }
68
-
69
-
70
-    /**
71
-     * This returns the parsed event list for main template
72
-     *
73
-     * @return string
74
-     */
75
-    private function _get_event_list_for_main()
76
-    {
77
-
78
-        $valid_shortcodes = array(
79
-            'event',
80
-            'attendee_list',
81
-            'ticket_list',
82
-            'datetime_list',
83
-            'venue',
84
-            'attendee',
85
-            'recipient_list',
86
-            'recipient_details',
87
-            'primary_registration_list',
88
-            'primary_registration_details',
89
-            'event_author',
90
-            'organization',
91
-        );
92
-        $template = $this->_data['template'];
93
-        $data = $this->_data['data'];
94
-        $events = '';
95
-
96
-        // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
97
-        foreach ($data->events as $event) {
98
-            $events .= $this->_shortcode_helper->parse_event_list_template(
99
-                $template,
100
-                $event['event'],
101
-                $valid_shortcodes,
102
-                $this->_extra_data
103
-            );
104
-        }
105
-        return $events;
106
-    }
107
-
108
-
109
-    /**
110
-     * This returns the parsed event list for an attendee
111
-     *
112
-     * @return string
113
-     */
114
-    private function _get_event_list_for_registration()
115
-    {
116
-        $valid_shortcodes = array(
117
-            'event',
118
-            'ticket_list',
119
-            'datetime_list',
120
-            'attendee',
121
-            'event_author',
122
-            'recipient_details',
123
-            'recipient_list',
124
-            'venue',
125
-            'organization',
126
-        );
127
-        $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
128
-            ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list'];
129
-        $registration = $this->_data['data'];
130
-
131
-        // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
132
-        $template = str_replace('[ATTENDEE_LIST]', '', $template);
133
-
134
-        // here we're setting up the events for the event_list template for THIS registration.
135
-        $evt_result = '';
136
-        $all_events = $this->_get_events_from_registration($registration);
137
-
138
-        // we're NOT going to prepare a list of attendees this time around
139
-        $events = '';
140
-
141
-        foreach ((array) $all_events as $event) {
142
-            $events .= $this->_shortcode_helper->parse_event_list_template(
143
-                $template,
144
-                $event,
145
-                $valid_shortcodes,
146
-                $this->_extra_data
147
-            );
148
-        }
149
-
150
-        return $events;
151
-    }
152
-
153
-
154
-    private function _get_events_from_registration(EE_Registration $registration)
155
-    {
156
-        return isset($this->_extra_data['data']->registrations)
157
-            ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array();
158
-    }
24
+	public function __construct()
25
+	{
26
+		parent::__construct();
27
+	}
28
+
29
+
30
+	protected function _init_props()
31
+	{
32
+		$this->label = __('Event List Shortcodes', 'event_espresso');
33
+		$this->description = __('All shortcodes specific to event lists', 'event_espresso');
34
+		$this->_shortcodes = array(
35
+			'[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'),
36
+		);
37
+	}
38
+
39
+
40
+	protected function _parser($shortcode)
41
+	{
42
+		switch ($shortcode) {
43
+			case '[EVENT_LIST]':
44
+				return $this->_get_event_list();
45
+				break;
46
+		}
47
+	}
48
+
49
+
50
+	/**
51
+	 * figure out what the incoming data is and then return the appropriate parsed value.
52
+	 *
53
+	 * @return string
54
+	 */
55
+	private function _get_event_list()
56
+	{
57
+		$this->_validate_list_requirements();
58
+
59
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
60
+			return $this->_get_event_list_for_main();
61
+		} elseif ($this->_data['data'] instanceof EE_Registration) {
62
+			return $this->_get_event_list_for_registration();
63
+		} // prevent recursive loop
64
+		else {
65
+			return '';
66
+		}
67
+	}
68
+
69
+
70
+	/**
71
+	 * This returns the parsed event list for main template
72
+	 *
73
+	 * @return string
74
+	 */
75
+	private function _get_event_list_for_main()
76
+	{
77
+
78
+		$valid_shortcodes = array(
79
+			'event',
80
+			'attendee_list',
81
+			'ticket_list',
82
+			'datetime_list',
83
+			'venue',
84
+			'attendee',
85
+			'recipient_list',
86
+			'recipient_details',
87
+			'primary_registration_list',
88
+			'primary_registration_details',
89
+			'event_author',
90
+			'organization',
91
+		);
92
+		$template = $this->_data['template'];
93
+		$data = $this->_data['data'];
94
+		$events = '';
95
+
96
+		// now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
97
+		foreach ($data->events as $event) {
98
+			$events .= $this->_shortcode_helper->parse_event_list_template(
99
+				$template,
100
+				$event['event'],
101
+				$valid_shortcodes,
102
+				$this->_extra_data
103
+			);
104
+		}
105
+		return $events;
106
+	}
107
+
108
+
109
+	/**
110
+	 * This returns the parsed event list for an attendee
111
+	 *
112
+	 * @return string
113
+	 */
114
+	private function _get_event_list_for_registration()
115
+	{
116
+		$valid_shortcodes = array(
117
+			'event',
118
+			'ticket_list',
119
+			'datetime_list',
120
+			'attendee',
121
+			'event_author',
122
+			'recipient_details',
123
+			'recipient_list',
124
+			'venue',
125
+			'organization',
126
+		);
127
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
128
+			? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list'];
129
+		$registration = $this->_data['data'];
130
+
131
+		// let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
132
+		$template = str_replace('[ATTENDEE_LIST]', '', $template);
133
+
134
+		// here we're setting up the events for the event_list template for THIS registration.
135
+		$evt_result = '';
136
+		$all_events = $this->_get_events_from_registration($registration);
137
+
138
+		// we're NOT going to prepare a list of attendees this time around
139
+		$events = '';
140
+
141
+		foreach ((array) $all_events as $event) {
142
+			$events .= $this->_shortcode_helper->parse_event_list_template(
143
+				$template,
144
+				$event,
145
+				$valid_shortcodes,
146
+				$this->_extra_data
147
+			);
148
+		}
149
+
150
+		return $events;
151
+	}
152
+
153
+
154
+	private function _get_events_from_registration(EE_Registration $registration)
155
+	{
156
+		return isset($this->_extra_data['data']->registrations)
157
+			? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array();
158
+	}
159 159
 }
Please login to merge, or discard this patch.