cvs: phd / build.php /formats xhtml.php /include PhDTheme.class.php /themes/pear peartheme.php
| From: | Christian Weiske | Date: | Mon, 16 Feb 2009 17:48:32 +0000 |
| Subject: | cvs: phd / build.php /formats xhtml.php /include PhDTheme.class.php /themes/pear peartheme.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-3282@lists.php.net to get a copy of this message | ||
cweiske Mon Feb 16 17:48:32 2009 UTC
Modified files:
/phd build.php
/phd/formats xhtml.php
/phd/include PhDTheme.class.php
/phd/themes/pear peartheme.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.61&r2=1.62&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.61 phd/build.php:1.62
--- phd/build.php:1.61 Sun Oct 19 14:50:46 2008
+++ phd/build.php Mon Feb 16 17:48:32 2009
@@ -1,6 +1,6 @@
#!@php_bin@
<?php
-/* $Id: build.php,v 1.61 2008/10/19 14:50:46 bjori Exp $ */
+/* $Id: build.php,v 1.62 2009/02/16 17:48:32 cweiske Exp $ */
/* {{{ Find the $ROOT directory of PhD
@php_dir@ will be replaced by the pear package manager
@@ -154,8 +154,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/formats/xhtml.php?r1=1.91&r2=1.92&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.91 phd/formats/xhtml.php:1.92
--- phd/formats/xhtml.php:1.91 Thu Feb 12 18:09:13 2009
+++ phd/formats/xhtml.php Mon Feb 16 17:48:32 2009
@@ -1,6 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.91 2009/02/12 18:09:13 cweiske Exp $ */
-require $ROOT. "/include/PhDMediaManager.class.php";
+/* $Id: xhtml.php,v 1.92 2009/02/16 17:48:32 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.2&r2=1.3&diff_format=u
Index: phd/include/PhDTheme.class.php
diff -u phd/include/PhDTheme.class.php:1.2 phd/include/PhDTheme.class.php:1.3
--- phd/include/PhDTheme.class.php:1.2 Sat Nov 1 06:02:04 2008
+++ phd/include/PhDTheme.class.php Mon Feb 16 17:48:32 2009
@@ -1,8 +1,57 @@
<?php
-/* $Id: PhDTheme.class.php,v 1.2 2008/11/01 06:02:04 cweiske Exp $ */
+/* $Id: PhDTheme.class.php,v 1.3 2009/02/16 17:48:32 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);
http://cvs.php.net/viewvc.cgi/phd/themes/pear/peartheme.php?r1=1.29&r2=1.30&diff_format=u
Index: phd/themes/pear/peartheme.php
diff -u phd/themes/pear/peartheme.php:1.29 phd/themes/pear/peartheme.php:1.30
--- phd/themes/pear/peartheme.php:1.29 Wed Feb 11 21:32:38 2009
+++ phd/themes/pear/peartheme.php Mon Feb 16 17:48:32 2009
@@ -214,7 +214,8 @@
);
/**
- * Programlisting role. Necessary to highlight the code properly.
+ * Programlisting role/type (php, xml, ..).
+ * Necessary to highlight the code properly.
* String when role is set, false if not.
*
* @var string