Changeset 22871
- Timestamp:
- 10/22/07 20:14:08 (9 months ago)
- Files:
-
- 4avatars/tags/0.2 (copied) (copied from 4avatars/trunk)
- 4avatars/tags/0.2/4avatars.php (copied) (copied from 4avatars/trunk/4avatars.php) (5 diffs)
- 4avatars/tags/0.2/default.gif (copied) (copied from 4avatars/trunk/default.gif)
- 4avatars/tags/0.2/readme.txt (copied) (copied from 4avatars/trunk/readme.txt) (2 diffs)
- 4avatars/trunk/4avatars.php (modified) (5 diffs)
- 4avatars/trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
4avatars/tags/0.2/4avatars.php
r21216 r22871 5 5 Plugin URI: http://www.b4it.xorg.pl/4avatars/ 6 6 Description: This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 7 Version: 0. 17 Version: 0.2 8 8 Author: b4it 9 Author URI: http://www.b4it.xorg.pl/ 9 10 */ 10 11 11 12 function foravatars() 12 13 { 13 if (get_option('avatar_site') == 'mybloglog') { 14 global $comment; 15 $url = $comment->comment_author_url; 16 $email = $comment->comment_author_email; 17 $nickname = $comment->comment_author; 18 if($email == "") { 19 $url = explode("/",$url); 20 $url = "http://" . $url[2]; 21 $nickname = ""; 22 } 23 if($url != "" && $url != "http://") 24 $mybloglog_URL = "http://www.mybloglog.com/buzz/co_redir.php?t=&href=" . $url . "&n=". $nickname; 25 else 26 $mybloglog_URL = "http://www.mybloglog.com/buzz/co_redir.php?t="; 27 28 if($url != "" && $url != "http://") 29 $mybloglog_IMG = "http://pub.mybloglog.com/coiserv.php?href=" . $url . "&n=". $nickname; 30 else 31 $mybloglog_IMG = get_option("avatar_default"); 14 global $comment; 15 $site = get_option('avatar_site'); 16 $size = get_option('avatar_size'); 17 $mail = $comment->comment_author_email; 18 $url = $comment->comment_author_url; 19 $nickname = $comment->comment_author; 20 21 switch ($site) { 22 case "mybloglog": 23 //MyBlogLog 24 if($mail == "") { 25 $url = explode("/",$url); 26 $url = "http://" . $url[2]; 27 $nickname = ""; 28 } 29 if($url != "" && $url != "http://") 30 echo "<a rel=\"nofollow\" href=\"http://www.mybloglog.com/buzz/co_redir.php?t=&href=" . $url . "&n=". $nickname."\" target=\"_blank\" title=\"Check my profile on MyBlogLog.com!\">"; 31 32 if($url != "" && $url != "http://") 33 $mybloglog_IMG = "http://pub.mybloglog.com/coiserv.php?href=" . $url . "&n=". $nickname; 34 else 35 $mybloglog_IMG = get_option("avatar_default"); 32 36 33 echo "<a rel=\"nofollow\" href=\"".$mybloglog_URL."\" target=\"_blank\" title=\"Check my profile on MyBlogLog.com!\">"; 34 echo "<img class=\"foravatars\" src=\"".$mybloglog_IMG."\" onload=\"if (this.width > 48) { this.width = 48; this.height = 48; } if (this.width < 48) { this.src='".get_option("avatar_default")."'; this.onload=void(null); }\" alt=\"4Avatars\" />"; 35 echo "</a>"; 36 } elseif (get_option('avatar_site') == 'gravatar') { 37 global $comment; 38 $mail = $comment->comment_author_email; 39 echo "<img class=\"foravatars\" src=\"http://www.gravatar.com/avatar.php?gravatar_id=".md5($mail)."&size=48&default=".urlencode(get_option('avatar_default'))."\" />"; 40 } elseif (get_option('avatar_site') == 'avatars') { 41 global $comment; 42 $mail = $comment->comment_author_email; 43 echo "<img class=\"foravatars\" src=\"http://www.avatars.pl/avatar.php?id=".md5($mail)."&size=48&default=".urlencode(get_option('avatar_default'))."\" />"; 37 echo "<img class=\"foravatars\" src=\"".$mybloglog_IMG."\" onload=\"if (this.width > ".$size.") { this.width = ".$size."; this.height = ".$size."; } if (this.width < ".$size.") { this.width = ".$size."; this.src='".get_option("avatar_default")."'; this.onload=void(null); }\" alt=\"4Avatars\" />"; 38 39 if($url != "" && $url != "http://") 40 echo "</a>"; 41 break; 42 case "gravatar": 43 //Gravatar 44 echo "<img class=\"foravatars\" src=\"http://www.gravatar.com/avatar.php?gravatar_id=".md5($mail)."&size=".$size."&default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 45 break; 46 case "avatars": 47 //Avatars.pl 48 echo "<img class=\"foravatars\" src=\"http://www.avatars.pl/avatar.php?id=".md5($mail)."&size=".$size."&default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 49 break; 44 50 } 45 51 } … … 47 53 function foravatars_options() 48 54 { 49 if (!empty($_POST['avatar_site']))50 {55 $blad = ""; 56 if (!empty($_POST['avatar_site'])) { 51 57 // Małe zabezpieczenie 52 if (!in_array($_POST['avatar_site'], array('mybloglog', 'gravatar', 'avatars'))) 53 { 58 if (!in_array($_POST['avatar_site'], array('mybloglog', 'gravatar', 'avatars'))) { 54 59 $_POST['avatar_site'] = 'mybloglog'; 55 60 } 56 61 57 62 update_option('avatar_site', $_POST['avatar_site']); 58 } 63 } else 64 $blad .= "<br />Wybież stronę."; 59 65 60 if (!empty($_POST['avatar_default'])) 61 { 66 if (!empty($_POST['avatar_default'])) { 62 67 update_option('avatar_default', $_POST['avatar_default']); 63 } 68 } else 69 $blad .= "<br />Podaj adres podstawowego avatara."; 64 70 65 if ($_SERVER['REQUEST_METHOD'] == 'POST') 66 { 67 ?> 71 if (!empty($_POST['avatar_size']) && is_numeric($_POST['avatar_size'])) { 72 update_option('avatar_size', $_POST['avatar_size']); 73 } else 74 $blad .= "<br />Rozmiar avatara nie jest liczbą."; 68 75 69 <div id="message" class="updated fade"><p><strong>Options saved!</strong></p></div> 70 71 <?php 76 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 77 if ($blad != "") { 78 echo "<div id=\"message\" class=\"error fade\"><p><strong>Zonk:".$blad."</strong></p></div>"; 79 $blad = ""; 80 } else { 81 echo "<div id=\"message\" class=\"updated fade\"><p><strong>Options saved!</strong></p></div>"; 82 } 72 83 } 73 84 ?> … … 92 103 <input type="radio" name="avatar_site" value="gravatar" <?php if (get_option('avatar_site') == 'gravatar') echo "checked=\"checked\"" ?>> Gravatar<br /> 93 104 <input type="radio" name="avatar_site" value="avatars" <?php if (get_option('avatar_site') == 'avatars') echo "checked=\"checked\"" ?>> Avatars.pl 105 </td> 106 </tr> 107 108 <tr valign="top"> 109 <th width="33%" scope="row">Avatar width:</th> 110 <td> 111 <input name="avatar_size" type="text" value="<?php echo get_option('avatar_size'); ?>" /><br /> 112 In pixels. 94 113 </td> 95 114 </tr> … … 121 140 { 122 141 // Dodajemy opcje 123 add_option('avatar_site', 'mybloglog', 'Site with avatars.'); 124 add_option('avatar_default', '/wp-content/plugins/4avatars/default.gif', 'URL to default avatar.'); 142 add_option("avatar_site", 'avatars', 'Site with avatars.', 'yes'); 143 $adres = get_option('siteurl')."/wp-content/plugins/4avatars/default.gif"; 144 add_option("avatar_default", $adres, 'URL to default avatar.', 'yes'); 145 add_option("avatar_size", '48', 'Width of avatar.', 'yes'); 125 146 } 126 147 … … 131 152 delete_option('avatar_site'); 132 153 delete_option('avatar_default'); 154 delete_option('avatar_size'); 133 155 } 134 156 135 157 add_action('admin_menu', 'foravatars_menu'); 136 add_action('activate_ foravatars', 'foravatars_activate');137 add_action('deactivate_ foravatars', 'foravatars_deactivate');158 add_action('activate_4Avatars/4avatars.php', 'foravatars_activate'); 159 add_action('deactivate_4Avatars/4avatars.php', 'foravatars_deactivate'); 138 160 ?> 4avatars/tags/0.2/readme.txt
r21212 r22871 5 5 Requires at least: 2.0.2 6 6 Tested up to: 2.3 7 Stable tag: 0. 17 Stable tag: 0.2 8 8 9 9 This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. … … 44 44 == Changelog == 45 45 46 v0.2: 47 48 * Some safe issue 49 * Ability to change width of avatar 50 * Some bugs connected with MyBlogLog avatars 51 46 52 v0.01: 47 53 4avatars/trunk/4avatars.php
r21216 r22871 5 5 Plugin URI: http://www.b4it.xorg.pl/4avatars/ 6 6 Description: This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 7 Version: 0. 17 Version: 0.2 8 8 Author: b4it 9 Author URI: http://www.b4it.xorg.pl/ 9 10 */ 10 11 11 12 function foravatars() 12 13 { 13 if (get_option('avatar_site') == 'mybloglog') { 14 global $comment; 15 $url = $comment->comment_author_url; 16 $email = $comment->comment_author_email; 17 $nickname = $comment->comment_author; 18 if($email == "") { 19 $url = explode("/",$url); 20 $url = "http://" . $url[2]; 21 $nickname = ""; 22 } 23 if($url != "" && $url != "http://") 24 $mybloglog_URL = "http://www.mybloglog.com/buzz/co_redir.php?t=&href=" . $url . "&n=". $nickname; 25 else 26 $mybloglog_URL = "http://www.mybloglog.com/buzz/co_redir.php?t="; 27 28 if($url != "" && $url != "http://") 29 $mybloglog_IMG = "http://pub.mybloglog.com/coiserv.php?href=" . $url . "&n=". $nickname; 30 else 31 $mybloglog_IMG = get_option("avatar_default"); 14 global $comment; 15 $site = get_option('avatar_site'); 16 $size = get_option('avatar_size'); 17 $mail = $comment->comment_author_email; 18 $url = $comment->comment_author_url; 19 $nickname = $comment->comment_author; 20 21 switch ($site) { 22 case "mybloglog": 23 //MyBlogLog 24 if($mail == "") { 25 $url = explode("/",$url); 26 $url = "http://" . $url[2]; 27 $nickname = ""; 28 } 29 if($url != "" && $url != "http://") 30 echo "<a rel=\"nofollow\" href=\"http://www.mybloglog.com/buzz/co_redir.php?t=&href=" . $url . "&n=". $nickname."\" target=\"_blank\" title=\"Check my profile on MyBlogLog.com!\">"; 31 32 if($url != "" && $url != "http://") 33 $mybloglog_IMG = "http://pub.mybloglog.com/coiserv.php?href=" . $url . "&n=". $nickname; 34 else 35 $mybloglog_IMG = get_option("avatar_default"); 32 36 33 echo "<a rel=\"nofollow\" href=\"".$mybloglog_URL."\" target=\"_blank\" title=\"Check my profile on MyBlogLog.com!\">"; 34 echo "<img class=\"foravatars\" src=\"".$mybloglog_IMG."\" onload=\"if (this.width > 48) { this.width = 48; this.height = 48; } if (this.width < 48) { this.src='".get_option("avatar_default")."'; this.onload=void(null); }\" alt=\"4Avatars\" />"; 35 echo "</a>"; 36 } elseif (get_option('avatar_site') == 'gravatar') { 37 global $comment; 38 $mail = $comment->comment_author_email; 39 echo "<img class=\"foravatars\" src=\"http://www.gravatar.com/avatar.php?gravatar_id=".md5($mail)."&size=48&default=".urlencode(get_option('avatar_default'))."\" />"; 40 } elseif (get_option('avatar_site') == 'avatars') { 41 global $comment; 42 $mail = $comment->comment_author_email; 43 echo "<img class=\"foravatars\" src=\"http://www.avatars.pl/avatar.php?id=".md5($mail)."&size=48&default=".urlencode(get_option('avatar_default'))."\" />"; 37 echo "<img class=\"foravatars\" src=\"".$mybloglog_IMG."\" onload=\"if (this.width > ".$size.") { this.width = ".$size."; this.height = ".$size."; } if (this.width < ".$size.") { this.width = ".$size."; this.src='".get_option("avatar_default")."'; this.onload=void(null); }\" alt=\"4Avatars\" />"; 38 39 if($url != "" && $url != "http://") 40 echo "</a>"; 41 break; 42 case "gravatar": 43 //Gravatar 44 echo "<img class=\"foravatars\" src=\"http://www.gravatar.com/avatar.php?gravatar_id=".md5($mail)."&size=".$size."&default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 45 break; 46 case "avatars": 47 //Avatars.pl 48 echo "<img class=\"foravatars\" src=\"http://www.avatars.pl/avatar.php?id=".md5($mail)."&size=".$size."&default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 49 break; 44 50 } 45 51 } … … 47 53 function foravatars_options() 48 54 { 49 if (!empty($_POST['avatar_site']))50 {55 $blad = ""; 56 if (!empty($_POST['avatar_site'])) { 51 57 // Małe zabezpieczenie 52 if (!in_array($_POST['avatar_site'], array('mybloglog', 'gravatar', 'avatars'))) 53 { 58 if (!in_array($_POST['avatar_site'], array('mybloglog', 'gravatar', 'avatars'))) { 54 59 $_POST['avatar_site'] = 'mybloglog'; 55 60 } 56 61 57 62 update_option('avatar_site', $_POST['avatar_site']); 58 } 63 } else 64 $blad .= "<br />Wybież stronę."; 59 65 60 if (!empty($_POST['avatar_default'])) 61 { 66 if (!empty($_POST['avatar_default'])) { 62 67 update_option('avatar_default', $_POST['avatar_default']); 63 } 68 } else 69 $blad .= "<br />Podaj adres podstawowego avatara."; 64 70 65 if ($_SERVER['REQUEST_METHOD'] == 'POST') 66 { 67 ?> 71 if (!empty($_POST['avatar_size']) && is_numeric($_POST['avatar_size'])) { 72 update_option('avatar_size', $_POST['avatar_size']); 73 } else 74 $blad .= "<br />Rozmiar avatara nie jest liczbą."; 68 75 69 <div id="message" class="updated fade"><p><strong>Options saved!</strong></p></div> 70 71 <?php 76 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 77 if ($blad != "") { 78 echo "<div id=\"message\" class=\"error fade\"><p><strong>Zonk:".$blad."</strong></p></div>"; 79 $blad = ""; 80 } else { 81 echo "<div id=\"message\" class=\"updated fade\"><p><strong>Options saved!</strong></p></div>"; 82 } 72 83 } 73 84 ?> … … 92 103 <input type="radio" name="avatar_site" value="gravatar" <?php if (get_option('avatar_site') == 'gravatar') echo "checked=\"checked\"" ?>> Gravatar<br /> 93 104 <input type="radio" name="avatar_site" value="avatars" <?php if (get_option('avatar_site') == 'avatars') echo "checked=\"checked\"" ?>> Avatars.pl 105 </td> 106 </tr> 107 108 <tr valign="top"> 109 <th width="33%" scope="row">Avatar width:</th> 110 <td> 111 <input name="avatar_size" type="text" value="<?php echo get_option('avatar_size'); ?>" /><br /> 112 In pixels. 94 113 </td> 95 114 </tr> … … 121 140 { 122 141 // Dodajemy opcje 123 add_option('avatar_site', 'mybloglog', 'Site with avatars.'); 124 add_option('avatar_default', '/wp-content/plugins/4avatars/default.gif', 'URL to default avatar.'); 142 add_option("avatar_site", 'avatars', 'Site with avatars.', 'yes'); 143 $adres = get_option('siteurl')."/wp-content/plugins/4avatars/default.gif"; 144 add_option("avatar_default", $adres, 'URL to default avatar.', 'yes'); 145 add_option("avatar_size", '48', 'Width of avatar.', 'yes'); 125 146 } 126 147 … … 131 152 delete_option('avatar_site'); 132 153 delete_option('avatar_default'); 154 delete_option('avatar_size'); 133 155 } 134 156 135 157 add_action('admin_menu', 'foravatars_menu'); 136 add_action('activate_ foravatars', 'foravatars_activate');137 add_action('deactivate_ foravatars', 'foravatars_deactivate');158 add_action('activate_4Avatars/4avatars.php', 'foravatars_activate'); 159 add_action('deactivate_4Avatars/4avatars.php', 'foravatars_deactivate'); 138 160 ?> 4avatars/trunk/readme.txt
r21212 r22871 5 5 Requires at least: 2.0.2 6 6 Tested up to: 2.3 7 Stable tag: 0. 17 Stable tag: 0.2 8 8 9 9 This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. … … 44 44 == Changelog == 45 45 46 v0.2: 47 48 * Some safe issue 49 * Ability to change width of avatar 50 * Some bugs connected with MyBlogLog avatars 51 46 52 v0.01: 47 53
