Skip to content

Commit

Permalink
Fix issues mentionned by @mahagr's review.
Browse files Browse the repository at this point in the history
Indeed, I was not using composer to autoload everything which is needeed.

Also:
  * Reverse changes regarding the files locations.
  • Loading branch information
funilrys committed Feb 21, 2020
1 parent d19349c commit 59f41db
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 22 deletions.
File renamed without changes.
37 changes: 23 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
],
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"Grav\\Plugin\\Shortcodes\\": "shortcodes"
},
"license": "MIT",
"authors": [
{
"name": "Amaury Carrade",
"email": "[email protected]"
}
],
"minimum-stability": "stable"
}
"classmap": [
"static-social-embeds.php",
"classes/SSEShortcode.php"
]
}
}
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions static-social-embeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public function onPluginsInitialized()
return;
}

require_once __DIR__ . '/classes/plugin/SSEShortcode.php';

// Enable the main event we are interested in
$this->enable([
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
Expand Down Expand Up @@ -96,6 +94,6 @@ public function onAssetsInitialized()
*/
public function onShortcodeHandlers()
{
$this->grav['shortcode']->registerAllShortcodes(__DIR__ . '/classes/shortcodes');
$this->grav['shortcode']->registerAllShortcodes(__DIR__ . '/shortcodes');
}
}
8 changes: 4 additions & 4 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 2 additions & 0 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
1 change: 1 addition & 0 deletions vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

return array(
'Jedkirby\\TweetEntityLinker\\' => array($vendorDir . '/jedkirby/tweet-entity-linker/src'),
'Grav\\Plugin\\Shortcodes\\' => array($baseDir . '/shortcodes'),
);
14 changes: 14 additions & 0 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,34 @@ class ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14
array (
'Jedkirby\\TweetEntityLinker\\' => 27,
),
'G' =>
array (
'Grav\\Plugin\\Shortcodes\\' => 23,
),
);

public static $prefixDirsPsr4 = array (
'Jedkirby\\TweetEntityLinker\\' =>
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)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1c781dd30cc1c5fc04980a1fc07fda14::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 59f41db

Please sign in to comment.