Case insensitivity, simplify shortcode
parent
248a96c59e
commit
a5e11dc73b
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* @author Jurij Podgoršek <g1smo@git.kompot.si>
|
* @author Jurij Podgoršek <g1smo@git.kompot.si>
|
||||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
* @version 0.1
|
* @version 0.2
|
||||||
*/
|
*/
|
||||||
class PicoVideoEmbed extends AbstractPicoPlugin
|
class PicoVideoEmbed extends AbstractPicoPlugin
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ class PicoVideoEmbed extends AbstractPicoPlugin
|
||||||
protected $dependsOn = array();
|
protected $dependsOn = array();
|
||||||
|
|
||||||
|
|
||||||
const SHORTCODE = '#\[video-embed .+?\]#';
|
const SHORTCODE = '#\[video .+?\]#i';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered after Pico has prepared the raw file contents for parsing
|
* Triggered after Pico has prepared the raw file contents for parsing
|
||||||
|
@ -35,9 +35,9 @@ class PicoVideoEmbed extends AbstractPicoPlugin
|
||||||
* @param string &$content prepared file contents for parsing
|
* @param string &$content prepared file contents for parsing
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function onContentPrepared(&$content)
|
public function onContentParsed(&$content)
|
||||||
{
|
{
|
||||||
if (strpos($content, '[video-embed') !== false) {
|
if (stripos($content, '[video') !== false) {
|
||||||
// Search for Embed shortcodes allover the content
|
// Search for Embed shortcodes allover the content
|
||||||
preg_match_all(self::SHORTCODE, $content, $matches);
|
preg_match_all(self::SHORTCODE, $content, $matches);
|
||||||
|
|
||||||
|
|
18
README.md
18
README.md
|
@ -3,14 +3,14 @@
|
||||||
This plugin for [Pico CMS](https://picocms.org/) adds support for embedding responsive videos from peertube, vimeo and youtube. It supports different link formats, such as:
|
This plugin for [Pico CMS](https://picocms.org/) adds support for embedding responsive videos from peertube, vimeo and youtube. It supports different link formats, such as:
|
||||||
|
|
||||||
```
|
```
|
||||||
[video-embed https://kolektiva.media/videos/embed/a5c6b8e1-6e9e-4a89-ace4-03b6cf97ce07]
|
[video https://kolektiva.media/videos/embed/a5c6b8e1-6e9e-4a89-ace4-03b6cf97ce07]
|
||||||
[video-embed https://kolektiva.media/w/mtiCL28GP9gzLC2FPKjs6v]
|
[video https://kolektiva.media/w/mtiCL28GP9gzLC2FPKjs6v]
|
||||||
[video-embed https://tube.mfraters.net/videos/watch/9a2b78db-ef05-4770-9196-8a1fcd243f43]
|
[video https://tube.mfraters.net/videos/watch/9a2b78db-ef05-4770-9196-8a1fcd243f43]
|
||||||
[video-embed https://vimeo.com/566821117]
|
[video https://vimeo.com/566821117]
|
||||||
[video-embed https://player.vimeo.com/video/566821117]
|
[video https://player.vimeo.com/video/566821117]
|
||||||
[video-embed https://youtu.be/NkdUs2Dxv4s]
|
[video https://youtu.be/NkdUs2Dxv4s]
|
||||||
[video-embed https://www.youtube.com/watch?v=NkdUs2Dxv4s]
|
[video https://www.youtube.com/watch?v=NkdUs2Dxv4s]
|
||||||
[video-embed https://www.youtube.com/embed/NkdUs2Dxv4s]
|
[video https://www.youtube.com/embed/NkdUs2Dxv4s]
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
@ -21,4 +21,4 @@ This plugin for [Pico CMS](https://picocms.org/) adds support for embedding resp
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
|
||||||
I would like to thank s4ad, who built the [spiritual predecessor](https://github.com/s4ad/PicoEmbed) of this plugin.
|
I would like to thank s4ad, who built the [spiritual predecessor](https://github.com/s4ad/PicoEmbed) of this plugin.
|
||||||
|
|
Loading…
Reference in New Issue