Completed
Branch 973/fix-visible-recaptcha (0580c7)
by
unknown
03:03 queued 30s
created
core/libraries/messages/message_type/EE_Invoice_message_type.class.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     protected function _set_admin_pages()
54 54
     {
55
-        $this->admin_registered_pages = array( 'events_edit' => true );
55
+        $this->admin_registered_pages = array('events_edit' => true);
56 56
     }
57 57
 
58 58
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     protected function _set_with_messengers()
68 68
     {
69 69
         $this->_with_messengers = array(
70
-            'html' => array( 'pdf' )
70
+            'html' => array('pdf')
71 71
             );
72 72
     }
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         // receipt message type data handler is 'Gateways' and it expects a transaction object.
79 79
         $transaction = $registration->transaction();
80 80
         if ($transaction instanceof EE_Transaction) {
81
-            return array( $transaction );
81
+            return array($transaction);
82 82
         }
83 83
         return array();
84 84
     }
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -13,123 +13,123 @@
 block discarded – undo
13 13
 class EE_Invoice_message_type extends EE_message_type
14 14
 {
15 15
 
16
-    public function __construct()
17
-    {
18
-        $this->name = 'invoice';
19
-        $this->description = esc_html__('The invoice message type is triggered via a url on the thank you page and via at url generated by the [INVOICE_URL] or [INVOICE_LINK] shortcode.', 'event_espresso');
20
-        $this->label = array(
21
-            'singular' => esc_html__('invoice', 'event_espresso'),
22
-            'plural' => esc_html__('invoices', 'event_espresso')
23
-        );
24
-        $this->_master_templates = array();
25
-        parent::__construct();
26
-    }
16
+	public function __construct()
17
+	{
18
+		$this->name = 'invoice';
19
+		$this->description = esc_html__('The invoice message type is triggered via a url on the thank you page and via at url generated by the [INVOICE_URL] or [INVOICE_LINK] shortcode.', 'event_espresso');
20
+		$this->label = array(
21
+			'singular' => esc_html__('invoice', 'event_espresso'),
22
+			'plural' => esc_html__('invoices', 'event_espresso')
23
+		);
24
+		$this->_master_templates = array();
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * @see parent::get_priority() for documentation.
32
-     * @return int
33
-     */
34
-    public function get_priority()
35
-    {
36
-        return EEM_Message::priority_high;
37
-    }
30
+	/**
31
+	 * @see parent::get_priority() for documentation.
32
+	 * @return int
33
+	 */
34
+	public function get_priority()
35
+	{
36
+		return EEM_Message::priority_high;
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * This method returns whether this message type should always generate a new copy
42
-     * when requested, or if links can be to the already generated copy.
43
-     * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table.
44
-     * Invoices always generate.
45
-     * @return bool     false means can link to generated EE_Message.  true must regenerate.
46
-     */
47
-    public function always_generate()
48
-    {
49
-        return true;
50
-    }
40
+	/**
41
+	 * This method returns whether this message type should always generate a new copy
42
+	 * when requested, or if links can be to the already generated copy.
43
+	 * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table.
44
+	 * Invoices always generate.
45
+	 * @return bool     false means can link to generated EE_Message.  true must regenerate.
46
+	 */
47
+	public function always_generate()
48
+	{
49
+		return true;
50
+	}
51 51
 
52 52
 
53
-    protected function _set_admin_pages()
54
-    {
55
-        $this->admin_registered_pages = array( 'events_edit' => true );
56
-    }
53
+	protected function _set_admin_pages()
54
+	{
55
+		$this->admin_registered_pages = array( 'events_edit' => true );
56
+	}
57 57
 
58 58
 
59 59
 
60
-    protected function _set_data_handler()
61
-    {
62
-        $this->_data_handler = 'Gateways';
63
-    }
60
+	protected function _set_data_handler()
61
+	{
62
+		$this->_data_handler = 'Gateways';
63
+	}
64 64
 
65 65
 
66 66
 
67
-    protected function _set_with_messengers()
68
-    {
69
-        $this->_with_messengers = array(
70
-            'html' => array( 'pdf' )
71
-            );
72
-    }
67
+	protected function _set_with_messengers()
68
+	{
69
+		$this->_with_messengers = array(
70
+			'html' => array( 'pdf' )
71
+			);
72
+	}
73 73
 
74 74
 
75 75
 
76
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
77
-    {
78
-        // receipt message type data handler is 'Gateways' and it expects a transaction object.
79
-        $transaction = $registration->transaction();
80
-        if ($transaction instanceof EE_Transaction) {
81
-            return array( $transaction );
82
-        }
83
-        return array();
84
-    }
76
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
77
+	{
78
+		// receipt message type data handler is 'Gateways' and it expects a transaction object.
79
+		$transaction = $registration->transaction();
80
+		if ($transaction instanceof EE_Transaction) {
81
+			return array( $transaction );
82
+		}
83
+		return array();
84
+	}
85 85
 
86 86
 
87 87
 
88
-    protected function _set_admin_settings_fields()
89
-    {
90
-        $this->_admin_settings_fields = array();
91
-    }
88
+	protected function _set_admin_settings_fields()
89
+	{
90
+		$this->_admin_settings_fields = array();
91
+	}
92 92
 
93 93
 
94 94
 
95
-    protected function _set_contexts()
96
-    {
97
-        $this->_context_label = array(
98
-            'label' => esc_html__('recipient', 'event_espresso'),
99
-            'plural' => esc_html__('recipients', 'event_espresso'),
100
-            'description' => esc_html__('Recipient\'s are who will view the invoice.', 'event_espresso')
101
-        );
95
+	protected function _set_contexts()
96
+	{
97
+		$this->_context_label = array(
98
+			'label' => esc_html__('recipient', 'event_espresso'),
99
+			'plural' => esc_html__('recipients', 'event_espresso'),
100
+			'description' => esc_html__('Recipient\'s are who will view the invoice.', 'event_espresso')
101
+		);
102 102
 
103
-        $this->_contexts = array(
104
-            'purchaser' => array(
105
-                'label' => esc_html__('Purchaser', 'event_espresso'),
106
-                'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso')
107
-            )
108
-        );
109
-    }
103
+		$this->_contexts = array(
104
+			'purchaser' => array(
105
+				'label' => esc_html__('Purchaser', 'event_espresso'),
106
+				'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso')
107
+			)
108
+		);
109
+	}
110 110
 
111 111
 
112 112
 
113 113
 
114
-    /**
115
-    * used to set the valid shortcodes for the receipt message type
116
-    *
117
-    * @since   4.5.0
118
-    *
119
-    * @return  void
120
-    */
121
-    protected function _set_valid_shortcodes()
122
-    {
123
-        $this->_valid_shortcodes['purchaser'] = array(
124
-            'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment'
125
-        );
126
-    }
114
+	/**
115
+	 * used to set the valid shortcodes for the receipt message type
116
+	 *
117
+	 * @since   4.5.0
118
+	 *
119
+	 * @return  void
120
+	 */
121
+	protected function _set_valid_shortcodes()
122
+	{
123
+		$this->_valid_shortcodes['purchaser'] = array(
124
+			'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment'
125
+		);
126
+	}
127 127
 
128 128
 
129 129
 
130 130
 
131
-    protected function _purchaser_addressees()
132
-    {
133
-        return parent::_primary_attendee_addressees();
134
-    }
131
+	protected function _purchaser_addressees()
132
+	{
133
+		return parent::_primary_attendee_addressees();
134
+	}
135 135
 }
Please login to merge, or discard this patch.
core/libraries/messages/message_type/EE_Receipt_message_type.class.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     protected function _set_admin_pages()
55 55
     {
56
-        $this->admin_registered_pages = array( 'events_edit' => true );
56
+        $this->admin_registered_pages = array('events_edit' => true);
57 57
     }
58 58
 
59 59
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     protected function _set_with_messengers()
69 69
     {
70 70
         $this->_with_messengers = array(
71
-            'html' => array( 'pdf' )
71
+            'html' => array('pdf')
72 72
         );
73 73
     }
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // receipt message type data handler is 'Gateways' and it expects a transaction object.
80 80
         $transaction = $registration->transaction();
81 81
         if ($transaction instanceof EE_Transaction) {
82
-            return array( $transaction );
82
+            return array($transaction);
83 83
         }
84 84
         return array();
85 85
     }
Please login to merge, or discard this patch.
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -13,142 +13,142 @@
 block discarded – undo
13 13
 class EE_Receipt_message_type extends EE_message_type
14 14
 {
15 15
 
16
-    public function __construct()
17
-    {
18
-        $this->name = 'receipt';
19
-        $this->description = esc_html__('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso');
20
-        $this->label = array(
21
-            'singular' => esc_html__('receipt', 'event_espresso'),
22
-            'plural' => esc_html__('receipts', 'event_espresso')
23
-        );
24
-        $this->_master_templates = array();
25
-        parent::__construct();
26
-    }
16
+	public function __construct()
17
+	{
18
+		$this->name = 'receipt';
19
+		$this->description = esc_html__('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso');
20
+		$this->label = array(
21
+			'singular' => esc_html__('receipt', 'event_espresso'),
22
+			'plural' => esc_html__('receipts', 'event_espresso')
23
+		);
24
+		$this->_master_templates = array();
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * @see parent::get_priority() for documentation.
32
-     * @return int
33
-     */
34
-    public function get_priority()
35
-    {
36
-        return EEM_Message::priority_high;
37
-    }
38
-
39
-
40
-
41
-    /**
42
-     * This method returns whether this message type should always generate a new copy
43
-     * when requested, or if links can be to the already generated copy.
44
-     * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table.
45
-     * Receipts always generate
46
-     * @return bool     false means can link to generated EE_Message.  true must regenerate.
47
-     */
48
-    public function always_generate()
49
-    {
50
-        return true;
51
-    }
52
-
53
-
54
-    protected function _set_admin_pages()
55
-    {
56
-        $this->admin_registered_pages = array( 'events_edit' => true );
57
-    }
58
-
59
-
60
-
61
-    protected function _set_data_handler()
62
-    {
63
-        $this->_data_handler = 'Gateways';
64
-    }
65
-
66
-
67
-
68
-    protected function _set_with_messengers()
69
-    {
70
-        $this->_with_messengers = array(
71
-            'html' => array( 'pdf' )
72
-        );
73
-    }
74
-
75
-
76
-
77
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
78
-    {
79
-        // receipt message type data handler is 'Gateways' and it expects a transaction object.
80
-        $transaction = $registration->transaction();
81
-        if ($transaction instanceof EE_Transaction) {
82
-            return array( $transaction );
83
-        }
84
-        return array();
85
-    }
86
-
87
-
88
-
89
-    protected function _set_admin_settings_fields()
90
-    {
91
-        $this->_admin_settings_fields = array();
92
-    }
93
-
94
-
95
-
96
-    protected function _set_contexts()
97
-    {
98
-        $this->_context_label = array(
99
-            'label' => esc_html__('recipient', 'event_espresso'),
100
-            'plural' => esc_html__('recipients', 'event_espresso'),
101
-            'description' => esc_html__('Recipient\'s are who will view the receipt.', 'event_espresso')
102
-        );
103
-
104
-        $this->_contexts = array(
105
-            'purchaser' => array(
106
-                'label' => esc_html__('Purchaser', 'event_espresso'),
107
-                'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso')
108
-            )
109
-        );
110
-    }
111
-
112
-
113
-
114
-
115
-    /**
116
-    * used to set the valid shortcodes for the receipt message type
117
-    *
118
-    * @since   4.5.0
119
-    *
120
-    * @return  void
121
-    */
122
-    protected function _set_valid_shortcodes()
123
-    {
124
-        $this->_valid_shortcodes['purchaser'] = array(
125
-            'attendee_list',
126
-            'attendee',
127
-            'datetime_list',
128
-            'datetime',
129
-            'event_list',
130
-            'event',
131
-            'event_meta',
132
-            'messenger',
133
-            'organization',
134
-            'primary_registration_list',
135
-            'primary_registration_details',
136
-            'ticket_list',
137
-            'ticket',
138
-            'transaction',
139
-            'venue',
140
-            'line_item_list',
141
-            'payment_list',
142
-            'line_item',
143
-            'payment'
144
-        );
145
-    }
146
-
30
+	/**
31
+	 * @see parent::get_priority() for documentation.
32
+	 * @return int
33
+	 */
34
+	public function get_priority()
35
+	{
36
+		return EEM_Message::priority_high;
37
+	}
38
+
39
+
40
+
41
+	/**
42
+	 * This method returns whether this message type should always generate a new copy
43
+	 * when requested, or if links can be to the already generated copy.
44
+	 * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table.
45
+	 * Receipts always generate
46
+	 * @return bool     false means can link to generated EE_Message.  true must regenerate.
47
+	 */
48
+	public function always_generate()
49
+	{
50
+		return true;
51
+	}
52
+
53
+
54
+	protected function _set_admin_pages()
55
+	{
56
+		$this->admin_registered_pages = array( 'events_edit' => true );
57
+	}
58
+
59
+
60
+
61
+	protected function _set_data_handler()
62
+	{
63
+		$this->_data_handler = 'Gateways';
64
+	}
65
+
66
+
67
+
68
+	protected function _set_with_messengers()
69
+	{
70
+		$this->_with_messengers = array(
71
+			'html' => array( 'pdf' )
72
+		);
73
+	}
74
+
75
+
76
+
77
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
78
+	{
79
+		// receipt message type data handler is 'Gateways' and it expects a transaction object.
80
+		$transaction = $registration->transaction();
81
+		if ($transaction instanceof EE_Transaction) {
82
+			return array( $transaction );
83
+		}
84
+		return array();
85
+	}
86
+
87
+
88
+
89
+	protected function _set_admin_settings_fields()
90
+	{
91
+		$this->_admin_settings_fields = array();
92
+	}
93
+
94
+
95
+
96
+	protected function _set_contexts()
97
+	{
98
+		$this->_context_label = array(
99
+			'label' => esc_html__('recipient', 'event_espresso'),
100
+			'plural' => esc_html__('recipients', 'event_espresso'),
101
+			'description' => esc_html__('Recipient\'s are who will view the receipt.', 'event_espresso')
102
+		);
103
+
104
+		$this->_contexts = array(
105
+			'purchaser' => array(
106
+				'label' => esc_html__('Purchaser', 'event_espresso'),
107
+				'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso')
108
+			)
109
+		);
110
+	}
111
+
112
+
113
+
114
+
115
+	/**
116
+	 * used to set the valid shortcodes for the receipt message type
117
+	 *
118
+	 * @since   4.5.0
119
+	 *
120
+	 * @return  void
121
+	 */
122
+	protected function _set_valid_shortcodes()
123
+	{
124
+		$this->_valid_shortcodes['purchaser'] = array(
125
+			'attendee_list',
126
+			'attendee',
127
+			'datetime_list',
128
+			'datetime',
129
+			'event_list',
130
+			'event',
131
+			'event_meta',
132
+			'messenger',
133
+			'organization',
134
+			'primary_registration_list',
135
+			'primary_registration_details',
136
+			'ticket_list',
137
+			'ticket',
138
+			'transaction',
139
+			'venue',
140
+			'line_item_list',
141
+			'payment_list',
142
+			'line_item',
143
+			'payment'
144
+		);
145
+	}
146
+
147 147
 
148 148
 
149 149
 
150
-    protected function _purchaser_addressees()
151
-    {
152
-        return parent::_primary_attendee_addressees();
153
-    }
150
+	protected function _purchaser_addressees()
151
+	{
152
+		return parent::_primary_attendee_addressees();
153
+	}
154 154
 }
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate_From_Queue.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
      */
63 63
     protected function _get_subject($custom_subject = '')
64 64
     {
65
-        if (! empty($custom_subject)) {
65
+        if ( ! empty($custom_subject)) {
66 66
             return $custom_subject;
67 67
         }
68 68
         $this->queue->get_message_repository()->rewind();
Please login to merge, or discard this patch.
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -13,90 +13,90 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * Will hold an EE_Messages_Queue object
18
-     * @type EE_Messages_Queue
19
-     */
20
-    public $queue = array();
16
+	/**
17
+	 * Will hold an EE_Messages_Queue object
18
+	 * @type EE_Messages_Queue
19
+	 */
20
+	public $queue = array();
21 21
 
22
-    /**
23
-     * @param string            $messenger_name  The messenger being used to send the message
24
-     * @param string            $message_type_name  The message type being used to grab variations etc.
25
-     * @param EE_Messages_Queue $queue
26
-     * @param string            $custom_subject  Used if a custom subject is desired for the generated aggregate EE_Message object
27
-     */
28
-    public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '')
29
-    {
30
-        $this->queue = $queue;
31
-        parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle);
32
-        if ($this->valid()) {
33
-            $this->_message->set_content($this->_get_content());
34
-            $this->_message->set_subject($this->_get_subject($custom_subject));
35
-            $this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo());
36
-        }
37
-    }
22
+	/**
23
+	 * @param string            $messenger_name  The messenger being used to send the message
24
+	 * @param string            $message_type_name  The message type being used to grab variations etc.
25
+	 * @param EE_Messages_Queue $queue
26
+	 * @param string            $custom_subject  Used if a custom subject is desired for the generated aggregate EE_Message object
27
+	 */
28
+	public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '')
29
+	{
30
+		$this->queue = $queue;
31
+		parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle);
32
+		if ($this->valid()) {
33
+			$this->_message->set_content($this->_get_content());
34
+			$this->_message->set_subject($this->_get_subject($custom_subject));
35
+			$this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo());
36
+		}
37
+	}
38 38
 
39 39
 
40 40
 
41
-    /**
42
-     * Uses the EE_Messages_Queue currently set on this object to generate the content
43
-     * for the single EE_Message aggregate object returned by get_EE_Message
44
-     * @return string;
45
-     */
46
-    protected function _get_content()
47
-    {
48
-        $content = '';
49
-        $this->queue->get_message_repository()->rewind();
50
-        while ($this->queue->get_message_repository()->valid()) {
51
-            $content .= $this->queue->get_message_repository()->current()->content();
52
-            $this->queue->get_message_repository()->next();
53
-        }
54
-        return $content;
55
-    }
41
+	/**
42
+	 * Uses the EE_Messages_Queue currently set on this object to generate the content
43
+	 * for the single EE_Message aggregate object returned by get_EE_Message
44
+	 * @return string;
45
+	 */
46
+	protected function _get_content()
47
+	{
48
+		$content = '';
49
+		$this->queue->get_message_repository()->rewind();
50
+		while ($this->queue->get_message_repository()->valid()) {
51
+			$content .= $this->queue->get_message_repository()->current()->content();
52
+			$this->queue->get_message_repository()->next();
53
+		}
54
+		return $content;
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object.
60
-     * @param string $custom_subject
61
-     *
62
-     * @return string
63
-     */
64
-    protected function _get_subject($custom_subject = '')
65
-    {
66
-        if (! empty($custom_subject)) {
67
-            return $custom_subject;
68
-        }
69
-        $this->queue->get_message_repository()->rewind();
70
-        $count_of_items = $this->queue->get_message_repository()->count();
58
+	/**
59
+	 * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object.
60
+	 * @param string $custom_subject
61
+	 *
62
+	 * @return string
63
+	 */
64
+	protected function _get_subject($custom_subject = '')
65
+	{
66
+		if (! empty($custom_subject)) {
67
+			return $custom_subject;
68
+		}
69
+		$this->queue->get_message_repository()->rewind();
70
+		$count_of_items = $this->queue->get_message_repository()->count();
71 71
 
72
-        // if $count of items in queue == 1, then let's just return the subject for that item.
73
-        if ($count_of_items === 1) {
74
-            return $this->queue->get_message_repository()->current()->subject();
75
-        }
76
-        // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder
77
-        return sprintf(
78
-            _n(
79
-                'Showing Aggregate output for 1 result',
80
-                'Showing Aggregate output for %d items',
81
-                $count_of_items,
82
-                'event_espresso'
83
-            ),
84
-            $count_of_items
85
-        );
86
-        // phpcs:enable
87
-    }
72
+		// if $count of items in queue == 1, then let's just return the subject for that item.
73
+		if ($count_of_items === 1) {
74
+			return $this->queue->get_message_repository()->current()->subject();
75
+		}
76
+		// phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder
77
+		return sprintf(
78
+			_n(
79
+				'Showing Aggregate output for 1 result',
80
+				'Showing Aggregate output for %d items',
81
+				$count_of_items,
82
+				'event_espresso'
83
+			),
84
+			$count_of_items
85
+		);
86
+		// phpcs:enable
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID
92
-     * for the single EE_Message aggregate object returned by get_EE_Message
93
-     * @return int;
94
-     */
95
-    protected function getGroupIdFromMessageRepo()
96
-    {
97
-        $this->queue->get_message_repository()->rewind();
98
-        if ($this->queue->get_message_repository()->valid()) {
99
-            return $this->queue->get_message_repository()->current()->GRP_ID();
100
-        }
101
-    }
90
+	/**
91
+	 * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID
92
+	 * for the single EE_Message aggregate object returned by get_EE_Message
93
+	 * @return int;
94
+	 */
95
+	protected function getGroupIdFromMessageRepo()
96
+	{
97
+		$this->queue->get_message_repository()->rewind();
98
+		if ($this->queue->get_message_repository()->valid()) {
99
+			return $this->queue->get_message_repository()->current()->GRP_ID();
100
+		}
101
+	}
102 102
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_List_Shortcodes.lib.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $this->_validate_list_requirements();
76 76
 
77
-        if (! $this->_data['data'] instanceof EE_Ticket) {
77
+        if ( ! $this->_data['data'] instanceof EE_Ticket) {
78 78
             return '';
79 79
         }
80 80
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         $addressee_obj = $this->_extra_data['data'];
86 86
 
87 87
         // made it here so we have an EE_Ticket, so we should have what we need.
88
-        $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
89
-            ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
90
-        $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
91
-            ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
88
+        $ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item'])
89
+            ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null;
90
+        $sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items'])
91
+            ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array();
92 92
 
93 93
         $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
94 94
             : $templates['ticket_line_item_pms'];
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         $this->_validate_list_requirements();
121 121
 
122
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
122
+        if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
123 123
             return '';
124 124
         }
125 125
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
         $this->_validate_list_requirements();
155 155
 
156
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
156
+        if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
157 157
             return '';
158 158
         }
159 159
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $this->_validate_list_requirements();
191 191
 
192
-        if (! $this->_data['data'] instanceof EE_Line_Item) {
192
+        if ( ! $this->_data['data'] instanceof EE_Line_Item) {
193 193
             return '';
194 194
         }
195 195
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 
203 203
         $main_line_item_id = $main_line_item->ID();
204 204
 
205
-        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
206
-            ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
205
+        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children'])
206
+            ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array();
207 207
 
208 208
         $line_item_list = '';
209 209
 
Please login to merge, or discard this patch.
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -20,202 +20,202 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    protected function _init_props()
24
-    {
25
-        $this->label = esc_html__('Line Item List Shortcodes', 'event_espresso');
26
-        $this->description = esc_html__('All shortcodes specific to line item lists', 'event_espresso');
27
-        $this->_shortcodes = array(
28
-            '[TICKET_LINE_ITEM_LIST]'         => esc_html__('Outputs a list of ticket line items.', 'event_espresso'),
29
-            '[TAX_LINE_ITEM_LIST]'            => esc_html__('Outputs a list of tax line items.', 'event_espresso'),
30
-            '[ADDITIONAL_LINE_ITEM_LIST]'     => esc_html__(
31
-                'Outputs a list of additional line items (other charges or discounts)',
32
-                'event_espresso'
33
-            ),
34
-            '[PRICE_MODIFIER_LINE_ITEM_LIST]' => esc_html__('Outputs a list of price modifier line items', 'event_espresso'),
35
-        );
36
-    }
37
-
38
-
39
-    protected function _parser($shortcode)
40
-    {
41
-
42
-        switch ($shortcode) {
43
-            case '[TICKET_LINE_ITEM_LIST]':
44
-                return $this->_get_ticket_line_item_list();
45
-                break;
46
-
47
-            case '[TAX_LINE_ITEM_LIST]':
48
-                return $this->_get_tax_line_item_list();
49
-                break;
50
-
51
-            case '[PRICE_MODIFIER_LINE_ITEM_LIST]':
52
-                return $this->_get_price_mod_line_item_list();
53
-                break;
54
-
55
-            case '[ADDITIONAL_LINE_ITEM_LIST]':
56
-                return $this->_get_additional_line_item_list();
57
-                break;
58
-
59
-            default:
60
-                return '';
61
-                break;
62
-        }
63
-    }
64
-
65
-
66
-    /**
67
-     * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event.
68
-     *
69
-     * @since 4.5.0
70
-     *
71
-     * @return string parsed ticket line item list.
72
-     */
73
-    private function _get_ticket_line_item_list()
74
-    {
75
-        $this->_validate_list_requirements();
76
-
77
-        if (! $this->_data['data'] instanceof EE_Ticket) {
78
-            return '';
79
-        }
80
-
81
-        $valid_shortcodes = array('line_item', 'line_item_list', 'ticket');
82
-
83
-        $ticket = $this->_data['data'];
84
-        $templates = $this->_extra_data['template'];
85
-        $addressee_obj = $this->_extra_data['data'];
86
-
87
-        // made it here so we have an EE_Ticket, so we should have what we need.
88
-        $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
89
-            ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
90
-        $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
91
-            ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
92
-
93
-        $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
94
-            : $templates['ticket_line_item_pms'];
95
-
96
-        if (empty($ticket_line_item) || empty($sub_line_items)) {
97
-            return '';
98
-        }
99
-
100
-        // now we just return the appropriate template parsed for each ticket.
101
-        return $this->_shortcode_helper->parse_line_item_list_template(
102
-            $template,
103
-            $ticket_line_item,
104
-            $valid_shortcodes,
105
-            $this->_extra_data
106
-        );
107
-    }
108
-
109
-
110
-    /**
111
-     * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction.
112
-     *
113
-     * @since 4.5.0
114
-     *
115
-     * @return string  parsed tax line item list.
116
-     */
117
-    private function _get_tax_line_item_list()
118
-    {
119
-
120
-        $this->_validate_list_requirements();
121
-
122
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
123
-            return '';
124
-        }
125
-
126
-        // made it here so we're good to go.
127
-        $valid_shortcodes = array('line_item');
128
-        $templates = $this->_data['template'];
129
-
130
-        $tax_line_items = $this->_data['data']->tax_line_items;
131
-        $line_item_list = '';
132
-        foreach ($tax_line_items as $line_item) {
133
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
134
-                $templates['tax_line_item_list'],
135
-                $line_item,
136
-                $valid_shortcodes,
137
-                $this->_extra_data
138
-            );
139
-        }
140
-
141
-        return $line_item_list;
142
-    }
143
-
144
-    /**
145
-     * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction.
146
-     *
147
-     * @since 4.5.0
148
-     *
149
-     * @return string  parsed other line item list.
150
-     */
151
-    private function _get_additional_line_item_list()
152
-    {
153
-
154
-        $this->_validate_list_requirements();
155
-
156
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
157
-            return '';
158
-        }
159
-
160
-        // made it here so we're good to go.
161
-        $valid_shortcodes = array('line_item');
162
-        $templates = $this->_data['template'];
163
-
164
-        $additional_line_items = $this->_data['data']->additional_line_items;
165
-        $line_item_list = '';
166
-        foreach ($additional_line_items as $line_item) {
167
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
168
-                $templates['additional_line_item_list'],
169
-                $line_item,
170
-                $valid_shortcodes,
171
-                $this->_extra_data
172
-            );
173
-        }
174
-
175
-
176
-        return $line_item_list;
177
-    }
178
-
179
-
180
-    /**
181
-     * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a
182
-     * parent ticket line item.
183
-     *
184
-     * @since 4.5.0
185
-     *
186
-     * @return string parsed price modifier line item list.
187
-     */
188
-    private function _get_price_mod_line_item_list()
189
-    {
190
-        $this->_validate_list_requirements();
191
-
192
-        if (! $this->_data['data'] instanceof EE_Line_Item) {
193
-            return '';
194
-        }
195
-
196
-        // made it here so we're good to go.
197
-        $main_line_item = $this->_data['data'];
198
-        $templates = $this->_extra_data['template'];
199
-        $addressee_obj = $this->_extra_data['data'];
200
-
201
-        $valid_shortcodes = array('line_item');
202
-
203
-        $main_line_item_id = $main_line_item->ID();
204
-
205
-        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
206
-            ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
207
-
208
-        $line_item_list = '';
209
-
210
-        foreach ($price_mod_line_items as $line_item) {
211
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
212
-                $templates['price_modifier_line_item_list'],
213
-                $line_item,
214
-                $valid_shortcodes,
215
-                $this->_extra_data
216
-            );
217
-        }
218
-
219
-        return $line_item_list;
220
-    }
23
+	protected function _init_props()
24
+	{
25
+		$this->label = esc_html__('Line Item List Shortcodes', 'event_espresso');
26
+		$this->description = esc_html__('All shortcodes specific to line item lists', 'event_espresso');
27
+		$this->_shortcodes = array(
28
+			'[TICKET_LINE_ITEM_LIST]'         => esc_html__('Outputs a list of ticket line items.', 'event_espresso'),
29
+			'[TAX_LINE_ITEM_LIST]'            => esc_html__('Outputs a list of tax line items.', 'event_espresso'),
30
+			'[ADDITIONAL_LINE_ITEM_LIST]'     => esc_html__(
31
+				'Outputs a list of additional line items (other charges or discounts)',
32
+				'event_espresso'
33
+			),
34
+			'[PRICE_MODIFIER_LINE_ITEM_LIST]' => esc_html__('Outputs a list of price modifier line items', 'event_espresso'),
35
+		);
36
+	}
37
+
38
+
39
+	protected function _parser($shortcode)
40
+	{
41
+
42
+		switch ($shortcode) {
43
+			case '[TICKET_LINE_ITEM_LIST]':
44
+				return $this->_get_ticket_line_item_list();
45
+				break;
46
+
47
+			case '[TAX_LINE_ITEM_LIST]':
48
+				return $this->_get_tax_line_item_list();
49
+				break;
50
+
51
+			case '[PRICE_MODIFIER_LINE_ITEM_LIST]':
52
+				return $this->_get_price_mod_line_item_list();
53
+				break;
54
+
55
+			case '[ADDITIONAL_LINE_ITEM_LIST]':
56
+				return $this->_get_additional_line_item_list();
57
+				break;
58
+
59
+			default:
60
+				return '';
61
+				break;
62
+		}
63
+	}
64
+
65
+
66
+	/**
67
+	 * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event.
68
+	 *
69
+	 * @since 4.5.0
70
+	 *
71
+	 * @return string parsed ticket line item list.
72
+	 */
73
+	private function _get_ticket_line_item_list()
74
+	{
75
+		$this->_validate_list_requirements();
76
+
77
+		if (! $this->_data['data'] instanceof EE_Ticket) {
78
+			return '';
79
+		}
80
+
81
+		$valid_shortcodes = array('line_item', 'line_item_list', 'ticket');
82
+
83
+		$ticket = $this->_data['data'];
84
+		$templates = $this->_extra_data['template'];
85
+		$addressee_obj = $this->_extra_data['data'];
86
+
87
+		// made it here so we have an EE_Ticket, so we should have what we need.
88
+		$ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
89
+			? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
90
+		$sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
91
+			? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
92
+
93
+		$template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
94
+			: $templates['ticket_line_item_pms'];
95
+
96
+		if (empty($ticket_line_item) || empty($sub_line_items)) {
97
+			return '';
98
+		}
99
+
100
+		// now we just return the appropriate template parsed for each ticket.
101
+		return $this->_shortcode_helper->parse_line_item_list_template(
102
+			$template,
103
+			$ticket_line_item,
104
+			$valid_shortcodes,
105
+			$this->_extra_data
106
+		);
107
+	}
108
+
109
+
110
+	/**
111
+	 * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction.
112
+	 *
113
+	 * @since 4.5.0
114
+	 *
115
+	 * @return string  parsed tax line item list.
116
+	 */
117
+	private function _get_tax_line_item_list()
118
+	{
119
+
120
+		$this->_validate_list_requirements();
121
+
122
+		if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
123
+			return '';
124
+		}
125
+
126
+		// made it here so we're good to go.
127
+		$valid_shortcodes = array('line_item');
128
+		$templates = $this->_data['template'];
129
+
130
+		$tax_line_items = $this->_data['data']->tax_line_items;
131
+		$line_item_list = '';
132
+		foreach ($tax_line_items as $line_item) {
133
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
134
+				$templates['tax_line_item_list'],
135
+				$line_item,
136
+				$valid_shortcodes,
137
+				$this->_extra_data
138
+			);
139
+		}
140
+
141
+		return $line_item_list;
142
+	}
143
+
144
+	/**
145
+	 * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction.
146
+	 *
147
+	 * @since 4.5.0
148
+	 *
149
+	 * @return string  parsed other line item list.
150
+	 */
151
+	private function _get_additional_line_item_list()
152
+	{
153
+
154
+		$this->_validate_list_requirements();
155
+
156
+		if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
157
+			return '';
158
+		}
159
+
160
+		// made it here so we're good to go.
161
+		$valid_shortcodes = array('line_item');
162
+		$templates = $this->_data['template'];
163
+
164
+		$additional_line_items = $this->_data['data']->additional_line_items;
165
+		$line_item_list = '';
166
+		foreach ($additional_line_items as $line_item) {
167
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
168
+				$templates['additional_line_item_list'],
169
+				$line_item,
170
+				$valid_shortcodes,
171
+				$this->_extra_data
172
+			);
173
+		}
174
+
175
+
176
+		return $line_item_list;
177
+	}
178
+
179
+
180
+	/**
181
+	 * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a
182
+	 * parent ticket line item.
183
+	 *
184
+	 * @since 4.5.0
185
+	 *
186
+	 * @return string parsed price modifier line item list.
187
+	 */
188
+	private function _get_price_mod_line_item_list()
189
+	{
190
+		$this->_validate_list_requirements();
191
+
192
+		if (! $this->_data['data'] instanceof EE_Line_Item) {
193
+			return '';
194
+		}
195
+
196
+		// made it here so we're good to go.
197
+		$main_line_item = $this->_data['data'];
198
+		$templates = $this->_extra_data['template'];
199
+		$addressee_obj = $this->_extra_data['data'];
200
+
201
+		$valid_shortcodes = array('line_item');
202
+
203
+		$main_line_item_id = $main_line_item->ID();
204
+
205
+		$price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
206
+			? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
207
+
208
+		$line_item_list = '';
209
+
210
+		foreach ($price_mod_line_items as $line_item) {
211
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
212
+				$templates['price_modifier_line_item_list'],
213
+				$line_item,
214
+				$valid_shortcodes,
215
+				$this->_extra_data
216
+			);
217
+		}
218
+
219
+		return $line_item_list;
220
+	}
221 221
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     protected function _parser($shortcode)
43 43
     {
44 44
         // ensure that the incoming object IS a line item.  If it isn't then bail early.
45
-        if (! $this->_data instanceof EE_Line_Item) {
45
+        if ( ! $this->_data instanceof EE_Line_Item) {
46 46
             return '';
47 47
         }
48 48
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 break;
63 63
 
64 64
             case '[LINE_ITEM_AMOUNT]':
65
-                return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code();
65
+                return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code();
66 66
                 break;
67 67
 
68 68
             case '[LINE_ITEM_TOTAL]':
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -18,65 +18,65 @@
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-    protected function _init_props()
22
-    {
23
-        $this->label = esc_html__('Line Item Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to line items', 'event_espresso');
25
-        $this->_shortcodes = array(
26
-            '[LINE_ITEM_NAME]' => esc_html__('Outputs the line item name.', 'event_espresso'),
27
-            '[LINE_ITEM_DESCRIPTION]' => esc_html__('Outputs a the description for the line item.', 'event_espresso'),
28
-            '[LINE_ITEM_QUANTITY]' => esc_html__('Outputs the quantity for this line item.', 'event_espresso'),
29
-            '[LINE_ITEM_AMOUNT]' => esc_html__(
30
-                'This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).',
31
-                'event_espresso'
32
-            ),
33
-            '[LINE_ITEM_TOTAL]' => esc_html__('This outputs the line item total.', 'event_espresso'),
34
-            '[LINE_ITEM_TAXABLE_*]' => esc_html__(
35
-                'This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.',
36
-                'event_espresso'
37
-            ),
38
-        );
39
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label = esc_html__('Line Item Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to line items', 'event_espresso');
25
+		$this->_shortcodes = array(
26
+			'[LINE_ITEM_NAME]' => esc_html__('Outputs the line item name.', 'event_espresso'),
27
+			'[LINE_ITEM_DESCRIPTION]' => esc_html__('Outputs a the description for the line item.', 'event_espresso'),
28
+			'[LINE_ITEM_QUANTITY]' => esc_html__('Outputs the quantity for this line item.', 'event_espresso'),
29
+			'[LINE_ITEM_AMOUNT]' => esc_html__(
30
+				'This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).',
31
+				'event_espresso'
32
+			),
33
+			'[LINE_ITEM_TOTAL]' => esc_html__('This outputs the line item total.', 'event_espresso'),
34
+			'[LINE_ITEM_TAXABLE_*]' => esc_html__(
35
+				'This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.',
36
+				'event_espresso'
37
+			),
38
+		);
39
+	}
40 40
 
41 41
 
42
-    protected function _parser($shortcode)
43
-    {
44
-        // ensure that the incoming object IS a line item.  If it isn't then bail early.
45
-        if (! $this->_data instanceof EE_Line_Item) {
46
-            return '';
47
-        }
42
+	protected function _parser($shortcode)
43
+	{
44
+		// ensure that the incoming object IS a line item.  If it isn't then bail early.
45
+		if (! $this->_data instanceof EE_Line_Item) {
46
+			return '';
47
+		}
48 48
 
49
-        $line_item = $this->_data;
49
+		$line_item = $this->_data;
50 50
 
51
-        switch ($shortcode) {
52
-            case '[LINE_ITEM_NAME]':
53
-                return $line_item->name();
54
-                break;
51
+		switch ($shortcode) {
52
+			case '[LINE_ITEM_NAME]':
53
+				return $line_item->name();
54
+				break;
55 55
 
56
-            case '[LINE_ITEM_DESCRIPTION]':
57
-                return $line_item->desc();
58
-                break;
56
+			case '[LINE_ITEM_DESCRIPTION]':
57
+				return $line_item->desc();
58
+				break;
59 59
 
60
-            case '[LINE_ITEM_QUANTITY]':
61
-                return $line_item->quantity();
62
-                break;
60
+			case '[LINE_ITEM_QUANTITY]':
61
+				return $line_item->quantity();
62
+				break;
63 63
 
64
-            case '[LINE_ITEM_AMOUNT]':
65
-                return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code();
66
-                break;
64
+			case '[LINE_ITEM_AMOUNT]':
65
+				return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code();
66
+				break;
67 67
 
68
-            case '[LINE_ITEM_TOTAL]':
69
-                return $line_item->total_no_code();
70
-                break;
71
-        }
68
+			case '[LINE_ITEM_TOTAL]':
69
+				return $line_item->total_no_code();
70
+				break;
71
+		}
72 72
 
73
-        if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== false) {
74
-            $attrs = $this->_get_shortcode_attrs($shortcode);
75
-            if ($line_item->is_taxable()) {
76
-                return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*';
77
-            }
78
-        }
73
+		if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== false) {
74
+			$attrs = $this->_get_shortcode_attrs($shortcode);
75
+			if ($line_item->is_taxable()) {
76
+				return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*';
77
+			}
78
+		}
79 79
 
80
-        return '';
81
-    }
80
+		return '';
81
+	}
82 82
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     protected function _parser($shortcode)
55 55
     {
56 56
 
57
-        if (! $this->_data instanceof EE_Datetime) {
57
+        if ( ! $this->_data instanceof EE_Datetime) {
58 58
             return ''; // get out cause we can only parse with the datetime object.
59 59
         }
60 60
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
             $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url());
94 94
 
95
-            return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>';
95
+            return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>';
96 96
         }
97 97
 
98 98
         return '';
Please login to merge, or discard this patch.
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -18,83 +18,83 @@
 block discarded – undo
18 18
 class EE_Datetime_Shortcodes extends EE_Shortcodes
19 19
 {
20 20
 
21
-    /**
22
-     * _init_props
23
-     *
24
-     * @access protected
25
-     * @return void
26
-     */
27
-    protected function _init_props()
28
-    {
29
-        $this->label = esc_html__('Datetime Shortcodes', 'event_espresso');
30
-        $this->description = esc_html__('All shortcodes specific to datetime related data', 'event_espresso');
31
-        $this->_shortcodes = array(
32
-            '[DATETIME_START]' => esc_html__('The start date and time.', 'event_espresso'),
33
-            '[DATETIME_END]' => esc_html__('The end date and time.', 'event_espresso'),
34
-            '[DATETIME_TIMEZONE]' => esc_html__('The timezone for the date and time', 'event_espresso'),
35
-            '[DATE_START]' => esc_html__('The datetime start date.', 'event_espresso'),
36
-            '[DATE_END]' => esc_html__('The datetime end date.', 'event_espresso'),
37
-            '[TIME_START]' => esc_html__('The datetime start time.', 'event_espresso'),
38
-            '[TIME_END]' => esc_html__('The datetime end time.', 'event_espresso'),
39
-            '[ICAL_LINK_*]' => esc_html__(
40
-                'The datetime iCal link. The optional "link_text" attribute can be used to set custom text within the link (Default is "Add to iCal Calendar").',
41
-                'event_espresso'
42
-            ),
43
-        );
44
-    }
21
+	/**
22
+	 * _init_props
23
+	 *
24
+	 * @access protected
25
+	 * @return void
26
+	 */
27
+	protected function _init_props()
28
+	{
29
+		$this->label = esc_html__('Datetime Shortcodes', 'event_espresso');
30
+		$this->description = esc_html__('All shortcodes specific to datetime related data', 'event_espresso');
31
+		$this->_shortcodes = array(
32
+			'[DATETIME_START]' => esc_html__('The start date and time.', 'event_espresso'),
33
+			'[DATETIME_END]' => esc_html__('The end date and time.', 'event_espresso'),
34
+			'[DATETIME_TIMEZONE]' => esc_html__('The timezone for the date and time', 'event_espresso'),
35
+			'[DATE_START]' => esc_html__('The datetime start date.', 'event_espresso'),
36
+			'[DATE_END]' => esc_html__('The datetime end date.', 'event_espresso'),
37
+			'[TIME_START]' => esc_html__('The datetime start time.', 'event_espresso'),
38
+			'[TIME_END]' => esc_html__('The datetime end time.', 'event_espresso'),
39
+			'[ICAL_LINK_*]' => esc_html__(
40
+				'The datetime iCal link. The optional "link_text" attribute can be used to set custom text within the link (Default is "Add to iCal Calendar").',
41
+				'event_espresso'
42
+			),
43
+		);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * _parser
49
-     *
50
-     * @access protected
51
-     * @param string $shortcode
52
-     * @return string
53
-     */
54
-    protected function _parser($shortcode)
55
-    {
47
+	/**
48
+	 * _parser
49
+	 *
50
+	 * @access protected
51
+	 * @param string $shortcode
52
+	 * @return string
53
+	 */
54
+	protected function _parser($shortcode)
55
+	{
56 56
 
57
-        if (! $this->_data instanceof EE_Datetime) {
58
-            return ''; // get out cause we can only parse with the datetime object.
59
-        }
57
+		if (! $this->_data instanceof EE_Datetime) {
58
+			return ''; // get out cause we can only parse with the datetime object.
59
+		}
60 60
 
61
-        switch ($shortcode) {
62
-            case '[DATETIME_START]':
63
-                return $this->_data->get_i18n_datetime('DTT_EVT_start');
64
-                break;
61
+		switch ($shortcode) {
62
+			case '[DATETIME_START]':
63
+				return $this->_data->get_i18n_datetime('DTT_EVT_start');
64
+				break;
65 65
 
66
-            case '[DATETIME_END]':
67
-                return $this->_data->get_i18n_datetime('DTT_EVT_end');
68
-                break;
66
+			case '[DATETIME_END]':
67
+				return $this->_data->get_i18n_datetime('DTT_EVT_end');
68
+				break;
69 69
 
70
-            case '[DATETIME_TIMEZONE]':
71
-                return $this->_data->get_timezone();
72
-                break;
73
-            case '[DATE_START]':
74
-                return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format'));
75
-                break;
76
-            case '[DATE_END]':
77
-                return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format'));
78
-                break;
79
-            case '[TIME_START]':
80
-                return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format'));
81
-                break;
82
-            case '[TIME_END]':
83
-                return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format'));
84
-                break;
85
-        }
70
+			case '[DATETIME_TIMEZONE]':
71
+				return $this->_data->get_timezone();
72
+				break;
73
+			case '[DATE_START]':
74
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format'));
75
+				break;
76
+			case '[DATE_END]':
77
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format'));
78
+				break;
79
+			case '[TIME_START]':
80
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format'));
81
+				break;
82
+			case '[TIME_END]':
83
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format'));
84
+				break;
85
+		}
86 86
 
87
-        if (strpos($shortcode, '[ICAL_LINK_*') !== false) {
88
-            $attrs = $this->_get_shortcode_attrs($shortcode);
87
+		if (strpos($shortcode, '[ICAL_LINK_*') !== false) {
88
+			$attrs = $this->_get_shortcode_attrs($shortcode);
89 89
 
90
-            $link_text = empty($attrs['link_text']) ? esc_html__('Add to iCal Calendar', 'event_espresso')
91
-                : $attrs['link_text'];
90
+			$link_text = empty($attrs['link_text']) ? esc_html__('Add to iCal Calendar', 'event_espresso')
91
+				: $attrs['link_text'];
92 92
 
93
-            $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url());
93
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url());
94 94
 
95
-            return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>';
96
-        }
95
+			return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>';
96
+		}
97 97
 
98
-        return '';
99
-    }
98
+		return '';
99
+	}
100 100
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Venue_Shortcodes.lib.php 2 patches
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -17,315 +17,315 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * Will hold the EE_Event if available
22
-     *
23
-     * @var EE_Event
24
-     */
25
-    protected $_event;
26
-
27
-    /**
28
-     * Will hold the EE_Venue if available
29
-     *
30
-     * @var EE_Venue
31
-     */
32
-    protected $_venue;
33
-
34
-
35
-    /**
36
-     * Initialize properties
37
-     */
38
-    protected function _init_props()
39
-    {
40
-        $this->label = esc_html__('Venue Shortcodes', 'event_espresso');
41
-        $this->description = esc_html__('All shortcodes specific to venue related data', 'event_espresso');
42
-        $this->_shortcodes = array(
43
-            '[VENUE_TITLE]'             => esc_html__('The title for the event venue', 'event_espresso'),
44
-            '[VENUE_DESCRIPTION]'       => esc_html__('The description for the event venue', 'event_espresso'),
45
-            '[VENUE_URL]'               => esc_html__('A url to a webpage for the venue', 'event_espresso'),
46
-            '[VENUE_DETAILS_URL]'       => sprintf(
47
-                esc_html__(
48
-                    'This shortcode outputs the url or website address to the venue details page on this website. This differs from %s which outputs what is entered in the "url" field in the venue details page.',
49
-                    'event_espresso'
50
-                ),
51
-                '[VENUE_URL]'
52
-            ),
53
-            '[VENUE_IMAGE]'             => esc_html__('An image representing the event venue', 'event_espresso'),
54
-            '[VENUE_PHONE]'             => esc_html__('The phone number for the venue', 'event_espresso'),
55
-            '[VENUE_ADDRESS]'           => esc_html__('The address for the venue', 'event_espresso'),
56
-            '[VENUE_ADDRESS2]'          => esc_html__('Address 2 for the venue', 'event_espresso'),
57
-            '[VENUE_CITY]'              => esc_html__('The city the venue is in', 'event_espresso'),
58
-            '[VENUE_STATE]'             => esc_html__('The state the venue is located in', 'event_espresso'),
59
-            '[VENUE_COUNTRY]'           => esc_html__('The country the venue is located in', 'event_espresso'),
60
-            '[VENUE_FORMATTED_ADDRESS]' => esc_html__(
61
-                'This just outputs the venue address in a semantic address format.',
62
-                'event_espresso'
63
-            ),
64
-            '[VENUE_ZIP]'               => esc_html__('The zip code for the venue address', 'event_espresso'),
65
-            '[VENUE_META_*]'            => esc_html__(
66
-                'This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the venue then it will be output in place of this shortcode.',
67
-                'event_espresso'
68
-            ),
69
-            '[GOOGLE_MAP_URL]'          => esc_html__(
70
-                'URL for the google map associated with the venue.',
71
-                'event_espresso'
72
-            ),
73
-            '[GOOGLE_MAP_LINK]'         => esc_html__('Link to a google map for the venue', 'event_espresso'),
74
-            '[GOOGLE_MAP_IMAGE]'        => esc_html__('Google map for venue wrapped in image tags', 'event_espresso'),
75
-        );
76
-    }
77
-
78
-
79
-    /**
80
-     * Parse incoming shortcode
81
-     *
82
-     * @param string $shortcode
83
-     * @return string
84
-     * @throws EE_Error
85
-     * @throws EntityNotFoundException
86
-     */
87
-    protected function _parser($shortcode)
88
-    {
89
-        $this->_venue = $this->_get_venue();
90
-        // If there is no venue object by now then get out.
91
-        if (! $this->_venue instanceof EE_Venue) {
92
-            return '';
93
-        }
94
-
95
-        switch ($shortcode) {
96
-            case '[VENUE_TITLE]':
97
-                return $this->_venue('title');
98
-                break;
99
-
100
-            case '[VENUE_DESCRIPTION]':
101
-                return $this->_venue('description');
102
-                break;
103
-
104
-            case '[VENUE_URL]':
105
-                return $this->_venue('url');
106
-                break;
107
-
108
-            case '[VENUE_IMAGE]':
109
-                return $this->_venue('image');
110
-                break;
111
-
112
-            case '[VENUE_PHONE]':
113
-                return $this->_venue('phone');
114
-                break;
115
-
116
-            case '[VENUE_ADDRESS]':
117
-                return $this->_venue('address');
118
-                break;
119
-
120
-            case '[VENUE_ADDRESS2]':
121
-                return $this->_venue('address2');
122
-                break;
123
-
124
-            case '[VENUE_CITY]':
125
-                return $this->_venue('city');
126
-                break;
127
-
128
-            case '[VENUE_COUNTRY]':
129
-                return $this->_venue('country');
130
-                break;
131
-
132
-            case '[VENUE_STATE]':
133
-                return $this->_venue('state');
134
-                break;
135
-
136
-            case '[VENUE_ZIP]':
137
-                return $this->_venue('zip');
138
-                break;
139
-
140
-            case '[VENUE_FORMATTED_ADDRESS]':
141
-                return $this->_venue('formatted_address');
142
-                break;
143
-
144
-            case '[GOOGLE_MAP_URL]':
145
-                return $this->_venue('gmap_url');
146
-                break;
147
-
148
-            case '[GOOGLE_MAP_LINK]':
149
-                return $this->_venue('gmap_link');
150
-                break;
151
-
152
-            case '[GOOGLE_MAP_IMAGE]':
153
-                return $this->_venue('gmap_link_img');
154
-                break;
155
-
156
-            case '[VENUE_DETAILS_URL]':
157
-                return $this->_venue('permalink');
158
-                break;
159
-        }
160
-
161
-        if (strpos($shortcode, '[VENUE_META_*') !== false) {
162
-            $shortcode = str_replace('[VENUE_META_*', '', $shortcode);
163
-            $shortcode = trim(str_replace(']', '', $shortcode));
164
-
165
-            // pull the meta value from the venue post
166
-            $venue_meta = $this->_venue->get_post_meta($shortcode, true);
167
-
168
-            return ! empty($venue_meta) ? $venue_meta : '';
169
-        }
170
-    }
171
-
172
-    /**
173
-     * This retrieves the EE_Venue from the available data object.
174
-     *
175
-     * @return EE_Venue|null
176
-     * @throws EE_Error
177
-     * @throws EntityNotFoundException
178
-     */
179
-    private function _get_venue()
180
-    {
181
-
182
-        // we need the EE_Event object to get the venue.
183
-        $this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
184
-
185
-        // if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the
186
-        // reg_obj instead.
187
-        if (! $this->_event instanceof EE_Event) {
188
-            $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
189
-            $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
190
-
191
-            $this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration
192
-                ? $aee->reg_obj->event()
193
-                : null;
194
-
195
-            // if still empty do we have a ticket data item?
196
-            $this->_event = ! $this->_event instanceof EE_Event
197
-                            && $this->_data instanceof EE_Ticket
198
-                            && $this->_extra_data['data'] instanceof EE_Messages_Addressee
199
-                ? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event']
200
-                : $this->_event;
201
-
202
-            // if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee
203
-            // and use that.
204
-            $this->_event = ! $this->_event instanceof EE_Event && $aee instanceof EE_Messages_Addressee
205
-                ? reset($aee->events)
206
-                : $this->_event;
207
-        }
208
-
209
-        // If we have an event object use it to pull the venue.
210
-        if ($this->_event instanceof EE_Event) {
211
-            return $this->_event->get_first_related('Venue');
212
-        }
213
-
214
-        return null;
215
-    }
216
-
217
-    /**
218
-     * This retrieves the specified venue information
219
-     *
220
-     * @param string $field What Venue field to retrieve
221
-     * @return string What was retrieved!
222
-     * @throws EE_Error
223
-     * @throws EntityNotFoundException
224
-     */
225
-    private function _venue($field)
226
-    {
227
-
228
-        if (! $this->_venue instanceof EE_Venue) {
229
-            return '';
230
-        } //no venue so get out.
231
-
232
-        switch ($field) {
233
-            case 'title':
234
-                return $this->_venue->get('VNU_name');
235
-                break;
236
-
237
-            case 'description':
238
-                return $this->_venue->get('VNU_desc');
239
-                break;
240
-
241
-            case 'url':
242
-                $url = $this->_venue->get('VNU_url');
243
-                return empty($url) ? $this->_venue->get_permalink() : $url;
244
-                break;
245
-
246
-            case 'permalink':
247
-                return $this->_venue->get_permalink();
248
-                break;
249
-
250
-            case 'image':
251
-                return '<img src="' . $this->_venue->feature_image_url(array(200, 200,))
252
-                       . '" alt="' . sprintf(
253
-                           esc_attr__('%s Feature Image', 'event_espresso'),
254
-                           $this->_venue->get('VNU_name')
255
-                       ) . '" />';
256
-                break;
257
-
258
-            case 'phone':
259
-                return $this->_venue->get('VNU_phone');
260
-                break;
261
-
262
-            case 'address':
263
-                return $this->_venue->get('VNU_address');
264
-                break;
265
-
266
-            case 'address2':
267
-                return $this->_venue->get('VNU_address2');
268
-                break;
269
-
270
-            case 'city':
271
-                return $this->_venue->get('VNU_city');
272
-                break;
273
-
274
-            case 'state':
275
-                $state = $this->_venue->state_obj();
276
-                return is_object($state) ? $state->get('STA_name') : '';
277
-                break;
278
-
279
-            case 'country':
280
-                $country = $this->_venue->country_obj();
281
-                return is_object($country) ? $country->get('CNT_name') : '';
282
-                break;
283
-
284
-            case 'zip':
285
-                return $this->_venue->get('VNU_zip');
286
-                break;
287
-
288
-            case 'formatted_address':
289
-                return EEH_Address::format($this->_venue);
290
-                break;
291
-
292
-            case 'gmap_link':
293
-            case 'gmap_url':
294
-            case 'gmap_link_img':
295
-                $atts = $this->get_map_attributes($this->_venue, $field);
296
-                return EEH_Maps::google_map_link($atts);
297
-                break;
298
-        }
299
-        return '';
300
-    }
301
-
302
-
303
-    /**
304
-     * Generates the attributes for retrieving a google_map artifact.
305
-     *
306
-     * @param EE_Venue $venue
307
-     * @param string   $field
308
-     * @return array
309
-     * @throws EE_Error
310
-     */
311
-    protected function get_map_attributes(EE_Venue $venue, $field = 'gmap_link')
312
-    {
313
-        $state = $venue->state_obj();
314
-        $country = $venue->country_obj();
315
-        $atts = array(
316
-            'id'      => $venue->ID(),
317
-            'address' => $venue->get('VNU_address'),
318
-            'city'    => $venue->get('VNU_city'),
319
-            'state'   => is_object($state) ? $state->get('STA_name') : '',
320
-            'zip'     => $venue->get('VNU_zip'),
321
-            'country' => is_object($country) ? $country->get('CNT_name') : '',
322
-            'type'    => $field === 'gmap_link' ? 'url' : 'map',
323
-            'map_w'   => 200,
324
-            'map_h'   => 200,
325
-        );
326
-        if ($field === 'gmap_url') {
327
-            $atts['type'] = 'url_only';
328
-        }
329
-        return $atts;
330
-    }
20
+	/**
21
+	 * Will hold the EE_Event if available
22
+	 *
23
+	 * @var EE_Event
24
+	 */
25
+	protected $_event;
26
+
27
+	/**
28
+	 * Will hold the EE_Venue if available
29
+	 *
30
+	 * @var EE_Venue
31
+	 */
32
+	protected $_venue;
33
+
34
+
35
+	/**
36
+	 * Initialize properties
37
+	 */
38
+	protected function _init_props()
39
+	{
40
+		$this->label = esc_html__('Venue Shortcodes', 'event_espresso');
41
+		$this->description = esc_html__('All shortcodes specific to venue related data', 'event_espresso');
42
+		$this->_shortcodes = array(
43
+			'[VENUE_TITLE]'             => esc_html__('The title for the event venue', 'event_espresso'),
44
+			'[VENUE_DESCRIPTION]'       => esc_html__('The description for the event venue', 'event_espresso'),
45
+			'[VENUE_URL]'               => esc_html__('A url to a webpage for the venue', 'event_espresso'),
46
+			'[VENUE_DETAILS_URL]'       => sprintf(
47
+				esc_html__(
48
+					'This shortcode outputs the url or website address to the venue details page on this website. This differs from %s which outputs what is entered in the "url" field in the venue details page.',
49
+					'event_espresso'
50
+				),
51
+				'[VENUE_URL]'
52
+			),
53
+			'[VENUE_IMAGE]'             => esc_html__('An image representing the event venue', 'event_espresso'),
54
+			'[VENUE_PHONE]'             => esc_html__('The phone number for the venue', 'event_espresso'),
55
+			'[VENUE_ADDRESS]'           => esc_html__('The address for the venue', 'event_espresso'),
56
+			'[VENUE_ADDRESS2]'          => esc_html__('Address 2 for the venue', 'event_espresso'),
57
+			'[VENUE_CITY]'              => esc_html__('The city the venue is in', 'event_espresso'),
58
+			'[VENUE_STATE]'             => esc_html__('The state the venue is located in', 'event_espresso'),
59
+			'[VENUE_COUNTRY]'           => esc_html__('The country the venue is located in', 'event_espresso'),
60
+			'[VENUE_FORMATTED_ADDRESS]' => esc_html__(
61
+				'This just outputs the venue address in a semantic address format.',
62
+				'event_espresso'
63
+			),
64
+			'[VENUE_ZIP]'               => esc_html__('The zip code for the venue address', 'event_espresso'),
65
+			'[VENUE_META_*]'            => esc_html__(
66
+				'This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the venue then it will be output in place of this shortcode.',
67
+				'event_espresso'
68
+			),
69
+			'[GOOGLE_MAP_URL]'          => esc_html__(
70
+				'URL for the google map associated with the venue.',
71
+				'event_espresso'
72
+			),
73
+			'[GOOGLE_MAP_LINK]'         => esc_html__('Link to a google map for the venue', 'event_espresso'),
74
+			'[GOOGLE_MAP_IMAGE]'        => esc_html__('Google map for venue wrapped in image tags', 'event_espresso'),
75
+		);
76
+	}
77
+
78
+
79
+	/**
80
+	 * Parse incoming shortcode
81
+	 *
82
+	 * @param string $shortcode
83
+	 * @return string
84
+	 * @throws EE_Error
85
+	 * @throws EntityNotFoundException
86
+	 */
87
+	protected function _parser($shortcode)
88
+	{
89
+		$this->_venue = $this->_get_venue();
90
+		// If there is no venue object by now then get out.
91
+		if (! $this->_venue instanceof EE_Venue) {
92
+			return '';
93
+		}
94
+
95
+		switch ($shortcode) {
96
+			case '[VENUE_TITLE]':
97
+				return $this->_venue('title');
98
+				break;
99
+
100
+			case '[VENUE_DESCRIPTION]':
101
+				return $this->_venue('description');
102
+				break;
103
+
104
+			case '[VENUE_URL]':
105
+				return $this->_venue('url');
106
+				break;
107
+
108
+			case '[VENUE_IMAGE]':
109
+				return $this->_venue('image');
110
+				break;
111
+
112
+			case '[VENUE_PHONE]':
113
+				return $this->_venue('phone');
114
+				break;
115
+
116
+			case '[VENUE_ADDRESS]':
117
+				return $this->_venue('address');
118
+				break;
119
+
120
+			case '[VENUE_ADDRESS2]':
121
+				return $this->_venue('address2');
122
+				break;
123
+
124
+			case '[VENUE_CITY]':
125
+				return $this->_venue('city');
126
+				break;
127
+
128
+			case '[VENUE_COUNTRY]':
129
+				return $this->_venue('country');
130
+				break;
131
+
132
+			case '[VENUE_STATE]':
133
+				return $this->_venue('state');
134
+				break;
135
+
136
+			case '[VENUE_ZIP]':
137
+				return $this->_venue('zip');
138
+				break;
139
+
140
+			case '[VENUE_FORMATTED_ADDRESS]':
141
+				return $this->_venue('formatted_address');
142
+				break;
143
+
144
+			case '[GOOGLE_MAP_URL]':
145
+				return $this->_venue('gmap_url');
146
+				break;
147
+
148
+			case '[GOOGLE_MAP_LINK]':
149
+				return $this->_venue('gmap_link');
150
+				break;
151
+
152
+			case '[GOOGLE_MAP_IMAGE]':
153
+				return $this->_venue('gmap_link_img');
154
+				break;
155
+
156
+			case '[VENUE_DETAILS_URL]':
157
+				return $this->_venue('permalink');
158
+				break;
159
+		}
160
+
161
+		if (strpos($shortcode, '[VENUE_META_*') !== false) {
162
+			$shortcode = str_replace('[VENUE_META_*', '', $shortcode);
163
+			$shortcode = trim(str_replace(']', '', $shortcode));
164
+
165
+			// pull the meta value from the venue post
166
+			$venue_meta = $this->_venue->get_post_meta($shortcode, true);
167
+
168
+			return ! empty($venue_meta) ? $venue_meta : '';
169
+		}
170
+	}
171
+
172
+	/**
173
+	 * This retrieves the EE_Venue from the available data object.
174
+	 *
175
+	 * @return EE_Venue|null
176
+	 * @throws EE_Error
177
+	 * @throws EntityNotFoundException
178
+	 */
179
+	private function _get_venue()
180
+	{
181
+
182
+		// we need the EE_Event object to get the venue.
183
+		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
184
+
185
+		// if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the
186
+		// reg_obj instead.
187
+		if (! $this->_event instanceof EE_Event) {
188
+			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
189
+			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
190
+
191
+			$this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration
192
+				? $aee->reg_obj->event()
193
+				: null;
194
+
195
+			// if still empty do we have a ticket data item?
196
+			$this->_event = ! $this->_event instanceof EE_Event
197
+							&& $this->_data instanceof EE_Ticket
198
+							&& $this->_extra_data['data'] instanceof EE_Messages_Addressee
199
+				? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event']
200
+				: $this->_event;
201
+
202
+			// if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee
203
+			// and use that.
204
+			$this->_event = ! $this->_event instanceof EE_Event && $aee instanceof EE_Messages_Addressee
205
+				? reset($aee->events)
206
+				: $this->_event;
207
+		}
208
+
209
+		// If we have an event object use it to pull the venue.
210
+		if ($this->_event instanceof EE_Event) {
211
+			return $this->_event->get_first_related('Venue');
212
+		}
213
+
214
+		return null;
215
+	}
216
+
217
+	/**
218
+	 * This retrieves the specified venue information
219
+	 *
220
+	 * @param string $field What Venue field to retrieve
221
+	 * @return string What was retrieved!
222
+	 * @throws EE_Error
223
+	 * @throws EntityNotFoundException
224
+	 */
225
+	private function _venue($field)
226
+	{
227
+
228
+		if (! $this->_venue instanceof EE_Venue) {
229
+			return '';
230
+		} //no venue so get out.
231
+
232
+		switch ($field) {
233
+			case 'title':
234
+				return $this->_venue->get('VNU_name');
235
+				break;
236
+
237
+			case 'description':
238
+				return $this->_venue->get('VNU_desc');
239
+				break;
240
+
241
+			case 'url':
242
+				$url = $this->_venue->get('VNU_url');
243
+				return empty($url) ? $this->_venue->get_permalink() : $url;
244
+				break;
245
+
246
+			case 'permalink':
247
+				return $this->_venue->get_permalink();
248
+				break;
249
+
250
+			case 'image':
251
+				return '<img src="' . $this->_venue->feature_image_url(array(200, 200,))
252
+					   . '" alt="' . sprintf(
253
+						   esc_attr__('%s Feature Image', 'event_espresso'),
254
+						   $this->_venue->get('VNU_name')
255
+					   ) . '" />';
256
+				break;
257
+
258
+			case 'phone':
259
+				return $this->_venue->get('VNU_phone');
260
+				break;
261
+
262
+			case 'address':
263
+				return $this->_venue->get('VNU_address');
264
+				break;
265
+
266
+			case 'address2':
267
+				return $this->_venue->get('VNU_address2');
268
+				break;
269
+
270
+			case 'city':
271
+				return $this->_venue->get('VNU_city');
272
+				break;
273
+
274
+			case 'state':
275
+				$state = $this->_venue->state_obj();
276
+				return is_object($state) ? $state->get('STA_name') : '';
277
+				break;
278
+
279
+			case 'country':
280
+				$country = $this->_venue->country_obj();
281
+				return is_object($country) ? $country->get('CNT_name') : '';
282
+				break;
283
+
284
+			case 'zip':
285
+				return $this->_venue->get('VNU_zip');
286
+				break;
287
+
288
+			case 'formatted_address':
289
+				return EEH_Address::format($this->_venue);
290
+				break;
291
+
292
+			case 'gmap_link':
293
+			case 'gmap_url':
294
+			case 'gmap_link_img':
295
+				$atts = $this->get_map_attributes($this->_venue, $field);
296
+				return EEH_Maps::google_map_link($atts);
297
+				break;
298
+		}
299
+		return '';
300
+	}
301
+
302
+
303
+	/**
304
+	 * Generates the attributes for retrieving a google_map artifact.
305
+	 *
306
+	 * @param EE_Venue $venue
307
+	 * @param string   $field
308
+	 * @return array
309
+	 * @throws EE_Error
310
+	 */
311
+	protected function get_map_attributes(EE_Venue $venue, $field = 'gmap_link')
312
+	{
313
+		$state = $venue->state_obj();
314
+		$country = $venue->country_obj();
315
+		$atts = array(
316
+			'id'      => $venue->ID(),
317
+			'address' => $venue->get('VNU_address'),
318
+			'city'    => $venue->get('VNU_city'),
319
+			'state'   => is_object($state) ? $state->get('STA_name') : '',
320
+			'zip'     => $venue->get('VNU_zip'),
321
+			'country' => is_object($country) ? $country->get('CNT_name') : '',
322
+			'type'    => $field === 'gmap_link' ? 'url' : 'map',
323
+			'map_w'   => 200,
324
+			'map_h'   => 200,
325
+		);
326
+		if ($field === 'gmap_url') {
327
+			$atts['type'] = 'url_only';
328
+		}
329
+		return $atts;
330
+	}
331 331
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $this->_venue = $this->_get_venue();
90 90
         // If there is no venue object by now then get out.
91
-        if (! $this->_venue instanceof EE_Venue) {
91
+        if ( ! $this->_venue instanceof EE_Venue) {
92 92
             return '';
93 93
         }
94 94
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
         // if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the
186 186
         // reg_obj instead.
187
-        if (! $this->_event instanceof EE_Event) {
187
+        if ( ! $this->_event instanceof EE_Event) {
188 188
             $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
189 189
             $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
190 190
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             $this->_event = ! $this->_event instanceof EE_Event
197 197
                             && $this->_data instanceof EE_Ticket
198 198
                             && $this->_extra_data['data'] instanceof EE_Messages_Addressee
199
-                ? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event']
199
+                ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event']
200 200
                 : $this->_event;
201 201
 
202 202
             // if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     private function _venue($field)
226 226
     {
227 227
 
228
-        if (! $this->_venue instanceof EE_Venue) {
228
+        if ( ! $this->_venue instanceof EE_Venue) {
229 229
             return '';
230 230
         } //no venue so get out.
231 231
 
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
                 break;
249 249
 
250 250
             case 'image':
251
-                return '<img src="' . $this->_venue->feature_image_url(array(200, 200,))
252
-                       . '" alt="' . sprintf(
251
+                return '<img src="'.$this->_venue->feature_image_url(array(200, 200,))
252
+                       . '" alt="'.sprintf(
253 253
                            esc_attr__('%s Feature Image', 'event_espresso'),
254 254
                            $this->_venue->get('VNU_name')
255
-                       ) . '" />';
255
+                       ).'" />';
256 256
                 break;
257 257
 
258 258
             case 'phone':
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Organization_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 return '<img src="'
105 105
                        . EE_Registry::instance()->CFG->organization->get_pretty(
106 106
                            'logo_url'
107
-                       ) . '" id="headerImage" />';
107
+                       ).'" id="headerImage" />';
108 108
                 break;
109 109
 
110 110
             case '[CO_LOGO_URL]':
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
             // set custom attrs if present (or default)
151 151
             $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
152
-            return $prefix . $tax_number;
152
+            return $prefix.$tax_number;
153 153
         }
154 154
 
155 155
         return '';
Please login to merge, or discard this patch.
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -19,139 +19,139 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    public function __construct()
23
-    {
24
-        parent::__construct();
25
-    }
26
-
27
-
28
-    protected function _init_props()
29
-    {
30
-        $this->label = esc_html__('Organization Shortcodes', 'event_espresso');
31
-        $this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso');
32
-        $this->_shortcodes = array(
33
-            '[COMPANY]'          => esc_html__('Event organization name', 'event_espresso'),
34
-            '[CO_ADD1]'          => esc_html__('Address 1 value for the organization', 'event_espresso'),
35
-            '[CO_ADD2]'          => esc_html__('Address 2 value for the organization', 'event_espresso'),
36
-            '[CO_CITY]'          => esc_html__('City the organization is in', 'event_espresso'),
37
-            '[CO_STATE]'         => esc_html__('State the organization is located in', 'event_espresso'),
38
-            '[CO_ZIP]'           => esc_html__('The zip code for the organization', 'event_espresso'),
39
-            '[CO_LOGO]'          => esc_html__('The logo image for the organization', 'event_espresso'),
40
-            '[CO_EMAIL]'         => esc_html__('The primary email address for the organization', 'event_espresso'),
41
-            '[CO_PHONE]'         => esc_html__('The phone number for the organization', 'event_espresso'),
42
-            '[CO_LOGO_URL]'      => esc_html__(
43
-                'Just the link to the image used as the logo for the organization',
44
-                'event_espresso'
45
-            ),
46
-            '[CO_FACEBOOK_URL]'  => esc_html__('Link to organization Facebook page', 'event_espresso'),
47
-            '[CO_TWITTER_URL]'   => esc_html__('Link to organization Twitter page', 'event_espresso'),
48
-            '[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'),
49
-            '[CO_GOOGLE_URL]'    => esc_html__('Link to organization Google page', 'event_espresso'),
50
-            '[CO_LINKEDIN_URL]'  => esc_html__('Link to organization LinkedIn page', 'event_espresso'),
51
-            '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'),
52
-            '[CO_TAX_NUMBER_*]'  => sprintf(
53
-                esc_html__(
54
-                    'This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.',
55
-                    'event_espresso'
56
-                ),
57
-                '<strong>',
58
-                '</strong>'
59
-            ),
60
-        );
61
-    }
62
-
63
-
64
-    protected function _parser($shortcode)
65
-    {
66
-
67
-        switch ($shortcode) {
68
-            case '[COMPANY]':
69
-                return EE_Registry::instance()->CFG->organization->get_pretty('name');
70
-                break;
71
-
72
-            case '[CO_ADD1]':
73
-                return EE_Registry::instance()->CFG->organization->get_pretty('address_1');
74
-                break;
75
-
76
-            case '[CO_ADD2]':
77
-                return EE_Registry::instance()->CFG->organization->get_pretty('address_2');
78
-                break;
79
-
80
-            case '[CO_CITY]':
81
-                return EE_Registry::instance()->CFG->organization->get_pretty('city');
82
-                break;
83
-
84
-            case '[CO_STATE]':
85
-                $state = EE_Registry::instance()->load_model('State')->get_one_by_ID(
86
-                    EE_Registry::instance()->CFG->organization->STA_ID
87
-                );
88
-                return $state instanceof EE_State ? $state->name() : '';
89
-                break;
90
-
91
-            case '[CO_ZIP]':
92
-                return EE_Registry::instance()->CFG->organization->get_pretty('zip');
93
-                break;
94
-
95
-            case '[CO_EMAIL]':
96
-                return EE_Registry::instance()->CFG->organization->get_pretty('email');
97
-                break;
98
-
99
-            case '[CO_PHONE]':
100
-                return EE_Registry::instance()->CFG->organization->get_pretty('phone');
101
-                break;
102
-
103
-            case '[CO_LOGO]':
104
-                return '<img src="'
105
-                       . EE_Registry::instance()->CFG->organization->get_pretty(
106
-                           'logo_url'
107
-                       ) . '" id="headerImage" />';
108
-                break;
109
-
110
-            case '[CO_LOGO_URL]':
111
-                return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
112
-                break;
113
-
114
-            case '[CO_FACEBOOK_URL]':
115
-                return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
116
-                break;
117
-
118
-            case '[CO_TWITTER_URL]':
119
-                return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
120
-                break;
121
-
122
-            case '[CO_PINTEREST_URL]':
123
-                return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
124
-                break;
125
-
126
-            case '[CO_LINKEDIN_URL]':
127
-                return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
128
-                break;
129
-
130
-            case '[CO_GOOGLE_URL]':
131
-                return EE_Registry::instance()->CFG->organization->get_pretty('google');
132
-                break;
133
-
134
-            case '[CO_INSTAGRAM_URL]':
135
-                return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
136
-                break;
137
-        }
138
-
139
-        // also allow for parameter shortcode
140
-        if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) {
141
-            // first see if there is any company tax number set and bail early if not
142
-            $tax_number = EE_Registry::instance()->CFG->organization->vat;
143
-            if (empty($tax_number)) {
144
-                return '';
145
-            }
146
-
147
-            // see if there are any attributes.
148
-            $attrs = $this->_get_shortcode_attrs($shortcode);
149
-
150
-            // set custom attrs if present (or default)
151
-            $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
152
-            return $prefix . $tax_number;
153
-        }
154
-
155
-        return '';
156
-    }
22
+	public function __construct()
23
+	{
24
+		parent::__construct();
25
+	}
26
+
27
+
28
+	protected function _init_props()
29
+	{
30
+		$this->label = esc_html__('Organization Shortcodes', 'event_espresso');
31
+		$this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso');
32
+		$this->_shortcodes = array(
33
+			'[COMPANY]'          => esc_html__('Event organization name', 'event_espresso'),
34
+			'[CO_ADD1]'          => esc_html__('Address 1 value for the organization', 'event_espresso'),
35
+			'[CO_ADD2]'          => esc_html__('Address 2 value for the organization', 'event_espresso'),
36
+			'[CO_CITY]'          => esc_html__('City the organization is in', 'event_espresso'),
37
+			'[CO_STATE]'         => esc_html__('State the organization is located in', 'event_espresso'),
38
+			'[CO_ZIP]'           => esc_html__('The zip code for the organization', 'event_espresso'),
39
+			'[CO_LOGO]'          => esc_html__('The logo image for the organization', 'event_espresso'),
40
+			'[CO_EMAIL]'         => esc_html__('The primary email address for the organization', 'event_espresso'),
41
+			'[CO_PHONE]'         => esc_html__('The phone number for the organization', 'event_espresso'),
42
+			'[CO_LOGO_URL]'      => esc_html__(
43
+				'Just the link to the image used as the logo for the organization',
44
+				'event_espresso'
45
+			),
46
+			'[CO_FACEBOOK_URL]'  => esc_html__('Link to organization Facebook page', 'event_espresso'),
47
+			'[CO_TWITTER_URL]'   => esc_html__('Link to organization Twitter page', 'event_espresso'),
48
+			'[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'),
49
+			'[CO_GOOGLE_URL]'    => esc_html__('Link to organization Google page', 'event_espresso'),
50
+			'[CO_LINKEDIN_URL]'  => esc_html__('Link to organization LinkedIn page', 'event_espresso'),
51
+			'[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'),
52
+			'[CO_TAX_NUMBER_*]'  => sprintf(
53
+				esc_html__(
54
+					'This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.',
55
+					'event_espresso'
56
+				),
57
+				'<strong>',
58
+				'</strong>'
59
+			),
60
+		);
61
+	}
62
+
63
+
64
+	protected function _parser($shortcode)
65
+	{
66
+
67
+		switch ($shortcode) {
68
+			case '[COMPANY]':
69
+				return EE_Registry::instance()->CFG->organization->get_pretty('name');
70
+				break;
71
+
72
+			case '[CO_ADD1]':
73
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_1');
74
+				break;
75
+
76
+			case '[CO_ADD2]':
77
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_2');
78
+				break;
79
+
80
+			case '[CO_CITY]':
81
+				return EE_Registry::instance()->CFG->organization->get_pretty('city');
82
+				break;
83
+
84
+			case '[CO_STATE]':
85
+				$state = EE_Registry::instance()->load_model('State')->get_one_by_ID(
86
+					EE_Registry::instance()->CFG->organization->STA_ID
87
+				);
88
+				return $state instanceof EE_State ? $state->name() : '';
89
+				break;
90
+
91
+			case '[CO_ZIP]':
92
+				return EE_Registry::instance()->CFG->organization->get_pretty('zip');
93
+				break;
94
+
95
+			case '[CO_EMAIL]':
96
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
97
+				break;
98
+
99
+			case '[CO_PHONE]':
100
+				return EE_Registry::instance()->CFG->organization->get_pretty('phone');
101
+				break;
102
+
103
+			case '[CO_LOGO]':
104
+				return '<img src="'
105
+					   . EE_Registry::instance()->CFG->organization->get_pretty(
106
+						   'logo_url'
107
+					   ) . '" id="headerImage" />';
108
+				break;
109
+
110
+			case '[CO_LOGO_URL]':
111
+				return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
112
+				break;
113
+
114
+			case '[CO_FACEBOOK_URL]':
115
+				return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
116
+				break;
117
+
118
+			case '[CO_TWITTER_URL]':
119
+				return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
120
+				break;
121
+
122
+			case '[CO_PINTEREST_URL]':
123
+				return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
124
+				break;
125
+
126
+			case '[CO_LINKEDIN_URL]':
127
+				return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
128
+				break;
129
+
130
+			case '[CO_GOOGLE_URL]':
131
+				return EE_Registry::instance()->CFG->organization->get_pretty('google');
132
+				break;
133
+
134
+			case '[CO_INSTAGRAM_URL]':
135
+				return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
136
+				break;
137
+		}
138
+
139
+		// also allow for parameter shortcode
140
+		if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) {
141
+			// first see if there is any company tax number set and bail early if not
142
+			$tax_number = EE_Registry::instance()->CFG->organization->vat;
143
+			if (empty($tax_number)) {
144
+				return '';
145
+			}
146
+
147
+			// see if there are any attributes.
148
+			$attrs = $this->_get_shortcode_attrs($shortcode);
149
+
150
+			// set custom attrs if present (or default)
151
+			$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
152
+			return $prefix . $tax_number;
153
+		}
154
+
155
+		return '';
156
+	}
157 157
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Payment_Shortcodes.lib.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     protected function _parser($shortcode)
50 50
     {
51 51
         // ensure that the incoming object is an EE_Payment object.  If it isn't then bail early.
52
-        if (! $this->_data instanceof EE_Payment) {
52
+        if ( ! $this->_data instanceof EE_Payment) {
53 53
             return '';
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -18,93 +18,93 @@
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-    protected function _init_props()
22
-    {
23
-        $this->label = esc_html__('Payment Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to payments.', 'event_espresso');
25
-        $this->_shortcodes = array(
26
-            '[PAYMENT_TIMESTAMP]' => esc_html__(
27
-                'Outputs the date of the payment (using the default date format).',
28
-                'event_espresso'
29
-            ),
30
-            '[PAYMENT_METHOD]' => esc_html__('Outputs a the payment method.', 'event_espresso'),
31
-            '[PAYMENT_AMOUNT]' => esc_html__('Outputs the payment amount (with currency symbol).', 'event_espresso'),
32
-            '[PAYMENT_GATEWAY]' => esc_html__('Outputs the gateway used for the payment.', 'event_espresso'),
33
-            '[PAYMENT_GATEWAY_RESPONSE]' => esc_html__('Outputs the payment gateway response.', 'event_espresso'),
34
-            '[PAYMENT_GATEWAY_TXN_ID]' => esc_html__(
35
-                'This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.',
36
-                'event_espresso'
37
-            ),
38
-            '[PAYMENT_PO_NUMBER]' => esc_html__('Purchase Order number (if present)', 'event_espresso'),
39
-            '[PAYMENT_EXTRA_ACCOUNTING]' => esc_html__(
40
-                'Any extra accounting messages. Typically added with payments made via the admin.',
41
-                'event_espresso'
42
-            ),
43
-            '[PAYMENT_STATUS]' => esc_html__('The status of the payment.', 'event_espresso'),
44
-            // '[PAYMENT_STATUS_WITH_ICONS]' => esc_html__('The status of the payment including icons representing the status.', 'event_espresso')
45
-        );
46
-    }
47
-
48
-
49
-    protected function _parser($shortcode)
50
-    {
51
-        // ensure that the incoming object is an EE_Payment object.  If it isn't then bail early.
52
-        if (! $this->_data instanceof EE_Payment) {
53
-            return '';
54
-        }
55
-
56
-        $payment = $this->_data;
57
-
58
-        switch ($shortcode) {
59
-            case '[PAYMENT_TIMESTAMP]':
60
-                return $payment->timestamp();
61
-                break;
62
-
63
-            case '[PAYMENT_METHOD]':
64
-                // previously the column 'PAY_source' was known as 'PAY_method'
65
-                return $payment->source();
66
-                break;
67
-
68
-            case '[PAYMENT_AMOUNT]':
69
-                return $payment->amount_no_code();
70
-                break;
71
-
72
-            case '[PAYMENT_GATEWAY]':
73
-                // previously teh column 'PMD_ID' was more-or-less 'PAY_gateway'
74
-                if ($payment->payment_method() instanceof EE_Payment_Method) {
75
-                    return $payment->payment_method()->name();
76
-                } else {
77
-                    return esc_html__('Unknown', 'event_espresso');
78
-                }
79
-                break;
80
-
81
-            case '[PAYMENT_GATEWAY_RESPONSE]':
82
-                return $payment->gateway_response();
83
-                break;
84
-
85
-            case '[PAYMENT_GATEWAY_TXN_ID]':
86
-                return $payment->txn_id_chq_nmbr();
87
-                break;
88
-
89
-            case '[PAYMENT_PO_NUMBER]':
90
-                return $payment->po_number();
91
-                break;
92
-
93
-            case '[PAYMENT_EXTRA_ACCOUNTING]':
94
-                return $payment->extra_accntng();
95
-                break;
96
-
97
-            case '[PAYMENT_STATUS]':
98
-                return $payment->pretty_status();
99
-                break;
100
-
101
-            case '[PAYMENT_STATUS_WITH_ICONS]':
102
-                return $payment->pretty_status(true);
103
-                break;
104
-
105
-            default:
106
-                return '';
107
-                break;
108
-        }
109
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label = esc_html__('Payment Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to payments.', 'event_espresso');
25
+		$this->_shortcodes = array(
26
+			'[PAYMENT_TIMESTAMP]' => esc_html__(
27
+				'Outputs the date of the payment (using the default date format).',
28
+				'event_espresso'
29
+			),
30
+			'[PAYMENT_METHOD]' => esc_html__('Outputs a the payment method.', 'event_espresso'),
31
+			'[PAYMENT_AMOUNT]' => esc_html__('Outputs the payment amount (with currency symbol).', 'event_espresso'),
32
+			'[PAYMENT_GATEWAY]' => esc_html__('Outputs the gateway used for the payment.', 'event_espresso'),
33
+			'[PAYMENT_GATEWAY_RESPONSE]' => esc_html__('Outputs the payment gateway response.', 'event_espresso'),
34
+			'[PAYMENT_GATEWAY_TXN_ID]' => esc_html__(
35
+				'This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.',
36
+				'event_espresso'
37
+			),
38
+			'[PAYMENT_PO_NUMBER]' => esc_html__('Purchase Order number (if present)', 'event_espresso'),
39
+			'[PAYMENT_EXTRA_ACCOUNTING]' => esc_html__(
40
+				'Any extra accounting messages. Typically added with payments made via the admin.',
41
+				'event_espresso'
42
+			),
43
+			'[PAYMENT_STATUS]' => esc_html__('The status of the payment.', 'event_espresso'),
44
+			// '[PAYMENT_STATUS_WITH_ICONS]' => esc_html__('The status of the payment including icons representing the status.', 'event_espresso')
45
+		);
46
+	}
47
+
48
+
49
+	protected function _parser($shortcode)
50
+	{
51
+		// ensure that the incoming object is an EE_Payment object.  If it isn't then bail early.
52
+		if (! $this->_data instanceof EE_Payment) {
53
+			return '';
54
+		}
55
+
56
+		$payment = $this->_data;
57
+
58
+		switch ($shortcode) {
59
+			case '[PAYMENT_TIMESTAMP]':
60
+				return $payment->timestamp();
61
+				break;
62
+
63
+			case '[PAYMENT_METHOD]':
64
+				// previously the column 'PAY_source' was known as 'PAY_method'
65
+				return $payment->source();
66
+				break;
67
+
68
+			case '[PAYMENT_AMOUNT]':
69
+				return $payment->amount_no_code();
70
+				break;
71
+
72
+			case '[PAYMENT_GATEWAY]':
73
+				// previously teh column 'PMD_ID' was more-or-less 'PAY_gateway'
74
+				if ($payment->payment_method() instanceof EE_Payment_Method) {
75
+					return $payment->payment_method()->name();
76
+				} else {
77
+					return esc_html__('Unknown', 'event_espresso');
78
+				}
79
+				break;
80
+
81
+			case '[PAYMENT_GATEWAY_RESPONSE]':
82
+				return $payment->gateway_response();
83
+				break;
84
+
85
+			case '[PAYMENT_GATEWAY_TXN_ID]':
86
+				return $payment->txn_id_chq_nmbr();
87
+				break;
88
+
89
+			case '[PAYMENT_PO_NUMBER]':
90
+				return $payment->po_number();
91
+				break;
92
+
93
+			case '[PAYMENT_EXTRA_ACCOUNTING]':
94
+				return $payment->extra_accntng();
95
+				break;
96
+
97
+			case '[PAYMENT_STATUS]':
98
+				return $payment->pretty_status();
99
+				break;
100
+
101
+			case '[PAYMENT_STATUS_WITH_ICONS]':
102
+				return $payment->pretty_status(true);
103
+				break;
104
+
105
+			default:
106
+				return '';
107
+				break;
108
+		}
109
+	}
110 110
 }
Please login to merge, or discard this patch.