Révision 4543c6c7
Ajouté par Assos Assos il y a plus de 10 ans
htmltest/sites/all/modules/addthis/includes/addthis.admin.inc | ||
---|---|---|
1 | 1 |
<?php |
2 |
|
|
3 | 2 |
/** |
4 | 3 |
* @file |
5 | 4 |
* Administrative page callbacks for the AddThis-module. |
6 | 5 |
*/ |
7 | 6 |
|
7 |
/** |
|
8 |
* Form handler for admin_settings_form. |
|
9 |
*/ |
|
8 | 10 |
function addthis_admin_settings_form($form_state) { |
9 | 11 |
AddThis::getInstance()->addStylesheets(); |
10 | 12 |
|
... | ... | |
23 | 25 |
'#collapsed' => TRUE, |
24 | 26 |
); |
25 | 27 |
$form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::CO_BRAND_KEY] = array( |
26 |
'#type' => 'textfield',
|
|
27 |
'#title' => t('Branding text'),
|
|
28 |
'#description' => t('Additional branding message to be rendered in the upper-right-hand corner of the compact menus.<br />Should be less than 15 characters in most cases to render properly.'),
|
|
29 |
'#default_value' => AddThis::getInstance()->getCoBrand(),
|
|
30 |
'#required' => FALSE,
|
|
31 |
'#maxlength' => 15,
|
|
28 |
'#type' => 'textfield', |
|
29 |
'#title' => t('Branding text'), |
|
30 |
'#description' => t('Additional branding message to be rendered in the upper-right-hand corner of the compact menus.<br />Should be less than 15 characters in most cases to render properly.'), |
|
31 |
'#default_value' => AddThis::getInstance()->getCoBrand(), |
|
32 |
'#required' => FALSE, |
|
33 |
'#maxlength' => 15, |
|
32 | 34 |
); |
33 | 35 |
$form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::UI_HEADER_COLOR_KEY] = array( |
34 |
'#type' => 'textfield',
|
|
35 |
'#title' => t('Header text color'),
|
|
36 |
'#default_value' => AddThis::getInstance()->getUiHeaderColor(),
|
|
37 |
'#description' => t('Something like #FFFFFF'),
|
|
38 |
'#size' => 8,
|
|
39 |
'#maxlength' => 7,
|
|
40 |
'#required' => FALSE,
|
|
36 |
'#type' => 'textfield', |
|
37 |
'#title' => t('Header text color'), |
|
38 |
'#default_value' => AddThis::getInstance()->getUiHeaderColor(), |
|
39 |
'#description' => t('Something like #FFFFFF'), |
|
40 |
'#size' => 8, |
|
41 |
'#maxlength' => 7, |
|
42 |
'#required' => FALSE, |
|
41 | 43 |
); |
42 | 44 |
$form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::UI_HEADER_BACKGROUND_COLOR_KEY] = array( |
43 |
'#type' => 'textfield',
|
|
44 |
'#title' => t('Header background color'),
|
|
45 |
'#default_value' => AddThis::getInstance()->getUiHeaderBackgroundColor(),
|
|
46 |
'#description' => t('Something like #000000'),
|
|
47 |
'#size' => 8,
|
|
48 |
'#maxlength' => 7,
|
|
49 |
'#required' => FALSE,
|
|
45 |
'#type' => 'textfield', |
|
46 |
'#title' => t('Header background color'), |
|
47 |
'#default_value' => AddThis::getInstance()->getUiHeaderBackgroundColor(), |
|
48 |
'#description' => t('Something like #000000'), |
|
49 |
'#size' => 8, |
|
50 |
'#maxlength' => 7, |
|
51 |
'#required' => FALSE, |
|
50 | 52 |
); |
51 | 53 |
$form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::CLICK_TO_OPEN_COMPACT_MENU_ENABLED_KEY] = array( |
52 | 54 |
'#type' => 'checkbox', |
... | ... | |
75 | 77 |
// Enabled services settings. |
76 | 78 |
$form['fieldset_compact_menu']['enabled_services_fieldset'] = array( |
77 | 79 |
'#type' => 'fieldset', |
78 |
'#title' => t('Enabled services'),
|
|
80 |
'#title' => t('Compact menu enabled services'),
|
|
79 | 81 |
'#description' => t('The sharing services you select here will be displayed in the compact menu. If you select no services, AddThis will provide a list of frequently used services. This list is updated regularly. <b>Notice that this setting does not define what services should be display in a toolbox.</b>'), |
80 | 82 |
'#collapsible' => TRUE, |
81 | 83 |
'#collapsed' => TRUE, |
... | ... | |
91 | 93 |
|
92 | 94 |
// Additional visual settings. |
93 | 95 |
$form['fieldset_compact_menu']['fieldset_additionals'] = array( |
94 |
'#type' => 'fieldset',
|
|
95 |
'#title' => t('Additional configuration'),
|
|
96 |
'#collapsible' => TRUE,
|
|
97 |
'#collapsed' => TRUE,
|
|
96 |
'#type' => 'fieldset', |
|
97 |
'#title' => t('Additional configuration'), |
|
98 |
'#collapsible' => TRUE, |
|
99 |
'#collapsed' => TRUE, |
|
98 | 100 |
); |
99 | 101 |
$form['fieldset_compact_menu']['fieldset_additionals'][AddThis::STANDARD_CSS_ENABLED_KEY] = array( |
100 |
'#type' => 'checkbox',
|
|
101 |
'#title' => t('Use standard AddThis stylesheet'),
|
|
102 |
'#description' => t('If not checked, AddThis will not load standard CSS file, allowing you to style everything yourself without incurring the cost of an additional load.'),
|
|
103 |
'#default_value' => AddThis::getInstance()->isStandardCssEnabled(),
|
|
104 |
'#required' => FALSE,
|
|
102 |
'#type' => 'checkbox', |
|
103 |
'#title' => t('Use standard AddThis stylesheet'), |
|
104 |
'#description' => t('If not checked, AddThis will not load standard CSS file, allowing you to style everything yourself without incurring the cost of an additional load.'), |
|
105 |
'#default_value' => AddThis::getInstance()->isStandardCssEnabled(), |
|
106 |
'#required' => FALSE, |
|
105 | 107 |
); |
106 | 108 |
$form['fieldset_compact_menu']['fieldset_additionals'][AddThis::COMPLIANT_508_KEY] = array( |
107 |
'#type' => 'checkbox',
|
|
108 |
'#title' => t('508 compliant'),
|
|
109 |
'#description' => 'If checked, clicking the AddThis button will open a new window to a page that is keyboard navigable.',
|
|
110 |
'#default_value' => AddThis::getInstance()->get508Compliant(),
|
|
111 |
'#required' => FALSE,
|
|
109 |
'#type' => 'checkbox', |
|
110 |
'#title' => t('508 compliant'), |
|
111 |
'#description' => 'If checked, clicking the AddThis button will open a new window to a page that is keyboard navigable.', |
|
112 |
'#default_value' => AddThis::getInstance()->get508Compliant(), |
|
113 |
'#required' => FALSE, |
|
112 | 114 |
); |
113 | 115 |
$form['fieldset_compact_menu']['fieldset_additionals'][AddThis::ADDRESSBOOK_ENABLED_KEY] = array( |
114 |
'#type' => 'checkbox',
|
|
115 |
'#title' => t('Use addressbook'),
|
|
116 |
'#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.',
|
|
117 |
'#default_value' => AddThis::getInstance()->isAddressbookEnabled(),
|
|
118 |
'#required' => FALSE,
|
|
116 |
'#type' => 'checkbox', |
|
117 |
'#title' => t('Use addressbook'), |
|
118 |
'#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.', |
|
119 |
'#default_value' => AddThis::getInstance()->isAddressbookEnabled(), |
|
120 |
'#required' => FALSE, |
|
119 | 121 |
); |
120 | 122 |
|
121 | 123 |
// Analytics settings. |
122 | 124 |
$profile_id = AddThis::getInstance()->getProfileId(); |
123 | 125 |
$can_track_clicks = empty($profile_id) ? FALSE : TRUE; |
124 | 126 |
$form['fieldset_analytics'] = array( |
125 |
'#type' => 'fieldset',
|
|
126 |
'#title' => t('Analytics & Tracking'),
|
|
127 |
'#collapsible' => TRUE,
|
|
128 |
'#collapsed' => $can_track_clicks ? TRUE : FALSE,
|
|
127 |
'#type' => 'fieldset', |
|
128 |
'#title' => t('Analytics & Tracking'), |
|
129 |
'#collapsible' => TRUE, |
|
130 |
'#collapsed' => $can_track_clicks ? TRUE : FALSE, |
|
129 | 131 |
); |
130 | 132 |
|
131 | 133 |
if (!$can_track_clicks) { |
... | ... | |
155 | 157 |
// Facebook Like tracking requires a namespace to be added. |
156 | 158 |
$rdf_enabled = module_exists('rdf'); |
157 | 159 |
if (!$rdf_enabled) { |
158 |
$rdf_description = '<span class="admin-disabled">' . t('The RDF module needs to be enabled to support Facebook Like tracking support.<br>Enable the module on <a href="!modules">modules</a> page.', |
|
160 |
$rdf_description = '<span class="admin-disabled">' . t('The RDF module needs to be enabled to support Facebook Like tracking support.<br />Enable the module on <a href="!modules">modules</a> page.',
|
|
159 | 161 |
array('!modules' => base_path() . 'admin/modules') |
160 | 162 |
) . '</span>'; |
161 | 163 |
} |
... | ... | |
175 | 177 |
); |
176 | 178 |
|
177 | 179 |
$form['fieldset_analytics'][AddThis::FACEBOOK_LIKE_COUNT_SUPPORT_ENABLED] = array( |
178 |
'#type' => 'checkbox',
|
|
179 |
'#title' => t('Enable Facebook Like tracking'),
|
|
180 |
'#description' => filter_xss($rdf_description, array('span')),
|
|
181 |
'#default_value' => AddThis::getInstance()->isFacebookLikeCountSupportEnabled(),
|
|
182 |
'#required' => FALSE,
|
|
183 |
'#disabled' => !$rdf_enabled,
|
|
180 |
'#type' => 'checkbox', |
|
181 |
'#title' => t('Enable Facebook Like tracking'), |
|
182 |
'#description' => filter_xss($rdf_description, array('span')), |
|
183 |
'#default_value' => AddThis::getInstance()->isFacebookLikeCountSupportEnabled(), |
|
184 |
'#required' => FALSE, |
|
185 |
'#disabled' => !$rdf_enabled, |
|
184 | 186 |
); |
185 | 187 |
|
186 |
// Google Analytics and Google Social Tracking support |
|
188 |
// Google Analytics and Google Social Tracking support.
|
|
187 | 189 |
$can_do_google_social_tracking = module_exists('googleanalytics'); |
188 | 190 |
$is_google_analytics_setup = $can_do_google_social_tracking && variable_get('googleanalytics_account', ''); |
189 | 191 |
$form['fieldset_analytics']['google_analytics'] = array( |
... | ... | |
222 | 224 |
'#disabled' => !$is_google_analytics_setup, |
223 | 225 |
); |
224 | 226 |
|
225 |
|
|
226 | 227 |
// Third party settings. |
227 | 228 |
$form['third_party_fieldset'] = array( |
228 | 229 |
'#type' => 'fieldset', |
... | ... | |
253 | 254 |
return system_settings_form($form); |
254 | 255 |
} |
255 | 256 |
|
257 |
/** |
|
258 |
* Form handler for admin_settings_advanced_form. |
|
259 |
*/ |
|
256 | 260 |
function addthis_admin_settings_advanced_form($form_state) { |
257 | 261 |
|
258 | 262 |
// Service URL's settings. |
259 | 263 |
$form['service_urls_fieldset'] = array( |
260 |
'#type' => 'fieldset',
|
|
261 |
'#title' => t('Service URLs'),
|
|
262 |
'#collapsible' => TRUE,
|
|
263 |
'#collapsed' => TRUE,
|
|
264 |
'#type' => 'fieldset', |
|
265 |
'#title' => t('Service URLs'), |
|
266 |
'#collapsible' => TRUE, |
|
267 |
'#collapsed' => TRUE, |
|
264 | 268 |
); |
265 | 269 |
$form['service_urls_fieldset'][AddThis::BOOKMARK_URL_KEY] = array( |
266 |
'#type' => 'textfield',
|
|
267 |
'#title' => t('AddThis bookmark URL'),
|
|
268 |
'#default_value' => AddThis::getInstance()->getBaseBookmarkUrl(),
|
|
269 |
'#required' => TRUE,
|
|
270 |
'#type' => 'textfield', |
|
271 |
'#title' => t('AddThis bookmark URL'), |
|
272 |
'#default_value' => AddThis::getInstance()->getBaseBookmarkUrl(), |
|
273 |
'#required' => TRUE, |
|
270 | 274 |
); |
271 | 275 |
$form['service_urls_fieldset'][AddThis::SERVICES_CSS_URL_KEY] = array( |
272 |
'#type' => 'textfield',
|
|
273 |
'#title' => t('AddThis services stylesheet URL'),
|
|
274 |
'#default_value' => AddThis::getInstance()->getServicesCssUrl(),
|
|
275 |
'#required' => TRUE,
|
|
276 |
'#type' => 'textfield', |
|
277 |
'#title' => t('AddThis services stylesheet URL'), |
|
278 |
'#default_value' => AddThis::getInstance()->getServicesCssUrl(), |
|
279 |
'#required' => TRUE, |
|
276 | 280 |
); |
277 | 281 |
$form['service_urls_fieldset'][AddThis::SERVICES_JSON_URL_KEY] = array( |
278 |
'#type' => 'textfield',
|
|
279 |
'#title' => t('AddThis services json URL'),
|
|
280 |
'#default_value' => AddThis::getInstance()->getServicesJsonUrl(),
|
|
281 |
'#required' => TRUE,
|
|
282 |
'#type' => 'textfield', |
|
283 |
'#title' => t('AddThis services json URL'), |
|
284 |
'#default_value' => AddThis::getInstance()->getServicesJsonUrl(), |
|
285 |
'#required' => TRUE, |
|
282 | 286 |
); |
283 | 287 |
$form['service_urls_fieldset'][AddThis::WIDGET_JS_URL_KEY] = array( |
284 |
'#type' => 'textfield',
|
|
285 |
'#title' => t('AddThis javascript widget URL'),
|
|
286 |
'#default_value' => AddThis::getInstance()->getBaseWidgetJsUrl(),
|
|
287 |
'#required' => TRUE,
|
|
288 |
'#type' => 'textfield', |
|
289 |
'#title' => t('AddThis javascript widget URL'), |
|
290 |
'#default_value' => AddThis::getInstance()->getBaseWidgetJsUrl(), |
|
291 |
'#required' => TRUE, |
|
288 | 292 |
); |
289 | 293 |
|
290 | 294 |
// Advanced settings. |
... | ... | |
309 | 313 |
'#required' => FALSE, |
310 | 314 |
'#description' => t('AddThis custom configuration code. See format at <a href="http://addthis.com/" target="_blank">AddThis.com</a>'), |
311 | 315 |
); |
316 |
$form['advanced_settings_fieldset'][AddThis::WIDGET_JS_LOAD_TYPE] = array( |
|
317 |
'#type' => 'select', |
|
318 |
'#title' => t('When to load the widget js.'), |
|
319 |
'#options' => array( |
|
320 |
'async' => t('When the page loads, but load assets asynchronously. (default)'), |
|
321 |
'include' => t('When the page loads.'), |
|
322 |
'domready' => t('When the DOM is ready at the script dynamicly.'), |
|
323 |
), |
|
324 |
'#default_value' => AddThis::getInstance()->getWidgetJsLoadType(), |
|
325 |
'#required' => FALSE, |
|
326 |
); |
|
312 | 327 |
return system_settings_form($form); |
313 | 328 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules