1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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>';
}
|