Skip to content

Commit

Permalink
More refactoring of photo object
Browse files Browse the repository at this point in the history
changed methods into new naming convention, added documentation and
optimized.
  • Loading branch information
jeroenrnl committed Jan 3, 2013
1 parent 7a89589 commit ba8ab2d
Show file tree
Hide file tree
Showing 19 changed files with 147 additions and 129 deletions.
6 changes: 3 additions & 3 deletions php/UnitTests/photoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testAddToAlbum($photo, array $newalbums) {
foreach($newalbums as $alb) {
$photo->addTo(new album($alb));
}
$albums=$photo->lookup_albums();
$albums=$photo->getAlbums();
foreach($albums as $album) {
$ids[]=$album->getId();
$this->assertInstanceOf("album", $album);
Expand All @@ -85,7 +85,7 @@ public function testAddToCategories($photo, array $newcats) {
foreach($newcats as $cat) {
$photo->addTo(new category($cat));
}
$cats=$photo->lookup_categories();
$cats=$photo->getCategories();
foreach($cats as $cat) {
$ids[]=$cat->getId();
$this->assertInstanceOf("category", $cat);
Expand All @@ -105,7 +105,7 @@ public function testAddPerson($photo, array $newpers) {
foreach($newpers as $pers) {
$photo->addTo(new person($pers));
}
$peo=$photo->lookup_people();
$peo=$photo->getPeople();
foreach($peo as $per) {
$ids[]=$per->getId();
$this->assertInstanceOf("person", $per);
Expand Down
2 changes: 1 addition & 1 deletion php/album.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function getCoverphoto($autothumb=null,$children=null) {

if ($coverphoto instanceof photo) {
$coverphoto->lookup();
return $coverphoto->get_image_tag(THUMB_PREFIX);
return $coverphoto->getImageTag(THUMB_PREFIX);
} else if (!$children) {
// No photos found in this album... let's look again, but now
// also in sub-albums...
Expand Down
2 changes: 1 addition & 1 deletion php/category.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function getCoverphoto($autothumb=null,$children=null) {

if (isset($coverphoto) && $coverphoto instanceof photo) {
$coverphoto->lookup();
return $coverphoto->get_image_tag(THUMB_PREFIX);
return $coverphoto->getImageTag(THUMB_PREFIX);
} else if (!$children) {
// No photos found in this cat... let's look again, but now
// also in subcat...
Expand Down
2 changes: 1 addition & 1 deletion php/comment.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function to_html($user, $thumbnail=null) {

if ($thumbnail) {
$html .= "<div class=\"thumbnail\">\n";
$html .= $photo->get_thumbnail_link();
$html .= $photo->getThumbnailLink();
$html .= "</div>\n";
}

Expand Down
4 changes: 2 additions & 2 deletions php/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<div class="main">
<br>
<?php
echo $photo->get_midsize_img();
echo $photo->getMidsizeImg();
?>
<br>
<dl class "comment">
Expand All @@ -122,7 +122,7 @@
<div class="main">
<br>
<?php
echo $photo->get_midsize_img();
echo $photo->getMidsizeImg();
?>
<br>

Expand Down
2 changes: 1 addition & 1 deletion php/define_annotated_photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<?php
//}
$people_string = "";
$people = $photo->lookup_people();
$people = $photo->getPeople();
if ($people) {
$count = 0;
foreach ($people as $person) {
Expand Down
10 changes: 5 additions & 5 deletions php/edit_photo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<div class="prev"><?php echo $prev_link ? "[ $prev_link ]" : "&nbsp;" ?></div>
<div class="photohdr">
<?php echo $photo->get_fullsize_link($photo->get("name")) ?> :
<?php echo $photo->getFullsizeLink($photo->get("name")) ?> :
<?php echo $photo->get("width") ?> x <?php echo $photo->get("height") ?>,
<?php echo $photo->get("size") ?> <?php echo translate("bytes") ?>
</div>
Expand All @@ -105,7 +105,7 @@
?>
</ul>

<?php echo $photo->get_fullsize_link($photo->get_midsize_img()) ?>
<?php echo $photo->getFullsizeLink($photo->getMidsizeImg()) ?>
<?php
}
?>
Expand Down Expand Up @@ -163,7 +163,7 @@
</label>
<fieldset class="multiple">
<?php
$people = $photo->lookup_people();
$people = $photo->getPeople();
if ($people) {
foreach ($people as $person) {
?>
Expand All @@ -183,7 +183,7 @@
<label for="albums"><?php echo translate("albums") ?></label>
<fieldset class="albums multiple">
<?php
$albums = $photo->lookup_albums($user);
$albums = $photo->getAlbums($user);
if ($albums) {
foreach ($albums as $album) {
?>
Expand All @@ -202,7 +202,7 @@
<label for="categories"><?php echo translate("categories") ?></label>
<fieldset class="categories multiple">
<?php
$categories = $photo->lookup_categories($user);
$categories = $photo->getCategories($user);
if ($categories) {
foreach ($categories as $category) {
?>
Expand Down
8 changes: 4 additions & 4 deletions php/edit_photos.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
?>
</div>
<div class="thumbnail">
<?php echo $photo->get_thumbnail_link("photo.php?photo_id=$photo_id") . "\n" ?><br>
<?php echo $photo->getThumbnailLink("photo.php?photo_id=$photo_id") . "\n" ?><br>
<?php
if ($can_edit && conf::get("rotate.enable") &&
($user->is_admin() || $permissions->get("writable"))) {
Expand Down Expand Up @@ -334,7 +334,7 @@
<label for="album__<?php echo $photo_id?>"><?php echo translate("albums") ?></label>
<fieldset class="checkboxlist">
<?php
$albums = $photo->lookup_albums($user);
$albums = $photo->getAlbums($user);
if ($albums) {
$append = "";
foreach ($albums as $album) {
Expand All @@ -355,7 +355,7 @@
<label for="category__<?php echo $photo_id?>"><?php echo translate("categories") ?></label>
<fieldset class="checkboxlist">
<?php
$categories = $photo->lookup_categories($user);
$categories = $photo->getCategories($user);
if ($categories) {
$append = "";
foreach ($categories as $category) {
Expand All @@ -376,7 +376,7 @@
<label for="person_0__<?php echo $photo_id ?>"><?php echo translate("people") ?></label>
<fieldset class="checkboxlist multiple">
<?php
$people = $photo->lookup_people();
$people = $photo->getPeople();
if ($people) {
$append = "";
foreach ($people as $person) {
Expand Down
2 changes: 1 addition & 1 deletion php/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
<?php
} else {
?>
<?php echo $photo->get_midsize_img() ?>
<?php echo $photo->getMidsizeImg() ?>
<?php
}
?>
Expand Down
4 changes: 2 additions & 2 deletions php/person.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function getCoverphoto($autothumb=null) {

if (isset($coverphoto)) {
$coverphoto->lookup();
return $coverphoto->get_image_tag(THUMB_PREFIX);
return $coverphoto->getImageTag(THUMB_PREFIX);
}
}

Expand Down Expand Up @@ -660,7 +660,7 @@ function get_photo_person_links($photo) {

$links = "";
if (!$photo) { return $links; }
$people = $photo->lookup_people();
$people = $photo->getPeople();
if ($people) {
foreach ($people as $person) {
if ($links) { $links .= ", "; }
Expand Down
Loading

0 comments on commit ba8ab2d

Please sign in to comment.