Source for file common.inc.php
Documentation is available at common.inc.php
* Common information needed by all portions of the application
* phpDocumentor :: automatic documentation generator
* Copyright (c) 2001-2008 Gregory Beaver
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* @category ToolsAndUtilities
* @copyright 2001-2008 Gregory Beaver
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version CVS: $Id: common.inc.php 288074 2009-09-05 02:16:26Z ashnazg $
* @link http://www.phpdoc.org
* @link http://pear.php.net/PhpDocumentor
* @see parserDocBlock, parserInclude, parserPage, parserClass
* @see parserDefine, parserFunction, parserMethod, parserVar
* @todo CS cleanup - change package to PhpDocumentor
* @todo CS cleanup - rename constant to TOKENIZER_EXT
/* phpDocumentor version */
if ('@PEAR-DIR@' !=
'@'.
'PEAR-DIR@') {
define("PHPDOCUMENTOR_VER", "@VER@");
define("PHPDOCUMENTOR_VER", "1.4.3");
define("PHPDOCUMENTOR_WEBSITE", "http://www.phpdoc.org");
// set the correct path delimiter
define('SMART_PATH_DELIMITER', DIRECTORY_SEPARATOR);
define('tokenizer_ext', extension_loaded('tokenizer')
&&
version_compare(phpversion(), "4.3.0", ">="));
// we just replace all the \ with / so that we can just operate on /
define('PATH_DELIMITER', '/'); // set the correct path delimiter
define('PHPDOCUMENTOR_WINDOWS', substr(PHP_OS, 0, 3) ==
'WIN');
phpversion() ==
'5.0.0RC1-dev' ||
phpversion() ==
'5.0.0RC2-dev'
||
version_compare(phpversion(), '5.0.0', 'ge'));
// determine which "clone" class to set, based on PHP major version
$cloneClassDir =
'PhpDocumentor' .
DIRECTORY_SEPARATOR .
'phpDocumentor';
$cloneClassFile =
'clone.inc.php';
if ('@VER@' ==
'@'.
'VER@') {
// we're _not_ in a PEAR installation
$cloneClassDir =
dirname(__FILE__
);
$cloneClassFile =
'clone5.inc.php';
require_once $cloneClassDir .
DIRECTORY_SEPARATOR .
$cloneClassFile;
// make arg arrays available
if (isset
($_SERVER['argv'])) {
$argv =
$_SERVER['argv'];
$argc =
$_SERVER['argc'];
* used in phpdoc.php and new_phpdoc.php
* @param string $directory a directory string
* @return array an array of directory contents
* @todo CS cleanup - rename function to PhpDocumentor_ConfigFileList
while ($d &&
$entry=
$d->read()) {
if (strcmp($entry, ".") !=
0 &&
strcmp($entry, "..") !=
0) {
if (substr($entry, 0, 1) !=
".") $getentry =
true;
* Works like {@link parse_ini_file}, except it will take a section like:
* and return an associative array(MYVAR => array(value1, value2, value3))
* @param string $filename full path to the ini file
* @param bool $process_sections add an associative index
* for each section [in brackets]
* @todo CS cleanup - rename function to PhpDocumentor_parse_ini_file
$lines =
@file($filename);
if (!$lines) return $lines;
foreach ($lines as $line) {
// code by Greg Beaver, ignore comments
if ($line[0] ==
';') continue;
if ($line[0] ==
"[" &&
$line[strlen($line) -
1] ==
"]") {
if (substr($property, 0, 1) ==
'"' &&
substr($property, -
1) ==
'"') {
if ($value ==
'false') $value =
false;
if ($value ==
'true') $value =
true;
if (substr($value, 0, 1) ==
'"' &&
substr($value, -
1) ==
'"') {
$ini_array[$sec_name][$property] =
$value;
$ini_array[$property] =
$value;
$ini_array[$property] =
$value;
if (trim($line[0]) ==
';') continue;
$ini_array[$sec_name][] =
trim($line);
* construct an "array_key_exists()" method
* if the runtime PHP version doesn't have one
* @todo CS Cleanup - can't avoid "prefixed by package" error
* @todo depend on PHP_Compat for this?
* Determines if a given key exists in a given array
* @param mixed $key key to search for
* @param array $search the array of keys to search
* @return bool whether or not the key was found
foreach ($search as $keys =>
$nul) {
if ($key ==
$keys) return true;
* construct an "is_a()" method
* if the runtime PHP version doesn't have one
* @todo CS Cleanup - can't avoid "prefixed by package" error
* @todo depend on PHP_Compat for this?
* Determines if one item "is" an object of the other item
* @param string $classname the class in question
* @param string $classquery the "is it a" class
* @return bool whether or not the class "is" one
function is_a($classname, $classquery)
} elseif (!empty($father)) {
return is_a($father, $classquery);
* @param string $s the "debug message" string to echo out
* @todo CS Cleanup - can't avoid "prefixed by package" error
* Returns a formatted var_dump for debugging purposes.
* @param string $s string to display
* @param mixed $v unlimited number of variables to display with var_dump()
if (isset
($GLOBALS['dont_debug']) &&
$GLOBALS['dont_debug']) return;
debug($s.
"\n\n</pre><blockquote><pre>");
debug("</pre></blockquote><pre>\n\n");
* Returns a lower-cased version of get_class for PHP 5
* get_class() returns case as declared in the file in PHP 5
* @param object $object the object to get the classname for
* @return string the class name of the given object
* @todo CS cleanup - rename function to PhpDocumentor_get_class
Documentation generated on Mon, 05 Dec 2011 20:56:50 -0600 by phpDocumentor 1.4.4