Commit 44b9de55 authored by markcarver's avatar markcarver

Issue #3059251 by markcarver, Devendra Mishra: PHP Parse error: syntax error,...

Issue #3059251 by markcarver, Devendra Mishra: PHP Parse error: syntax error, unexpected '[' in ApiProviderBase.php
parent 51409d4c
......@@ -165,7 +165,7 @@ abstract class ApiProviderBase extends ProviderBase {
* supported.
*/
public static function isValidVersion($version) {
return !!is_string($version) && preg_match('/^' . Bootstrap::FRAMEWORK_VERSION[0] . '\.\d+\.\d+$/', $version);
return !!is_string($version) && preg_match('/^' . substr(Bootstrap::FRAMEWORK_VERSION, 0, 1) . '\.\d+\.\d+$/', $version);
}
/**
......
......@@ -163,6 +163,9 @@ class CdnAsset {
// Extract the necessary data from the file.
list($path, $theme, $minified, $type) = static::extractParts($url);
// @todo Remove once PHP 5.5 is no longer supported (use array access).
$major = substr(Bootstrap::FRAMEWORK_VERSION, 0, 1);
// Bootstrap's example theme.
if ($theme === 'theme') {
$theme = 'bootstrap_theme';
......@@ -181,7 +184,7 @@ class CdnAsset {
}
// Other (e.g. bootswatch theme).
else {
$bootswatchThemes = isset(static::$bootswatchThemes[Bootstrap::FRAMEWORK_VERSION[0]]) ? static::$bootswatchThemes[Bootstrap::FRAMEWORK_VERSION[0]] : [];
$bootswatchThemes = isset(static::$bootswatchThemes[$major]) ? static::$bootswatchThemes[$major] : [];
if (!$theme || ($theme && !in_array($theme, $bootswatchThemes))) {
$theme = in_array($path, $bootswatchThemes) ? $path : 'bootstrap';
}
......@@ -194,7 +197,7 @@ class CdnAsset {
// If no version was provided, attempt to extract it.
// @todo Move regular expression to a constant once PHP 5.5 is no longer
// supported.
if (!isset($version) && preg_match('`(' . Bootstrap::FRAMEWORK_VERSION[0] . '\.\d+\.\d+)`', $url, $matches)) {
if (!isset($version) && preg_match('`(' . $major . '\.\d+\.\d+)`', $url, $matches)) {
$version = $matches[1];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment