cvs: phd(PHD_0_4) /themes/php chmsource.php
| From: | Christian Weiske | Date: | Fri, 07 Nov 2008 22:45:41 +0000 |
| Subject: | cvs: phd(PHD_0_4) /themes/php chmsource.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2474@lists.php.net to get a copy of this message | ||
cweiske Fri Nov 7 22:45:41 2008 UTC
Modified files: (Branch: PHD_0_4)
/phd/themes/php chmsource.php
Log:
Merge from head:
- whitespace changes
- move one function up
http://cvs.php.net/viewvc.cgi/phd/themes/php/chmsource.php?r1=1.4.2.5.2.3&r2=1.4.2.5.2.4&diff_format=u Index: phd/themes/php/chmsource.php diff -u phd/themes/php/chmsource.php:1.4.2.5.2.3 phd/themes/php/chmsource.php:1.4.2.5.2.4 --- phd/themes/php/chmsource.php:1.4.2.5.2.3 Sun Oct 26 00:05:04 2008 +++ phd/themes/php/chmsource.php Fri Nov 7 22:45:41 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: chmsource.php,v 1.4.2.5.2.3 2008/10/26 00:05:04 loudi Exp $ */ +/* $Id: chmsource.php,v 1.4.2.5.2.4 2008/11/07 22:45:41 cweiske Exp $ */ require_once $ROOT . '/themes/php/chunkedhtml.php'; class chmsource extends chunkedhtml { @@ -14,160 +14,160 @@ // Font list: http://www.microsoft.com/office/ork/xp/three/inte03.htm private $LANGUAGES = array( "hk" => array( - "langcode" => "0xc04 Hong Kong Cantonese", - "preferred_charset" => "CP950", - "mime_charset_name" => "Big5", - "preferred_font" => "MingLiu,10,0" + "langcode" => "0xc04 Hong Kong Cantonese", + "preferred_charset" => "CP950", + "mime_charset_name" => "Big5", + "preferred_font" => "MingLiu,10,0" ), "tw" => array( - "langcode" => "0x404 Traditional Chinese", - "preferred_charset" => "CP950", - "mime_charset_name" => "Big5", - "preferred_font" => "MingLiu,10,0" + "langcode" => "0x404 Traditional Chinese", + "preferred_charset" => "CP950", + "mime_charset_name" => "Big5", + "preferred_font" => "MingLiu,10,0" ), "cs" => array( - "langcode" => "0x405 Czech", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT, + "langcode" => "0x405 Czech", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT, ), "da" => array( - "langcode" => "0x406 Danish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Manualen" + "langcode" => "0x406 Danish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Manualen" ), "de" => array( - "langcode" => "0x407 German (Germany)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Handbuch", + "langcode" => "0x407 German (Germany)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Handbuch", ), "el" => array( - "langcode" => "0x408 Greek", - "preferred_charset" => "Windows-1253", - "mime_charset_name" => "Windows-1253", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x408 Greek", + "preferred_charset" => "Windows-1253", + "mime_charset_name" => "Windows-1253", + "preferred_font" => self::DEFAULT_FONT ), "en" => array( - "langcode" => "0x809 English (United Kingdom)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Manual", + "langcode" => "0x809 English (United Kingdom)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Manual", ), "es" => array( - "langcode" => "0xc0a Spanish (International Sort)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0xc0a Spanish (International Sort)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "fr" => array( - "langcode" => "0x40c French (France)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manuel PHP" + "langcode" => "0x40c French (France)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manuel PHP" ), "fi" => array( - "langcode" => "0x40b Finnish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40b Finnish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "he" => array( - "langcode" => "0x40d Hebrew", - "preferred_charset" => "Windows-1255", - "mime_charset_name" => "Windows-1255", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40d Hebrew", + "preferred_charset" => "Windows-1255", + "mime_charset_name" => "Windows-1255", + "preferred_font" => self::DEFAULT_FONT ), "hu" => array( - "langcode" => "0x40e Hungarian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40e Hungarian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "it" => array( - "langcode" => "0x410 Italian (Italy)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manuale PHP", + "langcode" => "0x410 Italian (Italy)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manuale PHP", ), "ja" => array( - "langcode" => "0x411 Japanese", - "preferred_charset" => "CP932", - "mime_charset_name" => "csWindows31J", - "preferred_font" => "MS PGothic,10,0" + "langcode" => "0x411 Japanese", + "preferred_charset" => "CP932", + "mime_charset_name" => "csWindows31J", + "preferred_font" => "MS PGothic,10,0" ), "kr" => array( - "langcode" => "0x412 Korean", - "preferred_charset" => "CP949", - "mime_charset_name" => "EUC-KR", - "preferred_font" => "Gulim,10,0" + "langcode" => "0x412 Korean", + "preferred_charset" => "CP949", + "mime_charset_name" => "EUC-KR", + "preferred_font" => "Gulim,10,0" ), "nl" => array( - "langcode" => "0x413 Dutch (Netherlands)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x413 Dutch (Netherlands)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "no" => array( - "langcode" => "0x414 Norwegian (Bokmal)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x414 Norwegian (Bokmal)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "pl" => array( - "langcode" => "0x415 Polish", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x415 Polish", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "pt_BR" => array( - "langcode" => "0x416 Portuguese (Brazil)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manual do PHP", + "langcode" => "0x416 Portuguese (Brazil)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manual do PHP", ), "ro" => array( - "langcode" => "0x418 Romanian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x418 Romanian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "ru" => array( - "langcode" => "0x419 Russian", - "preferred_charset" => "Windows-1251", - "mime_charset_name" => "Windows-1251", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x419 Russian", + "preferred_charset" => "Windows-1251", + "mime_charset_name" => "Windows-1251", + "preferred_font" => self::DEFAULT_FONT ), "sk" => array( - "langcode" => "0x41b Slovak", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x41b Slovak", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "sl" => array( - "langcode" => "0x424 Slovenian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x424 Slovenian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "sv" => array( - "langcode" => "0x41d Swedish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x41d Swedish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "zh" => array( - "langcode" => "0x804 Simplified Chinese", - "preferred_charset" => "CP936", - "mime_charset_name" => "gb2312", - "preferred_font" => "simsun,10,0" + "langcode" => "0x804 Simplified Chinese", + "preferred_charset" => "CP936", + "mime_charset_name" => "gb2312", + "preferred_font" => "simsun,10,0" ) ); @@ -189,26 +189,26 @@ if(!file_exists($this->chmdir) || is_file($this->chmdir)) mkdir($this->chmdir) or die("Can't create the CHM project directory"); $this->outputdir = $GLOBALS['OPTIONS']['output_dir'] . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; - if(!file_exists($this->outputdir) || is_file($this->outputdir)) + if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); $lang = $GLOBALS['OPTIONS']['language']; - $this->hhpStream = fopen($this->chmdir . "php_manual_{$lang}.hhp", "w"); - $this->hhcStream = fopen($this->chmdir . "php_manual_{$lang}.hhc", "w"); - $this->hhkStream = fopen($this->chmdir . "php_manual_{$lang}.hhk", "w"); + $this->hhpStream = fopen($this->chmdir . "php_manual_{$lang}.hhp", "w"); + $this->hhcStream = fopen($this->chmdir . "php_manual_{$lang}.hhc", "w"); + $this->hhkStream = fopen($this->chmdir . "php_manual_{$lang}.hhk", "w"); - file_put_contents($this->outputdir . "style.css", $this->fetchStylesheet() . PHP_EOL . 'body { padding : 3px;}'); + file_put_contents($this->outputdir . "style.css", $this->fetchStylesheet() . PHP_EOL . 'body { padding : 3px;}'); - self::headerChm(); + self::headerChm(); } public function __destruct() { self::footerChm(); - + fclose($this->hhpStream); fclose($this->hhcStream); fclose($this->hhkStream); - + chunkedhtml::__destruct(); } @@ -282,34 +282,39 @@ <ul> '); } - + protected function footerChm() { - fwrite($this->hhcStream, " </ul>\n" . - " </body>\n" . - "</html>\n"); - fwrite($this->hhkStream, " </ul>\n" . - " </body>\n" . - "</html>\n"); + fwrite($this->hhcStream, " </ul>\n" . + " </body>\n" . + "</html>\n"); + fwrite($this->hhkStream, " </ul>\n" . + " </body>\n" . + "</html>\n"); } - + public function appendData($data, $isChunk) { if ($this->lastContent) $this->appendChm($this->lastContent["name"], $this->lastContent["reference"], - $isChunk, $this->lastContent["hasChild"]); + $isChunk, $this->lastContent["hasChild"]); $this->lastContent = null; return parent::appendData($data, $isChunk); } - + public function format_chunk($open, $name, $attrs, $props) { $this->collectContent($attrs); return parent::format_chunk($open, $name, $attrs, $props); } - + public function format_container_chunk($open, $name, $attrs, $props) { $this->collectContent($attrs); return parent::format_container_chunk($open, $name, $attrs, $props); } + public function format_root_chunk($open, $name, $attrs) { + $this->collectContent($attrs); + return parent::format_root_chunk($open, $name, $attrs); + } + public function format_varlistentry($open, $name, $attrs) { $this->collectContent($attrs); fwrite($this->hhkStream, " <li><object type=\"text/sitemap\">\n" . @@ -318,19 +323,17 @@ " </object>\n </li>\n"); return false; } - public function format_root_chunk($open, $name, $attrs) { - $this->collectContent($attrs); - return parent::format_root_chunk($open, $name, $attrs); - } public function header($id) { $header = parent::header($id); // Add CSS link to <head> $header = ereg_replace('( *)</head>','\\1 <link media="all" rel="stylesheet" type="text/css" href="style.css"/> - \\1</head>', $header); + \\1</head>', $header); return $header; } - + + + private function collectContent($attrs) { if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { $id = $attrs[PhDReader::XMLNS_XML]["id"]; @@ -342,7 +345,7 @@ ); } } - + private function fetchStylesheet() { $stylesheet = file_get_contents("http://www.php.net/styles/site.css"); if ($stylesheet) return $stylesheet; @@ -351,7 +354,7 @@ return ""; } } - + private function offset($offset) { $spaces = ""; for ($i = 0; $i < $offset + 2 * $this->currentTocDepth; $i++)
http://cvs.php.net/viewvc.cgi/phd/themes/php/chmsource.php?r1=1.4.2.5.2.3&r2=1.4.2.5.2.4&diff_format=u Index: phd/themes/php/chmsource.php diff -u phd/themes/php/chmsource.php:1.4.2.5.2.3 phd/themes/php/chmsource.php:1.4.2.5.2.4 --- phd/themes/php/chmsource.php:1.4.2.5.2.3 Sun Oct 26 00:05:04 2008 +++ phd/themes/php/chmsource.php Fri Nov 7 22:45:41 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: chmsource.php,v 1.4.2.5.2.3 2008/10/26 00:05:04 loudi Exp $ */ +/* $Id: chmsource.php,v 1.4.2.5.2.4 2008/11/07 22:45:41 cweiske Exp $ */ require_once $ROOT . '/themes/php/chunkedhtml.php'; class chmsource extends chunkedhtml { @@ -14,160 +14,160 @@ // Font list: http://www.microsoft.com/office/ork/xp/three/inte03.htm private $LANGUAGES = array( "hk" => array( - "langcode" => "0xc04 Hong Kong Cantonese", - "preferred_charset" => "CP950", - "mime_charset_name" => "Big5", - "preferred_font" => "MingLiu,10,0" + "langcode" => "0xc04 Hong Kong Cantonese", + "preferred_charset" => "CP950", + "mime_charset_name" => "Big5", + "preferred_font" => "MingLiu,10,0" ), "tw" => array( - "langcode" => "0x404 Traditional Chinese", - "preferred_charset" => "CP950", - "mime_charset_name" => "Big5", - "preferred_font" => "MingLiu,10,0" + "langcode" => "0x404 Traditional Chinese", + "preferred_charset" => "CP950", + "mime_charset_name" => "Big5", + "preferred_font" => "MingLiu,10,0" ), "cs" => array( - "langcode" => "0x405 Czech", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT, + "langcode" => "0x405 Czech", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT, ), "da" => array( - "langcode" => "0x406 Danish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Manualen" + "langcode" => "0x406 Danish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Manualen" ), "de" => array( - "langcode" => "0x407 German (Germany)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Handbuch", + "langcode" => "0x407 German (Germany)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Handbuch", ), "el" => array( - "langcode" => "0x408 Greek", - "preferred_charset" => "Windows-1253", - "mime_charset_name" => "Windows-1253", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x408 Greek", + "preferred_charset" => "Windows-1253", + "mime_charset_name" => "Windows-1253", + "preferred_font" => self::DEFAULT_FONT ), "en" => array( - "langcode" => "0x809 English (United Kingdom)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "PHP Manual", + "langcode" => "0x809 English (United Kingdom)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "PHP Manual", ), "es" => array( - "langcode" => "0xc0a Spanish (International Sort)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0xc0a Spanish (International Sort)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "fr" => array( - "langcode" => "0x40c French (France)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manuel PHP" + "langcode" => "0x40c French (France)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manuel PHP" ), "fi" => array( - "langcode" => "0x40b Finnish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40b Finnish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "he" => array( - "langcode" => "0x40d Hebrew", - "preferred_charset" => "Windows-1255", - "mime_charset_name" => "Windows-1255", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40d Hebrew", + "preferred_charset" => "Windows-1255", + "mime_charset_name" => "Windows-1255", + "preferred_font" => self::DEFAULT_FONT ), "hu" => array( - "langcode" => "0x40e Hungarian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x40e Hungarian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "it" => array( - "langcode" => "0x410 Italian (Italy)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manuale PHP", + "langcode" => "0x410 Italian (Italy)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manuale PHP", ), "ja" => array( - "langcode" => "0x411 Japanese", - "preferred_charset" => "CP932", - "mime_charset_name" => "csWindows31J", - "preferred_font" => "MS PGothic,10,0" + "langcode" => "0x411 Japanese", + "preferred_charset" => "CP932", + "mime_charset_name" => "csWindows31J", + "preferred_font" => "MS PGothic,10,0" ), "kr" => array( - "langcode" => "0x412 Korean", - "preferred_charset" => "CP949", - "mime_charset_name" => "EUC-KR", - "preferred_font" => "Gulim,10,0" + "langcode" => "0x412 Korean", + "preferred_charset" => "CP949", + "mime_charset_name" => "EUC-KR", + "preferred_font" => "Gulim,10,0" ), "nl" => array( - "langcode" => "0x413 Dutch (Netherlands)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x413 Dutch (Netherlands)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "no" => array( - "langcode" => "0x414 Norwegian (Bokmal)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x414 Norwegian (Bokmal)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "pl" => array( - "langcode" => "0x415 Polish", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x415 Polish", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "pt_BR" => array( - "langcode" => "0x416 Portuguese (Brazil)", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT, - "title" => "Manual do PHP", + "langcode" => "0x416 Portuguese (Brazil)", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT, + "title" => "Manual do PHP", ), "ro" => array( - "langcode" => "0x418 Romanian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x418 Romanian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "ru" => array( - "langcode" => "0x419 Russian", - "preferred_charset" => "Windows-1251", - "mime_charset_name" => "Windows-1251", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x419 Russian", + "preferred_charset" => "Windows-1251", + "mime_charset_name" => "Windows-1251", + "preferred_font" => self::DEFAULT_FONT ), "sk" => array( - "langcode" => "0x41b Slovak", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x41b Slovak", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "sl" => array( - "langcode" => "0x424 Slovenian", - "preferred_charset" => "Windows-1250", - "mime_charset_name" => "Windows-1250", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x424 Slovenian", + "preferred_charset" => "Windows-1250", + "mime_charset_name" => "Windows-1250", + "preferred_font" => self::DEFAULT_FONT ), "sv" => array( - "langcode" => "0x41d Swedish", - "preferred_charset" => "Windows-1252", - "mime_charset_name" => "Windows-1252", - "preferred_font" => self::DEFAULT_FONT + "langcode" => "0x41d Swedish", + "preferred_charset" => "Windows-1252", + "mime_charset_name" => "Windows-1252", + "preferred_font" => self::DEFAULT_FONT ), "zh" => array( - "langcode" => "0x804 Simplified Chinese", - "preferred_charset" => "CP936", - "mime_charset_name" => "gb2312", - "preferred_font" => "simsun,10,0" + "langcode" => "0x804 Simplified Chinese", + "preferred_charset" => "CP936", + "mime_charset_name" => "gb2312", + "preferred_font" => "simsun,10,0" ) ); @@ -189,26 +189,26 @@ if(!file_exists($this->chmdir) || is_file($this->chmdir)) mkdir($this->chmdir) or die("Can't create the CHM project directory"); $this->outputdir = $GLOBALS['OPTIONS']['output_dir'] . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; - if(!file_exists($this->outputdir) || is_file($this->outputdir)) + if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); $lang = $GLOBALS['OPTIONS']['language']; - $this->hhpStream = fopen($this->chmdir . "php_manual_{$lang}.hhp", "w"); - $this->hhcStream = fopen($this->chmdir . "php_manual_{$lang}.hhc", "w"); - $this->hhkStream = fopen($this->chmdir . "php_manual_{$lang}.hhk", "w"); + $this->hhpStream = fopen($this->chmdir . "php_manual_{$lang}.hhp", "w"); + $this->hhcStream = fopen($this->chmdir . "php_manual_{$lang}.hhc", "w"); + $this->hhkStream = fopen($this->chmdir . "php_manual_{$lang}.hhk", "w"); - file_put_contents($this->outputdir . "style.css", $this->fetchStylesheet() . PHP_EOL . 'body { padding : 3px;}'); + file_put_contents($this->outputdir . "style.css", $this->fetchStylesheet() . PHP_EOL . 'body { padding : 3px;}'); - self::headerChm(); + self::headerChm(); } public function __destruct() { self::footerChm(); - + fclose($this->hhpStream); fclose($this->hhcStream); fclose($this->hhkStream); - + chunkedhtml::__destruct(); } @@ -282,34 +282,39 @@ <ul> '); } - + protected function footerChm() { - fwrite($this->hhcStream, " </ul>\n" . - " </body>\n" . - "</html>\n"); - fwrite($this->hhkStream, " </ul>\n" . - " </body>\n" . - "</html>\n"); + fwrite($this->hhcStream, " </ul>\n" . + " </body>\n" . + "</html>\n"); + fwrite($this->hhkStream, " </ul>\n" . + " </body>\n" . + "</html>\n"); } - + public function appendData($data, $isChunk) { if ($this->lastContent) $this->appendChm($this->lastContent["name"], $this->lastContent["reference"], - $isChunk, $this->lastContent["hasChild"]); + $isChunk, $this->lastContent["hasChild"]); $this->lastContent = null; return parent::appendData($data, $isChunk); } - + public function format_chunk($open, $name, $attrs, $props) { $this->collectContent($attrs); return parent::format_chunk($open, $name, $attrs, $props); } - + public function format_container_chunk($open, $name, $attrs, $props) { $this->collectContent($attrs); return parent::format_container_chunk($open, $name, $attrs, $props); } + public function format_root_chunk($open, $name, $attrs) { + $this->collectContent($attrs); + return parent::format_root_chunk($open, $name, $attrs); + } + public function format_varlistentry($open, $name, $attrs) { $this->collectContent($attrs); fwrite($this->hhkStream, " <li><object type=\"text/sitemap\">\n" . @@ -318,19 +323,17 @@ " </object>\n </li>\n"); return false; } - public function format_root_chunk($open, $name, $attrs) { - $this->collectContent($attrs); - return parent::format_root_chunk($open, $name, $attrs); - } public function header($id) { $header = parent::header($id); // Add CSS link to <head> $header = ereg_replace('( *)</head>','\\1 <link media="all" rel="stylesheet" type="text/css" href="style.css"/> - \\1</head>', $header); + \\1</head>', $header); return $header; } - + + + private function collectContent($attrs) { if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { $id = $attrs[PhDReader::XMLNS_XML]["id"]; @@ -342,7 +345,7 @@ ); } } - + private function fetchStylesheet() { $stylesheet = file_get_contents("http://www.php.net/styles/site.css"); if ($stylesheet) return $stylesheet; @@ -351,7 +354,7 @@ return ""; } } - + private function offset($offset) { $spaces = ""; for ($i = 0; $i < $offset + 2 * $this->currentTocDepth; $i++)