This repository was archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathConfig.php
More file actions
executable file
·169 lines (165 loc) · 7.64 KB
/
Config.php
File metadata and controls
executable file
·169 lines (165 loc) · 7.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
namespace Ctct\Util;
/**
* Configuration class to hold endpoints, urls, errors messages etc.
*
* @package Util
* @author Constant Contact
*/
class Config {
/**
* @var array - array of configuration properties
*/
private static $props = array(
/**
* REST endpoints
*/
'endpoints' => array(
'base_url' => 'https://api.cc.email/v3/',
'account_verified_addresses' => 'account/verifiedemailaddresses',
'account_info' => 'account/info',
'activity' => 'activities/%s',
'activities' => 'activities',
'export_contacts_activity' => 'activities/exportcontacts',
'clear_lists_activity' => 'activities/clearlists',
'remove_from_lists_activity' => 'activities/removefromlists',
'add_contacts_activity' => 'activities/addcontacts',
'contact' => 'contacts/%s',
'contacts' => 'contacts',
'lists' => 'contact_lists',
'list' => 'lists/%s',
'list_contacts' => 'lists/%s/contacts',
'contact_lists' => 'contacts/%s/lists',
'contact_list' => 'contacts/%s/lists/%s',
'campaigns' => 'emailmarketing/campaigns',
'campaign' => 'emailmarketing/campaigns/%s',
'campaign_schedules' => 'emailmarketing/campaigns/%s/schedules',
'campaign_schedule' => 'emailmarketing/campaigns/%s/schedules/%s',
'campaign_test_sends' => 'emailmarketing/campaigns/%s/tests',
'campaign_preview' => 'emailmarketing/campaigns/%s/preview',
'campaign_tracking_summary' => 'emailmarketing/campaigns/%s/tracking/reports/summary',
'campaign_tracking_bounces' => 'emailmarketing/campaigns/%s/tracking/bounces',
'campaign_tracking_clicks' => 'emailmarketing/campaigns/%s/tracking/clicks',
'campaign_tracking_forwards' => 'emailmarketing/campaigns/%s/tracking/forwards',
'campaign_tracking_opens' => 'emailmarketing/campaigns/%s/tracking/opens',
'campaign_tracking_sends' => 'emailmarketing/campaigns/%s/tracking/sends',
'campaign_tracking_unsubscribes' => 'emailmarketing/campaigns/%s/tracking/unsubscribes',
'campaign_tracking_link' => 'emailmarketing/campaigns/%s/tracking/clicks/%s',
'contact_tracking_summary' => 'contacts/%s/tracking/reports/summary',
'contact_tracking_bounces' => 'contacts/%s/tracking/bounces',
'contact_tracking_clicks' => 'contacts/%s/tracking/clicks',
'contact_tracking_forwards' => 'contacts/%s/tracking/forwards',
'contact_tracking_opens' => 'contacts/%s/tracking/opens',
'contact_tracking_sends' => 'contacts/%s/tracking/sends',
'contact_tracking_unsubscribes' => 'contacts/%s/tracking/unsubscribes',
'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s',
'events' => 'eventspot/events',
'event' => 'eventspot/events/%s',
'event_fees' => 'eventspot/events/%s/fees',
'event_fee' => 'eventspot/events/%s/fees/%s',
'event_registrants' => 'eventspot/events/%s/registrants',
'event_registrant' => 'eventspot/events/%s/registrants/%s',
'event_promocodes' => 'eventspot/events/%s/promocodes',
'event_promocode' => 'eventspot/events/%s/promocodes/%s',
'event_items' => 'eventspot/events/%s/items',
'event_item' => 'eventspot/events/%s/items/%s',
'event_item_attributes' => 'eventspot/events/%s/items/%s/attributes',
'event_item_attribute' => 'eventspot/events/%s/items/%s/attributes/%s',
'library_files' => 'library/files',
'library_file' => 'library/files/%s',
'library_folders' => 'library/folders',
'library_folder' => 'library/folders/%s',
'library_files_by_folder' => 'library/folders/%s/files',
'library_file_upload_status' => 'library/files/uploadstatus/%s'
),
/**
* Column names used with bulk activities
*/
'activities_columns' => array(
'email' => 'EMAIL',
'first_name' => 'FIRST NAME',
'last_name' => 'LAST NAME',
'birthday_day' => 'BIRTHDAY_DAY',
'birthday_month' => 'BIRTHDAY_MONTH',
'anniversary' => 'ANNIVERSARY',
'job_title' => 'JOB TITLE',
'company_name' => 'COMPANY NAME',
'work_phone' => 'WORK PHONE',
'home_phone' => 'HOME PHONE',
'address1' => 'ADDRESS LINE 1',
'address2' => 'ADDRESS LINE 2',
'address3' => 'ADDRESS LINE 3',
'city' => 'CITY',
'state' => 'STATE',
'state_province' => 'US STATE/CA PROVINCE',
'country' => 'COUNTRY',
'postal_code' => 'ZIP/POSTAL CODE',
'sub_postal_code' => 'SUB ZIP/POSTAL CODE',
'custom_field_1' => 'CUSTOM FIELD 1',
'custom_field_2' => 'CUSTOM FIELD 2',
'custom_field_3' => 'CUSTOM FIELD 3',
'custom_field_4' => 'CUSTOM FIELD 4',
'custom_field_5' => 'CUSTOM FIELD 5',
'custom_field_6' => 'CUSTOM FIELD 6',
'custom_field_7' => 'CUSTOM FIELD 7',
'custom_field_8' => 'CUSTOM FIELD 8',
'custom_field_9' => 'CUSTOM FIELD 9',
'custom_field_10' => 'CUSTOM FIELD 10',
'custom_field_11' => 'CUSTOM FIELD 11',
'custom_field_12' => 'CUSTOM FIELD 12',
'custom_field_13' => 'CUSTOM FIELD 13',
'custom_field_14' => 'CUSTOM FIELD 14',
'custom_field_15' => 'CUSTOM FIELD 15',
),
/**
* OAuth2 Authorization related configuration options
*/
'auth' => array(
'base_url' => 'https://idfed.constantcontact.com/as/',
'response_type_code' => 'code',
'response_type_token' => 'token',
'authorization_code_grant_type' => 'authorization_code',
'authorization_endpoint' => 'oauth/siteowner/authorize',
'token_endpoint' => 'token.oauth2',
'token_info' => 'tokeninfo.htm',
),
/**
* Errors to be returned for various exceptions
*/
'errors' => array(
'id_or_object' => 'Only an id or %s object are allowed for this method.',
'file_extension' => 'Only file extensions of the following are allowed: %s'
),
/**
* Setting the version fo the application used in Rest Calls when setting the version header
*/
'settings' => array(
'version' => '3.x.x'
),
);
/**
* Get a configuration property given a specified location, example usage: Config::get('auth.token_endpoint')
* @param $index - location of the property to obtain
* @return string
*/
public static function get($index) {
$index = explode('.', $index);
return self::getValue($index, self::$props);
}
/**
* Navigate through a config array looking for a particular index
* @param array $index The index sequence we are navigating down
* @param array $value The portion of the config array to process
* @return mixed
*/
private static function getValue($index, $value) {
if (is_array($index) && count($index)) {
$current_index = array_shift($index);
}
if (is_array($index) && count($index) && is_array($value[$current_index]) && count($value[$current_index])) {
return self::getValue($index, $value[$current_index]);
} else {
return $value[$current_index];
}
}
}