Merge branch 'release/1.2.4'

This commit is contained in:
Andy Miller
2017-04-24 15:32:07 -06:00
7 changed files with 52 additions and 31 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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', '/');

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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));
}
}
}

View File

@@ -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');
}
/**