cvs: phd(PHD_0_4) /include PhDMediaManager.class.php PhDThemeXhtml.class.php

From: Date: Thu, 19 Feb 2009 12:00:38 +0000
Subject: cvs: phd(PHD_0_4) /include PhDMediaManager.class.php PhDThemeXhtml.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3314@lists.php.net to get a copy of this message
cweiske Thu Feb 19 12:00:38 2009 UTC Modified files: (Branch: PHD_0_4) /phd/include PhDMediaManager.class.php PhDThemeXhtml.class.php Log: MFH: Fix mediamanager cwd-not-in-manualdir problem http://cvs.php.net/viewvc.cgi/phd/include/PhDMediaManager.class.php?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: phd/include/PhDMediaManager.class.php diff -u phd/include/PhDMediaManager.class.php:1.1.2.4 phd/include/PhDMediaManager.class.php:1.1.2.5 --- phd/include/PhDMediaManager.class.php:1.1.2.4 Wed Feb 18 12:57:10 2009 +++ phd/include/PhDMediaManager.class.php Thu Feb 19 12:00:38 2009 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDMediaManager.class.php,v 1.1.2.4 2009/02/18 12:57:10 rquadling Exp $ */ +/* $Id: PhDMediaManager.class.php,v 1.1.2.5 2009/02/19 12:00:38 cweiske Exp $ */ /** * Handles images (and other media objects) referenced in the docbook files. @@ -23,7 +23,15 @@ * * @var string */ - public $relative_path = ''; + public $relative_ref_path = ''; + + /** + * Path the media files are referenced relative to in the xml file. + * This is nearly always the directory the xml file is located in. + * + * @var string + */ + public $relative_source_path = ''; /** * If the image media directory exists @@ -34,6 +42,13 @@ + public function __construct($relative_source_path) + { + $this->relative_source_path = rtrim($relative_source_path, '/\\') . '/'; + }//public function __construct(..) + + + /** * Handles the file: * - Generate proper filename (short version with only one directory) @@ -53,7 +68,7 @@ $this->copyOver($filename, $newpath); - return $this->relative_path . $newpath; + return $this->relative_ref_path . $newpath; }//public function handleFile(..) @@ -70,14 +85,15 @@ protected function copyOver($filename, $newpath) { $fullpath = $this->output_dir . '/' . $newpath; + $fullfilename = $this->relative_source_path . $filename; if (file_exists($fullpath)) { //no need to copy over again return; } - if (!file_exists($filename)) { - trigger_error('Image does not exist: ' . $filename, E_USER_WARNING); + if (!file_exists($fullfilename)) { + trigger_error('Image does not exist: ' . $fullfilename, E_USER_WARNING); return; } @@ -89,7 +105,7 @@ $this->media_dir_exists = true; } - copy($filename, $fullpath); + copy($fullfilename, $fullpath); }//protected function copyOver(..) }//class PhDMediaManager http://cvs.php.net/viewvc.cgi/phd/include/PhDThemeXhtml.class.php?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: phd/include/PhDThemeXhtml.class.php diff -u phd/include/PhDThemeXhtml.class.php:1.1.2.4 phd/include/PhDThemeXhtml.class.php:1.1.2.5 --- phd/include/PhDThemeXhtml.class.php:1.1.2.4 Wed Feb 18 12:57:10 2009 +++ phd/include/PhDThemeXhtml.class.php Thu Feb 19 12:00:38 2009 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDThemeXhtml.class.php,v 1.1.2.4 2009/02/18 12:57:10 rquadling Exp $ */ +/* $Id: PhDThemeXhtml.class.php,v 1.1.2.5 2009/02/19 12:00:38 cweiske Exp $ */ /** * Base class for XHTML themes @@ -41,13 +41,13 @@ */ public function postConstruct() { - $this->mediamanager = new PhDMediaManager(); + $this->mediamanager = new PhDMediaManager($GLOBALS['OPTIONS']['xml_root']); if (isset($this->outputdir) && $this->outputdir) { $this->mediamanager->output_dir = $this->outputdir; } else { - $this->mediamanager->output_dir = $this->outputfile . '-data/'; - $this->mediamanager->relative_path = basename($this->mediamanager->output_dir) . '/'; + $this->mediamanager->output_dir = $this->outputfile . '-data/'; + $this->mediamanager->relative_ref_path = basename($this->mediamanager->output_dir) . '/'; } }//public function postConstruct() @@ -145,4 +145,4 @@ * vim<600: sw=4 ts=4 */ -?> \ No newline at end of file +?>

« previous php.doc.cvs (#3314) next »