-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
820 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "getgrav/grav-plugin-readingtime", | ||
"type": "grav-plugin", | ||
"description": "Grav Plugin Reading Time", | ||
"keywords": ["form"], | ||
"homepage": "https://github.com/getgrav/grav-plugin-readingtime", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Team Grav", | ||
"email": "[email protected]", | ||
"homepage": "http://getgrav.org", | ||
"role": "Developer" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/getgrav/grav-plugin-readingtime/issues", | ||
"irc": "https://chat.getgrav.org", | ||
"forum": "https://discourse.getgrav.org", | ||
"docs": "https://github.com/getgrav/grav-plugin-readingtime/blob/master/README.md" | ||
}, | ||
"require": { | ||
"php": ">=7.1.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Grav\\Plugin\\ReadingTime\\": "classes/" | ||
}, | ||
"classmap": [ | ||
"readingtime.php" | ||
] | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.1.3" | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
<?php namespace Grav\Plugin; | ||
<?php | ||
|
||
namespace Grav\Plugin; | ||
|
||
use Composer\Autoload\ClassLoader; | ||
use Grav\Common\Plugin; | ||
use Grav\Plugin\ReadingTime\TwigReadingTimeFilters; | ||
|
||
class ReadingTimePlugin extends Plugin | ||
{ | ||
public static function getSubscriptedEvents() | ||
{ | ||
return [ | ||
'onPluginsInitialized' => ['onPluginsInitialized', 0] | ||
]; | ||
} | ||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
'onPluginsInitialized' => [ | ||
['autoload', 100000], | ||
['onPluginsInitialized', 0] | ||
] | ||
]; | ||
} | ||
|
||
public function onPluginsInitialized() | ||
{ | ||
if ( $this->isAdmin() ) { | ||
$this->active = false; | ||
return; | ||
/** | ||
* [onPluginsInitialized:100000] Composer autoload. | ||
* | ||
* @return ClassLoader | ||
*/ | ||
public function autoload() | ||
{ | ||
return require __DIR__ . '/vendor/autoload.php'; | ||
} | ||
|
||
$this->enable([ | ||
'onTwigExtensions' => ['onTwigExtensions', 0] | ||
]); | ||
} | ||
public function onPluginsInitialized() | ||
{ | ||
if ($this->isAdmin()) { | ||
$this->active = false; | ||
return; | ||
} | ||
|
||
public function onTwigExtensions() | ||
{ | ||
require_once( __DIR__ . '/classes/TwigReadingTimeFilters.php' ); | ||
$this->enable([ | ||
'onTwigExtensions' => [ | ||
['onTwigExtensions', 0] | ||
] | ||
]); | ||
} | ||
|
||
$this->grav['twig']->twig->addExtension( new \Grav\Common\TwigReadingTimeFilters() ); | ||
} | ||
public function onTwigExtensions() | ||
{ | ||
$this->grav['twig']->twig->addExtension(new TwigReadingTimeFilters()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
// autoload.php @generated by Composer | ||
|
||
require_once __DIR__ . '/composer/autoload_real.php'; | ||
|
||
return ComposerAutoloaderInitba8cc29b2b127a27a57127d33945f8aa::getLoader(); |
Oops, something went wrong.