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.

2 string references to 'advagg_get_github_version_txt'
advagg_css_compress_libraries_info dans advagg_css_compress/advagg_css_compress.module
Implements hook_libraries_info().
advagg_get_remote_libraries_version dans ./advagg.module
Get the latest version number for the remote version.

Fichier

./advagg.module, line 5652

Code

function advagg_get_github_version_txt(array $library, array $options, $url) {
    $http_options = array(
        'timeout' => 2,
    );
    $request = drupal_http_request($url, $http_options);
    if (empty($request->data)) {
        // Try again.
        $request = drupal_http_request($url, array(
            'timeout' => 5,
        ));
    }
    if (empty($request->data)) {
        // Try again but force http.
        $url = advagg_force_http_path($url);
        $request = drupal_http_request($url, $http_options);
    }
    if (!empty($request->data)) {
        $matches = array();
        if (preg_match($options['pattern'], $request->data, $matches)) {
            return $matches[1];
        }
    }
    return '0';
}