Skip to content

Commit

Permalink
use dokuwiki equivalents of functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Klap-in committed Dec 15, 2014
1 parent dbd8d9a commit acf3824
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions DokuPDF.class.php
Expand Up @@ -26,7 +26,9 @@ function __construct($pagesize='A4', $orientation='portrait'){
io_mkdir_p(_MPDF_TEMP_PATH);

$format = $pagesize;
if($orientation == 'landscape') $format .= '-L';
if($orientation == 'landscape') {
$format .= '-L';
}

switch($conf['lang']) {
case 'zh':
Expand All @@ -51,22 +53,7 @@ function __construct($pagesize='A4', $orientation='portrait'){
* Cleanup temp dir
*/
function __destruct(){
$this->deletedir(_MPDF_TEMP_PATH);
}

/**
* Recursively delete a directory and its contents
*
* @link http://de3.php.net/manual/en/function.rmdir.php#108113
*/
function deletedir($dir){
foreach(glob($dir . '/*') as $file) {
if(is_dir($file))
$this->deletedir($file);
else
@unlink($file);
}
@rmdir($dir);
io_rmdir(_MPDF_TEMP_PATH, true);
}

/**
Expand Down Expand Up @@ -119,7 +106,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
if(preg_match('/[\?&]w=(\d+)/',$file, $m)) $w = $m[1];
if(preg_match('/[\?&]h=(\d+)/',$file, $m)) $h = $m[1];

if(preg_match('/^(https?|ftp):\/\//',$media)){
if(media_isexternal($media)){
$local = media_get_from_URL($media,$ext,-1);
if(!$local) $local = $media; // let mpdf try again
}else{
Expand All @@ -139,7 +126,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
$local = media_resize_image($local,$ext,$w,$h);
}
}
}elseif(preg_match('/^(https?|ftp):\/\//',$file)){ // fixed external URLs
}elseif(media_isexternal($file)){ // fixed external URLs
$local = media_get_from_URL($file,$ext,$conf['cachetime']);
}

Expand Down

0 comments on commit acf3824

Please sign in to comment.