src/Converter.php
private static function findScreenshot($number, $plugin_slug)
    {
        $extensions = array('png', 'jpg', 'jpeg', 'gif');

        // this seems to now be the correct URL, not s.wordpress.org/plugins
        $base_url   = 'https://s.w.org/plugins/' . $plugin_slug . '/';
        $assets_url = 'https://ps.w.org/' . $plugin_slug . '/assets/';

        /* check assets for all extensions first, because if there's a
           gif in the assets directory and a jpg in the base directory,
           the one in the assets directory needs to win.
        */
        foreach (array($assets_url, $base_url) as $prefix_url) {
            foreach ($extensions as $ext) {
                $url = $prefix_url . 'screenshot-' . $number . '.' . $ext;
                if (self::validateUrl($url)) {
                    return $url;
                }
            }
        }

        return false;
    }
private static function findScreenshot($number, $plugin_slug)
    {
        $extensions = array('png', 'jpg', 'jpeg', 'gif');

        // this seems to now be the correct URL, not s.wordpress.org/plugins
        $base_url   = 'https://s.w.org/plugins/' . $plugin_slug . '/';
        $assets_url = 'https://ps.w.org/' . $plugin_slug . '/assets/';

        /* check assets for all extensions first, because if there's a
           gif in the assets directory and a jpg in the base directory,
           the one in the assets directory needs to win.
        */
        foreach (array($assets_url, $base_url) as $prefix_url) {
            foreach ($extensions as $ext) {
                $url = $prefix_url . 'screenshot-' . $number . '.' . $ext;
                if (self::validateUrl($url)) {
                    return $url;
                }
            }
        }

        return false;
    }
private static function findScreenshot ( $ number , $ plugin_slug ) { $ extensions = array ( 'png' , 'jpg' , 'jpeg' , 'gif' ) ; // this seems to now be the correct URL, not s.wordpress.org/plugins $ base_url = 'https://s.w.org/plugins/' . $ plugin_slug . '/' ; $ assets_url = 'https://ps.w.org/' . $ plugin_slug . '/assets/' ; /* check assets for all extensions first, because if there's a
           gif in the assets directory and a jpg in the base directory,
           the one in the assets directory needs to win.
        */ foreach ( array ( $ assets_url , $ base_url ) as $ prefix_url ) { foreach ( $ extensions as $ ext ) { $ url = $ prefix_url . 'screenshot-' . $ number . '.' . $ ext ; if ( self :: validateUrl ( $ url ) ) { return $ url ; } } } return false ; }
Finds the correct screenshot file with the given number and plugin slug.

As per the WordPress plugin repo, file extensions may be any
of: (png|jpg|jpeg|gif).  We look in the /assets directory first,
then in the base directory.

@param   int $number Screenshot number to look for
@param   string $plugin_slug
@return  string|false   Valid screenshot URL or false if none found
@uses    url_validate
@link    http://wordpress.org/plugins/about/readme.txt
Finds the correct screenshot file with the given number and plugin slug .