コード例 #1
0
ファイル: MapImage.php プロジェクト: railpage/railpagecore
 /**
  * Static function to make using this class easier/lazier
  * @since Version 3.10.0
  * @param double $lat
  * @param double $lon
  * @return string
  */
 public static function Image($lat, $lon)
 {
     $MapImage = new MapImage($lat, $lon);
     return $MapImage->__toString();
 }
コード例 #2
0
ファイル: Weekly.php プロジェクト: railpage/railpagecore
 /**
  * Site content other than news that we could feature in this newsletter
  * @since Version 3.10.0
  * @return \Railpage\Newsletters\Weekly
  */
 private function getOtherContent()
 {
     $query = "SELECT CONCAT('http://railpage.com.au/locations/', LOWER(country), '/', LOWER(region_slug), '/', slug) AS url, name AS title, `desc` AS text, 'Locations' AS subtitle, `lat`, `long` AS lon FROM location WHERE date_added >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 WEEK)) LIMIT 0, 2";
     $result = $this->db->fetchAll($query);
     foreach ($result as $key => $row) {
         if (!empty($row['lat']) && !empty($row['lon'])) {
             $row['featuredimage'] = MapImage::Image($row['lat'], $row['lon']);
             $row['url'] = NewsletterUtility::CreateUTMParametersForLink($this->Newsletter, $row['url']);
         }
         $result[$key] = $row;
     }
     // Get the photo of the week
     $PhotoOfTheWeek = new PhotoOfTheWeek();
     $photo = $PhotoOfTheWeek->getImageOfTheWeek();
     if (!empty($photo)) {
         $result[] = ["url" => NewsletterUtility::CreateUTMParametersForLink($this->Newsletter, $photo['url']['canonical']), "title" => "Photo of the week", "subtitle" => sprintf("%s by %s", $photo['title'], $photo['meta']['author']['realname']), "text" => "Each week our site staff scour the photos submitted to Railpage, and showcase the best as Photo of the Week. We have thousands of photos on Railpage - dive in and take a look!", "featuredimage" => $photo['meta']['sizes']['small']['source'], "link_text" => "View photo"];
     }
     $this->prependedContent = $result;
     $this->num_items += count($this->prependedContent);
     return $this;
 }