add options & defaults to config, no* counterparts

This commit is contained in:
Sam 2020-04-05 22:52:52 -04:00
parent e0ab73f1c6
commit 4a572c5a76
8 changed files with 41 additions and 15 deletions

View File

@ -782,7 +782,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
'height'=>20,
'cache'=>'nocache',
'linking'=>'details',
'videoAtts'=>NULL
'videoAtts'=>array()
);
$calls = array (
@ -810,7 +810,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
'height'=>20,
'cache'=>'nocache',
'linking'=>'details',
'videoAtts'=> NULL
'videoAtts'=> array()
);
$calls = array (

View File

@ -16,7 +16,7 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('p_open',array()),
array('externalmedia',array($file,null,null,null,null,'cache','details')),
array('externalmedia',array($file,null,null,null,null,'cache','details',array())),
array('cdata',array(null)),
array('p_close',array()),
array('document_end',array()),
@ -139,7 +139,7 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser {
$title = 'Single quote: \' Ampersand: &';
$Renderer = new Doku_Renderer_xhtml();
$url = $Renderer->externalmedia($file, $title, null, null, null, 'cache', 'details', true, array());
$url = $Renderer->externalmedia($file, $title, null, null, null, 'cache', 'details', array(), true);
// make sure the title is escaped just once
$this->assertEquals(htmlspecialchars($title), substr($url, 28, 32));

View File

@ -100,6 +100,7 @@ $conf['gdlib'] = 2; //the GDlib version (0, 1 or 2) 2 tries
$conf['im_convert'] = ''; //path to ImageMagicks convert (will be used instead of GD)
$conf['jpg_quality'] = '70'; //quality of compression when scaling jpg images (0-100)
$conf['fetchsize'] = 0; //maximum size (bytes) fetch.php may download from extern, disabled by default
$conf['video_settings'] = 'controls'; //comma separated list of video embed attributes
/* Notification Settings */
$conf['subscribers'] = 0; //enable change notice subscription support

14
conf/local.php.bak.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/*
* Dokuwiki's Main Configuration File - Local Settings
* Auto-generated by config plugin
* Run for user: sam
* Date: Mon, 06 Apr 2020 04:07:15 +0200
*/
$conf['title'] = 'Sam-Test';
$conf['license'] = 'cc-by-sa';
$conf['useacl'] = 1;
$conf['superuser'] = '@admin';
$conf['disableactions'] = 'register,profile_delete,check,rss,subscribe,unsubscribe';
$conf['video_settings'] = 'autoplay';

View File

@ -1028,7 +1028,7 @@ class Doku_Handler {
//------------------------------------------------------------------------
function Doku_Handler_Parse_Media($match) {
global $conf;
// Strip the opening and closing markup
$link = preg_replace(array('/^\{\{/','/\}\}$/u'),'',$match);
@ -1096,17 +1096,18 @@ function Doku_Handler_Parse_Media($match) {
}
$videoAtts = array();
if(preg_match('/nocontrols/i',$param)){
$videoAtts["nocontrols"] = "1";
$confVideoAtts = explode(',',$conf['video_settings']);
if((in_array("controls", $confVideoAtts) || preg_match('/controls/i',$param)) && !preg_match('/nocontrols/i',$param)){
$videoAtts["controls"] = true;
}
if(preg_match('/autoplay/i',$param)){
$videoAtts["autoplay"] = "1";
if(((in_array("autoplay", $confVideoAtts)) || preg_match('/autoplay/i',$param)) && !preg_match('/noautoplay/i',$param)){
$videoAtts["autoplay"] = true;
}
if(preg_match('/loop/i',$param)){
$videoAtts["loop"] = "1";
if((in_array("loop", $confVideoAtts) || preg_match('/loop/i',$param)) && !preg_match('/noloop/i',$param)){
$videoAtts["loop"] = true;
}
if(preg_match('/muted/i',$param)){
$videoAtts["muted"] = "1";
if((in_array("muted", $confVideoAtts) || preg_match('/muted/i',$param)) && !preg_match('/nomuted/i',$param)){
$videoAtts["muted"] = true;
}
// Check whether this is a local or remote image or interwiki
if (media_isexternal($src) || link_isinterwiki($src)){

View File

@ -1880,11 +1880,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$out = '';
// open video tag
$out .= '<video '.buildAttributes($atts);
if(!$videoAtts["nocontrols"]) $out .= ' controls="controls"';
if($videoAtts["controls"]) $out .= ' controls="controls"';
if($videoAtts["autoplay"]) $out .= ' autoplay="autoplay"';
if($videoAtts["loop"]) $out .= ' loop="loop"';
if($videoAtts["muted"]) $out .= ' muted="muted"';
if($posterUrl) $out .= ' poster="'.hsc($posterUrl).'"';
$out .= '>'.NL;
$fallback = '';

View File

@ -137,6 +137,7 @@ $lang['gdlib'] = 'GD Lib version';
$lang['im_convert'] = 'Path to ImageMagick\'s convert tool';
$lang['jpg_quality'] = 'JPG compression quality (0-100)';
$lang['fetchsize'] = 'Maximum size (bytes) fetch.php may download from external URLs, eg. to cache and resize external images.';
$lang['video_settings'] = 'Select default attributes for video embeds';
/* Notification Settings */
$lang['subscribers'] = 'Allow users to subscribe to page changes by email';

View File

@ -189,6 +189,16 @@ $meta['im_convert'] = array('im_convert');
$meta['jpg_quality'] = array('numeric','_pattern' => '/^100$|^[1-9]?[0-9]$/'); //(0-100)
$meta['fetchsize'] = array('numeric');
$meta['refcheck'] = array('onoff');
$meta['video_settings'] = array(
'multicheckbox',
'_choices' => array(
'autoplay',
'controls',
'loop',
'muted'
),
'_other' => "never"
);
$meta['_notifications'] = array('fieldset');
$meta['subscribers'] = array('onoff');