はじまりの大地
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
name: DokuWiki Default Tasks
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '56 20 16 * *'
|
||||
|
||||
|
||||
jobs:
|
||||
all:
|
||||
uses: dokuwiki/github-action/.github/workflows/all.yml@main
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace dokuwiki\plugin\vshare\test;
|
||||
|
||||
use DokuWikiTest;
|
||||
|
||||
/**
|
||||
* General tests for the vshare plugin
|
||||
*
|
||||
* @group plugin_vshare
|
||||
* @group plugins
|
||||
*/
|
||||
class GeneralTest extends DokuWikiTest
|
||||
{
|
||||
|
||||
/**
|
||||
* Simple test to make sure the plugin.info.txt is in correct format
|
||||
*/
|
||||
public function testPluginInfo(): void
|
||||
{
|
||||
$file = __DIR__ . '/../plugin.info.txt';
|
||||
$this->assertFileExists($file);
|
||||
|
||||
$info = confToHash($file);
|
||||
|
||||
$this->assertArrayHasKey('base', $info);
|
||||
$this->assertArrayHasKey('author', $info);
|
||||
$this->assertArrayHasKey('email', $info);
|
||||
$this->assertArrayHasKey('date', $info);
|
||||
$this->assertArrayHasKey('name', $info);
|
||||
$this->assertArrayHasKey('desc', $info);
|
||||
$this->assertArrayHasKey('url', $info);
|
||||
|
||||
$this->assertEquals('vshare', $info['base']);
|
||||
$this->assertRegExp('/^https?:\/\//', $info['url']);
|
||||
$this->assertTrue(mail_isvalid($info['email']));
|
||||
$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
|
||||
$this->assertTrue(false !== strtotime($info['date']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in
|
||||
* conf/metadata.php.
|
||||
*/
|
||||
public function testPluginConf(): void
|
||||
{
|
||||
$conf_file = __DIR__ . '/../conf/default.php';
|
||||
$meta_file = __DIR__ . '/../conf/metadata.php';
|
||||
|
||||
if (!file_exists($conf_file) && !file_exists($meta_file)) {
|
||||
self::markTestSkipped('No config files exist -> skipping test');
|
||||
}
|
||||
|
||||
if (file_exists($conf_file)) {
|
||||
include($conf_file);
|
||||
}
|
||||
if (file_exists($meta_file)) {
|
||||
include($meta_file);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
gettype($conf),
|
||||
gettype($meta),
|
||||
'Both ' . DOKU_PLUGIN . 'vshare/conf/default.php and ' . DOKU_PLUGIN . 'vshare/conf/metadata.php have to exist and contain the same keys.'
|
||||
);
|
||||
|
||||
if ($conf !== null && $meta !== null) {
|
||||
foreach ($conf as $key => $value) {
|
||||
$this->assertArrayHasKey(
|
||||
$key,
|
||||
$meta,
|
||||
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'vshare/conf/metadata.php'
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($meta as $key => $value) {
|
||||
$this->assertArrayHasKey(
|
||||
$key,
|
||||
$conf,
|
||||
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'vshare/conf/default.php'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace dokuwiki\plugin\vshare\test;
|
||||
|
||||
use DokuWikiTest;
|
||||
|
||||
/**
|
||||
* site configuration tests for the vshare plugin
|
||||
*
|
||||
* @group plugin_vshare
|
||||
* @group plugins
|
||||
*/
|
||||
class SitesTest extends DokuWikiTest
|
||||
{
|
||||
/**
|
||||
* @see testPlaceholder
|
||||
* @see testRegEx
|
||||
*/
|
||||
public function provideSites()
|
||||
{
|
||||
$sites = \helper_plugin_vshare::loadSites();
|
||||
foreach ($sites as $site => $data) {
|
||||
yield [$site, $data];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideSites
|
||||
* @param string $site
|
||||
* @param string[] $data
|
||||
*/
|
||||
public function testPlaceholder($site, $data)
|
||||
{
|
||||
$this->assertArrayHasKey('url', $data, $site);
|
||||
$this->assertStringContainsString('@VIDEO@', $data['url'], $site);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideSites
|
||||
* @param string $site
|
||||
* @param string[] $data
|
||||
*/
|
||||
public function testRegEx($site, $data)
|
||||
{
|
||||
if (empty($data['web']) || empty($data['vid'])) {
|
||||
$this->markTestSkipped("$site has no sample data configured");
|
||||
}
|
||||
if (empty($data['rex'])) {
|
||||
$this->markTestSkipped("$site has no regular expression");
|
||||
}
|
||||
|
||||
// URL to use
|
||||
$url = empty($data['emb']) ? $data['web'] : $data['emb'];
|
||||
|
||||
$this->assertSame(
|
||||
1,
|
||||
preg_match('!' . $data['rex'] . '!i', $url, $match),
|
||||
"$site regex did not match web/emb url"
|
||||
);
|
||||
$this->assertEquals($data['vid'], $match[1], "$site regex did not return vid");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace dokuwiki\plugin\vshare\test;
|
||||
|
||||
use DokuWikiTest;
|
||||
|
||||
/**
|
||||
* syntax handling tests for the vshare plugin
|
||||
*
|
||||
* @group plugin_vshare
|
||||
* @group plugins
|
||||
*/
|
||||
class VideoSyntaxTest extends DokuWikiTest
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @see testParseSize
|
||||
*/
|
||||
public function provideParseSize()
|
||||
{
|
||||
return [
|
||||
['', 425, 239],
|
||||
['small', 255, 143],
|
||||
['Small', 255, 143],
|
||||
['178x123', 178, 123],
|
||||
['178X123', 178, 123],
|
||||
['small&medium', 255, 143, ['medium' => '']],
|
||||
['small&autoplay=false', 255, 143, ['autoplay' => 'false']],
|
||||
['178x123&autoplay=false', 178, 123, ['autoplay' => 'false']],
|
||||
['autoplay=false', 425, 239, ['autoplay' => 'false']],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideParseSize
|
||||
* @param string $input
|
||||
* @param int $ewidth
|
||||
* @param int $eheight
|
||||
* @param array $eparams
|
||||
*/
|
||||
public function testParseSize($input, $ewidth, $eheight, $eparams = [])
|
||||
{
|
||||
$syntax = new \syntax_plugin_vshare_video();
|
||||
parse_str($input, $params);
|
||||
list($width, $height) = $syntax->parseSize($params);
|
||||
|
||||
$this->assertEquals($ewidth, $width, 'width');
|
||||
$this->assertEquals($eheight, $height, 'height');
|
||||
$this->assertEquals($eparams, $eparams, 'height');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see testHandle
|
||||
*/
|
||||
public function provideHandle()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'{{youtube>L-WM8YxwqEU}}',
|
||||
[
|
||||
'site' => 'youtube',
|
||||
'domain' => 'www.youtube-nocookie.com',
|
||||
'video' => 'L-WM8YxwqEU',
|
||||
'url' => '//www.youtube-nocookie.com/embed/L-WM8YxwqEU?',
|
||||
'align' => 'none',
|
||||
'width' => 425,
|
||||
'height' => 239,
|
||||
'title' => '',
|
||||
],
|
||||
],
|
||||
[
|
||||
'{{youtube>L-WM8YxwqEU?small&start=30&end=45|A random segment of 15 seconds}}',
|
||||
[
|
||||
'site' => 'youtube',
|
||||
'domain' => 'www.youtube-nocookie.com',
|
||||
'video' => 'L-WM8YxwqEU',
|
||||
'url' => '//www.youtube-nocookie.com/embed/L-WM8YxwqEU?start=30&end=45',
|
||||
'align' => 'none',
|
||||
'width' => 255,
|
||||
'height' => 143,
|
||||
'title' => 'A random segment of 15 seconds',
|
||||
],
|
||||
],
|
||||
// FIXME add more tests
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideHandle
|
||||
* @param string $input
|
||||
* @param array $expect
|
||||
*/
|
||||
public function testHandle($input, $expect)
|
||||
{
|
||||
$syntax = new \syntax_plugin_vshare_video();
|
||||
$result = $syntax->handle($input, DOKU_LEXER_MATCHED, 0, new \Doku_Handler());
|
||||
$this->assertEquals($expect, $result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use dokuwiki\Extension\ActionPlugin;
|
||||
use dokuwiki\Extension\EventHandler;
|
||||
use dokuwiki\Extension\Event;
|
||||
|
||||
/**
|
||||
* DokuWiki Plugin vshare (Action Component)
|
||||
*
|
||||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class action_plugin_vshare extends ActionPlugin
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public function register(EventHandler $controller)
|
||||
{
|
||||
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'addSites');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the site regexes
|
||||
*
|
||||
* @param Event $event event object by reference
|
||||
* @param mixed $param optional parameter passed when event was registered
|
||||
* @return void
|
||||
*/
|
||||
public function addSites(Event $event, $param)
|
||||
{
|
||||
global $JSINFO;
|
||||
|
||||
$sites = parse_ini_file(__DIR__ . '/sites.ini', true, INI_SCANNER_RAW);
|
||||
$js = [];
|
||||
|
||||
foreach ($sites as $site => $data) {
|
||||
if (empty($data['rex'])) continue;
|
||||
$js[$site] = $data['rex'];
|
||||
}
|
||||
|
||||
$JSINFO['plugins']['vshare'] = $js;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
.vshare {
|
||||
aspect-ratio: 16/9;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.vshare {
|
||||
box-sizing: border-box;
|
||||
border: 1px solid __border__;
|
||||
cursor: pointer;
|
||||
background-image: url(video.svg);
|
||||
background-position: top left;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 5em 5em;
|
||||
}
|
||||
|
||||
iframe.vshare__left,
|
||||
div.vshare__left {
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
iframe.vshare__right,
|
||||
div.vshare__right {
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
iframe.vshare__center,
|
||||
div.vshare__center {
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
iframe.vshare__none,
|
||||
div.vshare__none {
|
||||
margin: 1px 3px 1px 3px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 710 B |
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Default settings for the vshare plugin
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
$conf['gdpr'] = 0;
|
||||
$conf['extrahard'] = 0;
|
||||
$conf['debug'] = 0;
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Options for the vshare plugin
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
$meta['gdpr'] = array('onoff');
|
||||
$meta['extrahard'] = array('onoff');
|
||||
$meta['debug'] = array('onoff');
|
||||
@@ -0,0 +1,9 @@
|
||||
# This is a list of files that were present in previous releases
|
||||
# but were removed later. They should not exist in your installation.
|
||||
_test/SyntaxTest.php
|
||||
redir.php
|
||||
sites.conf
|
||||
sites.js
|
||||
style.css
|
||||
syntax.php
|
||||
test.txt
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use dokuwiki\Extension\Plugin;
|
||||
|
||||
/**
|
||||
* DokuWiki Plugin vshare (Helper Component)
|
||||
*
|
||||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class helper_plugin_vshare extends Plugin
|
||||
{
|
||||
/**
|
||||
* Loads the configures sites and their data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function loadSites()
|
||||
{
|
||||
return parse_ini_file(__DIR__ . '/sites.ini', true, INI_SCANNER_RAW);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Nitaky <info@nitaky.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'أدرج الفيديو من خلال مواقع تشارك الفيديوهات';
|
||||
$lang['js']['prompt'] = 'من فضلك قم بوضع رابط الفيديو كاملا هنا';
|
||||
$lang['js']['notfound'] = 'عذرا، الرابط هذا لم يتم قبوله.
|
||||
نرجو منك العودة إلى الشروحات التي تبين الطريقة المثلى لإدراج الروابط بالشكل الصحيح يدويا.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author qezwan <qezwan@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'دانانی ڤیدیۆ لە سایتەکانی هاوبەشی کردنی ڤیدیۆ';
|
||||
$lang['js']['prompt'] = 'تکایە URL ەکە بە تەواوی بچەسپێنە بۆ پەڕەی ڤیدیۆکە لێرە:';
|
||||
$lang['js']['notfound'] = 'ببوورە، ئەم URLە نەناسراوە.
|
||||
تکایە ئاماژە بە بەڵگەنامەکان بکە لەسەر چۆنیەتی دانانی ڕستەسازی دروست بە دەستی.';
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Petr Kajzar <petr.kajzar@centrum.cz>
|
||||
* @author Jakub Duchek <jakduch@jakduch.cz>
|
||||
*/
|
||||
$lang['js']['button'] = 'Vložit video ze stránek pro sdílení videí';
|
||||
$lang['js']['prompt'] = 'Vložte prosím celý odkaz na stránku videa zde:';
|
||||
$lang['js']['notfound'] = 'Vložená URL adresa bohužel nebyla rozpoznána.
|
||||
Prosím, prostudujte dokumentaci a vložte správný kód ručně.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Jacob Palm <jacobpalmdk@icloud.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Indsæt video fra videodelingssider';
|
||||
$lang['js']['prompt'] = 'Indsæt venligst den fulde URL til videoen her:';
|
||||
$lang['js']['notfound'] = 'Beklager, denne URL blev ikke genkendt.
|
||||
Der henvises til dokumentationen for information om den hvordan den korrekte syntaks kan indtastes manuelt.';
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Hella <hella.breitkopf@gmail.com>
|
||||
* @author F. Mueller-Donath <j.felix@mueller-donath.de>
|
||||
*/
|
||||
$lang['js']['button'] = 'Video von Videoplattformen einfügen';
|
||||
$lang['js']['prompt'] = 'Bitte füge hier die komplette URL zur Videoseite ein:';
|
||||
$lang['js']['notfound'] = 'Die URL wurde leider nicht erkannt.
|
||||
Bitte lies in der Dokumentation nach wie du die korrekte Syntax für dieses Video manuell eingeben kannst.';
|
||||
$lang['js']['click'] = 'Klicke um dieses Video zu laden. Deine IP-Adresse und möglicherweise andere Daten werden an %s übertragen.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Hella <hella.breitkopf@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = '"Klicken zum Laden" einschalten';
|
||||
$lang['debug'] = 'Aktiviere die ~~vshare-debug~~ Syntax um alle konfigurierten Seiten visuell zu debuggen';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Joel Strasser <strasser999@gmail.com>
|
||||
* @author F. Mueller-Donath <j.felix@mueller-donath.de>
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
$lang['js']['button'] = 'Video von Videoplattformen einfügen';
|
||||
$lang['js']['prompt'] = 'Bitte fügen Sie hier die komplette URL zur Videoseite ein:';
|
||||
$lang['js']['notfound'] = 'Die URL wurde leider nicht erkannt.
|
||||
Bitte lesen Sie in der Dokumentation nach wie Sie die korrekte Syntax für dieses Video manuell eingeben können.';
|
||||
$lang['js']['click'] = 'Klicken Sie, um dieses Video zu laden. Es werden Ihre IP-Adresse und eventuell andere Daten zu %s geschickt.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Joel Strasser <strasser999@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Click-to-Load-Mechanismus aktivieren';
|
||||
$lang['debug'] = 'Aktivieren Sie die ~~vshare-debug~~-Syntax um alle konfigurierten Seiten visuell zu untersuchen';
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Katerina Katapodi <extragold1234@hotmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Εισάγετε βίντεο από τις ιστοσελίδες προβολής βίντεο';
|
||||
$lang['js']['prompt'] = 'Παρακαλώ επικολλήστε ολόκληρο το URL στην εικόνα βιντεο εδώ:';
|
||||
$lang['js']['notfound'] = 'Συγγνώμη αυτή η σελίδα δεν αναγνωρίστηκε. Παρακαλώ αναφερθείτε στα έγγραφα του πώς να διορθώσετε τη σύνταξη χειροκίνητα.';
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$lang['js']['button'] = 'Insert video from video sharing sites';
|
||||
$lang['js']['prompt'] = 'Please paste the full URL to the video page here:';
|
||||
$lang['js']['notfound'] = "Sorry, this URL wasn't recognized.\nPlease refer to the documentation on how to insert the correct syntax manually.";
|
||||
$lang['js']['click'] = 'Click to load this video. Your IP address and possibly other data will be transferred to %s.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* english language file for vshare plugin
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
$lang['gdpr'] = 'Enable click-to-load mechanism';
|
||||
$lang['extrahard'] = 'Enable the enhanced privacy features for the emebds, this will disable features like premium subscriptions, watch later, etc.';
|
||||
$lang['debug'] = 'Enable the ~~vshare-debug~~ syntax to visually debug all configured sites';
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Domingo Redal <docxml@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Insertar vídeo desde un sitio dedicado a compartir vídeos';
|
||||
$lang['js']['prompt'] = 'Pegue la dirección URL completa de la página del vídeo aquí:';
|
||||
$lang['js']['notfound'] = 'Lo sentimos, la dirección URL no fue reconocida.
|
||||
Consulte la documentación sobre cómo insertar manualmente la sintaxis correcta.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author nimahami <nima.hamidian@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'ویدئویی از تارنماهای به اشتراکگذاری ویدئو وارد نمائید';
|
||||
$lang['js']['prompt'] = 'لطفا نشانی اینترنتی کامل صفحه ویدئو را اینجا وارد نمایید';
|
||||
$lang['js']['notfound'] = 'با تاسف، این نشانی اینترنتی شناسایی نشد.
|
||||
لطفا در رابطه با چگونگی وارد کردن نگارش صحیح به صورت دستی به مستندات مراجعه نمائید. ';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* French language file for vshare plugin
|
||||
*
|
||||
* @author Mabrouk Belhout <mabroukb@gmail.com>
|
||||
* @author Fabrice DEJAIGHER <fabrice@chtiland.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Insère une vidéo depuis des sites de partage vidéo';
|
||||
$lang['js']['prompt'] = 'Copiez/collez le lien complet de la page contenant la vidéo ici :';
|
||||
$lang['js']['notfound'] = 'Désolé, cette URL n\'a pas été reconnue. Consultez la documentation sur la syntaxe pour insérer une vidéo manuellement.';
|
||||
$lang['js']['click'] = 'Cliquez pour charger la vidéo. Votre adresse IP et potentiellement d\'autres informations seront transférées à %s.';
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Fabrice Dejaigher <fabrice@chtiland.com>
|
||||
* @author Mabrouk Belhout <mabroukb@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Activer le mécanisme click-to-load';
|
||||
$lang['debug'] = 'Activer la syntaxe ~~vshare-debug~~ pour "deboguer" tous les sites configurés.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Paolo Russo <paolo@crowddreaming.academy>
|
||||
*/
|
||||
$lang['js']['button'] = 'Inserisci il video dal sito di video sharing';
|
||||
$lang['js']['prompt'] = 'Per favore, incolla qui la URL completa della pagina del video:';
|
||||
$lang['js']['notfound'] = 'Spiacenti, questa URL non è stata riconosciuta.
|
||||
Per favore, controlla la documentazione su come inserire a mano la sintassi corretta.';
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* japanese language file
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*/
|
||||
|
||||
$lang['js']['button'] = '動画共有サイトの動画を挿入';
|
||||
$lang['js']['prompt'] = 'ここに動画ページへの完全な URL を貼り付けて下さい:';
|
||||
$lang['js']['notfound'] = "申し訳ないですが、この URL が認識されません。\n手動で正しい構文を挿入する方法をマニュアルで確認して下さい。";
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* Korean language file for vshare plugin
|
||||
*
|
||||
* @author merefox <admin@homerecz.com>
|
||||
* @author Myeongjin <aranet100@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = '동영상 공유 사이트에서 동영상 넣기';
|
||||
$lang['js']['prompt'] = '여기에 동영상 페이지의 전체 URL을 붙여넣으세요:';
|
||||
$lang['js']['notfound'] = '죄송하지만 이 URL을 인식할 수 없습니다.
|
||||
수동으로 올바른 문법을 넣는 방법에 대해서는 설명문서를 참조하세요.';
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author merefox <admin@homerecz.com>
|
||||
*/
|
||||
$lang['gdpr'] = '클릭하여 불러오기 기능 활성화';
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* Dutch language file for vshare plugin.
|
||||
*
|
||||
* @author Gerrit <klapinklapin@gmail.com>
|
||||
* @author Mark C. Prins <mprins@users.sf.net>
|
||||
*/
|
||||
$lang['js']['button'] = 'Voeg een video van een video-delen website in';
|
||||
$lang['js']['prompt'] = 'Plak hier de volledige URL voor de video pagina:';
|
||||
$lang['js']['notfound'] = 'Sorry, deze URL werd niet herkend.
|
||||
Raadpleeg de documentatie over de juiste syntax om een URL handmatig in te voegen.';
|
||||
$lang['js']['click'] = 'Klik om de video te laden. Je IP-adres en mogelijk andere data zal gedeeld worden met %s.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Gerrit <klapinklapin@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Klik-om-te-laden mechanisme aanzetten';
|
||||
$lang['debug'] = 'Schakel de ~~vshare-debug~~ syntax in om visueel alle geconfigureerde site in één keer te controleren op fouten.';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Karstein Kvistad <spamme.post@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Sett inn video fra videodelingstjenester';
|
||||
$lang['js']['prompt'] = 'Lim inn hele web-lenken til videodelingssiden her:';
|
||||
$lang['js']['notfound'] = 'Beklager, denne lenken ble ikke gjenkjent.
|
||||
Vær vennlig å sjekk dokumentasjonen for hvordan å sette inn lenke med riktig syntaks.';
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Marek Adamski <fevbew@wp.pl>
|
||||
* @author Bartek S <sadupl@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Wstaw wideo z witryn udostępniających wideo';
|
||||
$lang['js']['prompt'] = 'Wklej tutaj pełny adres URL strony wideo:';
|
||||
$lang['js']['notfound'] = 'Przepraszamy, ten adres URL nie został rozpoznany.
|
||||
Zapoznaj się z dokumentacją, jak ręcznie wstawiać poprawną składnię.';
|
||||
$lang['js']['click'] = 'Kliknij, aby wczytać to wideo. Twój adres IP i ewentualnie inne dane zostaną przekazane do %s.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Marek Adamski <fevbew@wp.pl>
|
||||
*/
|
||||
$lang['gdpr'] = 'Włącz mechanizm „kliknij, aby wczytać”';
|
||||
$lang['debug'] = 'Włącz składnię ~~vshare-debug~~, aby wizualnie debugować wszystkie skonfigurowane witryny';
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Daniel Dias Rodrigues <danieldiasr@gmail.com>
|
||||
* @author Thiago Lima <thiagolimaes@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Insira o vídeo a partir de um site de compartilhamento de vídeos';
|
||||
$lang['js']['prompt'] = 'Por favor, cole aqui a URL completa da página do vídeo:';
|
||||
$lang['js']['notfound'] = 'Desculpe, a URL não foi reconhecida.
|
||||
Por favor, consulte a documentação sobre como inserir a sintaxe correta manualmente.';
|
||||
$lang['js']['click'] = 'Clique para carregar este vídeo. Seu endereço IP e possivelmente outros dados serão transferidos para %s.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Daniel Dias Rodrigues <danieldiasr@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Ativar mecanismo de clique para carregar';
|
||||
$lang['debug'] = 'Habilita a sintaxe ~~vshare-debug~~ para depurar visualmente todos os sites configurados';
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Aleksandr Selivanov <alexgearbox@yandex.ru>
|
||||
* @author Iliya <iliyabylich04@gmail.com>
|
||||
* @author Yuriy Skalko <yuriy.skalko@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Вставить видео с сайтов обмена видео ';
|
||||
$lang['js']['prompt'] = 'Пожалуйста, вставьте полный URL на страницу с видео';
|
||||
$lang['js']['notfound'] = 'Извините, адрес не распознаётся. Пожалуйста, обратитесь к документации, как вставить правильный синтаксис вручную.';
|
||||
$lang['js']['click'] = 'Нажмите для загрузки видео. Ваш IP-адрес и, возможно, другие данные будут переданы на %s.';
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Aleksandr Selivanov <alexgearbox@yandex.ru>
|
||||
* @author Iliya <iliyabylich04@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Включить механизм загрузки по клику';
|
||||
$lang['debug'] = 'Включить макрос ~~vshare-debug~~ для визуальной отладки всех сайтов, указанных в конфигурации';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Hakan <hakandursun2009@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Video paylaşım sitelerinden video ekle';
|
||||
$lang['js']['prompt'] = 'Lütfen tam URL\'yi video sayfasına yapıştırın:';
|
||||
$lang['js']['notfound'] = 'Üzgünüz, bu URL tanınmadı.
|
||||
Lütfen doğru sözdizimini manuel olarak nasıl ekleyeceğinize bakın.';
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Thien Hau <thienhau.9a14@gmail.com>
|
||||
*/
|
||||
$lang['js']['button'] = 'Chèn video từ các trang chia sẻ video';
|
||||
$lang['js']['prompt'] = 'Vui lòng dán URL đầy đủ vào trang video ở đây:';
|
||||
$lang['js']['notfound'] = 'Xin lỗi, URL này không được công nhận.
|
||||
Vui lòng tham khảo tài liệu về cách chèn đúng cú pháp.';
|
||||
$lang['js']['click'] = 'Nhấn để tải video này. Địa chỉ IP của bạn và có thể cả dữ liệu khác sẽ được chuyển đến %s.';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Thien Hau <thienhau.9a14@gmail.com>
|
||||
*/
|
||||
$lang['gdpr'] = 'Bật cơ chế nhấp để tải';
|
||||
$lang['debug'] = 'Bật cú pháp ~~vshare-debug~~ để gỡ lỗi trực quan tất cả các trang web đã định cấu hình';
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author 铁桶 <2335652849@qq.com>
|
||||
*/
|
||||
$lang['js']['click'] = '點擊以載入此影片。您的IP位址和其他資料(可能)將被傳輸至%s。';
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author 铁桶 <2335652849@qq.com>
|
||||
*/
|
||||
$lang['gdpr'] = '啟用點擊載入機制';
|
||||
$lang['debug'] = '啟用~~vshare-debug~~語法以視覺化調試所有已配置的站點';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author 铁桶 <2335652849@qq.com>
|
||||
* @author 黄璟然 <hjrluobo@qq.com>
|
||||
* @author Blog.bhyoo.xyz <rowing@bhyoo.xyz>
|
||||
*/
|
||||
$lang['js']['button'] = '从视频分享网站插入视频';
|
||||
$lang['js']['prompt'] = '请在这里粘贴视频页面的完整链接:';
|
||||
$lang['js']['notfound'] = '抱歉,这个网址无法识别。
|
||||
请参阅有关如何手动插入正确语法的文档。';
|
||||
$lang['js']['click'] = '点击加载此视频。您的IP地址和其他数据(可能)将被传输至%s。';
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author 铁桶 <2335652849@qq.com>
|
||||
* @author 黄璟然 <hjrluobo@qq.com>
|
||||
*/
|
||||
$lang['gdpr'] = '启用点击加载机制';
|
||||
$lang['debug'] = '启用~~vshare-debug~~语法以可视化调试所有已配置的站点';
|
||||
@@ -0,0 +1,2 @@
|
||||
downloadurl=https://github.com/splitbrain/dokuwiki-plugin-vshare/zipball/master
|
||||
installed=Mon, 08 Jul 2024 02:43:28 +0900
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
div.vshare__left,
|
||||
div.vshare__right,
|
||||
div.vshare__center {
|
||||
border: 1px solid #ccc;
|
||||
text-align: center;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
a.vshare {
|
||||
color: #aaa;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
base vshare
|
||||
author Andreas Gohr
|
||||
email andi@splitbrain.org
|
||||
date 2024-03-24
|
||||
name Video Sharing Site Plugin
|
||||
desc Easily embed videos from various Video Sharing sites. Example: {{youtube>XXXXXX}}
|
||||
url https://www.dokuwiki.org/plugin:vshare
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Append a toolbar button
|
||||
*/
|
||||
if (window.toolbar !== undefined) {
|
||||
toolbar[toolbar.length] = {
|
||||
"type": "pluginvshare",
|
||||
"title": LANG['plugins']['vshare']['button'],
|
||||
"icon": "../../plugins/vshare/button.png",
|
||||
"key": ""
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to determine the video service, extract the ID and insert
|
||||
* the correct syntax
|
||||
*/
|
||||
function tb_pluginvshare(btn, props, edid) {
|
||||
PluginVShare.edid = edid;
|
||||
PluginVShare.buildSyntax();
|
||||
}
|
||||
|
||||
const PluginVShare = {
|
||||
edid: null,
|
||||
|
||||
/**
|
||||
* Ask for URL, extract data and create syntax
|
||||
*/
|
||||
buildSyntax: function () {
|
||||
|
||||
const text = prompt(LANG['plugins']['vshare']['prompt']);
|
||||
if (!text) return;
|
||||
|
||||
for (const [site, rex] of Object.entries(JSINFO.plugins.vshare)) {
|
||||
const RE = new RegExp(rex, 'i');
|
||||
const match = text.match(RE);
|
||||
if (match) {
|
||||
const urlparam = '';
|
||||
const videoid = match[1];
|
||||
PluginVShare.insert(site, videoid, urlparam);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
alert(LANG['plugins']['vshare']['notfound']);
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert the syntax in the editor
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} videoid
|
||||
* @param {string} urlparam
|
||||
*/
|
||||
insert: function (key, videoid, urlparam) {
|
||||
const code = '{{' + key + '>' + videoid + '?' + urlparam + '}}';
|
||||
insertAtCarret(PluginVShare.edid, code);
|
||||
},
|
||||
|
||||
/**
|
||||
* Allow loading videos on click
|
||||
*/
|
||||
attachGDPRHandler: function () {
|
||||
const $videos = jQuery('div.vshare');
|
||||
|
||||
// add click handler
|
||||
$videos.on('click', function () {
|
||||
// create an iframe and copy over the attributes
|
||||
const iframe = document.createElement('iframe');
|
||||
let attr;
|
||||
let attributes = Array.prototype.slice.call(this.attributes);
|
||||
while(attr = attributes.pop()) {
|
||||
iframe.setAttribute(attr.nodeName, attr.nodeValue);
|
||||
}
|
||||
// replace the div with the iframe
|
||||
this.replaceWith(iframe);
|
||||
});
|
||||
|
||||
// add info text
|
||||
$videos.each(function (){
|
||||
const $self = jQuery(this);
|
||||
const info = document.createElement('p');
|
||||
info.innerText = LANG.plugins.vshare.click.replace('%s', $self.data('domain'));
|
||||
$self.append(info);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
jQuery(function () {
|
||||
PluginVShare.attachGDPRHandler();
|
||||
});
|
||||
@@ -0,0 +1,100 @@
|
||||
; [site]
|
||||
; url = the URL that will be loaded into an iframe, should contain at least @VIDEO@ placeholder
|
||||
; vid = a public sample video ID
|
||||
; web = the full URL to the website for the video identified by vid
|
||||
; emb = optional special URL to use for extracting the vid
|
||||
; rex = a regular expression that can extract the vid from the web or emb url
|
||||
; nfo = a hint on how to find the right URL to paste
|
||||
|
||||
[youtube]
|
||||
url = //www.youtube-nocookie.com/embed/@VIDEO@
|
||||
vid = W86cTIoMv2U
|
||||
web = https://www.youtube.com/watch?v=W86cTIoMv2U
|
||||
rex = youtube\.com/.*[&?]v=([a-z0-9_\-]+)
|
||||
|
||||
[vimeo]
|
||||
url = //player.vimeo.com/video/@VIDEO@
|
||||
vid = 916779781
|
||||
web = https://vimeo.com/916779781
|
||||
rex = vimeo\.com\/(\d+)
|
||||
|
||||
[slideshare]
|
||||
url = //www.slideshare.net/slideshow/embed_code/@VIDEO@
|
||||
vid = 45544603
|
||||
web = https://www.slideshare.net/iruska_38/little-cat-45544603
|
||||
emb = [slideshare id=45544603&doc=littlecat-150307015432-conversion-gate01]
|
||||
rex = slideshare.*id=(\d+)
|
||||
nfo = Use the WordPress shortcode
|
||||
|
||||
[dailymotion]
|
||||
url = //www.dailymotion.com/embed/video/@VIDEO@
|
||||
vid = x87k84d
|
||||
web = https://www.dailymotion.com/video/x87k84d
|
||||
rex = dailymotion\.com/video/([a-z0-9]+)
|
||||
|
||||
[twitchtv]
|
||||
url = //player.twitch.tv/?video=@VIDEO@&parent=@DOMAIN@
|
||||
vid = 2074388726
|
||||
web = https://www.twitch.tv/videos/2074388726
|
||||
|
||||
[archiveorg]
|
||||
url = //archive.org/embed/@VIDEO@
|
||||
vid = twitter-1414913663471812612
|
||||
web = https://archive.org/details/twitter-1414913663471812612
|
||||
rex = archive\.org/(?:embed|details)/([a-zA-Z0-9_\-]+)
|
||||
|
||||
[soundcloud]
|
||||
url = https://w.soundcloud.com/player/?url=https%3A//soundcloud.com/@VIDEO@
|
||||
vid = marcutio/welcome-to-jamrockmarcutio-remix
|
||||
web = https://soundcloud.com/marcutio/welcome-to-jamrockmarcutio-remix
|
||||
rex = soundcloud\.com/([\w-]+/[\w-]+)
|
||||
|
||||
[niconico]
|
||||
url = //embed.nicovideo.jp/watch/@VIDEO@
|
||||
vid = sm11509720
|
||||
web = https://www.nicovideo.jp/watch/sm11509720
|
||||
rex = nicovideo\.jp/watch/(sm[0-9]+)
|
||||
|
||||
[bitchute]
|
||||
url = //www.bitchute.com/embed/@VIDEO@
|
||||
vid = hBCtmAgzlgzT
|
||||
web = https://www.bitchute.com/video/hBCtmAgzlgzT/
|
||||
rex = bitchute\.com\/video\/([a-zA-Z0-9_\-]+)
|
||||
|
||||
[coub]
|
||||
url = //coub.com/embed/@VIDEO@
|
||||
vid = 2zije4
|
||||
web = https://coub.com/view/2zije4
|
||||
rex = coub\.com\/view\/([a-zA-Z0-9_\-]+)
|
||||
|
||||
[odysee]
|
||||
url = //odysee.com/$/embed/@VIDEO@
|
||||
vid = Catflappattycake/cc19d4ea5edc7ed09a5a883178c8f0317626b0fb
|
||||
web = https://odysee.com/@BedfordtheBengal:f/Catflappattycake:c
|
||||
emb = https://odysee.com/$/download/Catflappattycake/cc19d4ea5edc7ed09a5a883178c8f0317626b0fb
|
||||
rex = odysee\.com/\$/(?:embed|download)/([-%_?=/a-zA-Z0-9]+)
|
||||
nfo = Use the embed or download URL
|
||||
|
||||
[youku]
|
||||
url = //player.youku.com/embed/@VIDEO@
|
||||
vid =
|
||||
web =
|
||||
rex = v\.youku\.com/v_show/id_([0-9A-Za-z=]+)\.html
|
||||
|
||||
[bilibili]
|
||||
url = //player.bilibili.com/player.html?bvid=@VIDEO@&page=1&as_wide=1&high_quality=1&danmaku=0
|
||||
vid = BV1aR4y1j78Q
|
||||
web = https://www.bilibili.com/video/BV1aR4y1j78Q
|
||||
rex = bilibili\.com\/video\/(BV[0-9A-Za-z]+)
|
||||
|
||||
[msoffice]
|
||||
url = //hub.video.msn.com/embed/@VIDEO@/
|
||||
vid =
|
||||
web =
|
||||
rex = (?:office\.com.*[&?]videoid=([a-z0-9\-]+))
|
||||
|
||||
[msstream]
|
||||
url = url = //web.microsoftstream.com/embed/video/@VIDEO@?autoplay=false&showinfo=true
|
||||
vid =
|
||||
web =
|
||||
rex = microsoftstream\.com\/video\/([a-f0-9\-]{36})
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
use dokuwiki\Extension\SyntaxPlugin;
|
||||
|
||||
/**
|
||||
* DokuWiki Plugin vshare (Syntax Component)
|
||||
*
|
||||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class syntax_plugin_vshare_debug extends SyntaxPlugin
|
||||
{
|
||||
/** @inheritDoc */
|
||||
public function getType()
|
||||
{
|
||||
return 'substition';
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getPType()
|
||||
{
|
||||
return 'block';
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getSort()
|
||||
{
|
||||
return 155;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function connectTo($mode)
|
||||
{
|
||||
if ($this->getConf('debug')) {
|
||||
$this->Lexer->addSpecialPattern('~~vshare-debug~~', $mode, 'plugin_vshare_debug');
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function handle($match, $state, $pos, Doku_Handler $handler)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function render($mode, Doku_Renderer $renderer, $handlerdata)
|
||||
{
|
||||
if ($mode !== 'xhtml') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sites = helper_plugin_vshare::loadSites();
|
||||
$syntax = new syntax_plugin_vshare_video();
|
||||
$handler = new \Doku_Handler();
|
||||
|
||||
|
||||
$renderer->header('vshare sites', 1, 0);
|
||||
|
||||
foreach ($sites as $site => $info) {
|
||||
$renderer->header($site, 2, 0);
|
||||
|
||||
if (!empty($info['vid'])) {
|
||||
$data = $syntax->handle("{{ $site>{$info['vid']} }}", DOKU_LEXER_MATCHED, 0, $handler);
|
||||
$syntax->render($mode, $renderer, $data);
|
||||
} else {
|
||||
$renderer->p_open();
|
||||
$renderer->smiley('FIXME');
|
||||
$renderer->cdata(' No sample video ID available');
|
||||
$renderer->p_close();
|
||||
}
|
||||
|
||||
if (!empty($info['web'])) {
|
||||
$renderer->p_open();
|
||||
$renderer->externallink($info['web']);
|
||||
$renderer->p_close();
|
||||
} else {
|
||||
$renderer->p_open();
|
||||
$renderer->smiley('FIXME');
|
||||
$renderer->cdata(' No sample video available');
|
||||
$renderer->p_close();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
use dokuwiki\Extension\SyntaxPlugin;
|
||||
|
||||
/**
|
||||
* Easily embed videos from various Video Sharing sites
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class syntax_plugin_vshare_video extends SyntaxPlugin
|
||||
{
|
||||
protected $sites;
|
||||
|
||||
protected $sizes = [
|
||||
'small' => [255, 143],
|
||||
'medium' => [425, 239],
|
||||
'large' => [520, 293],
|
||||
'full' => ['100%', ''],
|
||||
'half' => ['50%', ''],
|
||||
];
|
||||
|
||||
protected $alignments = [
|
||||
0 => 'none',
|
||||
1 => 'right',
|
||||
2 => 'left',
|
||||
3 => 'center',
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Intitalizes the supported video sites
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sites = helper_plugin_vshare::loadSites();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function getType()
|
||||
{
|
||||
return 'substition';
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function getPType()
|
||||
{
|
||||
return 'block';
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function getSort()
|
||||
{
|
||||
return 159;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function connectTo($mode)
|
||||
{
|
||||
$pattern = implode('|', array_keys($this->sites));
|
||||
$this->Lexer->addSpecialPattern('\{\{\s?(?:' . $pattern . ')>[^}]*\}\}', $mode, 'plugin_vshare_video');
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function handle($match, $state, $pos, Doku_Handler $handler)
|
||||
{
|
||||
$command = substr($match, 2, -2);
|
||||
|
||||
// title
|
||||
[$command, $title] = sexplode('|', $command, 2, '');
|
||||
$title = trim($title);
|
||||
|
||||
// alignment
|
||||
$align = 0;
|
||||
if (substr($command, 0, 1) == ' ') ++$align;
|
||||
if (substr($command, -1) == ' ') $align += 2;
|
||||
$command = trim($command);
|
||||
|
||||
// get site and video
|
||||
[$site, $vid] = explode('>', $command);
|
||||
if (!$this->sites[$site]) return null; // unknown site
|
||||
if (!$vid) return null; // no video!?
|
||||
|
||||
// what size?
|
||||
[$vid, $pstr] = sexplode('?', $vid, 2, '');
|
||||
parse_str($pstr, $userparams);
|
||||
[$width, $height] = $this->parseSize($userparams);
|
||||
|
||||
// get URL
|
||||
$url = $this->insertPlaceholders($this->sites[$site]['url'], $vid, $width, $height);
|
||||
[$url, $urlpstr] = sexplode('?', $url, 2, '');
|
||||
parse_str($urlpstr, $urlparams);
|
||||
|
||||
// merge parameters
|
||||
$params = array_merge($urlparams, $userparams);
|
||||
$url = $url . '?' . buildURLparams($params, '&');
|
||||
|
||||
return [
|
||||
'site' => $site,
|
||||
'domain' => parse_url($url, PHP_URL_HOST),
|
||||
'video' => $vid,
|
||||
'url' => $url,
|
||||
'align' => $this->alignments[$align],
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => $title
|
||||
];
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function render($mode, Doku_Renderer $R, $data)
|
||||
{
|
||||
if ($mode != 'xhtml') return false;
|
||||
if (is_null($data)) return false;
|
||||
|
||||
if (is_a($R, 'renderer_plugin_dw2pdf')) {
|
||||
$R->doc .= $this->pdf($data);
|
||||
} else {
|
||||
$R->doc .= $this->iframe($data, $this->getConf('gdpr') ? 'div' : 'iframe');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the HTML for output of the embed iframe
|
||||
* @param array $data
|
||||
* @param string $element Can be used to not directly embed the iframe
|
||||
* @return string
|
||||
*/
|
||||
public function iframe($data, $element = 'iframe')
|
||||
{
|
||||
$attributes = [
|
||||
'src' => $data['url'],
|
||||
'width' => $data['width'],
|
||||
'height' => $data['height'],
|
||||
'style' => $this->sizeToStyle($data['width'], $data['height']),
|
||||
'class' => 'vshare vshare__' . $data['align'],
|
||||
'allowfullscreen' => '',
|
||||
'frameborder' => 0,
|
||||
'scrolling' => 'no',
|
||||
'data-domain' => $data['domain'],
|
||||
'loading' => 'lazy',
|
||||
];
|
||||
if ($this->getConf('extrahard')) {
|
||||
$attributes = array_merge($attributes, $this->hardenedIframeAttributes());
|
||||
}
|
||||
|
||||
return "<$element "
|
||||
. buildAttributes($attributes)
|
||||
. '><h3>' . hsc($data['title']) . "</h3></$element>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a style attribute for the given size
|
||||
*
|
||||
* @param int|string $width
|
||||
* @param int|string $height
|
||||
* @return string
|
||||
*/
|
||||
public function sizeToStyle($width, $height)
|
||||
{
|
||||
// no unit? use px
|
||||
if ($width && $width == (int)$width) {
|
||||
$width .= 'px';
|
||||
}
|
||||
// no unit? use px
|
||||
if ($height && $height == (int)$height) {
|
||||
$height .= 'px';
|
||||
}
|
||||
|
||||
$style = '';
|
||||
if ($width) $style .= 'width:' . $width . ';';
|
||||
if ($height) $style .= 'height:' . $height . ';';
|
||||
return $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the HTML for output in PDF exports
|
||||
*
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function pdf($data)
|
||||
{
|
||||
$html = '<div class="vshare vshare__' . $data['align'] . '"
|
||||
width="' . $data['width'] . '"
|
||||
height="' . $data['height'] . '">';
|
||||
|
||||
$html .= '<a href="' . $data['url'] . '" class="vshare">';
|
||||
$html .= '<img src="' . DOKU_BASE . 'lib/plugins/vshare/video.png" />';
|
||||
$html .= '</a>';
|
||||
|
||||
$html .= '<br />';
|
||||
|
||||
$html .= '<a href="' . $data['url'] . '" class="vshare">';
|
||||
$html .= ($data['title'] ? hsc($data['title']) : 'Video');
|
||||
$html .= '</a>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the placeholders in the given URL
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $vid
|
||||
* @param int|string $width
|
||||
* @param int|string $height
|
||||
* @return string
|
||||
*/
|
||||
public function insertPlaceholders($url, $vid, $width, $height)
|
||||
{
|
||||
global $INPUT;
|
||||
$url = str_replace('@VIDEO@', rawurlencode($vid), $url);
|
||||
$url = str_replace('@DOMAIN@', rawurlencode($INPUT->server->str('HTTP_HOST')), $url);
|
||||
$url = str_replace('@WIDTH@', $width, $url);
|
||||
$url = str_replace('@HEIGHT@', $height, $url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the wanted size from the parameter list
|
||||
*
|
||||
* @param array $params
|
||||
* @return int[]
|
||||
*/
|
||||
public function parseSize(&$params)
|
||||
{
|
||||
$known = implode('|', array_keys($this->sizes));
|
||||
|
||||
foreach (array_keys($params) as $key) {
|
||||
if (preg_match("/^((\d+)x(\d+))|($known)\$/i", $key, $m)) {
|
||||
unset($params[$key]);
|
||||
if (isset($m[4])) {
|
||||
return $this->sizes[strtolower($m[4])];
|
||||
} else {
|
||||
return [$m[2], $m[3]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default
|
||||
return $this->sizes['medium'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get additional attributes to set on the iframe to harden
|
||||
*
|
||||
* @link https://dustri.org/b/youtube-video-embedding-harm-reduction.html
|
||||
* @return array
|
||||
*/
|
||||
protected function hardenedIframeAttributes()
|
||||
{
|
||||
$disallow = [
|
||||
'accelerometer',
|
||||
'ambient-light-sensor',
|
||||
'autoplay',
|
||||
'battery',
|
||||
'browsing-topics',
|
||||
'camera',
|
||||
'display-capture',
|
||||
'domain-agent',
|
||||
'document-domain',
|
||||
'encrypted-media',
|
||||
'execution-while-not-rendered',
|
||||
'execution-while-out-of-viewport',
|
||||
'gamepad',
|
||||
'geolocation',
|
||||
'gyroscope',
|
||||
'hid',
|
||||
'identity-credentials-get',
|
||||
'idle-detection',
|
||||
'local-fonts',
|
||||
'magnetometer',
|
||||
'microphone',
|
||||
'midi',
|
||||
'otp-credentials',
|
||||
'payment',
|
||||
'picture-in-picture',
|
||||
'publickey-credentials-create',
|
||||
'publickey-credentials-get',
|
||||
'screen-wake-lock',
|
||||
'serial',
|
||||
'speaker-selection',
|
||||
'usb',
|
||||
'window-management',
|
||||
'xr-spatial-tracking',
|
||||
];
|
||||
|
||||
$disallow = implode('; ', array_map(static fn($v) => "$v 'none'", $disallow));
|
||||
|
||||
return [
|
||||
'credentialless' => '',
|
||||
'sandbox' => 'allow-scripts allow-same-origin',
|
||||
'allow' => $disallow,
|
||||
'csp' => 'sandbox allow-scripts allow-same-origin',
|
||||
'referrerpolicy' => 'no-referrer',
|
||||
];
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#cccccc" d="M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z"/></svg>
|
||||
|
After Width: | Height: | Size: 198 B |
Reference in New Issue
Block a user