Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/phpDoctor.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function phpDoctor($config = 'default.ini')
if (isset($this->_options['source_path'])) {
$this->_sourcePath = array();
foreach (explode(',', $this->_options['source_path']) as $path) {
$this->_sourcePath[] = $this->fixPath($path, getcwd());
$this->_sourcePath[] = $this->makeAbsolutePath($path, getcwd());
}
}

Expand Down Expand Up @@ -487,7 +487,7 @@ public function makeAbsolutePath($path, $prefix)
public function fixPath($path)
{
if (substr($path, -1, 1) != '/' && substr($path, -1, 1) != '\\') {
return $path.'/';
return $path.DIRECTORY_SEPARATOR;
} else {
return $path;
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"require": {
"php": ">=5.2.0",
"michelf/php-markdown": "1.3"
"michelf/php-markdown": "1.3",
"easybook/geshi" : "*"
},
"require-dev": {
"lastcraft/simpletest": "1.1.*"
Expand Down
2 changes: 1 addition & 1 deletion doclets/standard/htmlWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function _nav($path)

$output .= '<div class="small_links">'."\n";
$output .= '<a href="'.str_repeat('../', $this->_depth).'index.html" target="_top">Frames</a>'."\n";
$output .= '<a href="'.str_repeat('../', $this->_depth).$path.'" target="_top">No frames</a>'."\n";
$output .= '<a href="'.str_repeat('../', $this->_depth).str_replace('\\', '/', $path).'" target="_top">No frames</a>'."\n";
$output .= "</div>\n";
$thisClass = strtolower(get_class($this));
if ($thisClass == 'classwriter') {
Expand Down
4 changes: 2 additions & 2 deletions doclets/standard/sourceWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ public function sourceWriter(&$doclet)
$this->_sections[7] = array('title' => 'Todo', 'url' => 'todo-list.html');
$this->_sections[8] = array('title' => 'Index', 'url' => 'index-all.html');

$this->_depth = substr_count($filename, '/') + 1;
$this->_depth = substr_count(str_replace('\\', '/', $filename), '/') + 1;

if (class_exists('GeSHi')) {
$geshi = new GeSHi($data[0], 'php');
$source = $geshi->parse_code();
} else {
$source = '<pre>'.$data[0].'</pre>';
$source = '<pre>'.htmlspecialchars($data[0]).'</pre>';
}

ob_start();
Expand Down
2 changes: 1 addition & 1 deletion doclets/standard/standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function standard(&$rootDoc, $formatter)

if (isset($options['include_source'])) $this->_includeSource = $options['include_source'];
if ($this->_includeSource) {
@include_once 'geshi/geshi.php';
if (!class_exists('GeSHi')) @include_once 'geshi/geshi.php';
if (!class_exists('GeSHi')) {
$phpdoctor->warning('Could not find GeSHi in "geshi/geshi.php", not pretty printing source');
}
Expand Down
16 changes: 11 additions & 5 deletions phpdoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// check we are running from the command line
if (!isset($argv[0])) {
die('This program must be run from the command line using the CLI version of PHP');

// check we are using the correct version of PHP
} elseif (!defined('T_COMMENT') || !extension_loaded('tokenizer') || version_compare(phpversion(), '5', '<')) {
error('You need PHP version 5 or greater with the "tokenizer" extension to run this script, please upgrade');
Expand All @@ -35,14 +35,20 @@
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__));
require('classes'.DIRECTORY_SEPARATOR.'phpDoctor.php');

// include Composer autoloader
$autoloader = dirname(__FILE__).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
if (is_readable($autoloader)) {
require_once($autoloader);
}

// get name of config file to use
if (!isset($argv[1])) {
if (isset($_ENV['PHPDoctor'])) {
$argv[1] = $_ENV['PHPDoctor'];
} elseif (is_file(getcwd().'/phpdoctor.ini')) {
$argv[1] = getcwd().'/phpdoctor.ini';
} elseif (is_file(dirname(__FILE__).'/phpdoctor.ini')) {
$argv[1] = dirname(__FILE__).'/phpdoctor.ini';
} elseif (is_file(getcwd().DIRECTORY_SEPARATOR.'phpdoctor.ini')) {
$argv[1] = getcwd().DIRECTORY_SEPARATOR.'phpdoctor.ini';
} elseif (is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'phpdoctor.ini')) {
$argv[1] = dirname(__FILE__).DIRECTORY_SEPARATOR.'phpdoctor.ini';
} else {
die("Usage: phpdoc [config_file]\n");
}
Expand Down