[Phpfreechat-svn] SF.net SVN: phpfreechat: [1167] trunk/misc
Status: Beta
Brought to you by:
kerphi
|
From: <ke...@us...> - 2007-08-30 12:06:54
|
Revision: 1167
http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1167&view=rev
Author: kerphi
Date: 2007-08-30 05:06:57 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
rename the file to a more explicite name
Added Paths:
-----------
trunk/misc/generate-doc.inc.php
Removed Paths:
-------------
trunk/misc/generate-doc-from-svn.php
Deleted: trunk/misc/generate-doc-from-svn.php
===================================================================
--- trunk/misc/generate-doc-from-svn.php 2007-08-30 12:05:55 UTC (rev 1166)
+++ trunk/misc/generate-doc-from-svn.php 2007-08-30 12:06:57 UTC (rev 1167)
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * This script is used to parse the parameter descriptions in pfcglobalconfig.class.php
- * So that the official doc is keept up to date.
- */
-function pfc_generate_doc($f = NULL)
-{
- $f = ($f != NULL) ? $f : dirname(__FILE__).'/../src/pfcglobalconfig.class.php';
-
- $ct_params = array();
-// $ct_params['http'] = array( 'proxy' => 'tcp://proxyout.inist.fr:8080', 'request_fulluri' => true );
- $ct = stream_context_create($ct_params);
- $data = file_get_contents($f, false, $ct);
-
- if (preg_match('/class pfcGlobalConfig/',$data,$matches, PREG_OFFSET_CAPTURE, $offset))
- {
- $offset_start = $matches[0][1];
- }
- if (preg_match('/function pfcGlobalConfig/', $data, $matches, PREG_OFFSET_CAPTURE, $offset))
- {
- $offset_end = $matches[0][1];
- }
-
- $offset = $offset_start;
- $plist = array();
- $continue = true;
- while ($offset < $offset_end)
- {
- $p = array();
-
- // search for the begining of the description
- if (preg_match('/\/\*\*/', $data, $matches1, PREG_OFFSET_CAPTURE, $offset))
- $offset1 = $matches1[0][1];
- else
- $offset = $offset_end;
-
- // search for the end of the description
- if ($offset1 < $offset_end &&
- preg_match('/\*\//', $data, $matches3, PREG_OFFSET_CAPTURE, $offset))
- {
- $offset3 = $matches3[0][1];
-
- // search for the parameter description
- $p['desc'] = '';
- while($offset2 < $offset3)
- {
- if (preg_match('/\s+\*\s+(.*)/', $data, $matches2, PREG_OFFSET_CAPTURE, $offset))
- {
- $offset2 = $matches2[1][1];
- if ($offset2 < $offset3)
- {
- $offset = $offset2;
- $p['desc'] .= ' '.$matches2[1][0];
- }
- }
- else
- break;
- }
- $p['desc'] = trim($p['desc']);
-
- // search for the parameter name/default value
- if (preg_match('/var\s+\$([a-z_]+)\s+=\s+(.*);/i', $data, $matches4, PREG_OFFSET_CAPTURE, $offset))
- {
- $offset = $matches4[1][1];
- $p['name'] = $matches4[1][0];
- $p['value'] = $matches4[2][0];
- }
- else
- $offset = $offset_end;
- }
- else
- $offset = $offset_end;
-
- if (count($p) > 0) $plist[] = $p;
- }
- return $plist;
-}
-
-?>
\ No newline at end of file
Copied: trunk/misc/generate-doc.inc.php (from rev 1166, trunk/misc/generate-doc-from-svn.php)
===================================================================
--- trunk/misc/generate-doc.inc.php (rev 0)
+++ trunk/misc/generate-doc.inc.php 2007-08-30 12:06:57 UTC (rev 1167)
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * This script is used to parse the parameter descriptions in pfcglobalconfig.class.php
+ * So that the official doc is keept up to date.
+ */
+function pfc_generate_doc($f = NULL)
+{
+ $f = ($f != NULL) ? $f : dirname(__FILE__).'/../src/pfcglobalconfig.class.php';
+
+ $ct_params = array();
+// $ct_params['http'] = array( 'proxy' => 'tcp://proxyout.inist.fr:8080', 'request_fulluri' => true );
+ $ct = stream_context_create($ct_params);
+ $data = file_get_contents($f, false, $ct);
+
+ if (preg_match('/class pfcGlobalConfig/',$data,$matches, PREG_OFFSET_CAPTURE, $offset))
+ {
+ $offset_start = $matches[0][1];
+ }
+ if (preg_match('/function pfcGlobalConfig/', $data, $matches, PREG_OFFSET_CAPTURE, $offset))
+ {
+ $offset_end = $matches[0][1];
+ }
+
+ $offset = $offset_start;
+ $plist = array();
+ $continue = true;
+ while ($offset < $offset_end)
+ {
+ $p = array();
+
+ // search for the begining of the description
+ if (preg_match('/\/\*\*/', $data, $matches1, PREG_OFFSET_CAPTURE, $offset))
+ $offset1 = $matches1[0][1];
+ else
+ $offset = $offset_end;
+
+ // search for the end of the description
+ if ($offset1 < $offset_end &&
+ preg_match('/\*\//', $data, $matches3, PREG_OFFSET_CAPTURE, $offset))
+ {
+ $offset3 = $matches3[0][1];
+
+ // search for the parameter description
+ $p['desc'] = '';
+ while($offset2 < $offset3)
+ {
+ if (preg_match('/\s+\*\s+(.*)/', $data, $matches2, PREG_OFFSET_CAPTURE, $offset))
+ {
+ $offset2 = $matches2[1][1];
+ if ($offset2 < $offset3)
+ {
+ $offset = $offset2;
+ $p['desc'] .= ' '.$matches2[1][0];
+ }
+ }
+ else
+ break;
+ }
+ $p['desc'] = trim($p['desc']);
+
+ // search for the parameter name/default value
+ if (preg_match('/var\s+\$([a-z_]+)\s+=\s+(.*);/i', $data, $matches4, PREG_OFFSET_CAPTURE, $offset))
+ {
+ $offset = $matches4[1][1];
+ $p['name'] = $matches4[1][0];
+ $p['value'] = $matches4[2][0];
+ }
+ else
+ $offset = $offset_end;
+ }
+ else
+ $offset = $offset_end;
+
+ if (count($p) > 0) $plist[] = $p;
+ }
+ return $plist;
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|