Completed
Pull Request — master (#1312)
by
unknown
09:08
created
core/libraries/shortcodes/EE_Organization_Shortcodes.lib.php 1 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 ! empty($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 ! empty($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.