Version Description
Download this release
Release Info
Developer | micropat |
Plugin | AddToAny Share Buttons |
Version | 0.8 |
Comparing to | |
See all releases |
Code changes from version 0.7 to 0.8
- README.txt +7 -7
- add-to-any.php +126 -25
README.txt
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
=== Add to Any
|
2 |
Contributors: micropat
|
3 |
Donate link: http://www.addtoany.com/contact/
|
4 |
-
Tags: bookmarking, social bookmarking, bookmark, sharing, share, saving, save, Post, posts, links, plugin, widget, e-mail, email, button, delicious, Google, digg, reddit, facebook, myspace, addtoany, add, any
|
5 |
Requires at least: 2.0
|
6 |
Tested up to: 2.5
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Lets readers share, save, and bookmark your posts using any service.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Lets readers share, save, and bookmark your posts using any service, such as Delicious, Digg, Facebook, MySpace, and all the rest. The
|
14 |
|
15 |
Within the menu, users are additionally given a link to bookmark in-browser (Internet Explorer, Firefox, Opera, Safari, etc.), with directions on how to bookmark if their browser does not support auto-bookmarking from links/shortcuts.
|
16 |
|
@@ -27,7 +27,7 @@ See also, the <a href="/extend/plugins/add-to-any-subscribe/">Subscribe button</
|
|
27 |
|
28 |
== Installation ==
|
29 |
|
30 |
-
1. Upload 'add-to-any
|
31 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
32 |
|
33 |
== Frequently Asked Questions ==
|
@@ -42,5 +42,5 @@ Constantly.
|
|
42 |
|
43 |
== Screenshots ==
|
44 |
|
45 |
-
1. This is the Add to Any
|
46 |
-
2. This is the drop-down menu that appears instantly when visitors move the mouse over the
|
1 |
+
=== Add to Any Bookmark Button ===
|
2 |
Contributors: micropat
|
3 |
Donate link: http://www.addtoany.com/contact/
|
4 |
+
Tags: bookmarking, social bookmarking, bookmark, sharing, share, saving, save, Post, posts, page, pages, images, image, admin, statistics, links, plugin, widget, e-mail, email, button, delicious, Google, digg, reddit, facebook, myspace, addtoany, add, any
|
5 |
Requires at least: 2.0
|
6 |
Tested up to: 2.5
|
7 |
+
Stable tag: 0.8
|
8 |
|
9 |
Lets readers share, save, and bookmark your posts using any service.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Lets readers share, save, and bookmark your posts using any service, such as Delicious, Digg, Facebook, MySpace, and all the rest. The Bookmark button comes with a drop-down menu that appears on rollover.
|
14 |
|
15 |
Within the menu, users are additionally given a link to bookmark in-browser (Internet Explorer, Firefox, Opera, Safari, etc.), with directions on how to bookmark if their browser does not support auto-bookmarking from links/shortcuts.
|
16 |
|
27 |
|
28 |
== Installation ==
|
29 |
|
30 |
+
1. Upload 'add-to-any' to the '/wp-content/plugins/' directory
|
31 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
32 |
|
33 |
== Frequently Asked Questions ==
|
42 |
|
43 |
== Screenshots ==
|
44 |
|
45 |
+
1. This is the Add to Any Bookmark button!
|
46 |
+
2. This is the drop-down menu that appears instantly when visitors move the mouse over the Bookmark button! This screenshot shows Delicious as selected by a user.
|
add-to-any.php
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
/*
|
3 |
Plugin Name: Add to Any: Share/Save/Bookmark Button
|
4 |
Plugin URI: http://www.addtoany.com/buttons/
|
5 |
-
Description: Lets readers share, save and bookmark your posts using any service and browser.
|
6 |
-
Version: .
|
7 |
Author: MicroPat
|
8 |
Author URI: http://www.addtoany.com/contact/
|
9 |
*/
|
10 |
|
11 |
|
12 |
// Returns the utf string corresponding to the unicode value (from php.net, courtesy - romans@void.lv)
|
13 |
-
if (!function_exists('
|
14 |
-
function
|
15 |
{
|
16 |
if ($num < 128) return chr($num);
|
17 |
if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
|
@@ -21,14 +21,14 @@ if (!function_exists('add_to_any_code2utf')) {
|
|
21 |
}
|
22 |
}
|
23 |
// Since UTF-8 does not work in PHP4 ( http://us2.php.net/manual/en/function.html-entity-decode.php ) :
|
24 |
-
if (!function_exists('
|
25 |
-
function
|
26 |
{
|
27 |
static $trans_tbl;
|
28 |
|
29 |
// replace numeric entities
|
30 |
-
$string = preg_replace('~&#x([0-9a-f]+);~ei', '
|
31 |
-
$string = preg_replace('~&#([0-9]+);~e', '
|
32 |
|
33 |
// replace literal entities
|
34 |
if (!isset($trans_tbl))
|
@@ -43,35 +43,136 @@ if (!function_exists('add_to_any_html_entity_decode_utf8')) {
|
|
43 |
}
|
44 |
}
|
45 |
|
46 |
-
function
|
47 |
-
|
|
|
48 |
|
49 |
$sitename_enc = rawurlencode( get_bloginfo('name') );
|
50 |
$siteurl_enc = rawurlencode( trailingslashit( get_bloginfo('url') ) );
|
51 |
-
$linkname =
|
52 |
$linkname_enc = rawurlencode( $linkname );
|
53 |
$linkurl = get_permalink($post->ID);
|
54 |
$linkurl_enc = rawurlencode( $linkurl );
|
55 |
-
?>
|
56 |
|
57 |
-
<a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=<?=$sitename_enc?>&siteurl=<?=$siteurl_enc?>&linkname=<?=$linkname_enc?>&linkurl=<?=$linkurl_enc?>">
|
58 |
-
|
59 |
-
|
60 |
-
<script type="text/javascript">a2a_linkname="<?=str_replace('"', '\\"', $linkname)?>";a2a_linkurl="<?=$linkurl?>";</script>
|
61 |
-
<script type="text/javascript" src="http://www.addtoany.com/js.dropdown.js?type=page"></script>
|
62 |
|
63 |
-
<?
|
64 |
-
$
|
65 |
-
|
66 |
-
|
|
|
|
|
67 |
}
|
68 |
|
69 |
-
function
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
return $content;
|
72 |
}
|
73 |
|
74 |
-
add_action('the_content', '
|
75 |
-
add_action('the_content_rss', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
?>
|
2 |
/*
|
3 |
Plugin Name: Add to Any: Share/Save/Bookmark Button
|
4 |
Plugin URI: http://www.addtoany.com/buttons/
|
5 |
+
Description: Lets readers share, save, and bookmark your posts using any service and browser. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
|
6 |
+
Version: .8
|
7 |
Author: MicroPat
|
8 |
Author URI: http://www.addtoany.com/contact/
|
9 |
*/
|
10 |
|
11 |
|
12 |
// Returns the utf string corresponding to the unicode value (from php.net, courtesy - romans@void.lv)
|
13 |
+
if (!function_exists('A2A_SHARE_SAVE_code2utf')) {
|
14 |
+
function A2A_SHARE_SAVE_code2utf($num)
|
15 |
{
|
16 |
if ($num < 128) return chr($num);
|
17 |
if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
|
21 |
}
|
22 |
}
|
23 |
// Since UTF-8 does not work in PHP4 ( http://us2.php.net/manual/en/function.html-entity-decode.php ) :
|
24 |
+
if (!function_exists('A2A_SHARE_SAVE_html_entity_decode_utf8')) {
|
25 |
+
function A2A_SHARE_SAVE_html_entity_decode_utf8($string)
|
26 |
{
|
27 |
static $trans_tbl;
|
28 |
|
29 |
// replace numeric entities
|
30 |
+
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'A2A_SHARE_SAVE_code2utf(hexdec("\\1"))', $string);
|
31 |
+
$string = preg_replace('~&#([0-9]+);~e', 'A2A_SHARE_SAVE_code2utf(\\1)', $string);
|
32 |
|
33 |
// replace literal entities
|
34 |
if (!isset($trans_tbl))
|
43 |
}
|
44 |
}
|
45 |
|
46 |
+
function ADDTOANY_SHARE_SAVE_BUTTON($output_buffering=false) {
|
47 |
+
|
48 |
+
if($output_buffering)ob_start();
|
49 |
|
50 |
$sitename_enc = rawurlencode( get_bloginfo('name') );
|
51 |
$siteurl_enc = rawurlencode( trailingslashit( get_bloginfo('url') ) );
|
52 |
+
$linkname = A2A_SHARE_SAVE_html_entity_decode_utf8( get_the_title() );
|
53 |
$linkname_enc = rawurlencode( $linkname );
|
54 |
$linkurl = get_permalink($post->ID);
|
55 |
$linkurl_enc = rawurlencode( $linkurl );
|
56 |
+
?>
|
57 |
|
58 |
+
<a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=<?=$sitename_enc?>&siteurl=<?=$siteurl_enc?>&linkname=<?=$linkname_enc?>&linkurl=<?=$linkurl_enc?>"><img src="<?=trailingslashit(get_option('siteurl')).PLUGINDIR.'/add-to-any/share_save_120_16.gif'?>" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
|
59 |
+
<script type="text/javascript">a2a_linkname="<?=str_replace('"', '\\"', $linkname)?>";a2a_linkurl="<?=$linkurl?>";</script>
|
60 |
+
<script type="text/javascript" src="http://www.addtoany.com/js.dropdown.js?type=page"></script>
|
|
|
|
|
61 |
|
62 |
+
<?
|
63 |
+
if($output_buffering) {
|
64 |
+
$button = ob_get_contents();
|
65 |
+
ob_end_clean();
|
66 |
+
return $button;
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
+
function A2A_SHARE_SAVE_to_bottom_of_content($content) {
|
71 |
+
if (
|
72 |
+
( !is_page() && get_option('A2A_SHARE_SAVE_display_in_posts')=='-1' ) || // All posts
|
73 |
+
( !is_page() && !is_single() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) || // Front page posts
|
74 |
+
( is_page() && get_option('A2A_SHARE_SAVE_display_in_pages')=='-1' ) // Pages
|
75 |
+
)
|
76 |
+
return $content;
|
77 |
+
|
78 |
+
$content .= '<p class="addtoany_share_save">'.ADDTOANY_SHARE_SAVE_BUTTON(true).'</p>';
|
79 |
return $content;
|
80 |
}
|
81 |
|
82 |
+
add_action('the_content', 'A2A_SHARE_SAVE_to_bottom_of_content');
|
83 |
+
add_action('the_content_rss', 'A2A_SHARE_SAVE_to_bottom_of_content');
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
/*****************************
|
91 |
+
OPTIONS
|
92 |
+
******************************/
|
93 |
+
|
94 |
+
|
95 |
+
function A2A_SHARE_SAVE_options_page() {
|
96 |
+
|
97 |
+
if( $_POST[ 'A2A_SHARE_SAVE_submit_hidden' ] == 'Y' ) {
|
98 |
+
|
99 |
+
update_option( 'A2A_SHARE_SAVE_display_in_posts_on_front_page', ($_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page']=='1') ? '1':'-1' );
|
100 |
+
update_option( 'A2A_SHARE_SAVE_display_in_posts', ($_POST['A2A_SHARE_SAVE_display_in_posts']=='1') ? '1':'-1' );
|
101 |
+
update_option( 'A2A_SHARE_SAVE_display_in_pages', ($_POST['A2A_SHARE_SAVE_display_in_pages']=='1') ? '1':'-1' );
|
102 |
+
|
103 |
+
?>
|
104 |
+
<div class="updated fade"><p><strong><?php _e('Settings saved.', 'A2A_SHARE_SAVE_trans_domain' ); ?></strong></p></div>
|
105 |
+
<?
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
?>
|
110 |
+
|
111 |
+
<div class="wrap">
|
112 |
+
|
113 |
+
<h2><?=__( 'Add to Any: Share/Save Settings', 'A2A_SHARE_SAVE_trans_domain' )?></h2>
|
114 |
+
|
115 |
+
<form method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
|
116 |
+
|
117 |
+
<?php wp_nonce_field('update-options'); ?>
|
118 |
+
|
119 |
+
<input type="hidden" name="A2A_SHARE_SAVE_submit_hidden" value="Y">
|
120 |
+
|
121 |
+
<table class="form-table">
|
122 |
+
<tr valign="top">
|
123 |
+
<th scope="row">Placement</th>
|
124 |
+
<td>
|
125 |
+
<label>
|
126 |
+
<input name="A2A_SHARE_SAVE_display_in_posts"
|
127 |
+
onclick="e=getElementsByName('A2A_SHARE_SAVE_display_in_posts_on_front_page')[0];if(!this.checked){e.checked=false;e.disabled=true}else{e.checked=true;e.disabled=false}"
|
128 |
+
onchange="e=getElementsByName('A2A_SHARE_SAVE_display_in_posts_on_front_page')[0];if(!this.checked){e.checked=false;e.disabled=true}else{e.checked=true;e.disabled=false}"
|
129 |
+
type="checkbox"<? if(get_option('A2A_SHARE_SAVE_display_in_posts')!='-1') echo ' checked="checked"'; ?> value="1"/>
|
130 |
+
Display Share/Save button at the bottom of posts <strong>*</strong>
|
131 |
+
</label><br/>
|
132 |
+
<label>
|
133 |
+
<input name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?
|
134 |
+
if(get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')!='-1') echo ' checked="checked"';
|
135 |
+
if(get_option('A2A_SHARE_SAVE_display_in_posts')=='-1') echo ' disabled="disabled"';
|
136 |
+
?> value="1"/>
|
137 |
+
Display Share/Save button at the bottom of posts on the front page
|
138 |
+
</label><br/>
|
139 |
+
<label>
|
140 |
+
<input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<? if(get_option('A2A_SHARE_SAVE_display_in_pages')!='-1') echo ' checked="checked"'; ?> value="1"/>
|
141 |
+
Display Share/Save button at the bottom of pages <strong>*</strong>
|
142 |
+
</label>
|
143 |
+
|
144 |
+
<br/><br/>
|
145 |
+
<strong>*</strong> If unchecked, be sure to place the following code in <a href="theme-editor.php">your template pages</a> (within <code>index.php</code>, <code>single.php</code>, and/or <code>page.php</code>):<br/>
|
146 |
+
<code><? if( function_exists('ADDTOANY_SHARE_SAVE_BUTTON') ) { ADDTOANY_SHARE_SAVE_BUTTON(); } ?></code>
|
147 |
+
</td>
|
148 |
+
</tr>
|
149 |
+
</table>
|
150 |
+
|
151 |
+
<p class="submit">
|
152 |
+
<input type="submit" name="Submit" value="<?php _e('Save Changes', 'A2A_SHARE_SAVE_trans_domain' ) ?>" />
|
153 |
+
</p>
|
154 |
+
|
155 |
+
</form>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<?
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
function A2A_SHARE_SAVE_add_menu_link() {
|
163 |
+
if( current_user_can('manage_options') ) {
|
164 |
+
add_options_page(
|
165 |
+
'Add to Any: Share/Save Settings'
|
166 |
+
, 'Share/Save Buttons'
|
167 |
+
, 8
|
168 |
+
, basename(__FILE__)
|
169 |
+
, 'A2A_SHARE_SAVE_options_page'
|
170 |
+
);
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
add_action('admin_menu', 'A2A_SHARE_SAVE_add_menu_link');
|
175 |
+
|
176 |
+
|
177 |
|
178 |
?>
|