Security fix, added some more output validation
[project/addthis.git] / addthis.admin.inc
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Administration settings for AddThis button integration
7 */
8
9 /**
10 * Administration settings form.
11 *
12 * @return
13 * The completed form definition.
14 */
15 function addthis_admin_settings() {
16 $form = array();
17
18 $form['addthis_general_settings'] = array(
19 '#type' => 'fieldset',
20 '#title' => t('General settings'),
21 );
22 $form['addthis_general_settings']['addthis_username'] = array(
23 '#type' => 'textfield',
24 '#title' => t('Username'),
25 '#default_value' => variable_get('addthis_username', 'my-username'),
26 '#description' => t('Your username for <a href="http://www.addthis.com/">addthis.com</a>. Example: my-username'),
27 );
28 $form['addthis_general_settings']['addthis_display_in_links'] = array(
29 '#type' => 'checkbox',
30 '#title' => t('Display on node pages'),
31 '#default_value' => variable_get('addthis_display_in_links', '0'),
32 '#description' => t('Display an AddThis button always on a node page\'s links section.'),
33 );
34 $form['addthis_general_settings']['addthis_display_in_teasers'] = array(
35 '#type' => 'checkbox',
36 '#title' => t('Display in node teasers'),
37 '#default_value' => variable_get('addthis_display_in_teasers', '0'),
38 '#description' => t('Display an AddThis button in the node teasers.'),
39 );
40
41 $form['addthis_button_settings'] = array(
42 '#type' => 'fieldset',
43 '#title' => t('Button image settings'),
44 '#collapsible' => TRUE,
45 '#collapsed' => TRUE,
46 );
47 $form['addthis_button_settings']['addthis_image'] = array(
48 '#type' => 'textfield',
49 '#title' => t('Button image url'),
50 '#default_value' => variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
51 '#description' => t('URL for small image in the button. Example: http://s9.addthis.com/button1-share.gif'),
52 );
53 $form['addthis_button_settings']['addthis_image_secure'] = array(
54 '#type' => 'textfield',
55 '#title' => t('Button image url for secure https connection'),
56 '#default_value' => variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif'),
57 '#description' => t('This is only required if your site uses secure https connections. Example: https://secure.addthis.com/button1-share.gif'),
58 );
59 $form['addthis_button_settings']['addthis_image_width'] = array(
60 '#type' => 'textfield',
61 '#title' => t('Button image width'),
62 '#default_value' => variable_get('addthis_image_width', '125'),
63 '#description' => t('Width for button image. Example: 125'),
64 );
65 $form['addthis_button_settings']['addthis_image_height'] = array(
66 '#type' => 'textfield',
67 '#title' => t('Button image height'),
68 '#default_value' => variable_get('addthis_image_height', '16'),
69 '#description' => t('Height for button image. Example: 16'),
70 );
71 $form['addthis_button_settings']['addthis_image_attributes'] = array(
72 '#type' => 'textfield',
73 '#title' => t('Button image HTML attributes'),
74 '#default_value' => variable_get('addthis_image_attributes', 'alt=""'),
75 '#description' => t('Extra HTML attributes for img tag. Example: alt=""'),
76 );
77
78 $form['addthis_widget_settings'] = array(
79 '#type' => 'fieldset',
80 '#title' => t('Widget settings'),
81 '#collapsible' => TRUE,
82 '#collapsed' => TRUE,
83 );
84 $form['addthis_widget_settings']['addthis_dropdown_disabled'] = array(
85 '#type' => 'checkbox',
86 '#title' => t('Disable dropdown'),
87 '#default_value' => variable_get('addthis_dropdown_disabled', '0'),
88 '#description' => t('You can disable the dropdown for selecting where to share your link and use a pop-up window instead. This can be useful if the button is for example located next to a flash object.'),
89 );
90 $form['addthis_widget_settings']['addthis_logo'] = array(
91 '#type' => 'textfield',
92 '#title' => t('Logo url'),
93 '#default_value' => variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'),
94 '#description' => t('The logo to display on the popup window (about 200x50 pixels). The popup window is show when the user selects the \'More\' choice. Example: http://www.your-website.com/img/mylogo.gif'),
95 );
96 $form['addthis_widget_settings']['addthis_logo_background'] = array(
97 '#type' => 'textfield',
98 '#title' => t('Logo background color'),
99 '#default_value' => variable_get('addthis_logo_background', 'EFEFFF'),
100 '#description' => t('The color to use as a background around the logo in the popup. Example: EFEFEF'),
101 );
102 $form['addthis_widget_settings']['addthis_logo_color'] = array(
103 '#type' => 'textfield',
104 '#title' => t('Logo text color'),
105 '#default_value' => variable_get('addthis_logo_color', '666699'),
106 '#description' => t('The color to use for the text next to the logo in the popup. Example: 666666'),
107 );
108 $form['addthis_widget_settings']['addthis_brand'] = array(
109 '#type' => 'textfield',
110 '#title' => t('Brand text'),
111 '#default_value' => variable_get('addthis_brand', ''),
112 '#description' => t('The brand name to display in the drop-down (top right). Example: My Website. Leave blank to use the site_name variable, currently set to !site_name', array('!site_name' => variable_get('site_name', 'Drupal'))),
113 );
114 $form['addthis_widget_settings']['addthis_options'] = array(
115 '#type' => 'textarea',
116 '#title' => t('Options'),
117 '#default_value' => variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'),
118 '#description' => t('A comma-separated ordered list of options to include in the drop-down. Example: favorites, email, digg, delicious, more<br/>Currently supported options:<br/>
119 aim, aolfav, ask, backflip, ballhype, blinklist, blogmarks, bluedot, buzz, delicious, digg, diigo, email, facebook, favorites, fark, feedmelinks, friendfeed, furl, google, kaboodle, kirtsy, linkedin, live, magnolia, misterwong, mixx, multiply, myweb, myspace, netvous, newsvine, pownce, propeller, reddit, segnalo, sharedstuff, slashdot, spurl, stumbleupon, stylehive, tailrank, technorati, thisnext, twitter, yardbarker, yahoobkm, more<br />
120 The most up-to-date list can be found <a href="!url">here</a>.', array('!url' => url('http://addthis.com/services/list'))),
121 );
122 $form['addthis_widget_settings']['addthis_offset_top'] = array(
123 '#type' => 'textfield',
124 '#title' => t('Offset top'),
125 '#default_value' => variable_get('addthis_offset_top', '2'),
126 '#description' => t('Vertical offset for the drop-down window (in pixels). Example: 2'),
127 );
128 $form['addthis_widget_settings']['addthis_offset_left'] = array(
129 '#type' => 'textfield',
130 '#title' => t('Offset top'),
131 '#default_value' => variable_get('addthis_offset_left', '2'),
132 '#description' => t('Horizontal offset for the drop-down window (in pixels). Example: 2'),
133 );
134 $form['addthis_widget_settings']['addthis_disable_flash'] = array(
135 '#type' => 'checkbox',
136 '#title' => t('Disable Flash cookie'),
137 '#default_value' => variable_get('addthis_disable_flash', '0'),
138 '#description' => t('AddThis.com uses Flash cookies by default to <a href="http://www.addthis.com/blog/2009/01/05/the-addthis-flash-cookie-we-need-your-feedback/">provide more accurate tracking information</a>. Some people consider this <a href="http://drupal.org/node/364078">a privacy concern</a> and Flash cookies can be replaced with normal ones by checking this checkbox.'),
139 );
140 $form['addthis_widget_settings']['addthis_widget_version'] = array(
141 '#type' => 'select',
142 '#title' => t('Widget Version'),
143 '#default_value' => variable_get('addthis_widget_version', '152'),
144 '#options' => array(
145 152 => t('152 - Uses a popup window for the more option'),
146 200 => t('200 - Adds lightbox support for the more option')
147 ),
148 '#description' => t('The version of the addthis widget to use.'),
149 );
150 return system_settings_form($form);
151 }