From 0a4380cda3ed966ca0e39b057cf613ace07cb38c Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 15 Jul 2007 18:43:55 +0000 Subject: [PATCH] Importing tools to ISSO --- ISI_PHPUnit2_Output_HTML_Listener.php | 546 ++++++++++++++++++++++++++ create_schema.php | 196 +++++++++ function_finder.php | 454 +++++++++++++++++++++ info.php | 1 + wordrunner.php | 83 ++++ 5 files changed, 1280 insertions(+) create mode 100755 ISI_PHPUnit2_Output_HTML_Listener.php create mode 100644 create_schema.php create mode 100755 function_finder.php create mode 100644 info.php create mode 100755 wordrunner.php diff --git a/ISI_PHPUnit2_Output_HTML_Listener.php b/ISI_PHPUnit2_Output_HTML_Listener.php new file mode 100755 index 0000000..b713fd5 --- /dev/null +++ b/ISI_PHPUnit2_Output_HTML_Listener.php @@ -0,0 +1,546 @@ +$result = new PHPUnit2_Framework_TestResult; +* $result->addListener(new ISI_PHPUnit2_Output_HTML_Listener); +* $suite->run($result); +* +* @author Iris Studios, Inc. +* @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc. +* @version $Revision$ +* +*/ +class ISI_PHPUnit2_Output_HTML_Listener implements PHPUnit2_Framework_TestListener +{ + /** + * A successful test + * @var integer + */ + const TEST_SUCCESS = 1; + + /** + * An incomplete test + * @var integer + */ + const TEST_INCOMPLETE = 2; + + /** + * A failed test + * @var integer + */ + const TEST_FAIL = 3; + + /** + * An array of all the tests run in a given suite + * @var array + */ + protected $tests = array(); + + /** + * An array of arrays of all the errors in a given failed test in a suite + * @var array + */ + protected $errors = array(); + + /** + * An array of all the incomplete test messages for a test in a suite + * @var array + */ + protected $incompletes = array(); + + /** + * Statistics for a given test suite + * @var array + */ + protected $stats = array(); + + /** + * The name of the currently-running test suite + * @var string + */ + private $currentSuite; + + /** + * The name of the currently-running individual test + * @var string + */ + private $currentTest; + + // ################################################################### + /** + * A test errored out + * + * @param object PHPUnit2_Framework_Test + * @param except Thrown execption + */ + public function addError(PHPUnit2_Framework_Test $test, Exception $e) + { + $this->errors[ $this->currentSuite ][ $this->currentTest ][] = new ISI_Private_Exception($e); + } + + // ################################################################### + /** + * A test failed + * + * @param object PHPUnit2_Framework_Test + * @param object PHPUnit2_Framework_AssertionFailedError + */ + public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) + { + $this->errors[ $this->currentSuite ][ $this->currentTest ][] = new ISI_Private_Exception($e); + $this->tests[ $this->currentSuite ][ $this->currentTest ] = self::TEST_FAIL; + $this->stats[ $this->currentSuite ]['fail']++; + } + + // ################################################################### + /** + * A test reported being an incomplete implementation + * + * @param object PHPUnit2_Framework_Test + * @param except The thrown exception notice + */ + public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) + { + $this->incompletes[ $this->currentSuite ][ $this->currentTest ] = new ISI_Private_Exception($e); + $this->tests[ $this->currentSuite ][ $this->currentTest ] = self::TEST_INCOMPLETE; + $this->stats[ $this->currentSuite ]['incomplete']++; + } + + // ################################################################### + /** + * Start test suite + * + * @param object A PHPUnit2_Framework_TestSuite + */ + public function startTestSuite(PHPUnit2_Framework_TestSuite $suite) + { + $this->currentSuite = $suite->getName(); + if ($this->currentSuite == '') + { + return; + } + + $this->tests[ $this->currentSuite ] = array(); + $this->stats[ $this->currentSuite ] = array('total' => 0, 'fail' => 0, 'incomplete' => 0); + } + + // ################################################################### + /** + * Test suite ended + * + * @param object PHPUnit2_Framework_TestSuite + */ + public function endTestSuite(PHPUnit2_Framework_TestSuite $suite) + { + $this->currentSuite = null; + } + + // ################################################################### + /** + * An individual test started + * + * @param object The PHPUnit2_Framework_Test + */ + public function startTest(PHPUnit2_Framework_Test $test) + { + $this->currentTest = $test->getName(); + if ($this->currentTest == '') + { + return; + } + + $this->tests[ $this->currentSuite ][ $this->currentTest ] = self::TEST_SUCCESS; + $this->stats[ $this->currentSuite ]['total']++; + } + + // ################################################################### + /** + * An individual test ended + * + * @param object The PHPUnit2_Framework_Test + */ + public function endTest(PHPUnit2_Framework_Test $test) + { + $this->currentTest = null; + } + + // ################################################################### + /** + * Destructor: create the HTML output + */ + public function __destruct() + { + $stats = array('total' => 0, 'incomplete' => 0, 'fail' => 0, 'success' => 0); + foreach ($this->stats AS $statGroup) + { + foreach ($statGroup AS $statType => $count) + { + $stats["$statType"] += $count; + } + } + $stats['success'] = $stats['total'] - ($stats['incomplete'] + $stats['fail']); + + $output = ' + + + + Unit Test Results + + + + + +

Unit Test Results

+ +
+
The following is a report of how each unit test performed. If any errors or exceptions were thrown, they have been recorded below. Tests have been broken down into their test suite groups. Your overall statistics are here:
+ +
+ +
Total Tests: ' . $stats['total'] . '
+
Number Success: ' . $stats['success'] . '
+
Number Fail: ' . $stats['fail'] . '
+
Number Incomplete: ' . $stats['incomplete'] . '
+ +
+ +
Total Success Rate: ' . round(100 * ($stats['success'] / $stats['total']), 1) . '%
+
+ +
+ +'; + + foreach ($this->tests AS $suite => $tests) + { + $successPercent = round(100 * (($this->stats["$suite"]['total'] - ($this->stats["$suite"]['fail'] + $this->stats["$suite"]['incomplete'])) / $this->stats["$suite"]['total']), 1); + + $output .= '
'; + $output .= "\n\t" . '
'; + $output .= "\n\t\t" . '' . $this->stats["$suite"]['total'] . ' Tests, ' . $successPercent . '% Success' . ''; + $output .= "\n\t\t" . $suite; + $output .= "\n\t" . '
'; + $output .= "\n\t" . '
'; + foreach ($tests AS $name => $statusCode) + { + switch ($statusCode) + { + case self::TEST_SUCCESS: + $cssName = 'Success'; + $cssColor = 'green'; + + $info = ''; + break; + + case self::TEST_INCOMPLETE: + $cssName = 'Incomplete'; + $cssColor = 'blue'; + + $info = $this->formatInfo($this->incompletes["$suite"]["$name"]); + break; + + case self::TEST_FAIL: + $cssName = 'Fail'; + $cssColor = 'red'; + + $info = $this->formatInfo($this->errors["$suite"]["$name"]); + break; + } + + $output .= "\n\t\t" . '
'; + $output .= "\n\t\t\t" . '
' . $name . '
'; + + if ($info) + { + $output .= "\n\t\t\t" . '
'; + $output .= $info; + $output .= "\n\t\t\t" . '
'; + } + + $output .= "\n\t\t" . '
'; + } + $output .= "\n\t" . '
'; + $output .= "\n" . '
'; + $output .= "\n\n" . '
' . "\n\n"; + } + + $output .= ' + +'; + + file_put_contents('./UnitTestReport.html', $output); + } + + // ################################################################### + /** + * Formats an error array into a bulleted list + * + * @param mixed Error/information list + * + * @return string Formatted HTML + */ + private function formatInfo($list) + { + if (!is_array($list)) + { + $list = array($list); + } + + $count = sizeof($list); + foreach ($list AS $exc) + { + $i++; + + if ($exc->getMessage() != '') + { + $output = "\n\t\t\t\t" . '
'; + $output .= "\n\t\t\t\t\t" . '
• ' . htmlspecialchars($exc->getMessage()) . '
'; + } + + $output .= "\n\t\t\t\t\t" . '
in ' . $exc->getPath() . ' at line ' . $exc->getLine() . '
'; + + if ($exc->getMessage() != '') + { + $output .= "\n\t\t\t\t" . '
'; + } + } + + return $output; + } +} + +/** +* Iris Studios Private Exception Handler +* +* This class is just a form of an exception that ignores the stack trace +* because it's too long. +* +* @author Iris Studios, Inc. +* @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc. +* @version $Revision$ +* +*/ +class ISI_Private_Exception +{ + /** + * Exception context message + * @var string + */ + private $message = ''; + + /** + * File path + * @var string + */ + private $path = ''; + + /** + * Line number of the exception + * @var integer + */ + private $line = 0; + + // ################################################################### + /** + * Constructor: accept exception + * + * @param except A given exception + */ + public function __construct(Exception $e) + { + $this->message = $e->getMessage(); + $this->path = $e->getFile(); + $this->line = $e->getLine(); + } + + // ################################################################### + /** + * Returns the context message + * + * @return string Context message + */ + public function getMessage() + { + return $this->message; + } + + // ################################################################### + /** + * Returns the file path + * + * @return string File path + */ + public function getPath() + { + return $this->path; + } + + // ################################################################### + /** + * Returns the line number + * + * @return integer Line number + */ + public function getLine() + { + return $this->line; + } +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file diff --git a/create_schema.php b/create_schema.php new file mode 100644 index 0000000..0802c00 --- /dev/null +++ b/create_schema.php @@ -0,0 +1,196 @@ +setApplication('Schema Creator'); +$isso->setAppPath(getcwd()); + +define('ISSO_DB_LAYER', 'db_mysql'); +$isso->load('db_mysql', 'db', true); + +if (empty($_REQUEST['submit'])) +{ +?> + +
+ +
Database:
+
Username:
+
Password:
+
Server:
+ +
+ +
Database engine: MySQL PostgreSQL
+
Array variable:
+
Encase names with ticks: Yes
+
Add TABLE_PREFIX: Yes
+ + + +
+ +connect($isso->in['server'], $isso->in['username'], $isso->in['password'], $isso->in['database'], false); + + $t = ($isso->in['encase'] ? '`' : ''); + $prefix = ($isso->in['prefix'] ? '" . TABLE_PREFIX . "' : ''); + + $tables = $db->query("SHOW TABLES"); + while ($table = $db->fetch_array($tables, false)) + { + $table = $table[0]; + $list = array(); + $keys = array(); + + $build = "CREATE TABLE $t$prefix$table$t\n(\n"; + + $indexes = $db->query("SHOW INDEX FROM $table"); + while ($index = $db->fetch_array($indexes)) + { + array_walk($index, 'trim'); + + if ($index['Sub_part'] AND $isso->in['engine'] == 'postgresql') + { + $subpart = " ($index[Sub_part])"; + } + + if ($index['Key_name'] == 'PRIMARY') + { + $keys['primary'][] = "$t$index[Column_name]$t$subpart"; + } + else if ($index['Index_type'] == 'FULLTEXT') + { + $keys['fulltext']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; + } + else if ($index['Index_type'] == 'BTREE' AND $index['Non_unique'] == 0) + { + $keys['unique']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; + } + else if ($index['Index_type'] == 'BTREE' AND $index['Non_unique'] == 1) + { + $keys['std']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; + } + // we should never get here :-) + else + { + print_r($index); + exit; + } + } + + $fields = $db->query("DESCRIBE $table"); + while ($field = $db->fetch_array($fields)) + { + array_walk($field, 'trim'); + + if (preg_match('#^(tinyint|smallint|bigint|int)\(([0-9]+)\)( unsigned)?#i', $field['Type'], $matches)) + { + if ($matches[2] == 1) + { + $field['Type'] = 'bool'; + } + else if ($matches[2] < 10) + { + $field['Type'] = 'smallint'; + } + else if ($matches[2] > 12) + { + $field['Type'] = 'bigint'; + } + else + { + $field['Type'] = 'int'; + } + + if ($isso->in['engine'] == 'mysql' AND $field['Type'] != 'bool') + { + $field['Type'] .= $matches[3]; + } + else if ($isso->in['engine'] == 'postgresql') + { + if (preg_match('#AUTO_INCREMENT#i', $field['Extra'])) + { + $field['Type'] = 'SERIAL'; + $field['Extra'] = ''; + } + } + } + else if (preg_match('#^mediumtext|longtext$#i', $field['Type'])) + { + $field['Type'] = 'text'; + } + else if (preg_match('#.+?blob$#i', $field['Type'])) + { + $field['Type'] = 'blob'; + if ($isso->in['engine'] == 'postgresql') + { + $field['Type'] = 'bytea'; + } + } + + $list[] = "\t$t$field[Field]$t " . $field['Type'] . " " . ($field['Null'] == 'YES' ? "NULL" : "NOT NULL") . ($field['Extra'] != '' ? " " . strtoupper($field['Extra']) : "") . (!empty($field['default']) ? " DEFAULT '$field[Default]'" : ""); + } + + $build .= implode(",\n", $list); + + if ($keys['primary']) + { + $build .= ",\n\tPRIMARY KEY (" . implode(', ', $keys['primary']) . ")"; + } + if ($keys['fulltext']) + { + foreach ($keys['fulltext'] AS $name => $columns) + { + $build .= ",\n\tFULLTEXT KEY $t$name$t (" . implode(', ', $columns) . ")"; + } + } + if ($keys['unique']) + { + foreach ($keys['unique'] AS $name => $columns) + { + $build .= ",\n\tUNIQUE KEY $t$name$t (" . implode(', ', $columns) . ")"; + } + } + if ($keys['std']) + { + foreach ($keys['std'] AS $name => $columns) + { + $build .= ",\n\tKEY $t$name$t (" . implode(', ', $columns) . ")"; + } + } + + $build .= "\n);"; + + $queries["$table"] = $build; + } + + if ($isso->in['variable'] != '') + { + foreach ($queries AS $table => $query) + { + $output[] = "\${$isso->in['variable']}['$table'] = \"\n$query\";"; + } + } + else + { + $output = $queries; + } + + $output = implode("\n\n", $output); + + ?> + + + + \ No newline at end of file diff --git a/function_finder.php b/function_finder.php new file mode 100755 index 0000000..e16be68 --- /dev/null +++ b/function_finder.php @@ -0,0 +1,454 @@ + $methods) +{ + foreach ($methods AS $method) + { + $count['classes']["$name"]["$method"] = 0; + } +} + +foreach ($filelist AS $filename) +{ + $fpath = $path . $filename; + + $file = file_get_contents($fpath); + $count = fetch_calls($file, $elements['methods'], $elements['limiters']["$fpath"], $count); +} + +print_r($count); + +// ################################################################### +// ################################################################### +// ################################################################### + +function fetch_listing($path, $basepath = '', $unset = 1) +{ + static $filelist; + + if ($unset) + { + $filelist = array(); + } + + if (substr($path, (strlen($path) - 1), 1) != '/') + { + $path .= '/'; + } + + if ($handle = opendir($path)) + { + while (($file = readdir($handle)) !== false) + { + if (substr($file, 0, 1) != '.' AND $file != 'CVS') + { + if (is_dir($path . $file)) + { + $filelist["$basepath"][] = "$file/"; + fetch_listing("$path$file", "$basepath$file/", 0); + } + else + { + $filelist["$basepath"][] = $file; + } + } + } + closedir($handle); + } + return $filelist; +} + +// ################################################################### + +function fetch_flat_listing($path) +{ + $filelist = fetch_listing($path); + + foreach ($filelist AS $basepath => $files) + { + foreach ($files AS $file) + { + if (substr($file, (strlen($file) - 1), 1) != '/' AND preg_match('#\.php$#', $file) AND !strpos($basepath, '3rdparty') AND !strpos($basepath, 'phpdoc') AND !strpos($basepath, 'jpgraph')) + { + $flatlist[] = "./$basepath$file"; + } + } + } + return $flatlist; +} + +// ################################################################### + +function fetch_calls($file, $methodlist, $limiters, $count) +{ + static $objects, $extends; + + // strip comments + $file = preg_replace('#/\*(.*?)\*/#s', '', $file); + + // tokens + $tokens = token_get_all($file); + + // valid tokens + static $validtokens, $othertokens; + if (!is_array($validtokens)) + { + $validtokens = array('T_EXTENDS', 'T_FUNCTION', 'T_VARIABLE', 'T_STRING', 'T_NEW', 'T_DOUBLE_COLON', 'T_PAAMAYIM_NEKUDOTAYIM', 'T_OBJECT_OPERATOR'); + $othertokens = array('(', ')', ';'); + } + + // good tokens + $gt = array(); + + // actual function calls + $elements = array(); + + // remove invalid tokens + $i = 0; + foreach ($tokens AS $id => $bit) + { + unset($tokens["$id"]); + if (is_array($bit)) + { + if (in_array($token_name = token_name($bit[0]), $validtokens)) + { + $gt["$i"] = $bit; + $gt["$i"][2] = $token_name; + $gt["$i"][3] = $id; + $i++; + } + } + else + { + if (in_array($bit, $othertokens)) + { + $gt["$i"][0] = '-1'; + $gt["$i"][1] = $bit; + if ($bit == '(' OR $bit == ')') + { + $gt["$i"][2] = 'P_' . ($bit == '(' ? 'OPEN' : 'CLOSE'); + } + else + { + $gt["$i"][2] = 'SC'; + } + $gt["$i"][3] = $id; + $i++; + } + } + } + + // get what we're looking for + $triggers = array('new' => array(), 'popen' => array()); + foreach ($methodlist['classes'] AS $name => $methods) + { + $triggers['new'][] = $name; + $triggers['popen'] = array_merge($triggers['popen'], $methods); + } + $triggers['popen'] = array_merge($triggers['popen'], $methodlist['functions']); + + // find a list of all the defined objects + foreach ($gt AS $id => $bit) + { + $prevbit = $gt[ $id - 1 ]; + $nextbit = $gt[ $id + 1 ]; + + if ($bit[2] == 'T_NEW') + { + if ($prevbit[2] == 'T_VARIABLE' AND $nextbit[2] == 'T_STRING' AND in_array($nextbit[1], $triggers['new'])) + { + $objects["$prevbit[1]"] = $nextbit[1]; + } + } + if ($bit[2] == 'T_EXTENDS') + { + if ($prevbit[2] == 'T_STRING' AND $nextbit[2] == 'T_STRING' AND in_array($prevbit[1], $triggers['new']) AND in_array($prevbit[1], $triggers['new'])) + { + $extends["$prevbit[1]"] = $nextbit[1]; + } + } + } + + // process tokens + $incall = false; + $root = 0; + $stack = array(); + $functlist = array(); + foreach ($gt AS $id => $bit) + { + $token = $bit[2]; + $prevbit = $gt[ $id - 1 ]; + $nextbit = $gt[ $id + 1 ]; + + // handle object calls + if ($token == 'T_DOUBLE_COLON' OR $token == 'T_PAAMAYIM_NEKUDOTAYIM' OR $token == 'T_OBJECT_OPERATOR') + { + $classname = null; + + // find classname + if (isset($objects["$prevbit[1]"])) + { + $classname = $objects["$prevbit[1]"]; + } + else if (in_array($prevbit[1], $triggers['new'])) + { + $classname = $prevbit[1]; + } + // we've got an extension! + else if ($prevbit[1] == 'parent') + { + // find a class that the call could be in + foreach ($limiters AS $class => $limits) + { + if ($bit[3] > $limits[0] AND $bit[3] < $limits[1]) + { + $refclass = $class; + } + } + + // get the parent of that object + if (isset($methodlist['classes']["$refclass"])) + { + $tempclassname = $extends["$refclass"]; + if (isset($methodlist['classes']["$tempclassname"])) + { + $classname = $tempclassname; + } + } + } + // we've got an inner-object call + else if ($prevbit[1] == '$this') + { + // find a class that the call could be in + foreach ($limiters AS $class => $limits) + { + if ($bit[3] > $limits[0] AND $bit[3] < $limits[1]) + { + $refclass = $class; + } + } + + if (isset($methodlist['classes']["$refclass"])) + { + $classname = $refclass; + } + } + + // object name validation + if ($classname) + { + // method call validation + if (in_array($nextbit[1], $methodlist['classes']["$classname"])) + { + $count['classes']["$classname"]["$nextbit[1]"]++; + } + } + } + // initial + else if ($token == 'T_STRING' AND $nextbit[2] == 'P_OPEN' AND $prevbit[2] != 'T_FUNCTION' AND $prevbit[2] != 'T_DOUBLE_COLON' AND $prevbit[2] != 'T_PAAMAYIM_NEKUDOTAYIM' AND $prevbit[2] != 'T_OBJECT_OPERATOR' AND !in_array($bit[1], $triggers['new'])) + { + $incall = true; + $root = $id; + $functlist["$id"] = $bit[1]; + } + // parens in call + else if ($token == 'P_OPEN' AND $incall) + { + array_push($stack, $id); + } + // close parens in call + else if ($token == 'P_CLOSE' AND $incall) + { + // find the most recent function + $end = array_pop($stack) - 1; + + // see if we can increment a function + if (in_array($functlist["$end"], $methodlist['functions'])) + { + $count['functions'][ $functlist["$end"] ]++; + } + + // we're done with all functions and the semi colon is next + if (count($stack) == 0 AND $nextbit[2] == 'SC') + { + $incall = false; + } + } + } + + return $count; +} + +// ################################################################### + +function fetch_methods($file) +{ + // strip comments + $file = preg_replace('#/\*(.*?)\*/#s', '', $file); + + // tokens + $tokens = token_get_all($file); + + // valid tokens + static $validtokens, $othertokensopen, $othertokensclose, $othertokens; + if (!is_array($validtokens)) + { + $validtokens = array('T_CLASS', 'T_FUNCTION', 'T_STRING'); + $othertokensopen = array('{', '${', 'T_CURLY_OPEN', 'T_DOLLAR_OPEN_CURLY_BRACES'); + $othertokensclose = array('}'); + $othertokens = array_merge($othertokensopen, $othertokensclose); + } + + // good tokens + $gt = array(); + + // actual named items + $elements = array(); + + // remove invalid tokens + $i = 0; + foreach ($tokens AS $id => $bit) + { + unset($tokens["$id"]); + if (is_array($bit)) + { + // if we have a T_CLASS, T_FUNCTION, or T_STRING + if (in_array($token_name = token_name($bit[0]), $validtokens)) + { + $gt["$i"] = $bit; + $gt["$i"][2] = $token_name; + $gt["$i"][3] = $id; + $i++; + } + // special open { + else if (in_array($token_name = token_name($bit[0]), $othertokens)) + { + $gt["$i"][0] = '-1'; + $gt["$i"][1] = $bit[1]; + $gt["$i"][2] = 'B_' . (in_array($token_name, $othertokensopen) ? 'OPEN' : 'CLOSE'); + $gt["$i"][3] = $id; + $i++; + } + } + // if we have an opening or closing brace + else if (in_array($bit, $othertokens)) + { + // make up some token information + $gt["$i"][0] = '-1'; + $gt["$i"][1] = $bit; + $gt["$i"][2] = 'B_' . (in_array($bit, $othertokensopen) ? 'OPEN' : 'CLOSE'); + $gt["$i"][3] = $id; + $i++; + } + } + + // process tokens + $elements = array('classes' => array(), 'functions' => array()); + + $inclass = false; + $infunction = false; + $class = ''; + $stack = array(); + foreach ($gt AS $id => $bit) + { + $token = $bit[2]; + $nextbit = $gt[ $id + 1 ]; + + if ($token == 'T_CLASS') + { + $inclass = true; + $class = $nextbit[1]; + + $elements['classes']["$class"] = array(); + + $limiters["$class"][0] = $bit[3]; + } + else if ($token == 'T_FUNCTION') + { + $infunction = true; + + if ($inclass) + { + $elements['classes']["$class"][] = $nextbit[1]; + } + else + { + $elements['functions'][] = $nextbit[1]; + } + } + else if ($token == 'B_OPEN') + { + array_push($stack, $id); + } + else if ($token == 'B_CLOSE') + { + array_pop($stack); + + // breaking out of a method + if ($inclass AND $infunction) + { + if (count($stack) < 2) + { + $infunction = false; + } + } + // breaking out of a class + else if ($inclass AND !$infunction) + { + if (count($stack) < 1) + { + $inclass = false; + $limiters["$class"][1] = $bit[3]; + } + } + // breaking out of a function + else if (!$inclass AND $infunction) + { + if (count($stack) == 0) + { + $infunction = false; + } + } + } + $lastbit = $bit; + } + + return array('methods' => $elements, 'limiters' => $limiters); +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file diff --git a/info.php b/info.php new file mode 100644 index 0000000..b96d61a --- /dev/null +++ b/info.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wordrunner.php b/wordrunner.php new file mode 100755 index 0000000..093f4bf --- /dev/null +++ b/wordrunner.php @@ -0,0 +1,83 @@ + + + + + WordRunner + + + + + +

Welcome to WordRunner

+

This script will count the number of times a word is used in a passage. Simply copy and paste your article into the text area below and press "Run Words" to start the process.

+ + + +

Document Word Run Complete

+

WordRunner has finished processing your document: the results are listed below.

+ + + + + + + + $count) + { + if (($_POST['ignoresmalls'] AND $count > 3) OR !$_POST['ignoresmalls']) + { + echo "\r\t\r\t\r\r"; + } + } + + echo "
WordUsage Index
$word$count
\r
"; +} + +// ### START HTML #################################################### +?> + +
+ + +
Ignore Words With Small Counts
+
+ +
WordRunner ©2004 Robert Sesek
+ + + \ No newline at end of file -- 2.43.5