diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 81856f504..bf89f2167 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -193,13 +193,21 @@ class Assets } elseif (isset($this->collections[$asset])) { $this->add($this->collections[$asset], $priority, $pipeline); } else { + // Get extension + $extension = pathinfo($asset, PATHINFO_EXTENSION); + + // Strip query from pathinfo extension + $query_pos = strpos($extension, '?'); + if ($query_pos !== FALSE) { + $extension = substr($extension, 0, $query_pos); + } + // JavaScript or CSS - $info = pathinfo($asset); - if (isset($info['extension'])) { - $ext = strtolower($info['extension']); - if ($ext === 'css') { + if (strlen($extension) > 0) { + $extension = strtolower($extension); + if ($extension === 'css') { $this->addCss($asset, $priority, $pipeline); - } elseif ($ext === 'js') { + } elseif ($extension === 'js') { $this->addJs($asset, $priority, $pipeline); } } diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index e5d7698d6..955bb6892 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -288,22 +288,27 @@ class Page */ public function summary($size = null) { + /** @var Config $config */ + $config = self::$grav['config']; $content = $this->content(); + // Return summary based on settings in site config file + if (!$config->get('site.summary.enabled', TRUE)) { + return $content; + } + // Return calculated summary based on summary divider's position if (!$size && isset($this->summary_size)) { return substr($content, 0, $this->summary_size); } // Return calculated summary based on setting in site config file - /** @var Config $config */ - $config = self::$grav['config']; - if (!$size && $config->get('site.summary.size')) { + if (is_null($size) && $config->get('site.summary.size')) { $size = $config->get('site.summary.size'); } // Return calculated summary based on defaults - if (!$size) { + if (!is_numeric($size) || ($size < 0)) { $size = 300; }