Changeset 523678
- Timestamp:
- 03/26/2012 09:30:14 AM (14 years ago)
- Location:
- wp-eyeem/trunk
- Files:
-
- 1 added
- 3 edited
-
. (modified) (1 prop)
-
WP_EyeEm.class.php (modified) (4 diffs)
-
languages (added)
-
wp-eyeem.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-eyeem/trunk
- Property svn:ignore
-
old new 2 2 .project 3 3 .settings 4 index.html
-
- Property svn:ignore
-
wp-eyeem/trunk/WP_EyeEm.class.php
r523602 r523678 11 11 public function __construct($username, $maxsize) 12 12 { 13 $this->maxWidth = $maxsize; 13 14 $this->initializeEyeEm(); 14 15 … … 20 21 } 21 22 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; 24 41 } 25 42 … … 42 59 } 43 60 44 p rivatefunction getMaxWidthPhotoUrl($photo)61 public function getMaxWidthPhotoUrl($photo) 45 62 { 46 63 return ($this->maxWidth != null) ? str_replace("640/480", "550/480", $photo->photoUrl) : $photo->photoUrl; … … 48 65 } 49 66 50 public function __toString()51 {52 $ret = "";67 // public function __toString() 68 // { 69 // $ret = ""; 53 70 54 71 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>"; 58 75 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 // } 68 85 69 }70 else71 {72 $ret .= "<p>User has no photos</p>";73 }86 // } 87 // else 88 // { 89 // $ret .= "<p>User has no photos</p>"; 90 // } 74 91 75 return $ret;76 }92 // return $ret; 93 // } 77 94 78 95 } -
wp-eyeem/trunk/wp-eyeem.php
r523602 r523678 12 12 include_once 'WP_EyeEm.class.php'; 13 13 14 $plugin_dir = basename(dirname(__FILE__)); 15 load_plugin_textdomain('wp-eyeem', null, $plugin_dir . "/languages/"); 16 17 14 18 function showEyeEmPhotos() 15 19 { … … 22 26 $maxsize = null; 23 27 try { 28 24 29 $eyeem = new WP_EyeEm($username, $maxsize); 25 echo $eyeem;30 echo outputEyeEmToString($eyeem); 26 31 } 27 32 catch (Exception $e) 28 33 { 29 echo "User with id ".$username." not found.";34 echo printf(__("User with id %s not found.", "wp-eyeem"),$username); 30 35 } 31 36 } 37 } 38 39 function 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; 32 69 } 33 70
Note: See TracChangeset
for help on using the changeset viewer.