コード例 #1
0
 public function __construct($item_reviewed, $review, $reviewer, $date_reviewed)
 {
     parent::__construct();
     $this->set_attribute_str('class', 'hreview');
     $item_div = new HTMLTags_Div();
     $item_div->set_attribute_str('class', 'item');
     $item_div->append_str_to_content($item_reviewed);
     $this->append_tag_to_content($item_div);
     $description_div = new HTMLTags_Div();
     $description_div->set_attribute_str('class', 'description');
     $description_p = new HTMLTags_P($review);
     $description_div->append_tag_to_content($description_p);
     $this->append_tag_to_content($description_div);
     $reviewer_vcard_span = new HTMLTags_Span();
     $reviewer_vcard_span->set_attribute_str('class', 'reviewer vcard');
     $reviewer_fn_span = new HTMLTags_Span();
     $reviewer_fn_span->set_attribute_str('class', 'fn');
     $reviewer_fn_span->append_str_to_content($reviewer);
     $reviewer_vcard_span->append_tag_to_content($reviewer_fn_span);
     $random_br_tag = new HTMLTags_BR();
     $reviewer_vcard_span->append_tag_to_content($random_br_tag);
     $date_reviewed_abbr = new HTMLTags_Abbr();
     $date_reviewed_abbr->set_attribute_str('class', 'dtreviewed');
     $datetime_iso8601 = Formatting_DateTime::datetime_to_ISO8601($date_reviewed);
     $date_reviewed_abbr->set_attribute_str('title', $datetime_iso8601);
     $datetime_human_readable = Formatting_DateTime::datetime_to_human_readable($date_reviewed);
     $date_reviewed_abbr->append_str_to_content($datetime_human_readable);
     $reviewer_vcard_span->append_tag_to_content($date_reviewed_abbr);
     $this->append_tag_to_content($reviewer_vcard_span);
     return $this;
 }
コード例 #2
0
 public function get_latest_photographs_rss()
 {
     $photographs_table = $this->get_element();
     $rss_intro_str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n            <rss version=\"2.0\"\n                    xmlns:media=\"http://search.yahoo.com/mrss/\"\n                    xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n                    >\n                <channel>" . "\n\t\t\t";
     $rss_outro_str = "\n                </channel>\n            </rss>";
     $rss_header_str = '';
     $rss_header_str .= "<title>Brighton Wok - Latest Photos</title>";
     $rss_header_str .= "<link>http://www.brighton-wok.com/gallery.html</link>";
     $rss_header_str .= "<description>A feed of photographs from the production of Brighton Wok</description>";
     $rss_header_str .= "<pubDate>" . date('Y-m-d') . "</pubDate>";
     $rss_header_str .= "<lastBuildDate>" . date('Y-m-d') . "</lastBuildDate>";
     $rss_header_str .= "<generator>http://www.brighton-wok.com/</generator>" . "\n\t\t\t";
     $recent_photograph_rows = $photographs_table->get_all_rows('added', 'DESC', 0, 10);
     $rss_photos_strs_array = array();
     foreach ($recent_photograph_rows as $recent_photograph_row) {
         $recent_photograph_image_row = $recent_photograph_row->get_full_size_image();
         $recent_photograph_image_row_renderer = $recent_photograph_image_row->get_renderer();
         $recent_photograph_image_uri = $recent_photograph_image_row_renderer->get_html_url_in_public_images();
         $recent_photograph_thumbnail_row = $recent_photograph_row->get_thumbnail_image();
         $recent_photograph_thumbnail_row_renderer = $recent_photograph_thumbnail_row->get_renderer();
         $recent_photograph_thumbnail_uri = $recent_photograph_thumbnail_row_renderer->get_html_url_in_public_images();
         $rss_str = '';
         $rss_str .= "<item>" . "\n\t\t\t\t";
         $rss_str .= "<title>" . $recent_photograph_row->get_name() . "</title>";
         $rss_str .= "<link>http://www.brighton-wok.com/?page=gallery&amp;photograph_id=" . $recent_photograph_row->get_id() . "</link>";
         $date_added = $recent_photograph_row->get_added();
         $date_added_human_readable = Formatting_DateTime::datetime_to_human_readable($date_added);
         $rss_str .= "<description>" . "&lt;img src=\"http://www.brighton-wok.com" . $recent_photograph_image_uri->get_as_string() . "\" alt=\"" . $recent_photograph_row->get_name() . "\" /&gt;&lt;p&gt;" . $recent_photograph_row->get_description() . "&lt;/p&gt;&lt;p&gt;Photograph added on " . $date_added_human_readable . "&lt;/p&gt;</description>";
         $rss_str .= "<pubDate>" . $recent_photograph_row->get_added() . "</pubDate>";
         $rss_str .= "<dc:date.Taken>" . $recent_photograph_row->get_added() . "</dc:date.Taken>";
         $rss_str .= "<author>photos@brighton-wok.com (Brighton Wok)</author>";
         $rss_str .= "<media:content url=\"http://www.brighton-wok.com" . $recent_photograph_image_uri->get_as_string() . "\"" . " type=\"" . $recent_photograph_image_row->get_file_type() . "\" />";
         $rss_str .= "<media:title>" . $recent_photograph_row->get_name() . "</media:title>";
         $rss_str .= "<media:text type=\"html\">" . $recent_photograph_row->get_description() . "</media:text>";
         $rss_str .= "<media:thumbnail url=\"http://www.brighton-wok.com" . $recent_photograph_thumbnail_uri->get_as_string() . "\" />";
         $rss_str .= "<media:credit role=\"photographer\">Connected Films</media:credit>";
         $tags = array();
         $tags = $recent_photograph_row->get_tags_strs();
         $rss_str .= "<media:category scheme=\"urn:flickr:tags\">";
         foreach ($tags as $tag) {
             $rss_str .= $tag . " ";
         }
         $rss_str .= "</media:category>" . "\n\t\t\t";
         $rss_str .= "</item>" . "\n\t\t\t";
         $rss_photos_strs_array[] = $rss_str;
     }
     ################################
     # Build the RSS page
     ################################
     $rss_page = $rss_intro_str . $rss_header_str;
     foreach ($rss_photos_strs_array as $rss_photo_str) {
         $rss_page .= $rss_photo_str;
     }
     $rss_page .= $rss_outro_str;
     return $rss_page;
 }