diff --git a/composer.json b/composer.json index a46280c..8b58aaf 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,25 @@ { - "name": "amaurycarrade/grav-plugin-static-social-embeds", - "description": "Embeds social status (like tweets, instagram posts, toots, etc.) in articles without using their embed iframe, but rather statically without any dependency to the service.", - "type": "project", - "require": { - "jedkirby/tweet-entity-linker": "^1.2" + "name": "amaurycarrade/grav-plugin-static-social-embeds", + "description": "Embeds social status (like tweets, instagram posts, toots, etc.) in articles without using their embed iframe, but rather statically without any dependency to the service.", + "type": "project", + "require": { + "jedkirby/tweet-entity-linker": "^1.2" + }, + "license": "MIT", + "authors": [ + { + "name": "Amaury Carrade", + "email": "amaury@carrade.eu" + } + ], + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Grav\\Plugin\\Shortcodes\\": "shortcodes" }, - "license": "MIT", - "authors": [ - { - "name": "Amaury Carrade", - "email": "amaury@carrade.eu" - } - ], - "minimum-stability": "stable" -} + "classmap": [ + "static-social-embeds.php", + "classes/SSEShortcode.php" + ] + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 98d393d..918089e 100644 --- a/composer.lock +++ b/composer.lock @@ -1,7 +1,7 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "ceed69267bed5178b87a645dbf8fc029", diff --git a/static-social-embeds.php b/static-social-embeds.php index f7311a3..c61b149 100644 --- a/static-social-embeds.php +++ b/static-social-embeds.php @@ -1,4 +1,5 @@ ['onPluginsInitialized', 0] + 'onPluginsInitialized' => [ + ['autoload', 100001], + ['onPluginsInitialized', 0] + ], ]; } + /** + * [onPluginsInitialized:100000] Composer autoload. + * + * @return ClassLoader + */ + public function autoload() + { + return require __DIR__ . '/vendor/autoload.php'; + } + /** * Initialize the plugin */ public function onPluginsInitialized() { - // Don't proceed if we are in the admin plugin if ($this->isAdmin()) { + // Don't proceed if we are in the admin plugin return; } @@ -65,18 +76,15 @@ public function onAssetsInitialized() /** @var $assets Assets */ $assets = $this->grav['assets']; - if ($this->config->get('plugins.static-social-embeds.include_font_awesome_5', true)) - { + if ($this->config->get('plugins.static-social-embeds.include_font_awesome_5', true)) { $assets->add('https://use.fontawesome.com/releases/v5.1.0/css/all.css'); } - if ($this->config->get('plugins.static-social-embeds.built_in_css', true)) - { + if ($this->config->get('plugins.static-social-embeds.built_in_css', true)) { $assets->add('plugin://static-social-embeds/assets/css-compiled/sse.min.css', 4); } - if ($this->config->get('plugins.static-social-embeds.built_in_js', true)) - { + if ($this->config->get('plugins.static-social-embeds.built_in_js', true)) { $assets->addJs('plugin://static-social-embeds/assets/js/sse.js', 4, true, 'defer'); } } @@ -86,6 +94,6 @@ public function onAssetsInitialized() */ public function onShortcodeHandlers() { - $this->grav['shortcode']->registerAllShortcodes(__DIR__.'/shortcodes'); + $this->grav['shortcode']->registerAllShortcodes(__DIR__ . '/shortcodes'); } } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 2c72175..fce8549 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ public function isClassMapAuthoritative() */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -377,11 +377,11 @@ private function findFileWithExtension($class, $ext) $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 7a91153..5c2f58b 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,4 +6,6 @@ $baseDir = dirname($vendorDir); return array( + 'Grav\\Plugin\\Shortcodes\\SSEShortcode' => $baseDir . '/classes/SSEShortcode.php', + 'Grav\\Plugin\\StaticSocialEmbedsPlugin' => $baseDir . '/static-social-embeds.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 871088b..18c81b4 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,4 +7,5 @@ return array( 'Jedkirby\\TweetEntityLinker\\' => array($vendorDir . '/jedkirby/tweet-entity-linker/src'), + 'Grav\\Plugin\\Shortcodes\\' => array($baseDir . '/shortcodes'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 082479c..71388e5 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -11,6 +11,10 @@ class ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14 array ( 'Jedkirby\\TweetEntityLinker\\' => 27, ), + 'G' => + array ( + 'Grav\\Plugin\\Shortcodes\\' => 23, + ), ); public static $prefixDirsPsr4 = array ( @@ -18,6 +22,15 @@ class ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14 array ( 0 => __DIR__ . '/..' . '/jedkirby/tweet-entity-linker/src', ), + 'Grav\\Plugin\\Shortcodes\\' => + array ( + 0 => __DIR__ . '/../..' . '/shortcodes', + ), + ); + + public static $classMap = array ( + 'Grav\\Plugin\\Shortcodes\\SSEShortcode' => __DIR__ . '/../..' . '/classes/SSEShortcode.php', + 'Grav\\Plugin\\StaticSocialEmbedsPlugin' => __DIR__ . '/../..' . '/static-social-embeds.php', ); public static function getInitializer(ClassLoader $loader) @@ -25,6 +38,7 @@ public static function getInitializer(ClassLoader $loader) return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$classMap; }, null, ClassLoader::class); }