Plugin Directory

Changeset 523678


Ignore:
Timestamp:
03/26/2012 09:30:14 AM (14 years ago)
Author:
chilibean
Message:

Language modifications

Location:
wp-eyeem/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-eyeem/trunk

    • Property svn:ignore
      •  

        old new  
        22.project
        33.settings
         4index.html
  • wp-eyeem/trunk/WP_EyeEm.class.php

    r523602 r523678  
    1111    public function __construct($username, $maxsize)
    1212    {
     13        $this->maxWidth = $maxsize;
    1314        $this->initializeEyeEm();
    1415       
     
    2021        }
    2122       
    22         $this->photos = $this->user->getPhotos();
    23         $this->maxWidth = $maxsize;
     23        try {
     24            $this->photos = $this->user->getPhotos();
     25        }
     26        catch (Exception $e)
     27        {
     28            throw new Exception($e);
     29        }
     30       
     31    }
     32   
     33    public function getUser()
     34    {
     35        return $this->user;
     36    }
     37   
     38    public function getPhotos()
     39    {
     40        return $this->photos;   
    2441    }
    2542   
     
    4259    }
    4360   
    44     private function getMaxWidthPhotoUrl($photo)
     61    public function getMaxWidthPhotoUrl($photo)
    4562    {
    4663        return ($this->maxWidth != null) ? str_replace("640/480", "550/480", $photo->photoUrl) : $photo->photoUrl;
     
    4865    }
    4966   
    50     public function __toString()
    51     {
    52         $ret = "";
     67// public function __toString()
     68// {
     69//      $ret = "";
    5370       
    5471       
    55         if ($this->user->totalPhotos > 0)
    56         {
    57             $ret .= "<div>The 20 newest photos by ".$this->user->nickname." on EyeEm</div>";
     72//      if ($this->user->totalPhotos > 0)
     73//      {
     74//          $ret .= "<div>The 20 newest photos by ".$this->user->nickname." on EyeEm</div>";
    5875           
    59             foreach ($this->photos as $photo)
    60             {
    61                 $ret .= "
    62                 <div class=\"eyeem_post\">
    63                     <a href=\"" . $photo->webUrl . "\" title=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" target=\"_blank\"><img class=\"eyeem_photo\" title=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" alt=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" src=\"" . $this->getMaxWidthPhotoUrl($photo) . "\" /></a>
    64                     <div class=\"eyeem_caption\"><a href=\"" . $photo->webUrl . "\" target=\"_blank\">" . $photo->caption . "</a> by <a href=\"" . $this->user->webUrl . "\" target=\"_blank\">" . $this->user->nickname . "</a> on <a href=\"http://www.eyeem.com\" target=\"_blank\">EyeEm</a></div>
    65                 </div>
    66                 ";
    67             }
     76//          foreach ($this->photos as $photo)
     77//          {
     78//              $ret .= "
     79//              <div class=\"eyeem_post\">
     80//                  <a href=\"" . $photo->webUrl . "\" title=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" target=\"_blank\"><img class=\"eyeem_photo\" title=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" alt=\"" . $photo->caption . " by " . $this->user->nickname . " on EyeEm\" src=\"" . $this->getMaxWidthPhotoUrl($photo) . "\" /></a>
     81//                      <div class=\"eyeem_caption\"><a href=\"" . $photo->webUrl . "\" target=\"_blank\">" . $photo->caption . "</a> by <a href=\"" . $this->user->webUrl . "\" target=\"_blank\">" . $this->user->nickname . "</a> on <a href=\"http://www.eyeem.com\" target=\"_blank\">EyeEm</a></div>
     82//              </div>
     83//              ";
     84//          }
    6885
    69         }
    70         else
    71         {
    72             $ret .= "<p>User has no photos</p>";   
    73         }
     86//      }
     87//      else
     88//      {
     89//          $ret .= "<p>User has no photos</p>";   
     90//      }
    7491       
    75         return $ret;
    76     }
     92//      return $ret;
     93// }
    7794   
    7895}
  • wp-eyeem/trunk/wp-eyeem.php

    r523602 r523678  
    1212include_once 'WP_EyeEm.class.php';
    1313
     14$plugin_dir = basename(dirname(__FILE__));
     15load_plugin_textdomain('wp-eyeem', null, $plugin_dir . "/languages/");
     16
     17
    1418function showEyeEmPhotos()
    1519{
     
    2226            $maxsize = null;
    2327        try {
     28           
    2429            $eyeem = new WP_EyeEm($username, $maxsize);
    25             echo $eyeem;
     30            echo outputEyeEmToString($eyeem);
    2631        }
    2732        catch (Exception $e)
    2833        {
    29             echo "User with id ".$username." not found.";
     34            echo printf(__("User with id %s not found.", "wp-eyeem"),$username);
    3035        }
    3136    }
     37}
     38
     39function outputEyeEmToString(WP_Eyeem $eyeem)
     40{
     41    $ret = "";
     42   
     43   
     44    if ($eyeem->getUser()->totalPhotos > 0)
     45    {
     46        $ret .= "<div>";
     47        $ret .= printf(__("The 20 newest photos by %s on EyeEm", "wp-eyeem"), $eyeem->getUser()->nickname);
     48        $ret .= "</div>";
     49           
     50        foreach ($eyeem->getPhotos() as $photo)
     51        {
     52            $ret .= "
     53            <div class=\"eyeem_post\">
     54            <a href=\"" . $photo->webUrl . "\" title=\"" . $photo->caption . " by " . $eyeem->getUser()->nickname . " on EyeEm\" target=\"_blank\"><img class=\"eyeem_photo\" title=\"" . $photo->caption . " by " . $eyeem->getUser()->nickname . " on EyeEm\" alt=\"" . $photo->caption . " by " . $eyeem->getUser()->nickname . " on EyeEm\" src=\"" . $eyeem->getMaxWidthPhotoUrl($photo) . "\" /></a>
     55            <div class=\"eyeem_caption\"><a href=\"" . $photo->webUrl . "\" target=\"_blank\">" . $photo->caption . "</a> by <a href=\"" . $eyeem->getUser()->webUrl . "\" target=\"_blank\">" . $eyeem->getUser()->nickname . "</a> on <a href=\"http://www.eyeem.com\" target=\"_blank\">EyeEm</a></div>
     56            </div>
     57            ";
     58        }
     59   
     60    }
     61    else
     62    {
     63        $ret .= "<p>";
     64        $ret .= __("User has no photos", "wp-eyeem");
     65        $ret .= "</p>";
     66    }
     67   
     68    return $ret;
    3269}
    3370
Note: See TracChangeset for help on using the changeset viewer.