svn: /phd/trunk/ package_php.xml phpdotnet/phd/PI/PHPDOCHandler.php phpdotnet/phd/Package/IDE/SQLite.php phpdotnet/phd/Package/PHP/CHM.php
| From: | Richard Quadling | Date: | Mon, 22 Aug 2011 11:48:51 +0000 |
| Subject: | svn: /phd/trunk/ package_php.xml phpdotnet/phd/PI/PHPDOCHandler.php phpdotnet/phd/Package/IDE/SQLite.php phpdotnet/phd/Package/PHP/CHM.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-8660@lists.php.net to get a copy of this message | ||
rquadling Mon, 22 Aug 2011 11:48:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=315277
Log:
Allow Windows CHM files to use the url() loaded content defined in the CSS files.
Added svn:keywords where missing.
Changed paths:
U phd/trunk/package_php.xml
UU phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php
_U phd/trunk/phpdotnet/phd/Package/IDE/SQLite.php
U phd/trunk/phpdotnet/phd/Package/PHP/CHM.php
Modified: phd/trunk/package_php.xml
===================================================================
--- phd/trunk/package_php.xml 2011-08-22 11:36:56 UTC (rev 315276)
+++ phd/trunk/package_php.xml 2011-08-22 11:48:51 UTC (rev 315277)
@@ -40,7 +40,8 @@
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD
Style</license>
<notes>
- - Use transliteration for the Windows CHM TOC and Index - Romanian only - (Richard)
+ - Use transliteration for the Windows CHM TOC and Index - Romanian only - (Richard Q)
+ - Allow Windows CHM files to use the url() loaded content defined in the CSS files (Richard Q)
</notes>
<contents>
Modified: phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php
===================================================================
--- phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php 2011-08-22 11:36:56 UTC (rev 315276)
+++ phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php 2011-08-22 11:48:51 UTC (rev 315277)
@@ -1,6 +1,6 @@
<?php
namespace phpdotnet\phd;
-/* $Id: PHPDOCHandler.php 293260 2010-01-08 10:41:19Z rquadling $ */
+/* $Id$ */
class PI_PHPDOCHandler extends PIHandler {
Property changes on: phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Property changes on: phd/trunk/phpdotnet/phd/Package/IDE/SQLite.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Modified: phd/trunk/phpdotnet/phd/Package/PHP/CHM.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/PHP/CHM.php 2011-08-22 11:36:56 UTC (rev 315276)
+++ phd/trunk/phpdotnet/phd/Package/PHP/CHM.php 2011-08-22 11:48:51 UTC (rev 315277)
@@ -247,9 +247,44 @@
$stylesheet = $this->fetchStylesheet() . PHP_EOL;
}
+ self::headerChm();
+
+ // Find referenced content - background images, sprites, etc.
+ if (0 !==
preg_match_all('
url\((([\'"]|)((?:(?!file:).)*)\2)\)', $stylesheet,
$stylesheet_urls)) {
+ foreach(array_unique($stylesheet_urls[3]) as $stylesheet_url) {
+
+ // Parse the url, getting content from http://www.php.net if there is no scheme and host.
+ if (False !== ($parsed_url = parse_url($stylesheet_url))) {
+
+ if (!isset($parsed_url['scheme']) &&
!isset($parsed_url['host'])) {
+ $url_content = file_get_contents('http://www.php.net/' . $stylesheet_url);
+ } else {
+ // Otherwise content is fully identified.
+ $url_content = file_get_contents($stylesheet_url);
+ }
+
+ // Make sure the location to save the content is available.
+ @mkdir(dirname($content_filename = $this->outputdir .
$parsed_url['path']));
+
+ // Save the referenced content to the new location.
+ file_put_contents($content_filename, $url_content);
+
+ // Add the content to the hpp file.
+ fwrite($this->hhpStream, 'res' . DIRECTORY_SEPARATOR .
($relative_url = trim(substr(realpath($content_filename), strlen(realpath($this->outputdir))),
DIRECTORY_SEPARATOR)) . PHP_EOL);
+
+ // Force URLS to be relative to the "res" directory.
+ $stylesheet = str_replace($stylesheet_url, $relative_url, $stylesheet);
+
+ v('Saved content from css : %s.', $parsed_url['path'],
VERBOSE_MESSAGES);
+ } else {
+ v('Unable to save content from css : %s.', $stylesheet_url,
E_USER_WARNING);
+ }
+ }
+
+ }
+
+ // Save the stylesheet.
file_put_contents($this->outputdir . "style.css", $stylesheet . 'body
{padding : 3px;}' . PHP_EOL . '#usernotes {margin-left : inherit;}' . PHP_EOL);
-
- self::headerChm();
break;
case Render::VERBOSE:
parent::update($event, $val);