Version Description
Download this release
Release Info
Developer | _mjk_ |
Plugin | WordPress Share Buttons Plugin – AddThis |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- addthis_social_widget.php +177 -151
- php4/addthis_social_widget.php +0 -292
- readme.txt +2 -2
addthis_social_widget.php
CHANGED
@@ -20,176 +20,197 @@
|
|
20 |
* +--------------------------------------------------------------------------+
|
21 |
*/
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
return;
|
26 |
-
}
|
27 |
|
28 |
/**
|
29 |
* Plugin Name: AddThis Social Bookmarking Widget
|
30 |
* Plugin URI: http://www.addthis.com
|
31 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
32 |
-
* Version: 1.5.
|
33 |
*
|
34 |
* Author: The AddThis Team
|
35 |
* Author URI: http://www.addthis.com
|
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 |
-
add_option('addthis_username');
|
80 |
-
add_option('addthis_options', 'email, favorites, digg, delicious, myspace, google, facebook, reddit, live, more');
|
81 |
-
add_option('addthis_isdropdown', true);
|
82 |
-
add_option('addthis_showonpages', false);
|
83 |
-
add_option('addthis_showonarchives', false);
|
84 |
-
add_option('addthis_showoncats', false);
|
85 |
-
add_option('addthis_style');
|
86 |
-
add_option('addthis_header_background');
|
87 |
-
add_option('addthis_header_color');
|
88 |
-
add_option('addthis_brand');
|
89 |
-
add_option('addthis_language', 'en');
|
90 |
-
|
91 |
-
$this->addthis_isdropdown = get_option('addthis_isdropdown') === 'true';
|
92 |
-
|
93 |
-
if (!isset($style)) $style = get_option('addthis_style');
|
94 |
-
if (strlen($style) == 0) $style = 'share';
|
95 |
-
$this->addthis_style = $style;
|
96 |
-
|
97 |
-
if (!isset($username)) $username = get_option('addthis_username');
|
98 |
-
$this->addthis_username = $username;
|
99 |
-
|
100 |
-
$this->addthis_showonpages = get_option('addthis_showonpages') === 'true';
|
101 |
-
$this->addthis_showonarchives = get_option('addthis_showonarchives') === 'true';
|
102 |
-
$this->addthis_showoncats = get_option('addthis_showoncats') === 'true';
|
103 |
-
|
104 |
-
$language = get_option('addthis_language');
|
105 |
-
$this->addthis_language = $language;
|
106 |
-
|
107 |
-
$advopts = array('brand', 'language', 'header_background', 'header_color', 'options');
|
108 |
-
$this->customization = '';
|
109 |
-
for ($i = 0; $i < count($advopts); $i++)
|
110 |
-
{
|
111 |
-
$opt = $advopts[$i];
|
112 |
-
$val = get_option("addthis_$opt");
|
113 |
-
if (isset($val) && strlen($val)) $this->customization .= "var addthis_$opt = '$val';";
|
114 |
-
}
|
115 |
}
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
{
|
122 |
-
|
123 |
-
if (is_feed()) return $content;
|
124 |
-
else if (
|
125 |
-
else if (
|
126 |
-
else if (
|
127 |
-
|
128 |
-
|
129 |
-
$link = urlencode(get_permalink());
|
130 |
-
$title = urlencode(get_the_title($id));
|
131 |
-
|
132 |
-
$content .= "\n<!-- AddThis Button BEGIN -->\n";
|
133 |
-
if ($this->addthis_isdropdown)
|
134 |
-
{
|
135 |
-
if (isset($pub) || strlen($this->customization))
|
136 |
-
{
|
137 |
-
$content .= '<script type="text/javascript">' . (isset($pub) ? "\nvar addthis_pub = '$pub';\n" : "\n") . ($this->customization) . "\n</script>\n";
|
138 |
-
}
|
139 |
-
$content .= <<<EOF
|
140 |
-
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '$link', '$title')" onmouseout="addthis_close()" onclick="return addthis_sendto()">{$this->get_button_img()}</a><script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script></div>
|
141 |
-
EOF;
|
142 |
-
}
|
143 |
-
else
|
144 |
-
{
|
145 |
-
$content .= <<<EOF
|
146 |
-
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=$pub&url=$link&title=$title', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">{$this->get_button_img()}</a></div>
|
147 |
-
EOF;
|
148 |
-
}
|
149 |
-
$content .= "\n<!-- AddThis Button END -->";
|
150 |
-
return $content;
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
{
|
158 |
-
$
|
159 |
-
if ($this->addthis_language != 'en')
|
160 |
{
|
161 |
-
|
162 |
-
switch ($btnStyle)
|
163 |
-
{
|
164 |
-
case 'bookmark':
|
165 |
-
case 'addthis':
|
166 |
-
case 'bookmark-sm':
|
167 |
-
$btnStyle = 'share';
|
168 |
-
}
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
-
$btnWidth = $btnRecord['w'];
|
180 |
-
$btnHeight = $btnRecord['h'];
|
181 |
-
return <<<EOF
|
182 |
-
<img src="{$btnUrl}" width="{$btnWidth}" height="{$btnHeight}" border="0" alt="Bookmark and Share" style="border:0;padding:0"/>
|
183 |
-
EOF;
|
184 |
}
|
185 |
|
186 |
-
|
|
|
|
|
|
|
|
|
187 |
{
|
188 |
-
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
-
function
|
|
|
|
|
|
|
|
|
193 |
?>
|
194 |
<div class="wrap">
|
195 |
<h2>AddThis</h2>
|
@@ -209,7 +230,7 @@ function addthis_plugin_options() {
|
|
209 |
<select name="addthis_style">
|
210 |
<?php
|
211 |
$curstyle = get_option('addthis_style');
|
212 |
-
foreach (
|
213 |
{
|
214 |
echo "<option value=\"$style\"". ($style == $curstyle ? " selected":""). ">$style</option>";
|
215 |
}
|
@@ -221,6 +242,10 @@ function addthis_plugin_options() {
|
|
221 |
<th scope="row"><?php _e("Use dropdown menu:", 'addthis_trans_domain' ); ?></th>
|
222 |
<td><input type="checkbox" name="addthis_isdropdown" value="true" <?php echo (get_option('addthis_isdropdown') == 'true' ? 'checked' : ''); ?>/></td>
|
223 |
</tr>
|
|
|
|
|
|
|
|
|
224 |
</table>
|
225 |
|
226 |
<br />
|
@@ -234,7 +259,11 @@ function addthis_plugin_options() {
|
|
234 |
</tr>
|
235 |
<tr>
|
236 |
<th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
|
237 |
-
<td><input type="checkbox" name="addthis_showonpages" value="true" <?php echo (get_option('addthis_showonpages')
|
|
|
|
|
|
|
|
|
238 |
</tr>
|
239 |
<tr>
|
240 |
<th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
|
@@ -258,7 +287,7 @@ function addthis_plugin_options() {
|
|
258 |
<select name="addthis_language">
|
259 |
<?php
|
260 |
$curlng = get_option('addthis_language');
|
261 |
-
foreach (
|
262 |
{
|
263 |
echo "<option value=\"$lng\"". ($lng == $curlng ? " selected":""). ">$name</option>";
|
264 |
}
|
@@ -277,7 +306,7 @@ function addthis_plugin_options() {
|
|
277 |
</table>
|
278 |
|
279 |
<input type="hidden" name="action" value="update" />
|
280 |
-
<input type="hidden" name="page_options" value="addthis_username,addthis_style,addthis_isdropdown,addthis_showonpages,addthis_showonarchives,
|
281 |
|
282 |
<p class="submit">
|
283 |
<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
|
@@ -288,8 +317,5 @@ function addthis_plugin_options() {
|
|
288 |
<?php
|
289 |
}
|
290 |
|
291 |
-
|
292 |
-
if (strpos(phpversion(), '4') !== 0) {
|
293 |
-
$addthis &= new addthis_social_widget();
|
294 |
-
}
|
295 |
?>
|
20 |
* +--------------------------------------------------------------------------+
|
21 |
*/
|
22 |
|
23 |
+
if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
|
24 |
+
else return;
|
|
|
|
|
25 |
|
26 |
/**
|
27 |
* Plugin Name: AddThis Social Bookmarking Widget
|
28 |
* Plugin URI: http://www.addthis.com
|
29 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
30 |
+
* Version: 1.5.4
|
31 |
*
|
32 |
* Author: The AddThis Team
|
33 |
* Author URI: http://www.addthis.com
|
34 |
*/
|
35 |
+
$addthis_settings = array(array('isdropdown', 'true'),
|
36 |
+
array('customization', ''),
|
37 |
+
array('language', 'en'),
|
38 |
+
array('username', ''),
|
39 |
+
array('style', 'share'));
|
40 |
+
|
41 |
+
$addthis_languages = array('zh'=>'Chinese', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fi'=>'Finnish', 'fr'=>'French', 'de'=>'German', 'he'=>'Hebrew', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ru'=>'Russian', 'es'=>'Spanish', 'sv'=>'Swedish');
|
42 |
+
|
43 |
+
$addthis_styles = array(
|
44 |
+
'share' => array('img'=>'lg-share-%lang%.gif', 'w'=>125, 'h'=>16),
|
45 |
+
'bookmark' => array('img'=>'lg-bookmark-en.gif', 'w'=>125, 'h'=>16),
|
46 |
+
'addthis' => array('img'=>'lg-addthis-en.gif', 'w'=>125, 'h'=>16),
|
47 |
+
'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
|
48 |
+
'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
|
49 |
+
'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
|
50 |
+
/* Add your own style here, like this:
|
51 |
+
, 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
|
52 |
+
);
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Adds WP filter so we can append the AddThis button to post content.
|
57 |
+
*/
|
58 |
+
function addthis_init($username=null, $style=null)
|
59 |
{
|
60 |
+
global $addthis_settings;
|
61 |
+
|
62 |
+
add_filter('the_content', 'addthis_social_widget');
|
63 |
+
add_filter('admin_menu', 'addthis_admin_menu');
|
64 |
+
|
65 |
+
add_option('addthis_username');
|
66 |
+
add_option('addthis_options', 'email, favorites, digg, delicious, myspace, google, facebook, reddit, live, more');
|
67 |
+
add_option('addthis_isdropdown', 'true');
|
68 |
+
add_option('addthis_showonhome', 'true');
|
69 |
+
add_option('addthis_showonpages', 'false');
|
70 |
+
add_option('addthis_showoncats', 'false');
|
71 |
+
add_option('addthis_showonarchives', 'false');
|
72 |
+
add_option('addthis_style');
|
73 |
+
add_option('addthis_header_background');
|
74 |
+
add_option('addthis_header_color');
|
75 |
+
add_option('addthis_sidebar_only', 'false');
|
76 |
+
add_option('addthis_brand');
|
77 |
+
add_option('addthis_language', 'en');
|
78 |
+
|
79 |
+
$addthis_settings['sidebar_only'] = get_option('addthis_sidebar_only') === 'true';
|
80 |
+
$addthis_settings['isdropdown'] = get_option('addthis_isdropdown') === 'true';
|
81 |
+
$addthis_settings['showonhome'] = !(get_option('addthis_showonhome') !== 'true');
|
82 |
+
$addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true';
|
83 |
+
$addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true';
|
84 |
+
$addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true';
|
85 |
+
|
86 |
+
if (!isset($style)) $style = get_option('addthis_style');
|
87 |
+
if (strlen($style) == 0) $style = 'share';
|
88 |
+
$addthis_settings['style'] = $style;
|
89 |
+
|
90 |
+
if (!isset($username)) $username = get_option('addthis_username');
|
91 |
+
$addthis_settings['username'] = $username;
|
92 |
+
|
93 |
+
$language = get_option('addthis_language');
|
94 |
+
$addthis_settings['language'] = $language;
|
95 |
+
|
96 |
+
$advopts = array('brand', 'language', 'header_background', 'header_color', 'options');
|
97 |
+
$addthis_settings['customization'] = '';
|
98 |
+
for ($i = 0; $i < count($advopts); $i++)
|
99 |
{
|
100 |
+
$opt = $advopts[$i];
|
101 |
+
$val = get_option("addthis_$opt");
|
102 |
+
if (isset($val) && strlen($val)) $addthis_settings['customization'] .= "var addthis_$opt = '$val';";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
+
add_action('widgets_init', 'addthis_widget_init');
|
106 |
+
}
|
107 |
+
|
108 |
+
function addthis_widget_init()
|
109 |
+
{
|
110 |
+
if ( function_exists('register_sidebar_widget') )
|
111 |
+
register_sidebar_widget('AddThis Widget', 'addthis_sidebar_widget');
|
112 |
+
}
|
113 |
+
|
114 |
+
function addthis_sidebar_widget($args)
|
115 |
+
{
|
116 |
+
extract($args);
|
117 |
+
echo $before_widget;
|
118 |
+
echo $before_title . $after_title . addthis_social_widget('', true);
|
119 |
+
echo $after_widget;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Appends AddThis button to post content.
|
124 |
+
*/
|
125 |
+
function addthis_social_widget($content, $sidebar = false)
|
126 |
+
{
|
127 |
+
global $addthis_settings;
|
128 |
+
|
129 |
+
// add nothing to RSS feed or search results; control adding to static/archive/category pages
|
130 |
+
if (!$sidebar)
|
131 |
{
|
132 |
+
if ($addthis_settings['sidebar_only'] == 'true') return $content;
|
133 |
+
else if (is_feed()) return $content;
|
134 |
+
else if (is_search()) return $content;
|
135 |
+
else if (is_home() && !$addthis_settings['showonhome']) return $content;
|
136 |
+
else if (is_page() && !$addthis_settings['showonpages']) return $content;
|
137 |
+
else if (is_archive() && !$addthis_settings['showonarchives']) return $content;
|
138 |
+
else if (is_category() && !$addthis_settings['showoncats']) return $content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
+
$pub = $addthis_settings['username'];
|
142 |
+
$link = $sidebar ? '[URL]' : urlencode(get_permalink());
|
143 |
+
$title = $sidebar ? '[TITLE]' : urlencode(get_the_title($id));
|
144 |
+
|
145 |
+
$content .= "\n<!-- AddThis Button BEGIN -->\n";
|
146 |
+
if ($addthis_settings['isdropdown'])
|
147 |
{
|
148 |
+
if (isset($pub) || strlen($addthis_settings['customization']))
|
|
|
149 |
{
|
150 |
+
$content .= '<script type="text/javascript">' . (isset($pub) ? "\nvar addthis_pub = '$pub';\n" : "\n") . ($addthis_settings['customization']) . "\n</script>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
+
$content .= <<<EOF
|
153 |
+
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="return addthis_open(this, '', '$link', '$title')" onmouseout="addthis_close()" onclick="return addthis_sendto()">
|
154 |
+
EOF;
|
155 |
+
$content .= addthis_get_button_img() . '</a><script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script></div>';
|
156 |
+
}
|
157 |
+
else
|
158 |
+
{
|
159 |
+
$content .= <<<EOF
|
160 |
+
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php?v=20" onclick="window.open('http://www.addthis.com/bookmark.php?v=20&pub=$pub&url=$link&title=$title', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
|
161 |
+
EOF;
|
162 |
+
$content .= addthis_get_button_img() . '</a></div>';
|
163 |
+
}
|
164 |
+
$content .= "\n<!-- AddThis Button END -->";
|
165 |
+
return $content;
|
166 |
+
}
|
167 |
|
168 |
+
/**
|
169 |
+
* Generates img tag for share/bookmark button.
|
170 |
+
*/
|
171 |
+
function addthis_get_button_img()
|
172 |
+
{
|
173 |
+
global $addthis_settings;
|
174 |
+
global $addthis_styles;
|
175 |
+
|
176 |
+
$btnStyle = $addthis_settings['style'];
|
177 |
+
if ($addthis_settings['language'] != 'en')
|
178 |
+
{
|
179 |
+
// We use a translation of the word 'share' for all verbal buttons
|
180 |
+
switch ($btnStyle)
|
181 |
+
{
|
182 |
+
case 'bookmark':
|
183 |
+
case 'addthis':
|
184 |
+
case 'bookmark-sm':
|
185 |
+
$btnStyle = 'share';
|
186 |
}
|
|
|
|
|
|
|
|
|
|
|
187 |
}
|
188 |
|
189 |
+
if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
|
190 |
+
$btnRecord = $addthis_styles[$btnStyle];
|
191 |
+
$btnUrl = (strpos(trim($btnRecord['img']), 'http://') !== 0 ? "http://s7.addthis.com/static/btn/" : "") . $btnRecord['img'];
|
192 |
+
|
193 |
+
if (strpos($btnUrl, '%lang%') !== false)
|
194 |
{
|
195 |
+
$btnUrl = str_replace('%lang%',$addthis_settings['language'], $btnUrl);
|
196 |
}
|
197 |
+
$btnWidth = $btnRecord['w'];
|
198 |
+
$btnHeight = $btnRecord['h'];
|
199 |
+
return <<<EOF
|
200 |
+
<img src="$btnUrl" width="$btnWidth" height="$btnHeight" border="0" alt="Bookmark and Share"/>
|
201 |
+
EOF;
|
202 |
+
}
|
203 |
+
|
204 |
+
function addthis_admin_menu()
|
205 |
+
{
|
206 |
+
add_options_page('AddThis Plugin Options', 'AddThis', 8, __FILE__, 'addthis_plugin_options_php4');
|
207 |
}
|
208 |
|
209 |
+
function addthis_plugin_options_php4() {
|
210 |
+
global $addthis_styles;
|
211 |
+
global $addthis_languages;
|
212 |
+
global $addthis_settings;
|
213 |
+
|
214 |
?>
|
215 |
<div class="wrap">
|
216 |
<h2>AddThis</h2>
|
230 |
<select name="addthis_style">
|
231 |
<?php
|
232 |
$curstyle = get_option('addthis_style');
|
233 |
+
foreach ($addthis_styles as $style => $info)
|
234 |
{
|
235 |
echo "<option value=\"$style\"". ($style == $curstyle ? " selected":""). ">$style</option>";
|
236 |
}
|
242 |
<th scope="row"><?php _e("Use dropdown menu:", 'addthis_trans_domain' ); ?></th>
|
243 |
<td><input type="checkbox" name="addthis_isdropdown" value="true" <?php echo (get_option('addthis_isdropdown') == 'true' ? 'checked' : ''); ?>/></td>
|
244 |
</tr>
|
245 |
+
<tr>
|
246 |
+
<th scope="row"><?php _e("Show in sidebar only:", 'addthis_trans_domain' ); ?></th>
|
247 |
+
<td><input type="checkbox" name="addthis_sidebar_only" value="true" <?php echo (get_option('addthis_sidebar_only') == 'true' ? 'checked' : ''); ?>/></td>
|
248 |
+
</tr>
|
249 |
</table>
|
250 |
|
251 |
<br />
|
259 |
</tr>
|
260 |
<tr>
|
261 |
<th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
|
262 |
+
<td><input type="checkbox" name="addthis_showonpages" value="true" <?php echo (get_option('addthis_showonpages') !== '' ? 'checked' : ''); ?>/></td>
|
263 |
+
</tr>
|
264 |
+
<tr>
|
265 |
+
<th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
|
266 |
+
<td><input type="checkbox" name="addthis_showonhome" value="true" <?php echo (get_option('addthis_showonhome') == 'true' ? 'checked' : ''); ?>/></td>
|
267 |
</tr>
|
268 |
<tr>
|
269 |
<th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
|
287 |
<select name="addthis_language">
|
288 |
<?php
|
289 |
$curlng = get_option('addthis_language');
|
290 |
+
foreach ($addthis_languages as $lng=>$name)
|
291 |
{
|
292 |
echo "<option value=\"$lng\"". ($lng == $curlng ? " selected":""). ">$name</option>";
|
293 |
}
|
306 |
</table>
|
307 |
|
308 |
<input type="hidden" name="action" value="update" />
|
309 |
+
<input type="hidden" name="page_options" value="addthis_username,addthis_style,addthis_sidebar_only,addthis_isdropdown,addthis_showonpages,addthis_showoncats,addthis_showonhome,addthis_showonarchives,addthis_language,addthis_brand,addthis_options,addthis_header_background,addthis_header_color"/>
|
310 |
|
311 |
<p class="submit">
|
312 |
<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
|
317 |
<?php
|
318 |
}
|
319 |
|
320 |
+
addthis_init();
|
|
|
|
|
|
|
321 |
?>
|
php4/addthis_social_widget.php
DELETED
@@ -1,292 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
-
/*
|
4 |
-
* +--------------------------------------------------------------------------+
|
5 |
-
* | Copyright (c) 2008 Add This, LLC |
|
6 |
-
* +--------------------------------------------------------------------------+
|
7 |
-
* | This program is free software; you can redistribute it and/or modify |
|
8 |
-
* | it under the terms of the GNU General Public License as published by |
|
9 |
-
* | the Free Software Foundation; either version 2 of the License, or |
|
10 |
-
* | (at your option) any later version. |
|
11 |
-
* | |
|
12 |
-
* | This program is distributed in the hope that it will be useful, |
|
13 |
-
* | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
-
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
-
* | GNU General Public License for more details. |
|
16 |
-
* | |
|
17 |
-
* | You should have received a copy of the GNU General Public License |
|
18 |
-
* | along with this program; if not, write to the Free Software |
|
19 |
-
* | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
20 |
-
* +--------------------------------------------------------------------------+
|
21 |
-
*/
|
22 |
-
|
23 |
-
// If we're not running in PHP 4, return
|
24 |
-
if (strpos(phpversion(), '4') !== 0) {
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Plugin Name: AddThis Social Bookmarking Widget
|
30 |
-
* Plugin URI: http://www.addthis.com
|
31 |
-
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
32 |
-
* Version: 1.5.3
|
33 |
-
*
|
34 |
-
* Author: The AddThis Team
|
35 |
-
* Author URI: http://www.addthis.com
|
36 |
-
*/
|
37 |
-
$addthis_settings = array(array('isdropdown', 'false'),
|
38 |
-
array('customization', ''),
|
39 |
-
array('language', 'en'),
|
40 |
-
array('username', ''),
|
41 |
-
array('style', 'share'));
|
42 |
-
|
43 |
-
$addthis_languages = array('zh'=>'Chinese', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fi'=>'Finnish', 'fr'=>'French', 'de'=>'German', 'he'=>'Hebrew', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ru'=>'Russian', 'es'=>'Spanish', 'sv'=>'Swedish');
|
44 |
-
|
45 |
-
$addthis_styles = array(
|
46 |
-
'share' => array('img'=>'lg-share-%lang%.gif', 'w'=>125, 'h'=>16),
|
47 |
-
'bookmark' => array('img'=>'lg-bookmark-en.gif', 'w'=>125, 'h'=>16),
|
48 |
-
'addthis' => array('img'=>'lg-addthis-en.gif', 'w'=>125, 'h'=>16),
|
49 |
-
'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
|
50 |
-
'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
|
51 |
-
'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
|
52 |
-
/* Add your own style here, like this:
|
53 |
-
, 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
|
54 |
-
);
|
55 |
-
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Adds WP filter so we can append the AddThis button to post content.
|
59 |
-
*/
|
60 |
-
function addthis_init($username=null, $style=null)
|
61 |
-
{
|
62 |
-
global $addthis_settings;
|
63 |
-
|
64 |
-
add_filter('the_content', 'addthis_social_widget');
|
65 |
-
add_filter('admin_menu', 'addthis_admin_menu');
|
66 |
-
|
67 |
-
add_option('addthis_username');
|
68 |
-
add_option('addthis_options', 'email, favorites, digg, delicious, myspace, google, facebook, reddit, live, more');
|
69 |
-
add_option('addthis_isdropdown', true);
|
70 |
-
add_option('addthis_showonpages', false);
|
71 |
-
add_option('addthis_showoncats', false);
|
72 |
-
add_option('addthis_showonarchives', false);
|
73 |
-
add_option('addthis_style');
|
74 |
-
add_option('addthis_header_background');
|
75 |
-
add_option('addthis_header_color');
|
76 |
-
add_option('addthis_brand');
|
77 |
-
add_option('addthis_language', 'en');
|
78 |
-
|
79 |
-
$addthis_settings['isdropdown'] = get_option('addthis_isdropdown') === 'true';
|
80 |
-
$addthis_settings['showonpages'] = get_option('addthis_showonpages') === 'true';
|
81 |
-
$addthis_settings['showonarchives'] = get_option('addthis_showonarchives') === 'true';
|
82 |
-
$addthis_settings['showoncats'] = get_option('addthis_showoncats') === 'true';
|
83 |
-
|
84 |
-
if (!isset($style)) $style = get_option('addthis_style');
|
85 |
-
if (strlen($style) == 0) $style = 'share';
|
86 |
-
$addthis_settings['style'] = $style;
|
87 |
-
|
88 |
-
if (!isset($username)) $username = get_option('addthis_username');
|
89 |
-
$addthis_settings['username'] = $username;
|
90 |
-
|
91 |
-
$language = get_option('addthis_language');
|
92 |
-
$addthis_settings['language'] = $language;
|
93 |
-
|
94 |
-
$advopts = array('brand', 'language', 'header_background', 'header_color', 'options');
|
95 |
-
$addthis_settings['customization'] = '';
|
96 |
-
for ($i = 0; $i < count($advopts); $i++)
|
97 |
-
{
|
98 |
-
$opt = $advopts[$i];
|
99 |
-
$val = get_option("addthis_$opt");
|
100 |
-
if (isset($val) && strlen($val)) $addthis_settings['customization'] .= "var addthis_$opt = '$val';";
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Appends AddThis button to post content.
|
106 |
-
*/
|
107 |
-
function addthis_social_widget($content)
|
108 |
-
{
|
109 |
-
global $addthis_settings;
|
110 |
-
|
111 |
-
// add nothing to RSS feed; control adding to static/archive/category pages
|
112 |
-
if (is_feed()) return $content;
|
113 |
-
else if (is_page() && !$addthis_settings['showonpages']) return $content;
|
114 |
-
else if (is_archive() && !$addthis_settings['showonarchives']) return $content;
|
115 |
-
else if (is_category() && !$addthis_settings['showoncats']) return $content;
|
116 |
-
|
117 |
-
$pub = $addthis_settings['username'];
|
118 |
-
$link = urlencode(get_permalink());
|
119 |
-
$title = urlencode(get_the_title($id));
|
120 |
-
|
121 |
-
$content .= "\n<!-- AddThis Button BEGIN -->\n";
|
122 |
-
if ($addthis_settings['isdropdown'])
|
123 |
-
{
|
124 |
-
if (isset($pub) || strlen($addthis_settings['customization']))
|
125 |
-
{
|
126 |
-
$content .= '<script type="text/javascript">' . (isset($pub) ? "\nvar addthis_pub = '$pub';\n" : "\n") . ($addthis_settings['customization']) . "\n</script>\n";
|
127 |
-
}
|
128 |
-
$content .= <<<EOF
|
129 |
-
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '$link', '$title')" onmouseout="addthis_close()" onclick="return addthis_sendto()">
|
130 |
-
EOF;
|
131 |
-
$content .= addthis_get_button_img() . '</a><script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script></div>';
|
132 |
-
}
|
133 |
-
else
|
134 |
-
{
|
135 |
-
$content .= <<<EOF
|
136 |
-
<div class="addthis_container"><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=$pub&url=$link&title=$title', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
|
137 |
-
EOF;
|
138 |
-
$content .= addthis_get_button_img() . '</a></div>';
|
139 |
-
}
|
140 |
-
$content .= "\n<!-- AddThis Button END -->";
|
141 |
-
return $content;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Generates img tag for share/bookmark button.
|
146 |
-
*/
|
147 |
-
function addthis_get_button_img()
|
148 |
-
{
|
149 |
-
global $addthis_settings;
|
150 |
-
global $addthis_styles;
|
151 |
-
|
152 |
-
$btnStyle = $addthis_settings['style'];
|
153 |
-
if ($addthis_settings['language'] != 'en')
|
154 |
-
{
|
155 |
-
// We use a translation of the word 'share' for all verbal buttons
|
156 |
-
switch ($btnStyle)
|
157 |
-
{
|
158 |
-
case 'bookmark':
|
159 |
-
case 'addthis':
|
160 |
-
case 'bookmark-sm':
|
161 |
-
$btnStyle = 'share';
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
|
166 |
-
$btnRecord = $addthis_styles[$btnStyle];
|
167 |
-
$btnUrl = (strpos(trim($btnRecord['img']), 'http://') !== 0 ? "http://s7.addthis.com/static/btn/" : "") . $btnRecord['img'];
|
168 |
-
|
169 |
-
if (strpos($btnUrl, '%lang%') !== false)
|
170 |
-
{
|
171 |
-
$btnUrl = str_replace('%lang%',$addthis_settings['language'], $btnUrl);
|
172 |
-
}
|
173 |
-
$btnWidth = $btnRecord['w'];
|
174 |
-
$btnHeight = $btnRecord['h'];
|
175 |
-
return <<<EOF
|
176 |
-
<img src="$btnUrl" width="$btnWidth" height="$btnHeight" border="0" alt="Bookmark and Share"/>
|
177 |
-
EOF;
|
178 |
-
}
|
179 |
-
|
180 |
-
function addthis_admin_menu()
|
181 |
-
{
|
182 |
-
add_options_page('AddThis Plugin Options', 'AddThis', 8, __FILE__, 'addthis_plugin_options_php4');
|
183 |
-
}
|
184 |
-
|
185 |
-
function addthis_plugin_options_php4() {
|
186 |
-
global $addthis_styles;
|
187 |
-
global $addthis_languages;
|
188 |
-
global $addthis_settings;
|
189 |
-
|
190 |
-
?>
|
191 |
-
<div class="wrap">
|
192 |
-
<h2>AddThis</h2>
|
193 |
-
|
194 |
-
<form method="post" action="options.php">
|
195 |
-
<?php wp_nonce_field('update-options'); ?>
|
196 |
-
|
197 |
-
<h3>Required</h3>
|
198 |
-
<table class="form-table">
|
199 |
-
<tr valign="top">
|
200 |
-
<th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
|
201 |
-
<td><input type="text" name="addthis_username" value="<?php echo get_option('addthis_username'); ?>" /></td>
|
202 |
-
</tr>
|
203 |
-
<tr valign="top">
|
204 |
-
<th scope="row"><?php _e("Button style:", 'addthis_trans_domain' ); ?></th>
|
205 |
-
<td>
|
206 |
-
<select name="addthis_style">
|
207 |
-
<?php
|
208 |
-
$curstyle = get_option('addthis_style');
|
209 |
-
foreach ($addthis_styles as $style => $info)
|
210 |
-
{
|
211 |
-
echo "<option value=\"$style\"". ($style == $curstyle ? " selected":""). ">$style</option>";
|
212 |
-
}
|
213 |
-
?>
|
214 |
-
</select>
|
215 |
-
</td>
|
216 |
-
</tr>
|
217 |
-
<tr>
|
218 |
-
<th scope="row"><?php _e("Use dropdown menu:", 'addthis_trans_domain' ); ?></th>
|
219 |
-
<td><input type="checkbox" name="addthis_isdropdown" value="true" <?php echo (get_option('addthis_isdropdown') !== '' ? 'checked' : ''); ?>/></td>
|
220 |
-
</tr>
|
221 |
-
</table>
|
222 |
-
|
223 |
-
<br />
|
224 |
-
<br />
|
225 |
-
<br />
|
226 |
-
|
227 |
-
<h3>Advanced</h3>
|
228 |
-
<table class="form-table">
|
229 |
-
<tr valign="top">
|
230 |
-
<td colspan="2">See <a href="http://addthis.com/customization">our customization docs</a>.</td>
|
231 |
-
</tr>
|
232 |
-
<tr>
|
233 |
-
<th scope="row"><?php _e("Show on <a href=\"http://codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
|
234 |
-
<td><input type="checkbox" name="addthis_showonpages" value="true" <?php echo (get_option('addthis_showonpages') !== '' ? 'checked' : ''); ?>/></td>
|
235 |
-
</tr>
|
236 |
-
<tr>
|
237 |
-
<th scope="row"><?php _e("Show in archives:", 'addthis_trans_domain' ); ?></th>
|
238 |
-
<td><input type="checkbox" name="addthis_showonarchives" value="true" <?php echo (get_option('addthis_showonarchives') == 'true' ? 'checked' : ''); ?>/></td>
|
239 |
-
</tr>
|
240 |
-
<tr>
|
241 |
-
<th scope="row"><?php _e("Show in categories:", 'addthis_trans_domain' ); ?></th>
|
242 |
-
<td><input type="checkbox" name="addthis_showoncats" value="true" <?php echo (get_option('addthis_showoncats') == 'true' ? 'checked' : ''); ?>/></td>
|
243 |
-
</tr>
|
244 |
-
<tr valign="top">
|
245 |
-
<th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
|
246 |
-
<td><input type="text" name="addthis_brand" value="<?php echo get_option('addthis_brand'); ?>" /></td>
|
247 |
-
</tr>
|
248 |
-
<tr valign="top">
|
249 |
-
<th scope="row"><?php _e("Drop-down options (comma-separated):", 'addthis_trans_domain' ); ?></th>
|
250 |
-
<td><input type="text" name="addthis_options" value="<?php echo get_option('addthis_options'); ?>" size="100"/></td>
|
251 |
-
</tr>
|
252 |
-
<tr valign="top">
|
253 |
-
<th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
|
254 |
-
<td>
|
255 |
-
<select name="addthis_language">
|
256 |
-
<?php
|
257 |
-
$curlng = get_option('addthis_language');
|
258 |
-
foreach ($addthis_languages as $lng=>$name)
|
259 |
-
{
|
260 |
-
echo "<option value=\"$lng\"". ($lng == $curlng ? " selected":""). ">$name</option>";
|
261 |
-
}
|
262 |
-
?>
|
263 |
-
</select>
|
264 |
-
</td>
|
265 |
-
</tr>
|
266 |
-
<tr valign="top">
|
267 |
-
<th scope="row"><?php _e("Header background:", 'addthis_trans_domain' ); ?></th>
|
268 |
-
<td><input type="text" name="addthis_header_background" value="<?php echo get_option('addthis_header_background'); ?>" /></td>
|
269 |
-
</tr>
|
270 |
-
<tr valign="top">
|
271 |
-
<th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
|
272 |
-
<td><input type="text" name="addthis_header_color" value="<?php echo get_option('addthis_header_color'); ?>" /></td>
|
273 |
-
</tr>
|
274 |
-
</table>
|
275 |
-
|
276 |
-
<input type="hidden" name="action" value="update" />
|
277 |
-
<input type="hidden" name="page_options" value="addthis_username,addthis_style,addthis_isdropdown,addthis_showonpages,addthis_showoncats,addthis_showonarchives,addthis_language,addthis_brand,addthis_options,addthis_header_background,addthis_header_color"/>
|
278 |
-
|
279 |
-
<p class="submit">
|
280 |
-
<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
|
281 |
-
</p>
|
282 |
-
|
283 |
-
</form>
|
284 |
-
</div>
|
285 |
-
<?php
|
286 |
-
}
|
287 |
-
|
288 |
-
// If we're running in PHP 4, initialize
|
289 |
-
if (strpos(phpversion(), '4') === 0) {
|
290 |
-
addthis_init();
|
291 |
-
}
|
292 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: _mjk_
|
|
3 |
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
|
4 |
Requires at least: 2.3
|
5 |
Tested up to: 2.7
|
6 |
-
Stable tag: 1.5.
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
@@ -20,7 +20,7 @@ Over 120,000 sites have installed AddThis. Join us!
|
|
20 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
21 |
1. (Optional) Customize the plugin in the Settings > AddThis menu
|
22 |
|
23 |
-
|
24 |
|
25 |
== Frequently Asked Questions ==
|
26 |
|
3 |
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
|
4 |
Requires at least: 2.3
|
5 |
Tested up to: 2.7
|
6 |
+
Stable tag: 1.5.4
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
20 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
21 |
1. (Optional) Customize the plugin in the Settings > AddThis menu
|
22 |
|
23 |
+
Note: due to the confusion for many of our users, there are no longer separate versions for PHP4 and PHP5.
|
24 |
|
25 |
== Frequently Asked Questions ==
|
26 |
|