removed mods directory from the ATutor codebase
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / common.inc.php
diff --git a/mods/phpdoc2/PhpDocumentor/phpDocumentor/common.inc.php b/mods/phpdoc2/PhpDocumentor/phpDocumentor/common.inc.php
deleted file mode 100644 (file)
index c28d866..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-<?php\r
-/**\r
- * Common information needed by all portions of the application\r
- *\r
- * phpDocumentor :: automatic documentation generator\r
- * \r
- * PHP versions 4 and 5\r
- *\r
- * Copyright (c) 2001-2007 Gregory Beaver\r
- * \r
- * LICENSE:\r
- * \r
- * This library is free software; you can redistribute it\r
- * and/or modify it under the terms of the GNU Lesser General\r
- * Public License as published by the Free Software Foundation;\r
- * either version 2.1 of the License, or (at your option) any\r
- * later version.\r
- * \r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * @category  ToolsAndUtilities\r
- * @package   phpDocumentor\r
- * @author    Greg Beaver <cellog@php.net>\r
- * @copyright 2001-2007 Gregory Beaver\r
- * @license   http://www.opensource.org/licenses/lgpl-license.php LGPL\r
- * @version   CVS: $Id: common.inc.php,v 1.13 2007/10/06 22:57:15 ashnazg Exp $\r
- * @filesource\r
- * @link      http://www.phpdoc.org\r
- * @link      http://pear.php.net/PhpDocumentor\r
- * @see       parserDocBlock, parserInclude, parserPage, parserClass\r
- * @see       parserDefine, parserFunction, parserMethod, parserVar\r
- * @since     1.0rc1\r
- * @todo      CS cleanup - change package to PhpDocumentor\r
- * @todo      CS cleanup - rename constant to TOKENIZER_EXT\r
- */\r
-\r
-/* phpDocumentor version */\r
-if ('@PEAR-DIR@' != '@'.'PEAR-DIR@') {\r
-    /** @ignore */\r
-    define("PHPDOCUMENTOR_VER", "@VER@");\r
-} else {\r
-    define("PHPDOCUMENTOR_VER", "1.4.0");\r
-}\r
-\r
-/* phpDocumentor URL */\r
-define("PHPDOCUMENTOR_WEBSITE", "http://www.phpdoc.org");\r
-\r
-// set the correct path delimiter\r
-define('SMART_PATH_DELIMITER', DIRECTORY_SEPARATOR); \r
-\r
-define('tokenizer_ext', extension_loaded('tokenizer') \r
-    && version_compare(phpversion(), "4.3.0", ">="));\r
-\r
-// we just replace all the \ with / so that we can just operate on /\r
-define('PATH_DELIMITER', '/'); // set the correct path delimiter\r
-\r
-define('PHPDOCUMENTOR_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN');\r
-\r
-define('_IN_PHP5', \r
-    phpversion() == '5.0.0RC1-dev' || phpversion() == '5.0.0RC2-dev' \r
-    || version_compare(phpversion(), '5.0.0', 'ge'));\r
-\r
-// determine which "clone" class to set, based on PHP major version\r
-$cloneClassDir  = 'PhpDocumentor' . DIRECTORY_SEPARATOR . 'phpDocumentor';\r
-$cloneClassFile = 'clone.inc.php';\r
-if ('@VER@' == '@'.'VER@') {\r
-    // we're _not_ in a PEAR installation\r
-    $cloneClassDir = dirname(__FILE__);\r
-}\r
-if (_IN_PHP5) {\r
-    // we _are_ in PHP5\r
-    $cloneClassFile = 'clone5.inc.php';\r
-}\r
-require_once $cloneClassDir . DIRECTORY_SEPARATOR . $cloneClassFile;\r
-\r
-// make arg arrays available\r
-if (isset($_SERVER['argv'])) {\r
-    $argv = $_SERVER['argv'];\r
-    $argc = $_SERVER['argc'];\r
-}\r
-\r
-/**\r
- * used in phpdoc.php and new_phpdoc.php \r
- *\r
- * @param string $directory a directory string\r
- *\r
- * @return array an array of directory contents\r
- * @todo CS cleanup - rename function to PhpDocumentor_ConfigFileList\r
- */\r
-function phpDocumentor_ConfigFileList($directory)\r
-{\r
-    $ret = array();\r
-    if (@is_dir($directory)) {\r
-        $ret = array();\r
-\r
-        // thanks to Jason E Sweat (jsweat@users.sourceforge.net) for fix\r
-        $d = @dir($directory); \r
-\r
-        while ($d && $entry=$d->read()) {\r
-            $getentry = false;\r
-            if (strcmp($entry, ".") != 0 && strcmp($entry, "..") != 0) {\r
-                if (substr($entry, 0, 1) != ".") $getentry = true;\r
-            }\r
-            if ($getentry == true) {\r
-                if (strpos($entry, '.ini'))\r
-                if (is_file($directory . PATH_DELIMITER . $entry)) {\r
-                    $ret[] = str_replace('.ini', '', $entry);\r
-                }\r
-            }\r
-        }\r
-        if ($d) $d->close();\r
-    } else {\r
-    }\r
-    return $ret;\r
-}\r
-\r
-\r
-/**\r
- * Parse an .ini file\r
- * \r
- * Works like {@link parse_ini_file}, except it will take a section like:\r
- *\r
- * <pre>\r
- * [MYVAR]\r
- * value1\r
- * value2\r
- * value3\r
- * </pre>\r
- *\r
- * and return an associative array(MYVAR => array(value1, value2, value3))\r
- *\r
- * @param string $filename         full path to the ini file\r
- * @param bool   $process_sections add an associative index \r
- *                                 for each section [in brackets]\r
- *\r
- * @return array\r
- * @todo CS cleanup - rename function to PhpDocumentor_parse_ini_file\r
- */\r
-function phpDocumentor_parse_ini_file($filename, $process_sections = false)\r
-{\r
-    $ini_array = array();\r
-    $sec_name  = "";\r
-    $lines     = @file($filename);\r
-    if (!$lines) return $lines;\r
-    foreach ($lines as $line) {\r
-        // code by Greg Beaver, ignore comments\r
-        if ($line[0] == ';') continue;\r
-        $line = trim($line);\r
-        \r
-        if ($line == "") {\r
-            continue;\r
-        }\r
-        if ($line[0] == "[" && $line[strlen($line) - 1] == "]") {\r
-            $sec_name = substr($line, 1, strlen($line) - 2);\r
-        } else {\r
-            if (strpos($line, "=")) {\r
-                $pos      = strpos($line, "=");\r
-                $property = trim(substr($line, 0, $pos));\r
-                // code by Greg Beaver\r
-                if (substr($property, 0, 1) == '"' && substr($property, -1) == '"') {\r
-                    $property = \r
-                        stripcslashes(substr($property, 1, count($property) - 2));\r
-                }\r
-                $value = trim(substr($line, $pos + 1));\r
-                if ($value == 'false') $value = false;\r
-                if ($value == 'true') $value = true;\r
-                if (substr($value, 0, 1) == '"' && substr($value, -1) == '"') {\r
-                    $value = stripcslashes(substr($value, 1, count($value) - 2));\r
-                }\r
-                // done additions\r
-                \r
-                if ($process_sections) {\r
-                    if ($sec_name != '')\r
-                    $ini_array[$sec_name][$property] = $value;\r
-                    else\r
-                    $ini_array[$property] = $value;\r
-                } else {\r
-                    $ini_array[$property] = $value;\r
-                }\r
-            } else {\r
-                // code by Greg Beaver\r
-                if (trim($line[0]) == ';') continue;\r
-                if ($process_sections) {\r
-                    $ini_array[$sec_name][] = trim($line);\r
-                }\r
-                // done additions\r
-            }\r
-        }\r
-    }\r
-    return $ini_array;\r
-}\r
-\r
-\r
-/**\r
- * construct an "array_key_exists()" method\r
- * if the runtime PHP version doesn't have one\r
- * \r
- * @todo CS Cleanup - can't avoid "prefixed by package" error\r
- * @todo depend on PHP_Compat for this?\r
- */\r
-if (!function_exists('array_key_exists')) {\r
-    /** \r
-     * Determines if a given key exists in a given array\r
-     *\r
-     * @param mixed $key    key to search for\r
-     * @param array $search the array of keys to search\r
-     *\r
-     * @return bool whether or not the key was found\r
-     * @ignore\r
-     */\r
-    function array_key_exists($key, $search)\r
-    {\r
-        foreach ($search as $keys => $nul) {\r
-            if ($key == $keys) return true;\r
-        }\r
-        return false;\r
-    }\r
-}\r
-\r
-/**\r
- * construct an "is_a()" method\r
- * if the runtime PHP version doesn't have one\r
- * \r
- * @todo CS Cleanup - can't avoid "prefixed by package" error\r
- * @todo depend on PHP_Compat for this?\r
- */\r
-if (!function_exists('is_a')) {\r
-    /**\r
-     * Determines if one item "is" an object of the other item\r
-     *\r
-     * @param string $classname  the class in question\r
-     * @param string $classquery the "is it a" class\r
-     *\r
-     * @return bool whether or not the class "is" one\r
-     * @ignore\r
-     */\r
-    function is_a($classname, $classquery)\r
-    {\r
-        $father = get_parent_class($classname);\r
-        if (strtolower($father) == strtolower($classquery)) {\r
-            return true;\r
-        } elseif (!empty($father)) {\r
-            return is_a($father, $classquery);\r
-        } else {\r
-            return false;\r
-        }\r
-    }\r
-}\r
-\r
-\r
-/**\r
- * Debugging output\r
- *\r
- * @param string $s the "debug message" string to echo out\r
- *\r
- * @return void\r
- * @todo CS Cleanup - can't avoid "prefixed by package" error\r
- */\r
-/*\r
-* Taken out since ATutor has a function called debug as well. \r
-* Redeclaring function error otherwise.  \r
-function debug($s)\r
-{\r
-    echo "$s\n";\r
-}\r
-*/\r
-\r
-/**\r
- * Returns a formatted var_dump for debugging purposes.\r
- *\r
- * @param string $s string to display\r
- * @param mixed  $v unlimited number of variables to display with var_dump()\r
- *\r
- * @return void\r
- */\r
-function fancy_debug($s,$v)\r
-{\r
-    if (isset($GLOBALS['dont_debug']) && $GLOBALS['dont_debug']) return;\r
-    debug($s."\n\n</pre><blockquote><pre>");\r
-    var_dump($v);\r
-    if (func_num_args()>2) {\r
-        for ($i=2;$i<func_num_args();$i++) {\r
-            $a = func_get_arg($i);\r
-            // debug(" ");\r
-            var_dump($a);\r
-        }\r
-    }\r
-    debug("</pre></blockquote><pre>\n\n");\r
-}\r
-\r
-/**\r
- * Returns a lower-cased version of get_class for PHP 5\r
- *\r
- * get_class() returns case as declared in the file in PHP 5\r
- *\r
- * @param object $object the object to get the classname for\r
- *\r
- * @return string the class name of the given object\r
- * @todo CS cleanup - rename function to PhpDocumentor_get_class\r
- */\r
-function phpDocumentor_get_class($object)\r
-{\r
-    return strtolower(get_class($object));\r
-}\r
-\r
-?>\r