Skip to content

Commit

Permalink
Rename "children" to "items" in our feed view because it makes more
Browse files Browse the repository at this point in the history
semantic sense.
  • Loading branch information
bharat committed Jun 21, 2010
1 parent 74e821b commit 48af5e6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
8 changes: 4 additions & 4 deletions modules/gallery/helpers/gallery_rss.php
Expand Up @@ -28,18 +28,18 @@ static function feed($feed_id, $offset, $limit, $id) {
$feed = new stdClass();
switch ($feed_id) {
case "latest":
$feed->children = ORM::factory("item")
$feed->items = ORM::factory("item")
->viewable()
->where("type", "<>", "album")
->order_by("created", "DESC")
->find_all($limit, $offset);

$all_children = ORM::factory("item")
$all_items = ORM::factory("item")
->viewable()
->where("type", "<>", "album")
->order_by("created", "DESC");

$feed->max_pages = ceil($all_children->find_all()->count() / $limit);
$feed->max_pages = ceil($all_items->find_all()->count() / $limit);
$feed->title = t("Recent updates");
$feed->description = t("Recent updates");
return $feed;
Expand All @@ -48,7 +48,7 @@ static function feed($feed_id, $offset, $limit, $id) {
$item = ORM::factory("item", $id);
access::required("view", $item);

$feed->children = $item
$feed->items = $item
->viewable()
->descendants($limit, $offset, array(array("type", "=", "photo")));
$feed->max_pages = ceil(
Expand Down
66 changes: 33 additions & 33 deletions modules/rss/views/feed.mrss.php
Expand Up @@ -20,57 +20,57 @@
<? endif ?>
<pubDate><?= $pub_date ?></pubDate>
<lastBuildDate><?= $pub_date ?></lastBuildDate>
<? foreach ($feed->children as $child): ?>
<? foreach ($feed->items as $item): ?>
<item>
<title><?= html::purify($child->title) ?></title>
<link><?= url::abs_site("{$child->type}s/{$child->id}") ?></link>
<guid isPermaLink="true"><?= url::abs_site("{$child->type}s/{$child->id}") ?></guid>
<pubDate><?= date("D, d M Y H:i:s T", $child->created); ?></pubDate>
<description><?= html::purify($child->description) ?></description>
<title><?= html::purify($item->title) ?></title>
<link><?= url::abs_site("{$item->type}s/{$item->id}") ?></link>
<guid isPermaLink="true"><?= url::abs_site("{$item->type}s/{$item->id}") ?></guid>
<pubDate><?= date("D, d M Y H:i:s T", $item->created); ?></pubDate>
<description><?= html::purify($item->description) ?></description>
<content:encoded>
<![CDATA[
<span><?= html::purify($child->description) ?></span>
<span><?= html::purify($item->description) ?></span>
<p>
<? if ($child->type == "photo"): ?>
<img alt="" src="<?= $child->resize_url(true) ?>"
title="<?= html::purify($child->title)->for_html_attr() ?>"
height="<?= $child->resize_height ?>" width="<?= $child->resize_width ?>" /><br />
<? if ($item->type == "photo"): ?>
<img alt="" src="<?= $item->resize_url(true) ?>"
title="<?= html::purify($item->title)->for_html_attr() ?>"
height="<?= $item->resize_height ?>" width="<?= $item->resize_width ?>" /><br />
<? else: ?>
<a href="<?= url::abs_site("{$child->type}s/{$child->id}") ?>">
<img alt="" src="<?= $child->thumb_url(true) ?>"
title="<?= html::purify($child->title)->for_html_attr() ?>"
height="<?= $child->thumb_height ?>" width="<?= $child->thumb_width ?>" /></a><br />
<a href="<?= url::abs_site("{$item->type}s/{$item->id}") ?>">
<img alt="" src="<?= $item->thumb_url(true) ?>"
title="<?= html::purify($item->title)->for_html_attr() ?>"
height="<?= $item->thumb_height ?>" width="<?= $item->thumb_width ?>" /></a><br />
<? endif ?>
<?= html::purify($child->description) ?>
<?= html::purify($item->description) ?>
</p>
]]>
</content:encoded>
<media:thumbnail url="<?= $child->thumb_url(true) ?>"
height="<?= $child->thumb_height ?>"
width="<?= $child->thumb_width ?>"
<media:thumbnail url="<?= $item->thumb_url(true) ?>"
height="<?= $item->thumb_height ?>"
width="<?= $item->thumb_width ?>"
/>
<? $view_full = access::can("view_full", $child); ?>
<? if ($child->type == "photo" && $view_full): ?>
<? $view_full = access::can("view_full", $item); ?>
<? if ($item->type == "photo" && $view_full): ?>
<media:group>
<? endif ?>
<? if ($child->type == "photo"): ?>
<media:content url="<?= $child->resize_url(true) ?>"
fileSize="<?= @filesize($child->resize_path()) ?>"
type="<?= $child->mime_type ?>"
height="<?= $child->resize_height ?>"
width="<?= $child->resize_width ?>"
<? if ($item->type == "photo"): ?>
<media:content url="<?= $item->resize_url(true) ?>"
fileSize="<?= @filesize($item->resize_path()) ?>"
type="<?= $item->mime_type ?>"
height="<?= $item->resize_height ?>"
width="<?= $item->resize_width ?>"
/>
<? endif ?>
<? if ($view_full): ?>
<media:content url="<?= $child->file_url(true) ?>"
fileSize="<?= @filesize($child->file_path()) ?>"
type="<?= $child->mime_type ?>"
height="<?= $child->height ?>"
width="<?= $child->width ?>"
<media:content url="<?= $item->file_url(true) ?>"
fileSize="<?= @filesize($item->file_path()) ?>"
type="<?= $item->mime_type ?>"
height="<?= $item->height ?>"
width="<?= $item->width ?>"
isDefault="true"
/>
<? endif ?>
<? if ($child->type == "photo" && $view_full): ?>
<? if ($item->type == "photo" && $view_full): ?>
</media:group>
<? endif ?>
</item>
Expand Down
2 changes: 1 addition & 1 deletion modules/tag/helpers/tag_rss.php
Expand Up @@ -36,7 +36,7 @@ static function feed($feed_id, $offset, $limit, $id) {
}

$feed = new stdClass();
$feed->children = $tag->items($limit, $offset, "photo");
$feed->items = $tag->items($limit, $offset, "photo");
$feed->max_pages = ceil($tag->count / $limit);
$feed->title = $tag->name;
$feed->description = t("Photos related to %tag_name", array("tag_name" => $tag->name));
Expand Down

0 comments on commit 48af5e6

Please sign in to comment.