diff --git a/composer.json b/composer.json index ef489a234..d247aa06e 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "require": { "php": ">=5.4.0", "twig/twig": "~1.16", - "erusev/parsedown-extra": "~0.2", + "erusev/parsedown-extra": "dev-master", "symfony/yaml": "~2.5", "symfony/console": "~2.5", "symfony/event-dispatcher": "~2.5", diff --git a/system/config/system.yaml b/system/config/system.yaml index a944a3488..6fd85e641 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -32,15 +32,16 @@ twig: auto_reload: true # Refresh cache on changes autoescape: false # Autoescape Twig vars -assets: # Configuration for Assets Manager (JS, CSS) - css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file - css_minify: true # Minify the CSS during pipelining - css_rewrite: true # Rewrite any CSS relative URLs during pipelining - js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file - js_minify: true # Minify the JS during pipelining +assets: # Configuration for Assets Manager (JS, CSS) + css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file + css_minify: true # Minify the CSS during pipelining + css_rewrite: true # Rewrite any CSS relative URLs during pipelining + js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file + js_minify: true # Minify the JS during pipelining debugger: enabled: false # Enable Grav debugger and following settings + mode: detect # Mode tracy Debugger should be set to when enabled: detect|development|production strict: false # Throw fatal error also on PHP warnings and notices max_depth: 10 # How many nested levels to display for objects or arrays log: diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 750522441..ee32ead76 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -11,6 +11,7 @@ class Debugger { const PRODUCTION = TracyDebugger::PRODUCTION; const DEVELOPMENT = TracyDebugger::DEVELOPMENT; + const DETECT = TracyDebugger::DETECT; public function __construct($mode = self::PRODUCTION) { @@ -27,6 +28,7 @@ class Debugger /** @var Config $config */ $config = $grav['config']; + $mode = $config->get('system.debugger.mode'); TracyDebugger::$logDirectory = $config->get('system.debugger.log.enabled') ? LOG_DIR : null; TracyDebugger::$maxDepth = $config->get('system.debugger.max_depth'); @@ -39,7 +41,16 @@ class Debugger if (function_exists('ini_set')) { ini_set('display_errors', true); } - TracyDebugger::$productionMode = TracyDebugger::DEVELOPMENT; + + if ($mode == strtolower('detect')) { + TracyDebugger::$productionMode = self::DETECT; + } elseif ($mode == strtolower('production')) { + TracyDebugger::$productionMode = self::PRODUCTION; + } else { + TracyDebugger::$productionMode = self::DEVELOPMENT; + } + + } } diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 55bcd1da2..63ebc1152 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -70,6 +70,7 @@ class Page protected $modular_twig; protected $process; protected $summary_size; + protected $markdown_extra; /** * @var Page Unmodified (original) version of the page. Used for copying and moving the page. @@ -201,6 +202,9 @@ class Page if (isset($this->header->date)) { $this->date = strtotime($this->header->date); } + if (isset($this->header->markdown_extra)) { + $this->markdown_extra = (bool)$this->header->markdown_extra; + } if (isset($this->header->taxonomy)) { foreach ($this->header->taxonomy as $taxonomy => $taxitems) { $this->taxonomy[$taxonomy] = (array)$taxitems; @@ -214,7 +218,9 @@ class Page $this->process[$process] = $status; } } + } + return $this->header; } @@ -1517,7 +1523,9 @@ class Page { /** @var Config $config */ $config = self::$grav['config']; - if ($config->get('system.pages.markdown_extra')) { + + // get the appropriate setting for markdown extra + if (isset($this->markdown_extra) ? $this->markdown_extra : $config->get('system.pages.markdown_extra')) { $parsedown = new MarkdownExtra($this); } else { $parsedown = new Markdown($this); diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 24da249f3..9dbcca008 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -539,8 +539,14 @@ class Pages } } - // Sort by the new list. - asort($list); + // handle special case when order_by is random + if ($order_by == 'random') { + $list = $this->array_shuffle($list); + } else { + // else just sort the list according to specified key + asort($list); + } + // Move manually ordered items into the beginning of the list. Order of the unlisted items does not change. if (is_array($manual) && !empty($manual)) { @@ -568,4 +574,17 @@ class Pages $this->sort[$path][$order_by][$key] = $info; } } + + // Shuffles and associative array + protected function array_shuffle($list) { + $keys = array_keys($list); + shuffle($keys); + + $new = array(); + foreach($keys as $key) { + $new[$key] = $list[$key]; + } + + return $new; + } } diff --git a/user/config/system.yaml b/user/config/system.yaml index 84a96f979..be6a776ed 100644 --- a/user/config/system.yaml +++ b/user/config/system.yaml @@ -3,7 +3,7 @@ home: pages: theme: antimatter - markdown_extra: true + markdown_extra: false process: markdown: true twig: false diff --git a/vendor/autoload.php b/vendor/autoload.php index ef61f6138..9922f6973 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3::getLoader(); +return ComposerAutoloaderInitc72d8fa047c31604816395255e8b35b9::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index f6962e218..ede8c1c05 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3 +class ComposerAutoloaderInitc72d8fa047c31604816395255e8b35b9 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc72d8fa047c31604816395255e8b35b9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc72d8fa047c31604816395255e8b35b9', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInit3f16975091c92a1711741b1ac4f955c3 $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequire3f16975091c92a1711741b1ac4f955c3($file); + composerRequirec72d8fa047c31604816395255e8b35b9($file); } return $loader; } } -function composerRequire3f16975091c92a1711741b1ac4f955c3($file) +function composerRequirec72d8fa047c31604816395255e8b35b9($file) { require $file; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 20dfc0af6..0ee0cd5f4 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -40,52 +40,6 @@ "parser" ] }, - { - "name": "erusev/parsedown-extra", - "version": "0.2.0", - "version_normalized": "0.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown-extra.git", - "reference": "7578fe28ce42e7a1fff4ba2aada3807c4c03d04b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/7578fe28ce42e7a1fff4ba2aada3807c4c03d04b", - "reference": "7578fe28ce42e7a1fff4ba2aada3807c4c03d04b", - "shasum": "" - }, - "require": { - "erusev/parsedown": "~1.0" - }, - "time": "2014-08-16 11:20:35", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "ParsedownExtra": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "An extension of Parsedown that adds support for Markdown Extra.", - "homepage": "https://github.com/erusev/parsedown-extra", - "keywords": [ - "markdown", - "markdown extra", - "parsedown", - "parser" - ] - }, { "name": "doctrine/cache", "version": "v1.3.0", @@ -711,5 +665,51 @@ "user agent", "useragent" ] + }, + { + "name": "erusev/parsedown-extra", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown-extra.git", + "reference": "7578fe28ce42e7a1fff4ba2aada3807c4c03d04b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/7578fe28ce42e7a1fff4ba2aada3807c4c03d04b", + "reference": "7578fe28ce42e7a1fff4ba2aada3807c4c03d04b", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.0" + }, + "time": "2014-08-16 11:20:35", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-0": { + "ParsedownExtra": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "An extension of Parsedown that adds support for Markdown Extra.", + "homepage": "https://github.com/erusev/parsedown-extra", + "keywords": [ + "markdown", + "markdown extra", + "parsedown", + "parser" + ] } ]