From 504d4fbfa97488c7bd454e63a506f2db8f5eeef2 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 25 Nov 2021 15:42:14 -0700 Subject: [PATCH 1/6] twig-template powered notice shortcode --- classes/shortcodes/NoticeShortcode.php | 8 ++++++-- shortcode-core.php | 8 +++++++- templates/shortcodes/notice.html.twig | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 templates/shortcodes/notice.html.twig diff --git a/classes/shortcodes/NoticeShortcode.php b/classes/shortcodes/NoticeShortcode.php index ee30265..72ac208 100644 --- a/classes/shortcodes/NoticeShortcode.php +++ b/classes/shortcodes/NoticeShortcode.php @@ -12,9 +12,13 @@ public function init() if ($css_enabled) { $this->shortcode->addAssets('css', 'plugin://shortcode-core/css/shortcode-notice.css'); } - $type = $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info'; - return '
'.$sc->getContent().'
'; + $output = $this->twig->processTemplate('shortcodes/notice.html.twig', [ + 'type' => $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info', + 'content' => $sc->getContent(), + ]); + + return $output; }); } } \ No newline at end of file diff --git a/shortcode-core.php b/shortcode-core.php index 6845741..41976b9 100644 --- a/shortcode-core.php +++ b/shortcode-core.php @@ -62,7 +62,8 @@ public function onPluginsInitialized() 'onPageContentRaw' => ['onPageContentRaw', 0], 'onPageContentProcessed' => ['onPageContentProcessed', -10], 'onPageContent' => ['onPageContent', 0], - 'onTwigInitialized' => ['onTwigInitialized', 0] + 'onTwigInitialized' => ['onTwigInitialized', 0], + 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0], ]); $this->grav['shortcode'] = $this->shortcodes = new ShortcodeManager(); @@ -234,6 +235,11 @@ public function onTwigInitialized() $this->grav['twig']->twig_vars['shortcode'] = new ShortcodeTwigVar(); } + public function onTwigTemplatePaths() + { + $this->grav['twig']->twig_paths[] = __DIR__ . '/templates'; + } + public function registerNextGenEditorPlugin($event) { $config = $this->config->get('plugins.shortcode-core.nextgen-editor'); $plugins = $event['plugins']; diff --git a/templates/shortcodes/notice.html.twig b/templates/shortcodes/notice.html.twig new file mode 100644 index 0000000..e2bdc35 --- /dev/null +++ b/templates/shortcodes/notice.html.twig @@ -0,0 +1,3 @@ +
+
{{ content|raw }}
+
\ No newline at end of file From 743c68a7a91d0805911497042bbecd9b1d75611d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 25 Nov 2021 15:43:21 -0700 Subject: [PATCH 2/6] updated changelog --- CHANGELOG.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d36b6..3f4e76d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,17 @@ +# v5.1.0 +## mm/dd/2021 + +2. [](#improved) + * Notice shortcode now uses a twig template to allow for easy overriding of style + # v5.0.7 ## 09/28/2021 -1. [](#bugfix) - * NextGen Editor: Ensure content of children shortcode elements, such as UI Tab content, have a new empty line as prefix and suffix, to ensure Markdown lists are not lost [getgrav/grav-premium-issues#123](https://github.com/getgrav/grav-premium-issues/issues/123) -2. [](#improved) +1. [](#improved) * Added `processShortcodesRaw()` using raw_handlers [#104](https://github.com/getgrav/grav-plugin-shortcode-core/pull/104) * Better vertical alignment for inline shortcodes in NextGen Editor +1. [](#bugfix) + * NextGen Editor: Ensure content of children shortcode elements, such as UI Tab content, have a new empty line as prefix and suffix, to ensure Markdown lists are not lost [getgrav/grav-premium-issues#123](https://github.com/getgrav/grav-premium-issues/issues/123) # v5.0.6 ## 04/27/2021 From 59e74f7789cac56a1933b2d6dcdf274bed0b5ead Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 1 Dec 2021 08:21:09 -0700 Subject: [PATCH 3/6] vendor updates --- composer.lock | 17 +- vendor/composer/ClassLoader.php | 157 +++++++- vendor/composer/InstalledVersions.php | 350 ++++++++++++++++++ vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_real.php | 9 +- vendor/composer/autoload_static.php | 1 + vendor/composer/installed.json | 121 +++--- vendor/composer/installed.php | 32 ++ vendor/composer/platform_check.php | 26 ++ vendor/thunderer/shortcode/README.md | 4 +- .../src/Shortcode/ShortcodeInterface.php | 4 +- 11 files changed, 639 insertions(+), 83 deletions(-) create mode 100644 vendor/composer/InstalledVersions.php create mode 100644 vendor/composer/installed.php create mode 100644 vendor/composer/platform_check.php diff --git a/composer.lock b/composer.lock index 00dd36b..45e0cd3 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "thunderer/shortcode", - "version": "v0.7.3", + "version": "v0.7.4", "source": { "type": "git", "url": "https://github.com/thunderer/Shortcode.git", - "reference": "084ed05cdd759d318f7b75e370830bd135eadc8a" + "reference": "79a219febd774ba1ee66a2992fee1145b4367561" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thunderer/Shortcode/zipball/084ed05cdd759d318f7b75e370830bd135eadc8a", - "reference": "084ed05cdd759d318f7b75e370830bd135eadc8a", + "url": "https://api.github.com/repos/thunderer/Shortcode/zipball/79a219febd774ba1ee66a2992fee1145b4367561", + "reference": "79a219febd774ba1ee66a2992fee1145b4367561", "shasum": "" }, "require": { @@ -56,7 +56,11 @@ "parser", "shortcode" ], - "time": "2019-12-03T22:05:36+00:00" + "support": { + "issues": "https://github.com/thunderer/Shortcode/issues", + "source": "https://github.com/thunderer/Shortcode/tree/v0.7.4" + }, + "time": "2020-03-08T11:25:13+00:00" } ], "packages-dev": [], @@ -71,5 +75,6 @@ "platform-dev": [], "platform-overrides": { "php": "7.1.3" - } + }, + "plugin-api-version": "2.1.0" } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index fce8549..0cd6055 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -37,57 +37,130 @@ * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + /** @var ?string */ + private $vendorDir; + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr4 = array(); // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr0 = array(); + /** @var bool */ private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ private $classMap = array(); + + /** @var bool */ private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ private $missingClasses = array(); + + /** @var ?string */ private $apcuPrefix; + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); } + /** + * @return array[] + * @psalm-return array> + */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } + /** + * @return string[] Array of classname => path + * @psalm-var array + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void */ public function addClassMap(array $classMap) { @@ -102,9 +175,11 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void */ public function add($prefix, $paths, $prepend = false) { @@ -147,11 +222,13 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException + * + * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { @@ -195,8 +272,10 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -211,10 +290,12 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException + * + * @return void */ public function setPsr4($prefix, $paths) { @@ -234,6 +315,8 @@ public function setPsr4($prefix, $paths) * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -256,6 +339,8 @@ public function getUseIncludePath() * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -276,6 +361,8 @@ public function isClassMapAuthoritative() * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix + * + * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -296,25 +383,44 @@ public function getApcuPrefix() * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** * Unregisters this instance as an autoloader. + * + * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise + * @return true|null True if loaded, null otherwise */ public function loadClass($class) { @@ -323,6 +429,8 @@ public function loadClass($class) return true; } + + return null; } /** @@ -367,6 +475,21 @@ public function findFile($class) return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -438,6 +561,10 @@ private function findFileWithExtension($class, $ext) * Scope isolated include. * * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private */ function includeFile($file) { diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..d50e0c9 --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,350 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index e34a5db..9923be8 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,5 +6,6 @@ $baseDir = dirname($vendorDir); return array( + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Grav\\Plugin\\ShortcodeCorePlugin' => $baseDir . '/shortcode-core.php', ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 554f088..23fee12 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -13,19 +13,24 @@ public static function loadClassLoader($class) } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInitd0b6ad2d0f2308b1099bc12e8c596f66', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInitd0b6ad2d0f2308b1099bc12e8c596f66', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitd0b6ad2d0f2308b1099bc12e8c596f66::getInitializer($loader)); } else { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index dd04fc3..88e5c00 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -34,6 +34,7 @@ class ComposerStaticInitd0b6ad2d0f2308b1099bc12e8c596f66 ); public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Grav\\Plugin\\ShortcodeCorePlugin' => __DIR__ . '/../..' . '/shortcode-core.php', ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index cca822c..7300359 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,56 +1,65 @@ -[ - { - "name": "thunderer/shortcode", - "version": "v0.7.3", - "version_normalized": "0.7.3.0", - "source": { - "type": "git", - "url": "https://github.com/thunderer/Shortcode.git", - "reference": "084ed05cdd759d318f7b75e370830bd135eadc8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thunderer/Shortcode/zipball/084ed05cdd759d318f7b75e370830bd135eadc8a", - "reference": "084ed05cdd759d318f7b75e370830bd135eadc8a", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": ">=4.1", - "symfony/yaml": ">=2.0" - }, - "suggest": { - "ext-dom": "if you want to use XML serializer", - "ext-json": "if you want to use JSON serializer", - "symfony/yaml": "if you want to use YAML serializer" - }, - "time": "2019-12-03T22:05:36+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Thunder\\Shortcode\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Tomasz Kowalczyk", - "email": "tomasz@kowalczyk.cc" - } - ], - "description": "Advanced shortcode (BBCode) parser and engine for PHP", - "keywords": [ - "bbcode", - "engine", - "library", - "parser", - "shortcode" - ] - } -] +{ + "packages": [ + { + "name": "thunderer/shortcode", + "version": "v0.7.4", + "version_normalized": "0.7.4.0", + "source": { + "type": "git", + "url": "https://github.com/thunderer/Shortcode.git", + "reference": "79a219febd774ba1ee66a2992fee1145b4367561" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thunderer/Shortcode/zipball/79a219febd774ba1ee66a2992fee1145b4367561", + "reference": "79a219febd774ba1ee66a2992fee1145b4367561", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": ">=4.1", + "symfony/yaml": ">=2.0" + }, + "suggest": { + "ext-dom": "if you want to use XML serializer", + "ext-json": "if you want to use JSON serializer", + "symfony/yaml": "if you want to use YAML serializer" + }, + "time": "2020-03-08T11:25:13+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Thunder\\Shortcode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tomasz Kowalczyk", + "email": "tomasz@kowalczyk.cc" + } + ], + "description": "Advanced shortcode (BBCode) parser and engine for PHP", + "keywords": [ + "bbcode", + "engine", + "library", + "parser", + "shortcode" + ], + "support": { + "issues": "https://github.com/thunderer/Shortcode/issues", + "source": "https://github.com/thunderer/Shortcode/tree/v0.7.4" + }, + "install-path": "../thunderer/shortcode" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100644 index 0000000..40da702 --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,32 @@ + array( + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'type' => 'grav-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => '743c68a7a91d0805911497042bbecd9b1d75611d', + 'name' => 'getgrav/shortcode-core', + 'dev' => true, + ), + 'versions' => array( + 'getgrav/shortcode-core' => array( + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'type' => 'grav-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => '743c68a7a91d0805911497042bbecd9b1d75611d', + 'dev_requirement' => false, + ), + 'thunderer/shortcode' => array( + 'pretty_version' => 'v0.7.4', + 'version' => '0.7.4.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../thunderer/shortcode', + 'aliases' => array(), + 'reference' => '79a219febd774ba1ee66a2992fee1145b4367561', + 'dev_requirement' => false, + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php new file mode 100644 index 0000000..cd1bd2c --- /dev/null +++ b/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70103)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.3". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vendor/thunderer/shortcode/README.md b/vendor/thunderer/shortcode/README.md index 34f1c2f..bd77aac 100644 --- a/vendor/thunderer/shortcode/README.md +++ b/vendor/thunderer/shortcode/README.md @@ -36,7 +36,7 @@ Each part is described in the dedicated section in this document. There are no required dependencies and all PHP versions from 5.3 up to latest 7.0 [are tested](https://travis-ci.org/thunderer/Shortcode) and supported. This library is available on Composer/Packagist as `thunderer/shortcode`, to install it execute: ``` -composer require thunderer/shortcode=^0.6.5 +composer require thunderer/shortcode=^0.7.3 ``` or manually update your `composer.json` with: @@ -44,7 +44,7 @@ or manually update your `composer.json` with: ``` (...) "require": { - "thunderer/shortcode": "^0.6.5" + "thunderer/shortcode": "^0.7.3" } (...) ``` diff --git a/vendor/thunderer/shortcode/src/Shortcode/ShortcodeInterface.php b/vendor/thunderer/shortcode/src/Shortcode/ShortcodeInterface.php index 9950263..0e832e2 100644 --- a/vendor/thunderer/shortcode/src/Shortcode/ShortcodeInterface.php +++ b/vendor/thunderer/shortcode/src/Shortcode/ShortcodeInterface.php @@ -34,9 +34,9 @@ public function getParameters(); * without value * * @param string $name Parameter name - * @param null $default Value returned if there is no parameter with given name + * @param string|null $default Value returned if there is no parameter with given name * - * @return mixed + * @return string|null */ public function getParameter($name, $default = null); From baa717d9143032ce0998524ef820aed7d2b8163f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 1 Dec 2021 16:18:54 -0700 Subject: [PATCH 4/6] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4e76d..8df76ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 2. [](#improved) * Notice shortcode now uses a twig template to allow for easy overriding of style + * Updated vendor libraries to latest # v5.0.7 ## 09/28/2021 From 82e4dd1e7007cf368a30c11fdcbb635712bcd0d5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 9 Dec 2021 14:22:56 -0700 Subject: [PATCH 5/6] update readme with new config yaml --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bab7e0c..857fec3 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,15 @@ enabled: true active: true active_admin: true admin_pages_only: true -parser: regex +parser: regular include_default_shortcodes: true +css: + notice_enabled: true custom_shortcodes: -load_fontawesome: false +fontawesome: + load: true + url: '//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css' + v5: false ``` * `enabled: true|false` toggles if the shortcodes plugin is turned on or off @@ -58,7 +63,9 @@ load_fontawesome: false * `parser: wordpress|regex|regular` let's you configure the parser to use * `include_default_shortcodes: true|false` toggle the inclusion of shortcodes provided by this plugin * `custom_shortcodes:` the path to a directory where you can put your custom shortcodes (e.g. `/user/custom/shortcodes`) -* `load_fontawesome: true|false` toggles if the fontawesome icon library should be loaded or not +* `fontawesome.load: true|false` toggles if the fontawesome icon library should be loaded or not +* `fontawesome.url:` the CDN Url to use for fontawesome +* `v5:` Version 5 flag as it requires some additional logic > NOTE: In previous versions the `wordpress` parser was preferred. However with version `2.4.0`, the `regex` parser is now default. If you have saved configuration, you should manually change this to `regex` or you may receive errors or bad output. From df47eceb378c774a824720728b76b7ede28c5bc1 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 9 Dec 2021 14:34:11 -0700 Subject: [PATCH 6/6] prepare for release --- CHANGELOG.md | 5 +++-- blueprints.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8df76ab..f60464c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # v5.1.0 -## mm/dd/2021 +## 12/09/2021 -2. [](#improved) +1. [](#new) * Notice shortcode now uses a twig template to allow for easy overriding of style +1. [](#improved) * Updated vendor libraries to latest # v5.0.7 diff --git a/blueprints.yaml b/blueprints.yaml index 0c6b951..2f03f68 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,7 +1,7 @@ name: Shortcode Core slug: shortcode-core type: plugin -version: 5.0.7 +version: 5.1.0 description: "This plugin provides the core functionality for shortcode plugins" icon: code author: