diff --git a/action.php b/action.php index e0bc97d..44e750b 100644 --- a/action.php +++ b/action.php @@ -1,12 +1,14 @@ helper) { $this->helper = $this->loadHelper('epub', true); } - if (!$this->helper->is_inCache($INFO['id'])) return; //cache set in syntax.php + if (isset($INFO['id']) && !$this->helper->is_inCache($INFO['id'])) return; //cache set in syntax.php $event->preventDefault(); } diff --git a/plugin.info.txt b/plugin.info.txt index 681541a..e5970ac 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base epub author Myron Turner email turnermm02@shaw.ca -date 2022-10-05 +date 2023-01-31 name epub desc Ebook creator url http://www.dokuwiki.org/plugin:epub diff --git a/renderer.php b/renderer.php index 15bdff2..5c756ae 100644 --- a/renderer.php +++ b/renderer.php @@ -128,18 +128,18 @@ function _media ($src, $title=NULL, $align=NULL, $width=NULL, $mpfile = str_replace('Audio/',"",$src); $display_name = $title; $title = $mpfile; - $out .= $this->_formatLink( array('class'=>'media mediafile mf_mp3','title'=>$title,'name'=>$title, 'display'=>$display_name) ) ."\n

"; + $out .= $this->_formatLink( array('class'=>'media mediafile mf_mp3','title'=>$title,'name'=>$title, 'display'=>$display_name, 'url'=>'') ) ."\n

"; } } else if(strpos($mtype[1],'video') !== false) { if($this->video_link) $out .= '

' ;//$out .= '
' ; $out .= $this->set_video($src,$mtype,$title) ; if($this->video_link) { - list($title,$rest) = explode('(', $title); + list($title,$rest) = array_pad(explode('(', $title), 2, ''); $mpfile = str_replace('Video/',"",$src); $display_name = $title; $title = $mpfile; - $out .= $this->_formatLink( array('class'=>'media mediafile mf_mp4','title'=>$title,'name'=>$title, 'display'=>$display_name) ) ."\n

"; + $out .= $this->_formatLink( array('class'=>'media mediafile mf_mp4','title'=>$title,'name'=>$title, 'display'=>$display_name, 'url'=>'') ) ."\n

"; } } else { @@ -180,7 +180,7 @@ function is_image($link,&$type) { $mime_type = mimetype($link['title']); if(!$mime_type[1] ) { - list($url,$rest) = explode('?', $link['url']); + list($url,$rest) = array_pad(explode('?', $link['url']), 2,''); $mime_type = mimetype($url); if(!$mime_type[1]) { $mime_type = mimetype($rest); @@ -333,7 +333,7 @@ function smiley($smiley) { function local_name($link,&$orig="", &$frag ="") { $base_name= basename($link['url']); $title = $link['title']? ltrim($link['title'],':'): ""; - list($starturl,$frag) = explode('#',$link['url']); + list($starturl,$frag) = array_pad(explode('#',$link['url']), 2, ''); if ($title) { $name = $title; } diff --git a/scripts/css2.php b/scripts/css2.php index 1c9b313..837018b 100644 --- a/scripts/css2.php +++ b/scripts/css2.php @@ -6,14 +6,11 @@ * @author Andreas Gohr */ -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../').'/'); -if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) -if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT',1); // we gzip ourself here -if(!defined('EPUB_DIR')) define('EPUB_DIR',realpath(dirname(__FILE__).'/../').'/'); -if(!defined('DOKU_TPL')) define('DOKU_TPL', DOKU_BASE.'lib/tpl/'.$conf['template'].'/'); -if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', DOKU_INC.'lib/tpl/'.$conf['template'].'/'); -require_once(DOKU_INC.'inc/init.php'); - +use dokuwiki\Cache\Cache; +use dokuwiki\Extension\ActionPlugin; +use dokuwiki\Extension\Event; +use dokuwiki\Extension\EventHandler; +use dokuwiki\StyleUtils; // ---------------------- functions ------------------------------ @@ -69,9 +66,9 @@ function epub_css_out($path){ } // load user styles - if(isset($config_cascade['userstyle'][$mediatype])){ - $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; - } + #if(isset($config_cascade['userstyle'][$mediatype])){ + # $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + #} // load files $css = ""; diff --git a/scripts/epub_utils.php b/scripts/epub_utils.php index da99f7b..c76a973 100644 --- a/scripts/epub_utils.php +++ b/scripts/epub_utils.php @@ -31,6 +31,7 @@ function epub_opf_header($user_title) { } } + $cover_png = ""; if(!$user_title) { $cover_png=''. "\n"; } @@ -616,7 +617,10 @@ function epub_save_namespace($ns="") { function epub_checkfor_ns($name, &$pages, &$titles) { $name = rtrim($name); - $n = strrpos($name,'*',-1); + $n = false; + if (strlen($n) > 0){ + $n = strrpos($name,'*',-1); + } if(!$n) return; array_shift($pages); // remove namespace id: namespace:* diff --git a/syntax.php b/syntax.php index fcef3b3..2892b9f 100644 --- a/syntax.php +++ b/syntax.php @@ -1,8 +1,11 @@