For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > August 2007 > Fwd: [PHP-DOC] cvs: phd / build.php /themes/php phpweb.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fwd: [PHP-DOC] cvs: phd / build.php /themes/php phpweb.php
Hannes Magnusson

2007-08-19, 7:02 pm

Hi guys.

After this commit you no longer need to patch PHP.
This is though a total hack, imo, and we need some kind of array
sing functions in PHP :]

-Hannes

---------- Forwarded message ----------
From: Hannes Magnusson <bjori@php.net>
Date: Aug 19, 2007 3:19 PM
Subject: [PHP-DOC] cvs: phd / build.php /themes/php phpweb.php
To: phpdoc@lists.php.net


bjori Sun Aug 19 13:19:48 2007 UTC

Modified files:
/phd build.php
/phd/themes/php phpweb.php
Log:
Add a array-sing-fallback, removing the need to patch PHP


http://cvs.php.net/viewvc.cgi/phd/b...4&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.23 phd/build.php:1.24
--- phd/build.php:1.23 Sun Aug 19 12:09:55 2007
+++ phd/build.php Sun Aug 19 13:19:47 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: build.php,v 1.23 2007/08/19 12:09:55 bjori Exp $ */
+/* $Id: build.php,v 1.24 2007/08/19 13:19:47 bjori Exp $ */

function err($no, $str, $file, $line) {
global $notify;
@@ -49,6 +49,9 @@
/* FIXME: Load from sqlite db? */
}

+$rf = new ReflectionFunction("in_array");
+define("HAS_ARRAY_SEEK", $rf->getNumberOfParameters() == 4);
+
foreach($OPTIONS["output_format"] as $output_format) {
switch($output_format) {
case "xhtml":
http://cvs.php.net/viewvc.cgi/phd/t...9&diff_format=u
Index: phd/themes/php/phpweb.php
diff -u phd/themes/php/phpweb.php:1.8 phd/themes/php/phpweb.php:1.9
--- phd/themes/php/phpweb.php:1.8 Sat Aug 18 23:49:34 2007
+++ phd/themes/php/phpweb.php Sun Aug 19 13:19:48 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: phpweb.php,v 1.8 2007/08/18 23:49:34 bjori Exp $ */
+/* $Id: phpweb.php,v 1.9 2007/08/19 13:19:48 bjori Exp $ */

class phpweb extends phpdotnet implements PhDTheme {
protected $streams = array();
@@ -112,7 +112,18 @@
}

// S to $id
+ if (HAS_ARRAY_SEEK) {
in_array($siblings[$id], $siblings, false, true);
+ } else {
+ /* Workaround PHPs incapability of sing into array */
+ while(list($tmp,) = each($siblings)) {
+ if ($tmp == $id) {
+ // Set the internal pointer back to $id
+ prev($siblings);
+ break;
+ }
+ }
+ }
$tmp = prev($siblings);
if ($tmp) {
while (!empty($tmp["children"])) {
@@ -138,7 +149,19 @@
}

// S to $id
+ if (HAS_ARRAY_SEEK) {
in_array($siblings[$id], $siblings, false, true) or
die(var_export(debug_backtrace(), true) ."\n$id\n$parent"); // This
should *never* happen
+ } else {
+ /* Workaround PHPs incapability of sing into array */
+ while(list($tmp,) = each($siblings)) {
+ if ($tmp == $id) {
+ // Set the internal pointer back to $id
+ prev($siblings);
+ break;
+ }
+ }
+ }
+
$tmp = next($siblings);
prev($siblings); // Reset the internal pointer to previous pos
if ($tmp) {
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com