diff --git a/CHANGELOG.md b/CHANGELOG.md index e7d848e7b..9bd44a21b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,3 @@ -# v1.2.4 -## 04/xx/2017 - -1. [](#bugfix) - * Allow multiple calls to `Themes::initTheme()` without throwing errors - * Fixed querystrings in root pages with multi-lang enabled [#1436](https://github.com/getgrav/grav/issues/1436) - # Feature/Objects Branch ## xx/xx/2017 @@ -20,6 +13,26 @@ * Improve error handling in Folder::move() * Added extra parameter for Twig::processSite() to include custom context +# v1.2.5 +## 04/xx/2017 + +1. [](#improved) + * Add more controls over HTML5 video attributes (autoplay, poster, loop controls) [#1442](https://github.com/getgrav/grav/pull/1442) + * Removed logging statement for invalid slug [#1459](https://github.com/getgrav/grav/issues/1459) +1. [](#bugfix) + * Fix to force route/redirect matching from the start of the route by default [#1446](https://github.com/getgrav/grav/issues/1446) + * Edit check for valid slug [#1459](https://github.com/getgrav/grav/issues/1459) + +# v1.2.4 +## 04/24/2017 + +1. [](#improved) + * Added optional ignores for `Installer::sophisticatedInstall()` [#1447](https://github.com/getgrav/grav/issues/1447) +1. [](#bugfix) + * Allow multiple calls to `Themes::initTheme()` without throwing errors + * Fixed querystrings in root pages with multi-lang enabled [#1436](https://github.com/getgrav/grav/issues/1436) + * Allow support for `Pages::getList()` with `show_modular` option [#1080](https://github.com/getgrav/grav-plugin-admin/issues/1080) + # v1.2.3 ## 04/19/2017 @@ -28,7 +41,7 @@ * Allow `user/accounts.yaml` overrides and implemented more robust theme initialization * improved `getList()` method to do more powerful things * Fix Typo in GPM [#1427](https://github.com/getgrav/grav/issues/1427) - + # v1.2.2 ## 04/11/2017 diff --git a/composer.lock b/composer.lock index 426d66135..0c876ab34 100644 --- a/composer.lock +++ b/composer.lock @@ -1378,16 +1378,16 @@ }, { "name": "twig/twig", - "version": "v1.33.0", + "version": "v1.33.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "05cf49921b13f6f01d3cfdf9018cfa7a8086fd5a" + "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/05cf49921b13f6f01d3cfdf9018cfa7a8086fd5a", - "reference": "05cf49921b13f6f01d3cfdf9018cfa7a8086fd5a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/dd6ca96227917e1e85b41c7c3cc6507b411e0927", + "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927", "shasum": "" }, "require": { @@ -1436,7 +1436,7 @@ "keywords": [ "templating" ], - "time": "2017-03-22T15:40:09+00:00" + "time": "2017-04-20T17:39:48+00:00" } ], "packages-dev": [ diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index 2badbf131..7c6b0fb0f 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -12,12 +12,13 @@ form: fields: home.alias: type: pages - size: medium + size: large classes: fancy label: PLUGIN_ADMIN.HOME_PAGE show_all: false show_modular: false show_root: false + show_slug: true help: PLUGIN_ADMIN.HOME_PAGE_HELP home.hide_in_urls: diff --git a/system/defines.php b/system/defines.php index 6e79ce7cf..156371ba2 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.2.3'); +define('GRAV_VERSION', '1.2.4'); define('GRAV_TESTING', false); define('DS', '/'); diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index 0e6352147..1f8a2626e 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -58,6 +58,7 @@ class Installer 'sophisticated' => false, 'theme' => false, 'install_path' => '', + 'ignores' => [], 'exclude_checks' => [self::EXISTS, self::NOT_FOUND, self::IS_LINK] ]; @@ -134,7 +135,7 @@ class Installer self::moveInstall($extracted, $install_path); } } else { - self::sophisticatedInstall($extracted, $install_path); + self::sophisticatedInstall($extracted, $install_path, $options['ignores']); } Folder::delete($tmp); @@ -280,11 +281,11 @@ class Installer * * @return bool */ - public static function sophisticatedInstall($source_path, $install_path) + public static function sophisticatedInstall($source_path, $install_path, $ignores = []) { foreach (new \DirectoryIterator($source_path) as $file) { - if ($file->isLink() || $file->isDot()) { + if ($file->isLink() || $file->isDot() || in_array($file->getBasename(),$ignores)) { continue; } @@ -296,7 +297,7 @@ class Installer if ($file->getBasename() == 'bin') { foreach (glob($path . DS . '*') as $bin_file) { - @chmod($bin_file, 0755); + @chmod($bin_file, 0755); } } } else { diff --git a/system/src/Grav/Common/Page/Medium/VideoMedium.php b/system/src/Grav/Common/Page/Medium/VideoMedium.php index 51690da0f..31e426549 100644 --- a/system/src/Grav/Common/Page/Medium/VideoMedium.php +++ b/system/src/Grav/Common/Page/Medium/VideoMedium.php @@ -30,6 +30,75 @@ class VideoMedium extends Medium ]; } + /** + * Allows to set or remove the HTML5 default controls + * + * @param bool $display + * @return $this + */ + public function controls($display = true) + { + if($display) + { + $this->attributes['controls'] = true; + } + else + { + unset($this->attributes['controls']); + } + return $this; + } + + /** + * Allows to set the video's poster image + * + * @param $urlImage + * @return $this + */ + public function poster($urlImage) + { + $this->attributes['poster'] = $urlImage; + return $this; + } + + /** + * Allows to set the loop attribute + * + * @param bool $status + * @return $this + */ + public function loop($status = false) + { + if($status) + { + $this->attributes['loop'] = true; + } + else + { + unset($this->attributes['loop']); + } + return $this; + } + + /** + * Allows to set the autoplay attribute + * + * @param bool $status + * @return $this + */ + public function autoplay($status = false) + { + if($status) + { + $this->attributes['autoplay'] = true; + } + else + { + unset($this->attributes['autoplay']); + } + return $this; + } + /** * Reset medium. * diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 41e177cf0..fc3dc1d6c 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1497,9 +1497,6 @@ class Page { if ($var !== null && $var !== "") { $this->slug = $var; - if (!preg_match('/^[a-z0-9][-a-z0-9]*$/', $this->slug)) { - Grav::instance()['log']->notice("Invalid slug set in YAML frontmatter: " . $this->rawRoute() . " => " . $this->slug); - } } if (empty($this->slug)) { diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index f994a42e0..8217854d2 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -480,7 +480,7 @@ class Pages $site_redirects = $config->get("site.redirects"); if (is_array($site_redirects)) { foreach ((array)$site_redirects as $pattern => $replace) { - $pattern = '#' . $pattern . '#'; + $pattern = '#^' . preg_quote(ltrim($pattern, '^')) . '#'; try { $found = preg_replace($pattern, $replace, $source_url); if ($found != $source_url) { @@ -496,7 +496,7 @@ class Pages $site_routes = $config->get("site.routes"); if (is_array($site_routes)) { foreach ((array)$site_routes as $pattern => $replace) { - $pattern = '#' . $pattern . '#'; + $pattern = '#^' . preg_quote(ltrim($pattern, '^')) . '#'; try { $found = preg_replace($pattern, $replace, $source_url); if ($found != $source_url) { @@ -627,14 +627,17 @@ class Pages * Get list of route/title of all pages. * * @param Page $current - * @param int $level + * @param int $level * @param bool $rawRoutes * + * @param bool $showAll + * @param bool $showFullpath + * @param bool $showSlug + * @param bool $showModular + * @param bool $limitLevels * @return array - * - * @throws \RuntimeException */ - public function getList(Page $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $limitLevels = false) + public function getList(Page $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $showModular = false, $limitLevels = false) { if (!$current) { if ($level) { @@ -669,8 +672,8 @@ class Pages if ($limitLevels == false || ($level+1 < $limitLevels)) { foreach ($current->children() as $next) { - if ($showAll || $next->routable()) { - $list = array_merge($list, $this->getList($next, $level + 1, $rawRoutes, $showAll, $showFullpath, $showSlug, $limitLevels)); + if ($showAll || $next->routable() || ($next->modular() && $showModular)) { + $list = array_merge($list, $this->getList($next, $level + 1, $rawRoutes, $showAll, $showFullpath, $showSlug, $showModular, $limitLevels)); } } }