cvs: phd(PHD_0_4) / build.php package.xml /formats xhtml.php /include PhDTheme.class.php
| From: | Christian Weiske | Date: | Mon, 16 Feb 2009 17:49:36 +0000 |
| Subject: | cvs: phd(PHD_0_4) / build.php package.xml /formats xhtml.php /include PhDTheme.class.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-3283@lists.php.net to get a copy of this message | ||
cweiske Mon Feb 16 17:49:36 2009 UTC
Modified files: (Branch: PHD_0_4)
/phd build.php package.xml
/phd/formats xhtml.php
/phd/include PhDTheme.class.php
Log:
Fix bug #47408: Same image directory used for each theme
Each theme has its own media manager now.
http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.54.2.3.2.2&r2=1.54.2.3.2.3&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.54.2.3.2.2 phd/build.php:1.54.2.3.2.3
--- phd/build.php:1.54.2.3.2.2 Sun Jan 25 19:59:03 2009
+++ phd/build.php Mon Feb 16 17:49:36 2009
@@ -1,6 +1,6 @@
#!@php_bin@
<?php
-/* $Id: build.php,v 1.54.2.3.2.2 2009/01/25 19:59:03 cweiske Exp $ */
+/* $Id: build.php,v 1.54.2.3.2.3 2009/02/16 17:49:36 cweiske Exp $ */
/* {{{ Find the $ROOT directory of PhD
@php_dir@ will be replaced by the pear package manager
@@ -115,8 +115,7 @@
$themes[$themename] = new $themename(array($IDs, $REFS, $CLASSES, $VARS));
}
- // FIXME: this needs to go away when we add support for
- // things other than xhtml
+ $themes[$themename]->postConstruct();
$themes[$themename]->registerFormat($format);
http://cvs.php.net/viewvc.cgi/phd/package.xml?r1=1.74.2.19.2.48&r2=1.74.2.19.2.49&diff_format=u
Index: phd/package.xml
diff -u phd/package.xml:1.74.2.19.2.48 phd/package.xml:1.74.2.19.2.49
--- phd/package.xml:1.74.2.19.2.48 Mon Feb 16 09:43:52 2009
+++ phd/package.xml Mon Feb 16 17:49:36 2009
@@ -44,14 +44,15 @@
<date>2009-02-16</date>
<version>
<release>0.4.5</release>
- <api>0.4.4</api>
+ <api>0.4.5</api>
</version>
<stability>
- <release>snapshot</release>
+ <release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD
Style</license>
<notes>
+ - Fix bug #47408: Same image directory used for each theme
</notes>
<contents>
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.67.2.2.2.22&r2=1.67.2.2.2.23&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.67.2.2.2.22 phd/formats/xhtml.php:1.67.2.2.2.23
--- phd/formats/xhtml.php:1.67.2.2.2.22 Thu Feb 12 18:08:37 2009
+++ phd/formats/xhtml.php Mon Feb 16 17:49:36 2009
@@ -1,6 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.67.2.2.2.22 2009/02/12 18:08:37 cweiske Exp $ */
-require $ROOT. "/include/PhDMediaManager.class.php";
+/* $Id: xhtml.php,v 1.67.2.2.2.23 2009/02/16 17:49:36 cweiske Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -371,13 +370,6 @@
*/
public $role = false;
- /**
- * Media manager object
- *
- * @var PhDMediaManager
- */
- public $mediamanager = null;
-
/* Current Chunk variables */
protected $cchunk = array();
/* Default Chunk variables */
@@ -415,23 +407,6 @@
),
);
- public function __construct(array $IDs)
- {
- parent::__construct($IDs);
- $this->mediamanager = new PhDMediaManager();
- }
-
- public function registerTheme(PhDTheme $theme)
- {
- parent::registerTheme($theme);
- if (isset($theme->outputdir)) {
- $this->mediamanager->output_dir = $theme->outputdir;
- } else {
- $this->mediamanager->output_dir = $theme->outputfile . '-data/';
- $this->mediamanager->relative_path =
basename($this->mediamanager->output_dir) . '/';
- }
- }
-
public function __call($func, $args) {
if ($args[0]) {
trigger_error("No mapper found for '{$func}'", E_USER_WARNING);
@@ -1262,7 +1237,7 @@
}
public function format_imagedata($open, $name, $attrs) {
$file = $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"];
- $newpath = $this->mediamanager->handleFile($file);
+ $newpath = $this->theme->mediamanager->handleFile($file);
if ($this->cchunk["mediaobject"]["alt"] !== false) {
return '<img src="' . $newpath . '" alt="'
.$this->cchunk["mediaobject"]["alt"]. '" />';
http://cvs.php.net/viewvc.cgi/phd/include/PhDTheme.class.php?r1=1.1.10.1&r2=1.1.10.2&diff_format=u
Index: phd/include/PhDTheme.class.php
diff -u phd/include/PhDTheme.class.php:1.1.10.1 phd/include/PhDTheme.class.php:1.1.10.2
--- phd/include/PhDTheme.class.php:1.1.10.1 Fri Nov 7 22:16:42 2008
+++ phd/include/PhDTheme.class.php Mon Feb 16 17:49:36 2009
@@ -1,8 +1,57 @@
<?php
-/* $Id: PhDTheme.class.php,v 1.1.10.1 2008/11/07 22:16:42 cweiske Exp $ */
+/* $Id: PhDTheme.class.php,v 1.1.10.2 2009/02/16 17:49:36 cweiske Exp $ */
+require $ROOT. "/include/PhDMediaManager.class.php";
abstract class PhDTheme extends PhDHelper implements iPhDTheme {
protected $format;
+
+ /**
+ * Media manager object
+ *
+ * @var PhDMediaManager
+ */
+ public $mediamanager = null;
+
+
+
+ /**
+ * Creates the theme object.
+ *
+ * @param array $a Array with ID array as first value, ref array as second.
+ */
+ public function __construct(array $a)
+ {
+ parent::__construct($a);
+ }
+
+
+
+ /**
+ * Called after the constructor finished.
+ * This is needed since themes set their outputdir and outputfile
+ * in the constructor. That file/dir is used for mediamanager.
+ * That means we cannot instantiate and complete the manager in our
+ * constructor centrally.
+ *
+ * Each theme needs its own media manager, since the manager contains
+ * the output path.
+ *
+ * @return void
+ */
+ public function postConstruct()
+ {
+ $this->mediamanager = new PhDMediaManager();
+
+ if (isset($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) . '/';
+ }
+ }//public function postConstruct()
+
+
+
public function registerFormat($format) {
$this->format = $format;
$this->format->registerTheme($this);