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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
output
tags
vendor
*.swp
*.tgz
*.tar
Expand Down
12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
],
"require": {
"php": ">=5.3.0",
"php": ">=5.6",
"ext-dom": "*",
"ext-sqlite3": "*",
"ext-xmlreader": "*"
Expand All @@ -27,8 +27,14 @@
"easybook/geshi": "For using GeSHi as code highlighter"
},
"autoload": {
"psr-0": {
"phpdotnet\\": "."
"files": ["src/functions.php"],
"psr-4": {
"phpdotnet\\phd\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"phpdotnet\\phd\\Tests\\": "tests/"
}
}
}
9 changes: 5 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 0 additions & 36 deletions phpdotnet/phd/Autoloader.php

This file was deleted.

29 changes: 0 additions & 29 deletions phpdotnet/phd/Package/IDE/Factory.php

This file was deleted.

35 changes: 0 additions & 35 deletions phpdotnet/phd/Package/PHP/Factory.php

This file was deleted.

22 changes: 12 additions & 10 deletions render.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

// @php_dir@ gets replaced by pear with the install dir. use __DIR__ when
// running from SVN
define("__INSTALLDIR__", '@php_dir@' == '@'.'php_dir@' ? __DIR__ : '@php_dir@');
use phpdotnet\phd\Format\Factory;
use phpdotnet\phd\Options\Parser;
use phpdotnet\phd\Reader\Partial;

require __INSTALLDIR__ . '/phpdotnet/phd/Autoloader.php';
require __INSTALLDIR__ . '/phpdotnet/phd/functions.php';
define("__INSTALLDIR__", '@php_dir@' == '@'.'php_dir@' ? __DIR__ : '@php_dir@');

spl_autoload_register(array(__NAMESPACE__ . "\\Autoloader", "autoload"));
require_once __INSTALLDIR__ . '/vendor/autoload.php';

$olderrrep = error_reporting();
error_reporting($olderrrep | VERBOSE_DEFAULT);

$conf = array();
if (file_exists("phd.config.php")) {
Expand All @@ -22,7 +25,7 @@
Config::init(array());
}

Options_Parser::getopt();
Parser::getopt();

/* If no docbook file was passed, die */
if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) {
Expand All @@ -40,9 +43,8 @@
// This needs to be moved. Preferably into the PHP package.
if (!$conf) {
Config::init(array(
"lang_dir" => __INSTALLDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR
. "phd" . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR
. "langs" . DIRECTORY_SEPARATOR,
"lang_dir" => __INSTALLDIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR
. "data" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR,
"phpweb_version_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'version.xml',
"phpweb_acronym_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml',
));
Expand All @@ -62,7 +64,7 @@ function make_reader() {
$idlist = Config::render_ids() + Config::skip_ids();
if (!empty($idlist)) {
v("Running partial build", VERBOSE_RENDER_STYLE);
$reader = new Reader_Partial();
$reader = new Partial();
} else {
v("Running full build", VERBOSE_RENDER_STYLE);
$reader = new Reader();
Expand Down Expand Up @@ -97,7 +99,7 @@ function make_reader() {
}

foreach((array)Config::package() as $package) {
$factory = Format_Factory::createFactory($package);
$factory = Factory::createFactory($package);

// Default to all output formats specified by the package
if (count(Config::output_format()) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion phpdotnet/phd/Config.php → src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static function __callStatic($name, $params)
public static function getSupportedPackages() {
$packageList = array();
foreach(Config::package_dirs() as $dir) {
foreach (glob($dir . "/phpdotnet/phd/Package/*", GLOB_ONLYDIR) as $item) {
foreach (glob($dir . "/src/Package/*", GLOB_ONLYDIR) as $item) {
$baseitem = basename($item);
if ($baseitem[0] != '.') {
$packageList[] = $baseitem;
Expand Down
File renamed without changes.
17 changes: 10 additions & 7 deletions phpdotnet/phd/Format/Factory.php → src/Format/Factory.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
namespace phpdotnet\phd;
namespace phpdotnet\phd\Format;

abstract class Format_Factory {
use phpdotnet\phd\Format;
use phpdotnet\phd\Options\OptionsInterface;

abstract class Factory {
private $formats = array();
private $packageName = "";
private $optionsHandler = null;
Expand All @@ -25,7 +28,7 @@ public final function getOptionsHandler() {
return $this->optionsHandler;
}

public final function registerOptionsHandler(Options_Interface $optionsHandler) {
public final function registerOptionsHandler(OptionsInterface $optionsHandler) {
$this->optionsHandler = $optionsHandler;
}

Expand All @@ -41,7 +44,7 @@ public final function getPackageName() {

public final function createFormat($format) {
if (isset($this->formats[$format]) && $this->formats[$format]) {
$classname = __NAMESPACE__ . "\\" . $this->formats[$format];
$classname = "phpdotnet\\phd\\Package\\" . $this->formats[$format];

$obj = new $classname();
if (!($obj instanceof Format)) {
Expand All @@ -60,11 +63,11 @@ public static final function createFactory($package) {
}

if (!isset($factories[$package])) {
$classname = __NAMESPACE__ . "\\Package_" . $package . "_Factory";
$classname = 'phpdotnet\\phd\\Package\\' . $package . '\\Factory';

$factory = new $classname();
if (!($factory instanceof Format_Factory)) {
throw new \Exception("All Factories must inherit Format_Factory");
if (!($factory instanceof Factory)) {
throw new \Exception("All Factories must inherit Format\Factory");
}
$factories[$package] = $factory;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
namespace phpdotnet\phd;
namespace phpdotnet\phd\Format;

abstract class Format_Abstract_Manpage extends Format {
use phpdotnet\phd\Format;

abstract class Manpage extends Format {
public $role = false;

public function UNDEF($open, $name, $attrs, $props) {
Expand Down
40 changes: 40 additions & 0 deletions src/Format/PDF.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace phpdotnet\phd\Format;

use phpdotnet\phd\Format;

abstract class PDF extends Format {
protected $pdfDoc;

public function getPdfDoc() {
return $this->pdfDoc;
}

public function setPdfDoc($pdfDoc) {
$this->pdfDoc = $pdfDoc;
}

public function UNDEF($open, $name, $attrs, $props) {
if ($open) {
trigger_error("No mapper found for '{$name}'", E_USER_WARNING);
}
$this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 14, array(1, 0, 0)); // Helvetica 14 red
$this->pdfDoc->appendText(($open ? "<" : "</") . $name . ">");
$this->pdfDoc->revertFont();
return "";
}

public function CDATA($str) {
$this->pdfDoc->appendText(utf8_decode(trim($str)));
return "";
}

public function transformFromMap($open, $tag, $name, $attrs, $props) {
return "";
}

public function createLink($for, &$desc = null, $type = Format::SDESC){}

public function TEXT($str) {}

}
Loading