aboutsummaryrefslogtreecommitdiffstats
path: root/library/epub-meta/util.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-21 14:30:26 -0800
committerzotlabs <mike@macgirvin.com>2017-11-21 14:30:26 -0800
commit8dceb8e3a75282540d7dbe9dc6e26091dad71fe0 (patch)
tree867b34d5d5e070498a183656ac1e092b70910f62 /library/epub-meta/util.php
parent1acef2e242a824f77de1a9ea3971dcabfa1b63e2 (diff)
downloadvolse-hubzilla-8dceb8e3a75282540d7dbe9dc6e26091dad71fe0.tar.gz
volse-hubzilla-8dceb8e3a75282540d7dbe9dc6e26091dad71fe0.tar.bz2
volse-hubzilla-8dceb8e3a75282540d7dbe9dc6e26091dad71fe0.zip
thumbnail generator for epubs
Diffstat (limited to 'library/epub-meta/util.php')
-rw-r--r--library/epub-meta/util.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/library/epub-meta/util.php b/library/epub-meta/util.php
new file mode 100644
index 000000000..75cb8a829
--- /dev/null
+++ b/library/epub-meta/util.php
@@ -0,0 +1,30 @@
+<?php
+
+function to_file($input){
+ $input = str_replace(' ','_',$input);
+ $input = str_replace('__','_',$input);
+ $input = str_replace(',_',',',$input);
+ $input = str_replace('_,',',',$input);
+ $input = str_replace('-_','-',$input);
+ $input = str_replace('_-','-',$input);
+ $input = str_replace(',','__',$input);
+ return $input;
+}
+
+function book_output($input){
+ $input = str_replace('__',',',$input);
+ $input = str_replace('_',' ',$input);
+ $input = str_replace(',',', ',$input);
+ $input = str_replace('-',' - ',$input);
+ list($author,$title) = explode('-',$input,2);
+ $author = trim($author);
+ $title = trim($title);
+
+ if(!$title){
+ $title = $author;
+ $author = '';
+ }
+
+ return '<span class="title">'.htmlspecialchars($title).'</span>'.
+ '<span class="author">'.htmlspecialchars($author).'</author>';
+}