From 778b69015ea85dbac6e8748911117ac91786180f Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 11 Sep 2018 09:59:07 +0200 Subject: [PATCH] Allow iframe embed for youtube plugin --- serendipity_event_youtube/ChangeLog | 5 +++++ serendipity_event_youtube/lang_en.inc.php | 3 ++- .../serendipity_event_youtube.php | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/serendipity_event_youtube/ChangeLog b/serendipity_event_youtube/ChangeLog index 56040066..05f4540d 100644 --- a/serendipity_event_youtube/ChangeLog +++ b/serendipity_event_youtube/ChangeLog @@ -1,3 +1,8 @@ +1.5: +---- + +Added iframe/embed switch + 1.4: ---- Added legal gdpr/dsgvo info diff --git a/serendipity_event_youtube/lang_en.inc.php b/serendipity_event_youtube/lang_en.inc.php index c72725b5..005a32cf 100644 --- a/serendipity_event_youtube/lang_en.inc.php +++ b/serendipity_event_youtube/lang_en.inc.php @@ -9,7 +9,7 @@ @define('PLUGIN_EVENT_YOUTUBE_TITLE', 'Extended Editor Buttons: Youtube etc.'); @define('PLUGIN_EVENT_YOUTUBE_DESC', 'Offers more buttons to the editing screen to implement easy access to HTML/JS snippets like Youtube etc.'); @define('PLUGIN_EVENT_YOUTUBE_BUTTON', 'Youtube'); -@define('PLUGIN_EVENT_YOUTUBE_ID', 'Youtube Video-ID (i.e. "mAcwcqOPcHM", can be see in the URL after ?v=)'); +@define('PLUGIN_EVENT_YOUTUBE_ID', 'Youtube Video-ID (i.e. "mAcwcqOPcHM", can be seen in the URL after ?v=)'); @define('PLUGIN_EVENT_YOUTUBE_SERVER', 'Youtube: Server URL'); @define('PLUGIN_EVENT_YOUTUBE_WIDTH', 'Youtube: Video width'); @@ -18,3 +18,4 @@ @define('PLUGIN_EVENT_YOUTUBE_BORDER', 'Youtube: Use Border?'); @define('PLUGIN_EVENT_YOUTUBE_COLOR1', 'Youtube: Primary color?'); @define('PLUGIN_EVENT_YOUTUBE_COLOR2', 'Youtube: Secondary color?'); +@define('PLUGIN_EVENT_YOUTUBE_IFRAME', 'Youtube: Use iframe+html5 instead of flash?'); \ No newline at end of file diff --git a/serendipity_event_youtube/serendipity_event_youtube.php b/serendipity_event_youtube/serendipity_event_youtube.php index 23a764b6..e8aff405 100644 --- a/serendipity_event_youtube/serendipity_event_youtube.php +++ b/serendipity_event_youtube/serendipity_event_youtube.php @@ -30,7 +30,7 @@ class serendipity_event_youtube extends serendipity_event 'smarty' => '2.6.7', 'php' => '4.1.0' )); - $propbag->add('version', '1.4'); + $propbag->add('version', '1.5'); $propbag->add('event_hooks', array( 'backend_entry_toolbar_extended' => true, 'backend_entry_toolbar_body' => true, @@ -59,7 +59,7 @@ class serendipity_event_youtube extends serendipity_event $propbag->add('groups', array('BACKEND_EDITOR')); - $propbag->add('configuration', array('youtube_server', 'youtube_width', 'youtube_height', 'youtube_rel', 'youtube_border', 'youtube_color1', 'youtube_color2')); + $propbag->add('configuration', array('youtube_server', 'youtube_iframe', 'youtube_width', 'youtube_height', 'youtube_rel', 'youtube_border', 'youtube_color1', 'youtube_color2')); } function generate_content(&$title) { @@ -97,6 +97,14 @@ class serendipity_event_youtube extends serendipity_event return true; break; + case 'youtube_iframe': + $propbag->add('type', 'boolean'); + $propbag->add('name', PLUGIN_EVENT_YOUTUBE_IFRAME); + $propbag->add('default', 'true'); + return true; + break; + + case 'youtube_border': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_YOUTUBE_BORDER); @@ -165,6 +173,7 @@ var youtube_rel = 'get_config('youtube var youtube_border = 'get_config('youtube_border')) ? '1' : '0'); ?>'; var youtube_color1 = 'get_config('youtube_color1'); ?>'; var youtube_color2 = 'get_config('youtube_color2'); ?>'; +var youtube_iframe = 'get_config('youtube_iframe')) ? '1' : '0'); ?>'; function use_text_(img) { @@ -191,6 +200,10 @@ function use_text_(img) { + '' + "\n"; + if (youtube_iframe) { + img = "\n" + '