cvs: phd /formats xhtml.php /themes/php phpdotnet.php
| From: | Hannes Magnusson | Date: | Sat, 03 Nov 2007 16:44:10 +0000 |
| Subject: | cvs: phd /formats xhtml.php /themes/php phpdotnet.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-333@lists.php.net to get a copy of this message | ||
bjori Sat Nov 3 16:44:10 2007 UTC
Modified files:
/phd/formats xhtml.php
/phd/themes/php phpdotnet.php
Log:
Remove sprintf calls
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.39&r2=1.40&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.39 phd/formats/xhtml.php:1.40 --- phd/formats/xhtml.php:1.39 Fri Oct 19 14:23:09 2007 +++ phd/formats/xhtml.php Sat Nov 3 16:44:09 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.39 2007/10/19 14:23:09 bjori Exp $ */ +/* $Id: xhtml.php,v 1.40 2007/11/03 16:44:09 bjori Exp $ */ class XHTMLPhDFormat extends PhDFormat { protected $elementmap = array( /* {{{ */ @@ -267,17 +267,17 @@ } public function transformFromMap($open, $tag, $name, $props) { if ($open) { - return sprintf('<%s class="%s"%s>', $tag, $name, $props["empty"] ? " /" : ""); + return '<' .$tag. ' class="' .$name. '"' . ($props["empty"] ? '/' : "") . '>'; } - return "</$tag>"; + return '</' .$tag. '>'; } public function CDATA($str) { switch($this->role) { case "php": - return sprintf('<div class="phpcode">%s</div>', highlight_string(trim($str), 1)); + return '<div class="phpcode">' .(highlight_string(trim($str), 1)). '</div>'; break; default: - return sprintf('<div class="cdata"><pre>%s</pre></div>', htmlspecialchars($str, ENT_QUOTES, "UTF-8")); + return '<div class="cdata"><pre>' .(htmlspecialchars($str, ENT_QUOTES, "UTF-8")). '</pre></div>'; } } public function TEXT($str) { @@ -307,7 +307,7 @@ public function format_container_chunk($open, $name, $attrs) { if ($open) { - return sprintf('<div id="%s" class="%s">', $attrs[PhDReader::XMLNS_XML]["id"], $name); + return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } return "</div>"; } @@ -320,9 +320,9 @@ public function format_chunk($open, $name, $attrs) { if ($open) { if(isset($attrs[PhDReader::XMLNS_XML]["id"])) { - return sprintf('<div id="%s" class="%s">', $attrs[PhDReader::XMLNS_XML]["id"], $name); + return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } - return sprintf('<div class="%s">', $name); + return '<div class="' .$name. '">'; } return "</div>"; } @@ -331,7 +331,7 @@ if(!isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { $attrs[PhDReader::XMLNS_DOCBOOK] = "unkown"; } - return sprintf('<div class="%s %s">', $name, $attrs[PhDReader::XMLNS_DOCBOOK]["role"]); + return '<div class="' .$name.' ' .$attrs[PhDReader::XMLNS_DOCBOOK]["role"]. '">'; } return "</div>\n"; } @@ -572,7 +572,7 @@ } public function format_varlistentry($open, $name, $attrs) { if ($open) { - return isset($attrs[PhDReader::XMLNS_XML]["id"]) ? sprintf('<dt id="%s">', $attrs[PhDReader::XMLNS_XML]["id"]) : "<dt>\n"; + return isset($attrs[PhDReader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[PhDReader::XMLNS_XML]["id"]. '">' : "<dt>\n"; } return "</dt>\n"; } @@ -584,7 +584,7 @@ } public function format_userinput($open, $name, $attrs) { if ($open) { - return sprintf('<strong class="%s"><code>', $name); + return '<strong class="' .$name. '"><code>'; } return "</code></strong>\n"; } @@ -595,7 +595,7 @@ case "directive": /* FIXME: Different roles should probably be handled differently */ default: - return sprintf('<code class="systemitem %s">', $name); + return '<code class="systemitem ' .$name. '">'; } } return "</code>\n"; @@ -690,9 +690,9 @@ } public function format_imagedata($open, $name, $attrs) { if (isset($this->tmp["mediaobject"]["alt"])) { - return sprintf('<img src="%s" alt="%s" />', $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"], $this->tmp["mediaobject"]["alt"]); + return '<img src="' .$attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]. '" alt="' .$this->tmp["mediaobject"]["alt"]. '" />'; } - return sprintf('<img src="%s" />', $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]); + return '<img src="' .$attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]. '" />'; } public function format_table($open, $name, $attrs) { @@ -709,18 +709,18 @@ return "</colgroup>\n"; } private function parse_table_entry_attributes($attrs) { - $retval = sprintf('align="%s"', $attrs["align"]); + $retval = 'align="' .$attrs["align"]. '"'; if ($attrs["align"] == "char" && isset($attrs["char"])) { - $retval .= sprintf(' char="%s"', htmlspecialchars($attrs["char"], ENT_QUOTES)); + $retval .= ' char="' .(htmlspecialchars($attrs["char"], ENT_QUOTES)). '"'; if (isset($attrs["charoff"])) { - $retval .= sprintf(' charoff="%s"', htmlspecialchars($attrs["charoff"], ENT_QUOTES)); + $retval .= ' charoff="' .(htmlspecialchars($attrs["charoff"], ENT_QUOTES)). '"'; } } if (isset($attrs["valign"])) { - $retval .= sprintf(' valign="%s"', $attrs["valign"]); + $retval .= ' valign="' .$attrs["valign"]. '"'; } if (isset($attrs["colwidth"])) { - $retval .= sprintf(' width="%d"', $attrs["colwidth"]); + $retval .= ' width="' .((int)$attrs["colwidth"]). '"'; } return $retval; } @@ -728,21 +728,21 @@ if ($open) { $str = self::parse_table_entry_attributes(PhDFormat::colspec($attrs[PhDReader::XMLNS_DOCBOOK])); - return sprintf('<col %s />', $str); + return '<col '.$str. ' />'; } /* noop */ } public function format_th($open, $name, $attrs) { if ($open) { $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<%s valign="%s">', $name, $valign); + return '<' .$name. ' valign="' .$valign. '">'; } return "</$name>\n"; } public function format_tbody($open, $name, $attrs) { if ($open) { $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<tbody valign="%s">', $valign); + return '<tbody valign="' .$valign. '">'; } return "</tbody>"; } @@ -750,14 +750,14 @@ if ($open) { PhDFormat::initRow(); $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<tr valign="%s">', $valign); + return '<tr valign="' .$valign. '">'; } return "</tr>\n"; } public function format_th_entry($open, $name, $attrs = array()) { if ($open) { $colspan = PhDFormat::colspan($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<th colspan="%d">', $colspan); + return '<th colspan="' .((int)$colspan). '">'; } return '</th>'; } @@ -778,13 +778,13 @@ $colspan = PhDFormat::colspan($dbattrs); $rowspan = PhDFormat::rowspan($dbattrs); $moreattrs = self::parse_table_entry_attributes($dbattrs); - return sprintf('%s<td colspan="%d" rowspan="%d" %s>', $retval, $colspan, $rowspan, $moreattrs); + return $retval. '<td colspan="' .((int)$colspan). '" rowspan="' .((int)$rowspan). '" ' .$moreattrs. '>'; } return "</td>"; } public function admonition_title($title, $lang) { - return sprintf('<b class="%s">%s</b>', strtolower($title), $this->autogen($title, $lang)); + return '<b class="' .(strtolower($title)). '">' .($this->autogen($title, $lang)). '</b>'; } } http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.27&r2=1.28&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.27 phd/themes/php/phpdotnet.php:1.28 --- phd/themes/php/phpdotnet.php:1.27 Thu Oct 18 16:53:05 2007 +++ phd/themes/php/phpdotnet.php Sat Nov 3 16:44:10 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: phpdotnet.php,v 1.27 2007/10/18 16:53:05 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.28 2007/11/03 16:44:10 bjori Exp $ */ class phpdotnet extends PhDHelper { protected $elementmap = array( @@ -181,15 +181,31 @@ $class .= " external"; } if ($name == "xref") { - return sprintf('<a href="%s%s" class="%s">%s</a>', - $this->chunked ? "" : "#", - $this->chunked ? - $href : (isset($linkto) ? $linkto : $href), - $class, $content . PhDHelper::getDescription($id, false)); + if ($this->chunked) { + $link = $href; + } else { + $link = "#"; + if (isset($linkto)) { + $link .= $linkto; + } else { + $link .= $href; + } + } + return '<a href="' .$link. '" class="' .$class. '">' .($content.PhDHelper::getDescription($id, false)). '</a>'; } elseif ($props["empty"]) { - return sprintf('<a href="%s%s%s" class="%s">%s%2$s</a>', $this->chunked ? "" : "#", $href, $fragment, $class, $content); + if ($this->chunked) { + $link = ""; + } else { + $link = "#"; + } + return '<a href="' .$link.$href.$fragment. '" class="' .$class. '">' .$content.$href.$fragment. '</a>'; } else { - return sprintf('<a href="%s%s%s" class="%s">%s', $this->chunked ? "" : "#", $href, $fragment, $class, $content); + if ($this->chunked) { + $link = ""; + } else { + $link = "#"; + } + return '<a href="' .$link.$href.$fragment. '" class="' .$class. '">' .$content; } } return "</a>"; @@ -217,7 +233,7 @@ } public function format_refpurpose($open, $tag, $attrs) { if ($open) { - return sprintf('<p class="verinfo">(%s)</p><p class="refpurpose">%s â ', htmlspecialchars($this->versionInfo($this->refname), ENT_QUOTES, "UTF-8"), $this->refname); + return '<p class="verinfo">(' .(htmlspecialchars($this->versionInfo($this->refname), ENT_QUOTES, "UTF-8")). ')</p><p class="refpurpose">'. $this->refname. ' â '; } return "</p>\n"; } @@ -259,7 +275,7 @@ } $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_'.$name.'">'; foreach($chunks as $chunkid => $junk) { - $content .= sprintf('<li><a href="%s%s.%s">%s</a></li>', $this->chunked ? "" : "#", $chunkid, $this->ext, PhDHelper::getDescription($chunkid, true)); + $content .= '<li><a href="' .($this->chunked ? "" : "#").$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, true)). '</a></li>'; } $content .= "</ul>\n"; $this->tmp["container_chunk"] = $content; @@ -273,7 +289,7 @@ if (count($chunks) > 1) { $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_reference">'; foreach($chunks as $chunkid => $junk) { - $content .= sprintf('<li><a href="%s%s.%s">%s</a> â %s</li>', $this->chunked ? "" : "#", $chunkid, $this->ext, PhDHelper::getDescription($chunkid, false), PhDHelper::getDescription($chunkid, true)); + $content .= '<li><a href="' .($this->chunked ? "" : "#").$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, false)). '</a> â ' .(PhDHelper::getDescription($chunkid, true)). '</li>'; } $content .= "</ul>\n"; } @@ -307,9 +323,9 @@ $long = PhDHelper::getDescription($chunkid, true); $short = PhDHelper::getDescription($chunkid, false); if ($long && $short && $long != $short) { - $content .= sprintf('<li><a href="%s">%s</a> â %s', $href, $short, $long); + $content .= '<li><a href="' .$href. '">' .$short. '</a> â ' .$long; } else { - $content .= sprintf('<li><a href="%s">%s</a>', $href, $long ? $long : $short); + $content .= '<li><a href="' .$href. '">' .($long ? $long : $short). '</a>'; } $children = PhDHelper::getChildren($chunkid); if (count($children)) { @@ -319,9 +335,9 @@ $long = PhDHelper::getDescription($childid, true); $short = PhDHelper::getDescription($childid, false); if ($long && $short && $long != $short) { - $content .= sprintf('<li><a href="%s">%s</a> â %s</li>', $href, $short, $long); + $content .= '<li><a href="' .$href. '">' .$short. '</a> â ' .$long. '</li>'; } else { - $content .= sprintf('<li><a href="%s">%s</a></li>', $href, $long ? $long : $short); + $content .= '<li><a href="' .$href. '">' .($long ? $long : $short). '</a></li>'; } } $content .="</ul>"; @@ -341,10 +357,10 @@ $link = strtolower(str_replace(array("__", "_", "::", "->"), array("", "-", "-", "-"), $value)); if ($this->CURRENT_FUNCTION === $link || !($filename = PhDHelper::getFilename("function.$link"))) { - return sprintf("<b>%s%s</b>", $value, $tag == "function" ? "()" : ""); + return '<b>' .$value.($tag == "function" ? "()" : ""). '</b>'; } - return sprintf('<a href="%s%s.%s" class="function">%s%s</a>', $this->chunked ? "" : "#", $filename, $this->ext, $value, $tag == "function" ? "()" : ""); + return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$value.($tag == "function" ? "()" : ""). '</a>'; } public function format_type_text($type, $tagname) { $t = strtolower($type); @@ -378,12 +394,12 @@ break; } if ($href && $this->chunked) { - return sprintf('<a href="%s.%s%s" class="%s %s">%5$s</a>', $href, $this->ext, ($fragment ? "#$fragment" : ""), $tagname, $type); + return '<a href="' .$href. '.' .$this->ext.($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } if ($href) { - return sprintf('<a href="#%s" class="%s %s">%3$s</a>', $fragment ? $fragment : $href, $tagname, $type); + return '<a href="#' .($fragment ? $fragment : $href). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } - return sprintf('<span class="%s %s">%2$s</span>', $tagname, $type); + return '<span class="' .$tagname. ' ' .$type. '">' .$type. '</span>'; } public function format_example_title($open, $name, $attrs, $props) { @@ -413,7 +429,7 @@ $ret = '<div class="qandaset"><ol class="qandaset_questions">'; $i = 0; foreach($nlist as $node) { - $ret .= sprintf('<li><a href="#%s">%s</a></li>', $this->tmp["qandaentry"][$i++], htmlspecialchars($node->textContent,ENT_QUOTES, "UTF-8")); + $ret .= '<li><a href="#' .($this->tmp["qandaentry"][$i++]). '">' .(htmlspecialchars($node->textContent,ENT_QUOTES, "UTF-8")). '</a></li>'; } return $ret.'</ul>'.$xml.'</div>';
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.39&r2=1.40&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.39 phd/formats/xhtml.php:1.40 --- phd/formats/xhtml.php:1.39 Fri Oct 19 14:23:09 2007 +++ phd/formats/xhtml.php Sat Nov 3 16:44:09 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.39 2007/10/19 14:23:09 bjori Exp $ */ +/* $Id: xhtml.php,v 1.40 2007/11/03 16:44:09 bjori Exp $ */ class XHTMLPhDFormat extends PhDFormat { protected $elementmap = array( /* {{{ */ @@ -267,17 +267,17 @@ } public function transformFromMap($open, $tag, $name, $props) { if ($open) { - return sprintf('<%s class="%s"%s>', $tag, $name, $props["empty"] ? " /" : ""); + return '<' .$tag. ' class="' .$name. '"' . ($props["empty"] ? '/' : "") . '>'; } - return "</$tag>"; + return '</' .$tag. '>'; } public function CDATA($str) { switch($this->role) { case "php": - return sprintf('<div class="phpcode">%s</div>', highlight_string(trim($str), 1)); + return '<div class="phpcode">' .(highlight_string(trim($str), 1)). '</div>'; break; default: - return sprintf('<div class="cdata"><pre>%s</pre></div>', htmlspecialchars($str, ENT_QUOTES, "UTF-8")); + return '<div class="cdata"><pre>' .(htmlspecialchars($str, ENT_QUOTES, "UTF-8")). '</pre></div>'; } } public function TEXT($str) { @@ -307,7 +307,7 @@ public function format_container_chunk($open, $name, $attrs) { if ($open) { - return sprintf('<div id="%s" class="%s">', $attrs[PhDReader::XMLNS_XML]["id"], $name); + return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } return "</div>"; } @@ -320,9 +320,9 @@ public function format_chunk($open, $name, $attrs) { if ($open) { if(isset($attrs[PhDReader::XMLNS_XML]["id"])) { - return sprintf('<div id="%s" class="%s">', $attrs[PhDReader::XMLNS_XML]["id"], $name); + return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } - return sprintf('<div class="%s">', $name); + return '<div class="' .$name. '">'; } return "</div>"; } @@ -331,7 +331,7 @@ if(!isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { $attrs[PhDReader::XMLNS_DOCBOOK] = "unkown"; } - return sprintf('<div class="%s %s">', $name, $attrs[PhDReader::XMLNS_DOCBOOK]["role"]); + return '<div class="' .$name.' ' .$attrs[PhDReader::XMLNS_DOCBOOK]["role"]. '">'; } return "</div>\n"; } @@ -572,7 +572,7 @@ } public function format_varlistentry($open, $name, $attrs) { if ($open) { - return isset($attrs[PhDReader::XMLNS_XML]["id"]) ? sprintf('<dt id="%s">', $attrs[PhDReader::XMLNS_XML]["id"]) : "<dt>\n"; + return isset($attrs[PhDReader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[PhDReader::XMLNS_XML]["id"]. '">' : "<dt>\n"; } return "</dt>\n"; } @@ -584,7 +584,7 @@ } public function format_userinput($open, $name, $attrs) { if ($open) { - return sprintf('<strong class="%s"><code>', $name); + return '<strong class="' .$name. '"><code>'; } return "</code></strong>\n"; } @@ -595,7 +595,7 @@ case "directive": /* FIXME: Different roles should probably be handled differently */ default: - return sprintf('<code class="systemitem %s">', $name); + return '<code class="systemitem ' .$name. '">'; } } return "</code>\n"; @@ -690,9 +690,9 @@ } public function format_imagedata($open, $name, $attrs) { if (isset($this->tmp["mediaobject"]["alt"])) { - return sprintf('<img src="%s" alt="%s" />', $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"], $this->tmp["mediaobject"]["alt"]); + return '<img src="' .$attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]. '" alt="' .$this->tmp["mediaobject"]["alt"]. '" />'; } - return sprintf('<img src="%s" />', $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]); + return '<img src="' .$attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]. '" />'; } public function format_table($open, $name, $attrs) { @@ -709,18 +709,18 @@ return "</colgroup>\n"; } private function parse_table_entry_attributes($attrs) { - $retval = sprintf('align="%s"', $attrs["align"]); + $retval = 'align="' .$attrs["align"]. '"'; if ($attrs["align"] == "char" && isset($attrs["char"])) { - $retval .= sprintf(' char="%s"', htmlspecialchars($attrs["char"], ENT_QUOTES)); + $retval .= ' char="' .(htmlspecialchars($attrs["char"], ENT_QUOTES)). '"'; if (isset($attrs["charoff"])) { - $retval .= sprintf(' charoff="%s"', htmlspecialchars($attrs["charoff"], ENT_QUOTES)); + $retval .= ' charoff="' .(htmlspecialchars($attrs["charoff"], ENT_QUOTES)). '"'; } } if (isset($attrs["valign"])) { - $retval .= sprintf(' valign="%s"', $attrs["valign"]); + $retval .= ' valign="' .$attrs["valign"]. '"'; } if (isset($attrs["colwidth"])) { - $retval .= sprintf(' width="%d"', $attrs["colwidth"]); + $retval .= ' width="' .((int)$attrs["colwidth"]). '"'; } return $retval; } @@ -728,21 +728,21 @@ if ($open) { $str = self::parse_table_entry_attributes(PhDFormat::colspec($attrs[PhDReader::XMLNS_DOCBOOK])); - return sprintf('<col %s />', $str); + return '<col '.$str. ' />'; } /* noop */ } public function format_th($open, $name, $attrs) { if ($open) { $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<%s valign="%s">', $name, $valign); + return '<' .$name. ' valign="' .$valign. '">'; } return "</$name>\n"; } public function format_tbody($open, $name, $attrs) { if ($open) { $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<tbody valign="%s">', $valign); + return '<tbody valign="' .$valign. '">'; } return "</tbody>"; } @@ -750,14 +750,14 @@ if ($open) { PhDFormat::initRow(); $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<tr valign="%s">', $valign); + return '<tr valign="' .$valign. '">'; } return "</tr>\n"; } public function format_th_entry($open, $name, $attrs = array()) { if ($open) { $colspan = PhDFormat::colspan($attrs[PhDReader::XMLNS_DOCBOOK]); - return sprintf('<th colspan="%d">', $colspan); + return '<th colspan="' .((int)$colspan). '">'; } return '</th>'; } @@ -778,13 +778,13 @@ $colspan = PhDFormat::colspan($dbattrs); $rowspan = PhDFormat::rowspan($dbattrs); $moreattrs = self::parse_table_entry_attributes($dbattrs); - return sprintf('%s<td colspan="%d" rowspan="%d" %s>', $retval, $colspan, $rowspan, $moreattrs); + return $retval. '<td colspan="' .((int)$colspan). '" rowspan="' .((int)$rowspan). '" ' .$moreattrs. '>'; } return "</td>"; } public function admonition_title($title, $lang) { - return sprintf('<b class="%s">%s</b>', strtolower($title), $this->autogen($title, $lang)); + return '<b class="' .(strtolower($title)). '">' .($this->autogen($title, $lang)). '</b>'; } } http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.27&r2=1.28&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.27 phd/themes/php/phpdotnet.php:1.28 --- phd/themes/php/phpdotnet.php:1.27 Thu Oct 18 16:53:05 2007 +++ phd/themes/php/phpdotnet.php Sat Nov 3 16:44:10 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: phpdotnet.php,v 1.27 2007/10/18 16:53:05 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.28 2007/11/03 16:44:10 bjori Exp $ */ class phpdotnet extends PhDHelper { protected $elementmap = array( @@ -181,15 +181,31 @@ $class .= " external"; } if ($name == "xref") { - return sprintf('<a href="%s%s" class="%s">%s</a>', - $this->chunked ? "" : "#", - $this->chunked ? - $href : (isset($linkto) ? $linkto : $href), - $class, $content . PhDHelper::getDescription($id, false)); + if ($this->chunked) { + $link = $href; + } else { + $link = "#"; + if (isset($linkto)) { + $link .= $linkto; + } else { + $link .= $href; + } + } + return '<a href="' .$link. '" class="' .$class. '">' .($content.PhDHelper::getDescription($id, false)). '</a>'; } elseif ($props["empty"]) { - return sprintf('<a href="%s%s%s" class="%s">%s%2$s</a>', $this->chunked ? "" : "#", $href, $fragment, $class, $content); + if ($this->chunked) { + $link = ""; + } else { + $link = "#"; + } + return '<a href="' .$link.$href.$fragment. '" class="' .$class. '">' .$content.$href.$fragment. '</a>'; } else { - return sprintf('<a href="%s%s%s" class="%s">%s', $this->chunked ? "" : "#", $href, $fragment, $class, $content); + if ($this->chunked) { + $link = ""; + } else { + $link = "#"; + } + return '<a href="' .$link.$href.$fragment. '" class="' .$class. '">' .$content; } } return "</a>"; @@ -217,7 +233,7 @@ } public function format_refpurpose($open, $tag, $attrs) { if ($open) { - return sprintf('<p class="verinfo">(%s)</p><p class="refpurpose">%s â ', htmlspecialchars($this->versionInfo($this->refname), ENT_QUOTES, "UTF-8"), $this->refname); + return '<p class="verinfo">(' .(htmlspecialchars($this->versionInfo($this->refname), ENT_QUOTES, "UTF-8")). ')</p><p class="refpurpose">'. $this->refname. ' â '; } return "</p>\n"; } @@ -259,7 +275,7 @@ } $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_'.$name.'">'; foreach($chunks as $chunkid => $junk) { - $content .= sprintf('<li><a href="%s%s.%s">%s</a></li>', $this->chunked ? "" : "#", $chunkid, $this->ext, PhDHelper::getDescription($chunkid, true)); + $content .= '<li><a href="' .($this->chunked ? "" : "#").$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, true)). '</a></li>'; } $content .= "</ul>\n"; $this->tmp["container_chunk"] = $content; @@ -273,7 +289,7 @@ if (count($chunks) > 1) { $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_reference">'; foreach($chunks as $chunkid => $junk) { - $content .= sprintf('<li><a href="%s%s.%s">%s</a> â %s</li>', $this->chunked ? "" : "#", $chunkid, $this->ext, PhDHelper::getDescription($chunkid, false), PhDHelper::getDescription($chunkid, true)); + $content .= '<li><a href="' .($this->chunked ? "" : "#").$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, false)). '</a> â ' .(PhDHelper::getDescription($chunkid, true)). '</li>'; } $content .= "</ul>\n"; } @@ -307,9 +323,9 @@ $long = PhDHelper::getDescription($chunkid, true); $short = PhDHelper::getDescription($chunkid, false); if ($long && $short && $long != $short) { - $content .= sprintf('<li><a href="%s">%s</a> â %s', $href, $short, $long); + $content .= '<li><a href="' .$href. '">' .$short. '</a> â ' .$long; } else { - $content .= sprintf('<li><a href="%s">%s</a>', $href, $long ? $long : $short); + $content .= '<li><a href="' .$href. '">' .($long ? $long : $short). '</a>'; } $children = PhDHelper::getChildren($chunkid); if (count($children)) { @@ -319,9 +335,9 @@ $long = PhDHelper::getDescription($childid, true); $short = PhDHelper::getDescription($childid, false); if ($long && $short && $long != $short) { - $content .= sprintf('<li><a href="%s">%s</a> â %s</li>', $href, $short, $long); + $content .= '<li><a href="' .$href. '">' .$short. '</a> â ' .$long. '</li>'; } else { - $content .= sprintf('<li><a href="%s">%s</a></li>', $href, $long ? $long : $short); + $content .= '<li><a href="' .$href. '">' .($long ? $long : $short). '</a></li>'; } } $content .="</ul>"; @@ -341,10 +357,10 @@ $link = strtolower(str_replace(array("__", "_", "::", "->"), array("", "-", "-", "-"), $value)); if ($this->CURRENT_FUNCTION === $link || !($filename = PhDHelper::getFilename("function.$link"))) { - return sprintf("<b>%s%s</b>", $value, $tag == "function" ? "()" : ""); + return '<b>' .$value.($tag == "function" ? "()" : ""). '</b>'; } - return sprintf('<a href="%s%s.%s" class="function">%s%s</a>', $this->chunked ? "" : "#", $filename, $this->ext, $value, $tag == "function" ? "()" : ""); + return '<a href="' .($this->chunked ? "" : "#").$filename. '.' .$this->ext. '" class="function">' .$value.($tag == "function" ? "()" : ""). '</a>'; } public function format_type_text($type, $tagname) { $t = strtolower($type); @@ -378,12 +394,12 @@ break; } if ($href && $this->chunked) { - return sprintf('<a href="%s.%s%s" class="%s %s">%5$s</a>', $href, $this->ext, ($fragment ? "#$fragment" : ""), $tagname, $type); + return '<a href="' .$href. '.' .$this->ext.($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } if ($href) { - return sprintf('<a href="#%s" class="%s %s">%3$s</a>', $fragment ? $fragment : $href, $tagname, $type); + return '<a href="#' .($fragment ? $fragment : $href). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>'; } - return sprintf('<span class="%s %s">%2$s</span>', $tagname, $type); + return '<span class="' .$tagname. ' ' .$type. '">' .$type. '</span>'; } public function format_example_title($open, $name, $attrs, $props) { @@ -413,7 +429,7 @@ $ret = '<div class="qandaset"><ol class="qandaset_questions">'; $i = 0; foreach($nlist as $node) { - $ret .= sprintf('<li><a href="#%s">%s</a></li>', $this->tmp["qandaentry"][$i++], htmlspecialchars($node->textContent,ENT_QUOTES, "UTF-8")); + $ret .= '<li><a href="#' .($this->tmp["qandaentry"][$i++]). '">' .(htmlspecialchars($node->textContent,ENT_QUOTES, "UTF-8")). '</a></li>'; } return $ret.'</ul>'.$xml.'</div>';