mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 11:31:43 +01:00
Merge branch 'develop' of https://github.com/getgrav/grav into develop
This commit is contained in:
@@ -889,7 +889,7 @@ class Assets
|
||||
/**
|
||||
* Removes an item from the CSS array if set
|
||||
*
|
||||
* @param $key the asset key
|
||||
* @param string $key The asset key
|
||||
*/
|
||||
public function removeCss($key)
|
||||
{
|
||||
@@ -902,7 +902,7 @@ class Assets
|
||||
/**
|
||||
* Removes an item from the JS array if set
|
||||
*
|
||||
* @param $key the asset key
|
||||
* @param string $key The asset key
|
||||
*/
|
||||
public function removeJs($key)
|
||||
{
|
||||
|
||||
@@ -256,7 +256,7 @@ class Cache extends Getters
|
||||
*
|
||||
* @param string $id the id of the cached entry
|
||||
*
|
||||
* @return object returns the cached entry, can be any type, or false if doesn't exist
|
||||
* @return object|bool returns the cached entry, can be any type, or false if doesn't exist
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class RecursiveFolderFilterIterator extends \RecursiveFilterIterator
|
||||
/**
|
||||
* Create a RecursiveFilterIterator from a RecursiveIterator
|
||||
*
|
||||
* @param RecursiveIterator $iterator
|
||||
* @param \RecursiveIterator $iterator
|
||||
*/
|
||||
public function __construct(\RecursiveIterator $iterator)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ class GPM extends Iterator
|
||||
* Returns the Locally installable packages
|
||||
*
|
||||
* @param array $list_type_installed
|
||||
* @return Iterator The installed packages
|
||||
* @return array The installed packages
|
||||
*/
|
||||
public function getInstallable($list_type_installed = ['plugins' => true, 'themes' => true])
|
||||
{
|
||||
@@ -117,6 +117,8 @@ class GPM extends Iterator
|
||||
if (isset($this->installed['themes'][$slug])) {
|
||||
return $this->installed['themes'][$slug];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +201,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Plugins and Themes that can be updated.
|
||||
* Plugins and Themes are extended with the `available` property that relies to the remote version
|
||||
* @param $list_type_update specifies what type of package to update
|
||||
* @param array $list_type_update specifies what type of package to update
|
||||
* @return array Array of updatable Plugins and Themes.
|
||||
* Format: ['total' => int, 'plugins' => array, 'themes' => array]
|
||||
*/
|
||||
@@ -222,7 +224,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Plugins that can be updated.
|
||||
* The Plugins are extended with the `available` property that relies to the remote version
|
||||
* @return Iterator Array of updatable Plugins
|
||||
* @return array Array of updatable Plugins
|
||||
*/
|
||||
public function getUpdatablePlugins()
|
||||
{
|
||||
@@ -302,7 +304,7 @@ class GPM extends Iterator
|
||||
/**
|
||||
* Returns an array of Themes that can be updated.
|
||||
* The Themes are extended with the `available` property that relies to the remote version
|
||||
* @return Iterator Array of updatable Themes
|
||||
* @return array Array of updatable Themes
|
||||
*/
|
||||
public function getUpdatableThemes()
|
||||
{
|
||||
@@ -435,7 +437,7 @@ class GPM extends Iterator
|
||||
|
||||
/**
|
||||
* Returns the list of Plugins and Themes available in the repository
|
||||
* @return array Array of available Plugins and Themes
|
||||
* @return Remote\Packages Available Plugins and Themes
|
||||
* Format: ['plugins' => array, 'themes' => array]
|
||||
*/
|
||||
public function getRepository()
|
||||
@@ -447,7 +449,7 @@ class GPM extends Iterator
|
||||
* Searches for a Package in the repository
|
||||
* @param string $search Can be either the slug or the name
|
||||
* @param bool $ignore_exception True if should not fire an exception (for use in Twig)
|
||||
* @return Remote\Package Package if found, FALSE if not
|
||||
* @return Remote\Package|bool Package if found, FALSE if not
|
||||
*/
|
||||
public function findPackage($search, $ignore_exception = false)
|
||||
{
|
||||
@@ -600,6 +602,8 @@ class GPM extends Iterator
|
||||
return $dependency[$dependency_slug];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -191,10 +191,7 @@ class Response
|
||||
|
||||
/**
|
||||
* Progress normalized for cURL and Fopen
|
||||
* Accepts a vsariable length of arguments passed in by stream method
|
||||
*
|
||||
* @return array Normalized array with useful data.
|
||||
* Format: ['code' => int|false, 'filesize' => bytes, 'transferred' => bytes, 'percent' => int]
|
||||
* Accepts a variable length of arguments passed in by stream method
|
||||
*/
|
||||
public static function progress()
|
||||
{
|
||||
@@ -243,6 +240,8 @@ class Response
|
||||
if (self::isCurlAvailable()) {
|
||||
return self::getCurl(func_get_args());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
namespace Grav\Common;
|
||||
|
||||
use Grav\Common\Config\Config;
|
||||
use Grav\Common\Language\Language;
|
||||
use Grav\Common\Page\Medium\ImageMedium;
|
||||
use Grav\Common\Page\Medium\Medium;
|
||||
use Grav\Common\Page\Page;
|
||||
use RocketTheme\Toolbox\DI\Container;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Grav\Common\Helpers;
|
||||
|
||||
use DOMText;
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMWordsIterator;
|
||||
use DOMLettersIterator;
|
||||
|
||||
@@ -118,7 +120,7 @@ class Truncator {
|
||||
|
||||
/**
|
||||
* Builds a DOMDocument object from a string containing HTML.
|
||||
* @param string HTML to load
|
||||
* @param string $html HTML to load
|
||||
* @returns DOMDocument Returns a DOMDocument object.
|
||||
*/
|
||||
public static function htmlToDomDocument($html)
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Grav\Common\Markdown;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Helpers\Excerpts;
|
||||
use Grav\Common\Page\Page;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
trait ParsedownGravTrait
|
||||
@@ -166,6 +167,8 @@ trait ParsedownGravTrait
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function inlineSpecialCharacter($Excerpt)
|
||||
@@ -183,6 +186,8 @@ trait ParsedownGravTrait
|
||||
'extent' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function inlineImage($excerpt)
|
||||
@@ -243,5 +248,7 @@ trait ParsedownGravTrait
|
||||
|
||||
return call_user_func_array($func, $args);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class Collection extends Iterator
|
||||
*
|
||||
* @param Page|string|null $key
|
||||
*
|
||||
* @return $this|void
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function remove($key = null)
|
||||
|
||||
@@ -57,7 +57,7 @@ class Link implements RenderableInterface
|
||||
*
|
||||
* @param string $method
|
||||
* @param mixed $args
|
||||
* @return $this|mixed
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ trait StaticResizeTrait
|
||||
*
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return Medium
|
||||
* @return $this
|
||||
*/
|
||||
public function resize($width = null, $height = null)
|
||||
{
|
||||
|
||||
@@ -224,7 +224,7 @@ class Page
|
||||
*
|
||||
* @param string $var Raw content string
|
||||
*
|
||||
* @return Object Raw content string
|
||||
* @return string Raw content string
|
||||
*/
|
||||
public function raw($var = null)
|
||||
{
|
||||
@@ -1743,7 +1743,7 @@ class Page
|
||||
*
|
||||
* @param string $var redirect url
|
||||
*
|
||||
* @return array
|
||||
* @return string
|
||||
*/
|
||||
public function redirect($var = null)
|
||||
{
|
||||
@@ -2166,7 +2166,7 @@ class Page
|
||||
*
|
||||
* @param integer $direction either -1 or +1
|
||||
*
|
||||
* @return Page the sibling page
|
||||
* @return Page|bool the sibling page
|
||||
*/
|
||||
public function adjacentSibling($direction = 1)
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ class Pages
|
||||
/**
|
||||
* Returns a list of all pages.
|
||||
*
|
||||
* @return Page
|
||||
* @return array|Page[]
|
||||
*/
|
||||
public function instances()
|
||||
{
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class AssetsProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class AssetsProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'assets';
|
||||
public $title = 'Assets';
|
||||
|
||||
public function process() {
|
||||
$this->container['assets']->init();
|
||||
$this->container->fireEvent('onAssetsInitialized');
|
||||
public function process()
|
||||
{
|
||||
$this->container['assets']->init();
|
||||
$this->container->fireEvent('onAssetsInitialized');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class ConfigurationProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class ConfigurationProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = '_config';
|
||||
public $title = 'Configuration';
|
||||
|
||||
public function process() {
|
||||
$this->container['config']->init();
|
||||
return $this->container['plugins']->setup();
|
||||
public function process()
|
||||
{
|
||||
$this->container['config']->init();
|
||||
return $this->container['plugins']->setup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class DebuggerAssetsProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class DebuggerAssetsProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'debugger_assets';
|
||||
public $title = 'Debugger Assets';
|
||||
|
||||
public function process() {
|
||||
$this->container['debugger']->addAssets();
|
||||
public function process()
|
||||
{
|
||||
$this->container['debugger']->addAssets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class DebuggerInitProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class DebuggerInitProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = '_debugger';
|
||||
public $title = 'Init Debugger';
|
||||
|
||||
public function process() {
|
||||
$this->container['debugger']->init();
|
||||
public function process()
|
||||
{
|
||||
$this->container['debugger']->init();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class ErrorsProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class ErrorsProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = '_errors';
|
||||
public $title = 'Error Handlers Reset';
|
||||
|
||||
public function process() {
|
||||
$this->container['errors']->resetHandlers();
|
||||
public function process()
|
||||
{
|
||||
$this->container['errors']->resetHandlers();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class InitializeProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class InitializeProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'init';
|
||||
public $title = 'Initialize';
|
||||
|
||||
public function process() {
|
||||
public function process()
|
||||
{
|
||||
$this->container['config']->debug();
|
||||
|
||||
// Use output buffering to prevent headers from being sent too early.
|
||||
@@ -36,5 +37,4 @@ class InitializeProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
$this->container->setLocale();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ use Grav\Common\Page\Page;
|
||||
|
||||
class PagesProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
|
||||
public $id = 'pages';
|
||||
public $title = 'Pages';
|
||||
|
||||
@@ -41,5 +40,4 @@ class PagesProcessor extends ProcessorBase implements ProcessorInterface
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class PluginsProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class PluginsProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'plugins';
|
||||
public $title = 'Plugins';
|
||||
|
||||
public function process() {
|
||||
$this->container['plugins']->init();
|
||||
$this->container->fireEvent('onPluginsInitialized');
|
||||
public function process()
|
||||
{
|
||||
$this->container['plugins']->init();
|
||||
$this->container->fireEvent('onPluginsInitialized');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
interface ProcessorInterface {
|
||||
public function process();
|
||||
interface ProcessorInterface
|
||||
{
|
||||
public function process();
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class RenderProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class RenderProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'render';
|
||||
public $title = 'Render';
|
||||
|
||||
public function process() {
|
||||
$this->container->output = $this->container['output'];
|
||||
$this->container->fireEvent('onOutputGenerated');
|
||||
public function process()
|
||||
{
|
||||
$this->container->output = $this->container['output'];
|
||||
$this->container->fireEvent('onOutputGenerated');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class SiteSetupProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class SiteSetupProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = '_setup';
|
||||
public $title = 'Site Setup';
|
||||
|
||||
public function process() {
|
||||
$this->container['setup']->init();
|
||||
$this->container['streams'];
|
||||
public function process()
|
||||
{
|
||||
$this->container['setup']->init();
|
||||
$this->container['streams'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class TasksProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class TasksProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'tasks';
|
||||
public $title = 'Tasks';
|
||||
|
||||
public function process() {
|
||||
public function process()
|
||||
{
|
||||
$task = $this->container['task'];
|
||||
if ($task) {
|
||||
$this->container->fireEvent('onTask.' . $task);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class ThemesProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class ThemesProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'themes';
|
||||
public $title = 'Themes';
|
||||
|
||||
public function process() {
|
||||
$this->container['themes']->init();
|
||||
public function process()
|
||||
{
|
||||
$this->container['themes']->init();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Processors;
|
||||
|
||||
class TwigProcessor extends ProcessorBase implements ProcessorInterface {
|
||||
|
||||
class TwigProcessor extends ProcessorBase implements ProcessorInterface
|
||||
{
|
||||
public $id = 'twig';
|
||||
public $title = 'Twig';
|
||||
|
||||
public function process() {
|
||||
$this->container['twig']->init();
|
||||
public function process()
|
||||
{
|
||||
$this->container['twig']->init();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ use Grav\Common\Assets;
|
||||
|
||||
class AssetsServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container) {
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['assets'] = new Assets();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ use Pimple\ServiceProviderInterface;
|
||||
|
||||
class OutputServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container) {
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['output'] = function ($c) {
|
||||
return $c['twig']->processSite($c['page']->templateFormat());
|
||||
};
|
||||
|
||||
@@ -8,21 +8,23 @@
|
||||
|
||||
namespace Grav\Common\Service;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Language\Language;
|
||||
use Grav\Common\Page\Page;
|
||||
use Grav\Common\Page\Pages;
|
||||
use Grav\Common\Uri;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
|
||||
class PageServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container) {
|
||||
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['page'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
|
||||
/** @var Pages $pages */
|
||||
$pages = $c['pages'];
|
||||
/** @var Language $language */
|
||||
$language = $c['language'];
|
||||
|
||||
/** @var Uri $uri */
|
||||
$uri = $c['uri'];
|
||||
@@ -34,6 +36,9 @@ class PageServiceProvider implements ServiceProviderInterface
|
||||
|
||||
// Redirection tests
|
||||
if ($page) {
|
||||
/** @var Language $language */
|
||||
$language = $c['language'];
|
||||
|
||||
if ($c['config']->get('system.force_ssl')) {
|
||||
if (!isset($_SERVER['HTTPS']) || $_SERVER["HTTPS"] != "on") {
|
||||
$url = "https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
|
||||
namespace Grav\Common\Service;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
|
||||
class TaskServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container) {
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container['task'] = function ($c) {
|
||||
/** @var Grav $c */
|
||||
return !empty($_POST['task']) ? $_POST['task'] : $c['uri']->param('task');
|
||||
|
||||
@@ -39,7 +39,7 @@ class DirectInstallCommand extends ConsoleCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null|void
|
||||
* @return bool
|
||||
*/
|
||||
protected function serve()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ use Symfony\Component\Yaml\Yaml;
|
||||
class VersionCommand extends ConsoleCommand
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
* @var GPM
|
||||
*/
|
||||
protected $gpm;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user