Plugin Directory

Changeset 3287302


Ignore:
Timestamp:
05/04/2025 10:52:32 PM (11 months ago)
Author:
uwonder
Message:

Update to version 1.6 from GitHub

Location:
simple-google-photos-grid
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-google-photos-grid/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • simple-google-photos-grid/tags/1.6/Simple_Google_Photos_Grid.php

    r1776581 r3287302  
    2323  protected static $css_loaded = false;
    2424  protected static $js_loaded = false;
     25
     26  protected array $valid_domains = [
     27    'photos.app.goo.gl',
     28    'photos.google.com',
     29  ];
    2530
    2631  public function html($photos, $num_photos_to_show, $num_photos_per_row, $link_url) {
     
    8489  protected function get_photos_from_google($album_url) {
    8590    $photos = [];
    86     $response = wp_remote_get( $album_url );
     91    $response = wp_safe_remote_get( $album_url );
    8792    if ( !is_wp_error( $response ) ) {
    8893      $body = $response['body'];
     
    9196    }
    9297    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;
    93116  }
    94117
     
    135158        width:100%;
    136159        height:100%;
    137         overflow:hidden;     
     160        overflow:hidden;
    138161      }
    139162      div.{$cell_class} {
     
    169192              var container = jQuery(this);
    170193              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            });
    173196          });
    174197        }
  • simple-google-photos-grid/tags/1.6/readme.md

    r2185349 r3287302  
    99
    1010 - 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).
    1212 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low.
    1313 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos.
    1414 - Cache Interval (in minutes): How long to cache photo URLs before checking the album on Google again. 0 for no cache.
    15  
     15
    1616## Shortcode
    1717Place the shortcode in a post, page or theme.
     
    1919
    2020Available 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`
    2222- number-photos: (optional) number of photos to display, defaults to 4
    2323- number-photos-per-row: (optional) number of photos per row, defaults to 2
     
    2727
    2828## 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  
     29Your 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
    3131Google Photos Public Sharing Settings:
    3232
     
    3737## Finally
    3838No 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  
    33Tags: album, gallery, photos, Google Photos
    44Requires at least: 4.0
    5 Tested up to: 5.2.4
     5Tested up to: 6.8.1
    66Stable tag: trunk
    77License: GPLv2
     
    3131
    3232 - 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).
    3434 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low.
    3535 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos.
     
    4141
    4242Available 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'
    4444- number-photos: (optional) number of photos to display, defaults to 4
    4545- number-photos-per-row: (optional) number of photos per row, defaults to 2
     
    5353
    5454== Changelog ==
     55
     56= 1.6 =
     57* Fix CVE-2025-46503
    5558
    5659= 1.5 =
  • simple-google-photos-grid/tags/1.6/simple-google-photos-grid-shortcode.php

    r2185350 r3287302  
    1212    $attributes = array_change_key_case((array)$attributes, CASE_LOWER);
    1313
    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'])) {
    1517      return '';
    1618    }
     
    2830      : Simple_Google_Photos_Grid::NUMBER_PHOTOS_PER_ROW;
    2931
    30     $grid = new Simple_Google_Photos_Grid();
    31 
    3232    $photos = $grid->get_photos($attributes['album-url'], $cache_interval);
    3333
  • simple-google-photos-grid/tags/1.6/simple-google-photos-grid-widget.php

    r1775225 r3287302  
    4545
    4646    $grid = new Simple_Google_Photos_Grid();
     47
     48    if(!$grid->isValidAlbumUrl($instance['album-url'])) {
     49      return;
     50    }
    4751
    4852    $photos = $grid->get_photos($instance['album-url'], $cache_interval);
     
    117121  public function update( $new_instance, $old_instance ) {
    118122    $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
    119133    $instance['title'] = strip_tags($new_instance['title']);
    120134    $instance['cache-interval'] = intval($new_instance['cache-interval']);
    121135    $instance['number-photos'] = intval($new_instance['number-photos']);
    122136    $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 
    125137    return $instance;
    126138  }
  • simple-google-photos-grid/tags/1.6/simple-google-photos-grid.php

    r2185350 r3287302  
    44 * Plugin URI: https://github.com/datvance/simple-google-photos-grid
    55 * Description: Show the latest photos from a public Google Photos album.
    6  * Version: 1.5
     6 * Version: 1.6
    77 * Author: Josheli
    88 * Author URI: https://josheli.com
  • simple-google-photos-grid/trunk/Simple_Google_Photos_Grid.php

    r1776581 r3287302  
    2323  protected static $css_loaded = false;
    2424  protected static $js_loaded = false;
     25
     26  protected array $valid_domains = [
     27    'photos.app.goo.gl',
     28    'photos.google.com',
     29  ];
    2530
    2631  public function html($photos, $num_photos_to_show, $num_photos_per_row, $link_url) {
     
    8489  protected function get_photos_from_google($album_url) {
    8590    $photos = [];
    86     $response = wp_remote_get( $album_url );
     91    $response = wp_safe_remote_get( $album_url );
    8792    if ( !is_wp_error( $response ) ) {
    8893      $body = $response['body'];
     
    9196    }
    9297    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;
    93116  }
    94117
     
    135158        width:100%;
    136159        height:100%;
    137         overflow:hidden;     
     160        overflow:hidden;
    138161      }
    139162      div.{$cell_class} {
     
    169192              var container = jQuery(this);
    170193              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            });
    173196          });
    174197        }
  • simple-google-photos-grid/trunk/readme.md

    r2185349 r3287302  
    99
    1010 - 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).
    1212 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low.
    1313 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos.
    1414 - Cache Interval (in minutes): How long to cache photo URLs before checking the album on Google again. 0 for no cache.
    15  
     15
    1616## Shortcode
    1717Place the shortcode in a post, page or theme.
     
    1919
    2020Available 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`
    2222- number-photos: (optional) number of photos to display, defaults to 4
    2323- number-photos-per-row: (optional) number of photos per row, defaults to 2
     
    2727
    2828## 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  
     29Your 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
    3131Google Photos Public Sharing Settings:
    3232
     
    3737## Finally
    3838No 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  
    33Tags: album, gallery, photos, Google Photos
    44Requires at least: 4.0
    5 Tested up to: 5.2.4
     5Tested up to: 6.8.1
    66Stable tag: trunk
    77License: GPLv2
     
    3131
    3232 - 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).
    3434 - Num Photos to Show: Even numbers probably work best. There's a maximum number, not sure what it is, but it's pretty low.
    3535 - Num Photos per Row: How many photos to show per row? Probably some number that works well with Num Photos.
     
    4141
    4242Available 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'
    4444- number-photos: (optional) number of photos to display, defaults to 4
    4545- number-photos-per-row: (optional) number of photos per row, defaults to 2
     
    5353
    5454== Changelog ==
     55
     56= 1.6 =
     57* Fix CVE-2025-46503
    5558
    5659= 1.5 =
  • simple-google-photos-grid/trunk/simple-google-photos-grid-shortcode.php

    r2185350 r3287302  
    1212    $attributes = array_change_key_case((array)$attributes, CASE_LOWER);
    1313
    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'])) {
    1517      return '';
    1618    }
     
    2830      : Simple_Google_Photos_Grid::NUMBER_PHOTOS_PER_ROW;
    2931
    30     $grid = new Simple_Google_Photos_Grid();
    31 
    3232    $photos = $grid->get_photos($attributes['album-url'], $cache_interval);
    3333
  • simple-google-photos-grid/trunk/simple-google-photos-grid-widget.php

    r1775225 r3287302  
    4545
    4646    $grid = new Simple_Google_Photos_Grid();
     47
     48    if(!$grid->isValidAlbumUrl($instance['album-url'])) {
     49      return;
     50    }
    4751
    4852    $photos = $grid->get_photos($instance['album-url'], $cache_interval);
     
    117121  public function update( $new_instance, $old_instance ) {
    118122    $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
    119133    $instance['title'] = strip_tags($new_instance['title']);
    120134    $instance['cache-interval'] = intval($new_instance['cache-interval']);
    121135    $instance['number-photos'] = intval($new_instance['number-photos']);
    122136    $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 
    125137    return $instance;
    126138  }
  • simple-google-photos-grid/trunk/simple-google-photos-grid.php

    r2185350 r3287302  
    44 * Plugin URI: https://github.com/datvance/simple-google-photos-grid
    55 * Description: Show the latest photos from a public Google Photos album.
    6  * Version: 1.5
     6 * Version: 1.6
    77 * Author: Josheli
    88 * Author URI: https://josheli.com
Note: See TracChangeset for help on using the changeset viewer.