Changeset 22871

Show
Ignore:
Timestamp:
10/22/07 20:14:08 (9 months ago)
Author:
b4it
Message:

tagging version 0.2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 4avatars/tags/0.2/4avatars.php

    r21216 r22871  
    55Plugin URI: http://www.b4it.xorg.pl/4avatars/ 
    66Description: This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 
    7 Version: 0.1 
     7Version: 0.2 
    88Author: b4it 
     9Author URI: http://www.b4it.xorg.pl/ 
    910*/ 
    1011 
    1112function foravatars()  
    1213{ 
    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=&amp;href=" . $url . "&amp;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 . "&amp;n=". $nickname; 
     34                  else 
     35                        $mybloglog_IMG = get_option("avatar_default");  
    3236  
    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)."&amp;size=48&amp;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)."&amp;size=48&amp;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)."&amp;size=".$size."&amp;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)."&amp;size=".$size."&amp;default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 
     49                  break; 
    4450      } 
    4551}  
     
    4753function foravatars_options() 
    4854{ 
    49       if (!empty($_POST['avatar_site'])) 
    50      
     55      $blad = ""; 
     56      if (!empty($_POST['avatar_site']))
    5157            // 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'))) { 
    5459                  $_POST['avatar_site'] = 'mybloglog'; 
    5560            } 
    5661 
    5762            update_option('avatar_site', $_POST['avatar_site']); 
    58       } 
     63      } else  
     64            $blad .= "<br />Wybież stronę."; 
    5965 
    60       if (!empty($_POST['avatar_default'])) 
    61       { 
     66      if (!empty($_POST['avatar_default'])) { 
    6267            update_option('avatar_default', $_POST['avatar_default']); 
    63       } 
     68      } else  
     69            $blad .= "<br />Podaj adres podstawowego avatara."; 
    6470 
    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ą."; 
    6875 
    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            } 
    7283      } 
    7384?> 
     
    92103                              <input type="radio" name="avatar_site" value="gravatar" <?php if (get_option('avatar_site') == 'gravatar') echo "checked=\"checked\"" ?>> Gravatar<br /> 
    93104                              <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. 
    94113                        </td> 
    95114                  </tr> 
     
    121140{ 
    122141      // 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'); 
    125146} 
    126147 
     
    131152      delete_option('avatar_site'); 
    132153      delete_option('avatar_default'); 
     154      delete_option('avatar_size'); 
    133155} 
    134156 
    135157add_action('admin_menu', 'foravatars_menu'); 
    136 add_action('activate_foravatars', 'foravatars_activate'); 
    137 add_action('deactivate_foravatars', 'foravatars_deactivate'); 
     158add_action('activate_4Avatars/4avatars.php', 'foravatars_activate'); 
     159add_action('deactivate_4Avatars/4avatars.php', 'foravatars_deactivate'); 
    138160?> 
  • 4avatars/tags/0.2/readme.txt

    r21212 r22871  
    55Requires at least: 2.0.2 
    66Tested up to: 2.3 
    7 Stable tag: 0.1 
     7Stable tag: 0.2 
    88 
    99This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 
     
    4444== Changelog == 
    4545 
     46v0.2: 
     47 
     48* Some safe issue 
     49* Ability to change width of avatar 
     50* Some bugs connected with MyBlogLog avatars  
     51 
    4652v0.01: 
    4753 
  • 4avatars/trunk/4avatars.php

    r21216 r22871  
    55Plugin URI: http://www.b4it.xorg.pl/4avatars/ 
    66Description: This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 
    7 Version: 0.1 
     7Version: 0.2 
    88Author: b4it 
     9Author URI: http://www.b4it.xorg.pl/ 
    910*/ 
    1011 
    1112function foravatars()  
    1213{ 
    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=&amp;href=" . $url . "&amp;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 . "&amp;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=&amp;href=" . $url . "&amp;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 . "&amp;n=". $nickname; 
     34                  else 
     35                        $mybloglog_IMG = get_option("avatar_default");  
    3236  
    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)."&amp;size=48&amp;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)."&amp;size=48&amp;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)."&amp;size=".$size."&amp;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)."&amp;size=".$size."&amp;default=".urlencode(get_option('avatar_default'))."\" alt=\"4Avatars\" />"; 
     49                  break; 
    4450      } 
    4551}  
     
    4753function foravatars_options() 
    4854{ 
    49       if (!empty($_POST['avatar_site'])) 
    50      
     55      $blad = ""; 
     56      if (!empty($_POST['avatar_site']))
    5157            // 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'))) { 
    5459                  $_POST['avatar_site'] = 'mybloglog'; 
    5560            } 
    5661 
    5762            update_option('avatar_site', $_POST['avatar_site']); 
    58       } 
     63      } else  
     64            $blad .= "<br />Wybież stronę."; 
    5965 
    60       if (!empty($_POST['avatar_default'])) 
    61       { 
     66      if (!empty($_POST['avatar_default'])) { 
    6267            update_option('avatar_default', $_POST['avatar_default']); 
    63       } 
     68      } else  
     69            $blad .= "<br />Podaj adres podstawowego avatara."; 
    6470 
    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ą."; 
    6875 
    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            } 
    7283      } 
    7384?> 
     
    92103                              <input type="radio" name="avatar_site" value="gravatar" <?php if (get_option('avatar_site') == 'gravatar') echo "checked=\"checked\"" ?>> Gravatar<br /> 
    93104                              <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. 
    94113                        </td> 
    95114                  </tr> 
     
    121140{ 
    122141      // 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'); 
    125146} 
    126147 
     
    131152      delete_option('avatar_site'); 
    132153      delete_option('avatar_default'); 
     154      delete_option('avatar_size'); 
    133155} 
    134156 
    135157add_action('admin_menu', 'foravatars_menu'); 
    136 add_action('activate_foravatars', 'foravatars_activate'); 
    137 add_action('deactivate_foravatars', 'foravatars_deactivate'); 
     158add_action('activate_4Avatars/4avatars.php', 'foravatars_activate'); 
     159add_action('deactivate_4Avatars/4avatars.php', 'foravatars_deactivate'); 
    138160?> 
  • 4avatars/trunk/readme.txt

    r21212 r22871  
    55Requires at least: 2.0.2 
    66Tested up to: 2.3 
    7 Stable tag: 0.1 
     7Stable tag: 0.2 
    88 
    99This plugin allows you to add MyBlogLog.com or Gravatar.com or Avatars.pl avatars to Wordpress comments. 
     
    4444== Changelog == 
    4545 
     46v0.2: 
     47 
     48* Some safe issue 
     49* Ability to change width of avatar 
     50* Some bugs connected with MyBlogLog avatars  
     51 
    4652v0.01: 
    4753