Get the latest version number for the remote version.

Paramètres

array $library: An associative array containing all information about the library.

array $options: An associative array containing options for the version parser.

string $url: URL for the remote version to lookup.

Return value

string The latest version number as a string or 0 on failure.

4 string references to 'advagg_get_github_version_json'
advagg_font_libraries_info dans advagg_font/advagg_font.module
Implements hook_libraries_info().
advagg_get_remote_libraries_version dans ./advagg.module
Get the latest version number for the remote version.
advagg_mod_libraries_info dans advagg_mod/advagg_mod.module
Implements hook_libraries_info().
advagg_validator_libraries_info dans advagg_validator/advagg_validator.module
Implements hook_libraries_info().

Fichier

./advagg.module, line 5618

Code

function advagg_get_github_version_json(array $library, array $options, $url) {
    $http_options = array(
        'timeout' => 2,
    );
    $package = drupal_http_request($url, $http_options);
    if (empty($package->data)) {
        // Try again.
        $package = drupal_http_request($url, array(
            'timeout' => 5,
        ));
    }
    if (empty($package->data)) {
        // Try again but force http.
        $url = advagg_force_http_path($url);
        $package = drupal_http_request($url, $http_options);
    }
    if (!empty($package->data)) {
        $package = json_decode($package->data);
        if (isset($package->version)) {
            return (string) $package->version;
        }
    }
    return 0;
}