Changeset 3287302
- Timestamp:
- 05/04/2025 10:52:32 PM (11 months ago)
- Location:
- simple-google-photos-grid
- Files:
-
- 13 edited
- 1 copied
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
tags/1.6 (copied) (copied from simple-google-photos-grid/trunk)
-
tags/1.6/Simple_Google_Photos_Grid.php (modified) (5 diffs)
-
tags/1.6/readme.md (modified) (4 diffs)
-
tags/1.6/readme.txt (modified) (4 diffs)
-
tags/1.6/simple-google-photos-grid-shortcode.php (modified) (2 diffs)
-
tags/1.6/simple-google-photos-grid-widget.php (modified) (2 diffs)
-
tags/1.6/simple-google-photos-grid.php (modified) (1 diff)
-
trunk/Simple_Google_Photos_Grid.php (modified) (5 diffs)
-
trunk/readme.md (modified) (4 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/simple-google-photos-grid-shortcode.php (modified) (2 diffs)
-
trunk/simple-google-photos-grid-widget.php (modified) (2 diffs)
-
trunk/simple-google-photos-grid.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simple-google-photos-grid/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
simple-google-photos-grid/tags/1.6/Simple_Google_Photos_Grid.php
r1776581 r3287302 23 23 protected static $css_loaded = false; 24 24 protected static $js_loaded = false; 25 26 protected array $valid_domains = [ 27 'photos.app.goo.gl', 28 'photos.google.com', 29 ]; 25 30 26 31 public function html($photos, $num_photos_to_show, $num_photos_per_row, $link_url) { … … 84 89 protected function get_photos_from_google($album_url) { 85 90 $photos = []; 86 $response = wp_ remote_get( $album_url );91 $response = wp_safe_remote_get( $album_url ); 87 92 if ( !is_wp_error( $response ) ) { 88 93 $body = $response['body']; … … 91 96 } 92 97 return $photos; 98 } 99 100 public function isValidAlbumUrl($album_url): bool { 101 102 if(!is_string($album_url)) return false; 103 104 $album_url = strtolower(trim($album_url)); 105 $url = parse_url($album_url); 106 107 if(!isset($url['scheme']) || $url['scheme'] !== 'https') { 108 return false; 109 } 110 111 if(!isset($url['host']) || !in_array($url['host'], $this->valid_domains)) { 112 return false; 113 } 114 115 return true; 93 116 } 94 117 … … 135 158 width:100%; 136 159 height:100%; 137 overflow:hidden; 160 overflow:hidden; 138 161 } 139 162 div.{$cell_class} { … … 169 192 var container = jQuery(this); 170 193 var width = container.find("div.{$cell_class}").first().width(); 171 container.find("img.{$image_class}").css("width", width).css("height", width); 172 }); 194 container.find("img.{$image_class}").css("width", width).css("height", width); 195 }); 173 196 }); 174 197 } -
simple-google-photos-grid/tags/1.6/readme.md
r2185349 r3287302 9 9 10 10 - Title: Heading of the widget on your site. Default to empty. 11 - Album URL: The full URL to your public gallery on Google Photos. Ideally should be a short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1), but any Google Photos URL should do.11 - Album URL: The full URL to your public gallery on Google Photos. URL must use one of the following domains: `photos.app.goo.gl` or `photos.google.com`. Ideally should be the short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1z). 12 12 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low. 13 13 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos. 14 14 - Cache Interval (in minutes): How long to cache photo URLs before checking the album on Google again. 0 for no cache. 15 15 16 16 ## Shortcode 17 17 Place the shortcode in a post, page or theme. … … 19 19 20 20 Available attributes are: 21 - album-url: (required) the url to a public Google Photos album 21 - album-url: (required) the url to a public Google Photos album, domain must be one of `photos.app.goo.gl` or `photos.google.com` 22 22 - number-photos: (optional) number of photos to display, defaults to 4 23 23 - number-photos-per-row: (optional) number of photos per row, defaults to 2 … … 27 27 28 28 ## Notes 29 Your album on Google Photos must be "public", which means you need to go into Google Photos on the web and set "Sharing options" to on, i.e. "Anyone with the link can see these photos and the people who've been invited or joined." 30 29 Your album on Google Photos must be "public", which means you need to go into Google Photos on the web and set "Sharing options" to on, i.e. "Anyone with the link can see these photos and the people who've been invited or joined." 30 31 31 Google Photos Public Sharing Settings: 32 32 … … 37 37 ## Finally 38 38 No support is provided. Probably no features will be added. You are free to ask, or to fork. Pull requests accepted. 39 40 ## Changelog 41 42 = 1.6 = 43 * Fix CVE-2025-46503 44 45 = 1.5 = 46 * Fixed notices in shortcode 47 48 = 1.4 = 49 * Fixed uninstall and shortcode bugs 50 51 = 1.3 = 52 * Added "number photos per row" configuration/attribute to have grids other than 2x2 53 54 = 1.2 = 55 * Fixed bug if more than one grid on a page 56 57 = 1.1 = 58 * Added shortcode 59 60 = 1.0 = 61 * Initial release -
simple-google-photos-grid/tags/1.6/readme.txt
r2185350 r3287302 3 3 Tags: album, gallery, photos, Google Photos 4 4 Requires at least: 4.0 5 Tested up to: 5.2.45 Tested up to: 6.8.1 6 6 Stable tag: trunk 7 7 License: GPLv2 … … 31 31 32 32 - Title: Heading of the widget on your site. Default to empty. 33 - Album URL: The full URL to your public gallery on Google Photos. Ideally should be a short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1), but any Google Photos URL should do.33 - Album URL: The full URL to your public gallery on Google Photos. URL must use one of the following domains: 'photos.app.goo.gl' or 'photos.google.com'. Ideally should be the short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1z). 34 34 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low. 35 35 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos. … … 41 41 42 42 Available attributes are: 43 - album-url: (required) the url to a public Google Photos album 43 - album-url: (required) the url to a public Google Photos album, domain must be one of 'photos.app.goo.gl' or 'photos.google.com' 44 44 - number-photos: (optional) number of photos to display, defaults to 4 45 45 - number-photos-per-row: (optional) number of photos per row, defaults to 2 … … 53 53 54 54 == Changelog == 55 56 = 1.6 = 57 * Fix CVE-2025-46503 55 58 56 59 = 1.5 = -
simple-google-photos-grid/tags/1.6/simple-google-photos-grid-shortcode.php
r2185350 r3287302 12 12 $attributes = array_change_key_case((array)$attributes, CASE_LOWER); 13 13 14 if(!isset($attributes['album-url']) || substr($attributes['album-url'], 0, 8) != 'https://') { 14 $grid = new Simple_Google_Photos_Grid(); 15 16 if(!$grid->isValidAlbumUrl($attributes['album-url'])) { 15 17 return ''; 16 18 } … … 28 30 : Simple_Google_Photos_Grid::NUMBER_PHOTOS_PER_ROW; 29 31 30 $grid = new Simple_Google_Photos_Grid();31 32 32 $photos = $grid->get_photos($attributes['album-url'], $cache_interval); 33 33 -
simple-google-photos-grid/tags/1.6/simple-google-photos-grid-widget.php
r1775225 r3287302 45 45 46 46 $grid = new Simple_Google_Photos_Grid(); 47 48 if(!$grid->isValidAlbumUrl($instance['album-url'])) { 49 return; 50 } 47 51 48 52 $photos = $grid->get_photos($instance['album-url'], $cache_interval); … … 117 121 public function update( $new_instance, $old_instance ) { 118 122 $instance = []; 123 124 $grid = new Simple_Google_Photos_Grid(); 125 126 if($grid->isValidAlbumUrl($new_instance['album-url'])) { 127 $instance['album-url'] = esc_url_raw( $new_instance['album-url'], ['https'] ); 128 } 129 else { 130 return false; 131 } 132 119 133 $instance['title'] = strip_tags($new_instance['title']); 120 134 $instance['cache-interval'] = intval($new_instance['cache-interval']); 121 135 $instance['number-photos'] = intval($new_instance['number-photos']); 122 136 $instance['number-photos-per-row'] = intval($new_instance['number-photos-per-row']); 123 $instance['album-url'] = esc_url_raw( $new_instance['album-url'], ['https'] );124 125 137 return $instance; 126 138 } -
simple-google-photos-grid/tags/1.6/simple-google-photos-grid.php
r2185350 r3287302 4 4 * Plugin URI: https://github.com/datvance/simple-google-photos-grid 5 5 * Description: Show the latest photos from a public Google Photos album. 6 * Version: 1. 56 * Version: 1.6 7 7 * Author: Josheli 8 8 * Author URI: https://josheli.com -
simple-google-photos-grid/trunk/Simple_Google_Photos_Grid.php
r1776581 r3287302 23 23 protected static $css_loaded = false; 24 24 protected static $js_loaded = false; 25 26 protected array $valid_domains = [ 27 'photos.app.goo.gl', 28 'photos.google.com', 29 ]; 25 30 26 31 public function html($photos, $num_photos_to_show, $num_photos_per_row, $link_url) { … … 84 89 protected function get_photos_from_google($album_url) { 85 90 $photos = []; 86 $response = wp_ remote_get( $album_url );91 $response = wp_safe_remote_get( $album_url ); 87 92 if ( !is_wp_error( $response ) ) { 88 93 $body = $response['body']; … … 91 96 } 92 97 return $photos; 98 } 99 100 public function isValidAlbumUrl($album_url): bool { 101 102 if(!is_string($album_url)) return false; 103 104 $album_url = strtolower(trim($album_url)); 105 $url = parse_url($album_url); 106 107 if(!isset($url['scheme']) || $url['scheme'] !== 'https') { 108 return false; 109 } 110 111 if(!isset($url['host']) || !in_array($url['host'], $this->valid_domains)) { 112 return false; 113 } 114 115 return true; 93 116 } 94 117 … … 135 158 width:100%; 136 159 height:100%; 137 overflow:hidden; 160 overflow:hidden; 138 161 } 139 162 div.{$cell_class} { … … 169 192 var container = jQuery(this); 170 193 var width = container.find("div.{$cell_class}").first().width(); 171 container.find("img.{$image_class}").css("width", width).css("height", width); 172 }); 194 container.find("img.{$image_class}").css("width", width).css("height", width); 195 }); 173 196 }); 174 197 } -
simple-google-photos-grid/trunk/readme.md
r2185349 r3287302 9 9 10 10 - Title: Heading of the widget on your site. Default to empty. 11 - Album URL: The full URL to your public gallery on Google Photos. Ideally should be a short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1), but any Google Photos URL should do.11 - Album URL: The full URL to your public gallery on Google Photos. URL must use one of the following domains: `photos.app.goo.gl` or `photos.google.com`. Ideally should be the short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1z). 12 12 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low. 13 13 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos. 14 14 - Cache Interval (in minutes): How long to cache photo URLs before checking the album on Google again. 0 for no cache. 15 15 16 16 ## Shortcode 17 17 Place the shortcode in a post, page or theme. … … 19 19 20 20 Available attributes are: 21 - album-url: (required) the url to a public Google Photos album 21 - album-url: (required) the url to a public Google Photos album, domain must be one of `photos.app.goo.gl` or `photos.google.com` 22 22 - number-photos: (optional) number of photos to display, defaults to 4 23 23 - number-photos-per-row: (optional) number of photos per row, defaults to 2 … … 27 27 28 28 ## Notes 29 Your album on Google Photos must be "public", which means you need to go into Google Photos on the web and set "Sharing options" to on, i.e. "Anyone with the link can see these photos and the people who've been invited or joined." 30 29 Your album on Google Photos must be "public", which means you need to go into Google Photos on the web and set "Sharing options" to on, i.e. "Anyone with the link can see these photos and the people who've been invited or joined." 30 31 31 Google Photos Public Sharing Settings: 32 32 … … 37 37 ## Finally 38 38 No support is provided. Probably no features will be added. You are free to ask, or to fork. Pull requests accepted. 39 40 ## Changelog 41 42 = 1.6 = 43 * Fix CVE-2025-46503 44 45 = 1.5 = 46 * Fixed notices in shortcode 47 48 = 1.4 = 49 * Fixed uninstall and shortcode bugs 50 51 = 1.3 = 52 * Added "number photos per row" configuration/attribute to have grids other than 2x2 53 54 = 1.2 = 55 * Fixed bug if more than one grid on a page 56 57 = 1.1 = 58 * Added shortcode 59 60 = 1.0 = 61 * Initial release -
simple-google-photos-grid/trunk/readme.txt
r2185350 r3287302 3 3 Tags: album, gallery, photos, Google Photos 4 4 Requires at least: 4.0 5 Tested up to: 5.2.45 Tested up to: 6.8.1 6 6 Stable tag: trunk 7 7 License: GPLv2 … … 31 31 32 32 - Title: Heading of the widget on your site. Default to empty. 33 - Album URL: The full URL to your public gallery on Google Photos. Ideally should be a short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1), but any Google Photos URL should do.33 - Album URL: The full URL to your public gallery on Google Photos. URL must use one of the following domains: 'photos.app.goo.gl' or 'photos.google.com'. Ideally should be the short, "shared" link (such as https://photos.app.goo.gl/G8EOLs5YtESchh4g1z). 34 34 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low. 35 35 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos. … … 41 41 42 42 Available attributes are: 43 - album-url: (required) the url to a public Google Photos album 43 - album-url: (required) the url to a public Google Photos album, domain must be one of 'photos.app.goo.gl' or 'photos.google.com' 44 44 - number-photos: (optional) number of photos to display, defaults to 4 45 45 - number-photos-per-row: (optional) number of photos per row, defaults to 2 … … 53 53 54 54 == Changelog == 55 56 = 1.6 = 57 * Fix CVE-2025-46503 55 58 56 59 = 1.5 = -
simple-google-photos-grid/trunk/simple-google-photos-grid-shortcode.php
r2185350 r3287302 12 12 $attributes = array_change_key_case((array)$attributes, CASE_LOWER); 13 13 14 if(!isset($attributes['album-url']) || substr($attributes['album-url'], 0, 8) != 'https://') { 14 $grid = new Simple_Google_Photos_Grid(); 15 16 if(!$grid->isValidAlbumUrl($attributes['album-url'])) { 15 17 return ''; 16 18 } … … 28 30 : Simple_Google_Photos_Grid::NUMBER_PHOTOS_PER_ROW; 29 31 30 $grid = new Simple_Google_Photos_Grid();31 32 32 $photos = $grid->get_photos($attributes['album-url'], $cache_interval); 33 33 -
simple-google-photos-grid/trunk/simple-google-photos-grid-widget.php
r1775225 r3287302 45 45 46 46 $grid = new Simple_Google_Photos_Grid(); 47 48 if(!$grid->isValidAlbumUrl($instance['album-url'])) { 49 return; 50 } 47 51 48 52 $photos = $grid->get_photos($instance['album-url'], $cache_interval); … … 117 121 public function update( $new_instance, $old_instance ) { 118 122 $instance = []; 123 124 $grid = new Simple_Google_Photos_Grid(); 125 126 if($grid->isValidAlbumUrl($new_instance['album-url'])) { 127 $instance['album-url'] = esc_url_raw( $new_instance['album-url'], ['https'] ); 128 } 129 else { 130 return false; 131 } 132 119 133 $instance['title'] = strip_tags($new_instance['title']); 120 134 $instance['cache-interval'] = intval($new_instance['cache-interval']); 121 135 $instance['number-photos'] = intval($new_instance['number-photos']); 122 136 $instance['number-photos-per-row'] = intval($new_instance['number-photos-per-row']); 123 $instance['album-url'] = esc_url_raw( $new_instance['album-url'], ['https'] );124 125 137 return $instance; 126 138 } -
simple-google-photos-grid/trunk/simple-google-photos-grid.php
r2185350 r3287302 4 4 * Plugin URI: https://github.com/datvance/simple-google-photos-grid 5 5 * Description: Show the latest photos from a public Google Photos album. 6 * Version: 1. 56 * Version: 1.6 7 7 * Author: Josheli 8 8 * Author URI: https://josheli.com
Note: See TracChangeset
for help on using the changeset viewer.