diff --git a/CHANGELOG.md b/CHANGELOG.md index fabcb1377..5e4599da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 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 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/Language/Language.php b/system/src/Grav/Common/Language/Language.php index dbf2b95ba..31fad6681 100644 --- a/system/src/Grav/Common/Language/Language.php +++ b/system/src/Grav/Common/Language/Language.php @@ -170,7 +170,7 @@ class Language */ public function setActiveFromUri($uri) { - $regex = '/(^\/(' . $this->getAvailable() . '))(?:\/.*|$)/i'; + $regex = '/(^\/(' . $this->getAvailable() . '))(?:\/|\?|$)/i'; // if languages set if ($this->enabled()) { @@ -178,7 +178,7 @@ class Language if (preg_match($regex, $uri, $matches)) { $this->lang_in_url = true; $this->active = $matches[2]; - $uri = preg_replace("/\\" . $matches[1] . "/", '', $matches[0], 1); + $uri = preg_replace("/\\" . $matches[1] . "/", '', $uri, 1); // store in session if different if ($this->config->get('system.session.enabled', false) diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 279d7024d..457701ce3 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -552,14 +552,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) { @@ -594,8 +597,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)); } } } diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index bfe31e01c..492c86610 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -24,6 +24,8 @@ class Themes extends Iterator /** @var Config */ protected $config; + protected $inited = false; + /** * Themes constructor. * @@ -51,25 +53,29 @@ class Themes extends Iterator public function initTheme() { - /** @var Themes $themes */ - $themes = $this->grav['themes']; + if ($this->inited === false) { + /** @var Themes $themes */ + $themes = $this->grav['themes']; - try { - $instance = $themes->load(); - } catch (\InvalidArgumentException $e) { - throw new \RuntimeException($this->current() . ' theme could not be found'); + try { + $instance = $themes->load(); + } catch (\InvalidArgumentException $e) { + throw new \RuntimeException($this->current() . ' theme could not be found'); + } + + if ($instance instanceof EventSubscriberInterface) { + /** @var EventDispatcher $events */ + $events = $this->grav['events']; + + $events->addSubscriber($instance); + } + + $this->grav['theme'] = $instance; + + $this->grav->fireEvent('onThemeInitialized'); + + $this->inited = true; } - - if ($instance instanceof EventSubscriberInterface) { - /** @var EventDispatcher $events */ - $events = $this->grav['events']; - - $events->addSubscriber($instance); - } - - $this->grav['theme'] = $instance; - - $this->grav->fireEvent('onThemeInitialized'); } /**