1: <?php
2: namespace Ctct\Util;
3:
4: 5: 6: 7: 8: 9:
10: class Config
11: {
12: 13: 14:
15: private static $props = array(
16: 17: 18:
19: 'endpoints' => array(
20: 'base_url' => 'https://api.constantcontact.com/v2/',
21: 'account_verified_addresses' => 'account/verifiedemailaddresses',
22: 'account_info' => 'account/info',
23: 'activity' => 'activities/%s',
24: 'activities' => 'activities',
25: 'export_contacts_activity' => 'activities/exportcontacts',
26: 'clear_lists_activity' => 'activities/clearlists',
27: 'remove_from_lists_activity' => 'activities/removefromlists',
28: 'add_contacts_activity' => 'activities/addcontacts',
29: 'contact' => 'contacts/%s',
30: 'contacts' => 'contacts',
31: 'lists' => 'lists',
32: 'list' => 'lists/%s',
33: 'list_contacts' => 'lists/%s/contacts',
34: 'contact_lists' => 'contacts/%s/lists',
35: 'contact_list' => 'contacts/%s/lists/%s',
36: 'campaigns' => 'emailmarketing/campaigns',
37: 'campaign' => 'emailmarketing/campaigns/%s',
38: 'campaign_schedules' => 'emailmarketing/campaigns/%s/schedules',
39: 'campaign_schedule' => 'emailmarketing/campaigns/%s/schedules/%s',
40: 'campaign_test_sends' => 'emailmarketing/campaigns/%s/tests',
41: 'campaign_tracking_summary' => 'emailmarketing/campaigns/%s/tracking/reports/summary',
42: 'campaign_tracking_bounces' => 'emailmarketing/campaigns/%s/tracking/bounces',
43: 'campaign_tracking_clicks' => 'emailmarketing/campaigns/%s/tracking/clicks',
44: 'campaign_tracking_forwards' => 'emailmarketing/campaigns/%s/tracking/forwards',
45: 'campaign_tracking_opens' => 'emailmarketing/campaigns/%s/tracking/opens',
46: 'campaign_tracking_sends' => 'emailmarketing/campaigns/%s/tracking/sends',
47: 'campaign_tracking_unsubscribes' => 'emailmarketing/campaigns/%s/tracking/unsubscribes',
48: 'campaign_tracking_link' => 'emailmarketing/campaigns/%s/tracking/clicks/%s',
49: 'contact_tracking_summary' => 'contacts/%s/tracking/reports/summary',
50: 'contact_tracking_bounces' => 'contacts/%s/tracking/bounces',
51: 'contact_tracking_clicks' => 'contacts/%s/tracking/clicks',
52: 'contact_tracking_forwards' => 'contacts/%s/tracking/forwards',
53: 'contact_tracking_opens' => 'contacts/%s/tracking/opens',
54: 'contact_tracking_sends' => 'contacts/%s/tracking/sends',
55: 'contact_tracking_unsubscribes' => 'contacts/%s/tracking/unsubscribes',
56: 'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s',
57: 'library_files' => 'library/files',
58: 'library_file' => 'library/files/%s',
59: 'library_folders' => 'library/folders',
60: 'library_folder' => 'library/folders/%s',
61: 'library_files_by_folder' => 'library/folders/%s/files',
62: 'library_file_upload_status' => 'library/files/uploadstatus/%s'
63: ),
64: 65: 66:
67: 'activities_columns' => array(
68: 'email' => 'EMAIL',
69: 'first_name' => 'FIRST NAME',
70: 'last_name' => 'LAST NAME',
71: 'birthday_day' => 'BIRTHDAY_DAY',
72: 'birthday_month' => 'BIRTHDAY_MONTH',
73: 'anniversary' => 'ANNIVERSARY',
74: 'job_title' => 'JOB TITLE',
75: 'company_name' => 'COMPANY NAME',
76: 'work_phone' => 'WORK PHONE',
77: 'home_phone' => 'HOME PHONE',
78: 'address1' => 'ADDRESS LINE 1',
79: 'address2' => 'ADDRESS LINE 2',
80: 'address3' => 'ADDRESS LINE 3',
81: 'city' => 'CITY',
82: 'state' => 'STATE',
83: 'state_province' => 'US STATE/CA PROVINCE',
84: 'country' => 'COUNTRY',
85: 'postal_code' => 'ZIP/POSTAL CODE',
86: 'sub_postal_code' => 'SUB ZIP/POSTAL CODE',
87: 'custom_field_1' => 'CUSTOM FIELD 1',
88: 'custom_field_2' => 'CUSTOM FIELD 2',
89: 'custom_field_3' => 'CUSTOM FIELD 3',
90: 'custom_field_4' => 'CUSTOM FIELD 4',
91: 'custom_field_5' => 'CUSTOM FIELD 5',
92: 'custom_field_6' => 'CUSTOM FIELD 6',
93: 'custom_field_7' => 'CUSTOM FIELD 7',
94: 'custom_field_8' => 'CUSTOM FIELD 8',
95: 'custom_field_9' => 'CUSTOM FIELD 9',
96: 'custom_field_10' => 'CUSTOM FIELD 10',
97: 'custom_field_11' => 'CUSTOM FIELD 11',
98: 'custom_field_12' => 'CUSTOM FIELD 12',
99: 'custom_field_13' => 'CUSTOM FIELD 13',
100: 'custom_field_14' => 'CUSTOM FIELD 14',
101: 'custom_field_15' => 'CUSTOM FIELD 15',
102: ),
103: 104: 105:
106: 'auth' => array(
107: 'base_url' => 'https://oauth2.constantcontact.com/oauth2/',
108: 'response_type_code' => 'code',
109: 'response_type_token' => 'token',
110: 'authorization_code_grant_type' => 'authorization_code',
111: 'authorization_endpoint' => 'oauth/siteowner/authorize',
112: 'token_endpoint' => 'oauth/token',
113: 'token_info' => 'tokeninfo.htm'
114: ),
115: 116: 117:
118: 'errors' => array(
119: 'id_or_object' => 'Only an id or %s object are allowed for this method.',
120: 'file_extension' => 'Only file extensions of the following are allowed: %s'
121: ),
122:
123: 124: 125:
126: 'settings' => array(
127: 'version' => '2.0.0'
128: ),
129: );
130:
131: 132: 133: 134: 135:
136: public static function get($index)
137: {
138: $index = explode('.', $index);
139: return self::getValue($index, self::$props);
140: }
141:
142: 143: 144: 145: 146: 147:
148: private static function getValue($index, $value)
149: {
150: if (is_array($index) && count($index)) {
151: $current_index = array_shift($index);
152: }
153: if (is_array($index) && count($index) && is_array($value[$current_index]) && count($value[$current_index])) {
154: return self::getValue($index, $value[$current_index]);
155: } else {
156: return $value[$current_index];
157: }
158: }
159: }
160: