Commit 8c682527 by 杨树贤

pdf包更新

parent bd411744
Showing with 596 additions and 1510 deletions
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"doctrine/instantiator": "1.0.2", "doctrine/instantiator": "1.0.2",
"phpdocumentor/reflection-docblock": "3.2.2", "phpdocumentor/reflection-docblock": "3.2.2",
"jenssegers/mongodb": "3.0.0", "jenssegers/mongodb": "3.0.0",
"barryvdh/laravel-dompdf": "0.6.*" "barryvdh/laravel-dompdf": "0.8.*"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
} }
], ],
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.5.9",
"illuminate/support": "5.0.x|5.1.x|5.2.x", "illuminate/support": "5.1.x|5.2.x|5.3.x|5.4.x|5.5.x|5.6.x",
"dompdf/dompdf": "0.6.*" "dompdf/dompdf": "^0.8"
}, },
"autoload": { "autoload": {
...@@ -22,7 +22,16 @@ ...@@ -22,7 +22,16 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "0.6-dev" "dev-master": "0.8-dev"
},
"laravel": {
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
],
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade"
}
} }
} },
"minimum-stability": "dev"
} }
...@@ -38,7 +38,7 @@ return array( ...@@ -38,7 +38,7 @@ return array(
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic, * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats. * Symbol, ZapfDingbats.
*/ */
"DOMPDF_FONT_DIR" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) "font_dir" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/** /**
* The location of the DOMPDF font cache directory * The location of the DOMPDF font cache directory
...@@ -48,7 +48,7 @@ return array( ...@@ -48,7 +48,7 @@ return array(
* *
* Note: This directory must exist and be writable by the webserver process. * Note: This directory must exist and be writable by the webserver process.
*/ */
"DOMPDF_FONT_CACHE" => storage_path('fonts/'), "font_cache" => storage_path('fonts/'),
/** /**
* The location of a temporary directory. * The location of a temporary directory.
...@@ -57,7 +57,7 @@ return array( ...@@ -57,7 +57,7 @@ return array(
* The temporary directory is required to download remote images and when * The temporary directory is required to download remote images and when
* using the PFDLib back end. * using the PFDLib back end.
*/ */
"DOMPDF_TEMP_DIR" => sys_get_temp_dir(), "temp_dir" => sys_get_temp_dir(),
/** /**
* ==== IMPORTANT ==== * ==== IMPORTANT ====
...@@ -71,23 +71,12 @@ return array( ...@@ -71,23 +71,12 @@ return array(
* direct class use like: * direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/ */
"DOMPDF_CHROOT" => realpath(base_path()), "chroot" => realpath(base_path()),
/**
* Whether to use Unicode fonts or not.
*
* When set to true the PDF backend must be set to "CPDF" and fonts must be
* loaded via load_font.php.
*
* When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a
* document must be present in your fonts, however.
*/
"DOMPDF_UNICODE_ENABLED" => true,
/** /**
* Whether to enable font subsetting or not. * Whether to enable font subsetting or not.
*/ */
"DOMPDF_ENABLE_FONTSUBSETTING" => false, "enable_font_subsetting" => false,
/** /**
* The PDF rendering backend to use * The PDF rendering backend to use
...@@ -117,7 +106,7 @@ return array( ...@@ -117,7 +106,7 @@ return array(
* @link http://www.ros.co.nz/pdf * @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image * @link http://www.php.net/image
*/ */
"DOMPDF_PDF_BACKEND" => "CPDF", "pdf_backend" => "CPDF",
/** /**
* PDFlib license key * PDFlib license key
...@@ -143,7 +132,7 @@ return array( ...@@ -143,7 +132,7 @@ return array(
* the desired content might be different (e.g. screen or projection view of html file). * the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here. * Therefore allow specification of content here.
*/ */
"DOMPDF_DEFAULT_MEDIA_TYPE" => "screen", "default_media_type" => "screen",
/** /**
* The default paper size. * The default paper size.
...@@ -152,7 +141,7 @@ return array( ...@@ -152,7 +141,7 @@ return array(
* *
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/ */
"DOMPDF_DEFAULT_PAPER_SIZE" => "a4", "default_paper_size" => "a4",
/** /**
* The default font family * The default font family
...@@ -160,7 +149,7 @@ return array( ...@@ -160,7 +149,7 @@ return array(
* Used if no suitable fonts can be found. This must exist in the font folder. * Used if no suitable fonts can be found. This must exist in the font folder.
* @var string * @var string
*/ */
"DOMPDF_DEFAULT_FONT" => "serif", "default_font" => "serif",
/** /**
* Image DPI setting * Image DPI setting
...@@ -195,7 +184,7 @@ return array( ...@@ -195,7 +184,7 @@ return array(
* *
* @var int * @var int
*/ */
"DOMPDF_DPI" => 96, "dpi" => 96,
/** /**
* Enable inline PHP * Enable inline PHP
...@@ -209,7 +198,7 @@ return array( ...@@ -209,7 +198,7 @@ return array(
* *
* @var bool * @var bool
*/ */
"DOMPDF_ENABLE_PHP" => false, "enable_php" => false,
/** /**
* Enable inline Javascript * Enable inline Javascript
...@@ -219,7 +208,7 @@ return array( ...@@ -219,7 +208,7 @@ return array(
* *
* @var bool * @var bool
*/ */
"DOMPDF_ENABLE_JAVASCRIPT" => true, "enable_javascript" => true,
/** /**
* Enable remote file access * Enable remote file access
...@@ -238,28 +227,17 @@ return array( ...@@ -238,28 +227,17 @@ return array(
* *
* @var bool * @var bool
*/ */
"DOMPDF_ENABLE_REMOTE" => true, "enable_remote" => true,
/** /**
* A ratio applied to the fonts height to be more like browsers' line height * A ratio applied to the fonts height to be more like browsers' line height
*/ */
"DOMPDF_FONT_HEIGHT_RATIO" => 1.1, "font_height_ratio" => 1.1,
/**
* Enable CSS float
*
* Allows people to disabled CSS float support
* @var bool
*/
"DOMPDF_ENABLE_CSS_FLOAT" => false,
/** /**
* Use the more-than-experimental HTML5 Lib parser * Use the more-than-experimental HTML5 Lib parser
*/ */
"DOMPDF_ENABLE_HTML5PARSER" => false, "enable_html5_parser" => false,
), ),
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Require this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also. Require this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also.
"barryvdh/laravel-dompdf": "0.6.*" composer require barryvdh/laravel-dompdf
## Installation ## Installation
...@@ -51,13 +51,52 @@ You can chain the methods: ...@@ -51,13 +51,52 @@ You can chain the methods:
You can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on) You can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on)
PDF::loadHTML($html)->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save('myfile.pdf') PDF::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->save('myfile.pdf')
If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself. If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself.
Use `php artisan vendor:publish` to create a config file located at `config/dompdf.php` which will allow you to define local configurations to change some settings (default paper etc). Use `php artisan vendor:publish` to create a config file located at `config/dompdf.php` which will allow you to define local configurations to change some settings (default paper etc).
You can also use your ConfigProvider to set certain keys. You can also use your ConfigProvider to set certain keys.
### Configuration
The defaults configuration settings are set in `config/dompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
You can still alter the dompdf options in your code before generating the pdf using this command:
PDF::setOptions(['dpi' => 150, 'defaultFont' => 'sans-serif']);
Available options and their defaults:
* __rootDir__: "{app_directory}/vendor/dompdf/dompdf"
* __tempDir__: "/tmp" _(available in config/dompdf.php)_
* __fontDir__: "{app_directory}/storage/fonts/" _(available in config/dompdf.php)_
* __fontCache__: "{app_directory}/storage/fonts/" _(available in config/dompdf.php)_
* __chroot__: "{app_directory}" _(available in config/dompdf.php)_
* __logOutputFile__: "/tmp/log.htm"
* __defaultMediaType__: "screen" _(available in config/dompdf.php)_
* __defaultPaperSize__: "a4" _(available in config/dompdf.php)_
* __defaultFont__: "serif" _(available in config/dompdf.php)_
* __dpi__: 96 _(available in config/dompdf.php)_
* __fontHeightRatio__: 1.1 _(available in config/dompdf.php)_
* __isPhpEnabled__: false _(available in config/dompdf.php)_
* __isRemoteEnabled__: true _(available in config/dompdf.php)_
* __isJavascriptEnabled__: true _(available in config/dompdf.php)_
* __isHtml5ParserEnabled__: false _(available in config/dompdf.php)_
* __isFontSubsettingEnabled__: false _(available in config/dompdf.php)_
* __debugPng__: false
* __debugKeepTemp__: false
* __debugCss__: false
* __debugLayout__: false
* __debugLayoutLines__: true
* __debugLayoutBlocks__: true
* __debugLayoutInline__: true
* __debugLayoutPaddingBox__: true
* __pdfBackend__: "CPDF" _(available in config/dompdf.php)_
* __pdflibLicense__: ""
* __adminUsername__: "user"
* __adminPassword__: "password"
### Tip: UTF-8 support ### Tip: UTF-8 support
In your templates, set the UTF-8 Metatag: In your templates, set the UTF-8 Metatag:
......
<?php <?php
namespace Barryvdh\DomPDF; namespace Barryvdh\DomPDF;
use DOMPDF; use Dompdf\Dompdf;
use Dompdf\Options;
use Exception; use Exception;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\View\Factory as ViewFactory; use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Contracts\Config\Repository as ConfigRepository; use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Illuminate\Http\Response; use Illuminate\Http\Response;
/** /**
* A Laravel wrapper for DOMPDF * A Laravel wrapper for Dompdf
* *
* @package laravel-dompdf * @package laravel-dompdf
* @author Barry vd. Heuvel * @author Barry vd. Heuvel
*/ */
class PDF{ class PDF{
/** @var \DOMPDF */ /** @var Dompdf */
protected $dompdf; protected $dompdf;
/** @var \Illuminate\Contracts\Config\Repository */ /** @var \Illuminate\Contracts\Config\Repository */
...@@ -35,33 +36,24 @@ class PDF{ ...@@ -35,33 +36,24 @@ class PDF{
protected $public_path; protected $public_path;
/** /**
* @param \DOMPDF $dompdf * @param Dompdf $dompdf
* @param \Illuminate\Contracts\Config\Repository $config * @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Filesystem\Filesystem $files * @param \Illuminate\Filesystem\Filesystem $files
* @param \Illuminate\View\Factory $view * @param \Illuminate\Contracts\View\Factory $view
*/ */
public function __construct(DOMPDF $dompdf, ConfigRepository $config, Filesystem $files, ViewFactory $view){ public function __construct(Dompdf $dompdf, ConfigRepository $config, Filesystem $files, ViewFactory $view){
$this->dompdf = $dompdf; $this->dompdf = $dompdf;
$this->config = $config; $this->config = $config;
$this->files = $files; $this->files = $files;
$this->view = $view; $this->view = $view;
$this->showWarnings = $this->config->get('dompdf.show_warnings', false); $this->showWarnings = $this->config->get('dompdf.show_warnings', false);
//To prevent old configs from not working..
if($this->config->has('dompdf.paper')){
$this->paper = $this->config->get('dompdf.paper');
}else{
$this->paper = DOMPDF_DEFAULT_PAPER_SIZE;
}
$this->orientation = $this->config->get('dompdf.orientation') ?: 'portrait';
} }
/** /**
* Get the DomPDF instance * Get the DomPDF instance
* *
* @return \DOMPDF * @return Dompdf
*/ */
public function getDomPDF(){ public function getDomPDF(){
return $this->dompdf; return $this->dompdf;
...@@ -74,22 +66,10 @@ class PDF{ ...@@ -74,22 +66,10 @@ class PDF{
* @param string $orientation * @param string $orientation
* @return $this * @return $this
*/ */
public function setPaper($paper, $orientation=null){ public function setPaper($paper, $orientation = 'portrait'){
$this->paper = $paper; $this->paper = $paper;
if($orientation){
$this->orientation = $orientation;
}
return $this;
}
/**
* Set the orientation (default portrait)
*
* @param string $orientation
* @return static
*/
public function setOrientation($orientation){
$this->orientation = $orientation; $this->orientation = $orientation;
$this->dompdf->setPaper($paper, $orientation);
return $this; return $this;
} }
...@@ -113,7 +93,7 @@ class PDF{ ...@@ -113,7 +93,7 @@ class PDF{
*/ */
public function loadHTML($string, $encoding = null){ public function loadHTML($string, $encoding = null){
$string = $this->convertEntities($string); $string = $this->convertEntities($string);
$this->dompdf->load_html($string, $encoding); $this->dompdf->loadHtml($string, $encoding);
$this->rendered = false; $this->rendered = false;
return $this; return $this;
} }
...@@ -125,7 +105,7 @@ class PDF{ ...@@ -125,7 +105,7 @@ class PDF{
* @return static * @return static
*/ */
public function loadFile($file){ public function loadFile($file){
$this->dompdf->load_html_file($file); $this->dompdf->loadHtmlFile($file);
$this->rendered = false; $this->rendered = false;
return $this; return $this;
} }
...@@ -145,6 +125,18 @@ class PDF{ ...@@ -145,6 +125,18 @@ class PDF{
} }
/** /**
* Set/Change an option in DomPdf
*
* @param array $options
* @return static
*/
public function setOptions(array $options) {
$options = new Options($options);
$this->dompdf->setOptions($options);
return $this;
}
/**
* Output the PDF as a string. * Output the PDF as a string.
* *
* @return string The rendered PDF as string * @return string The rendered PDF as string
...@@ -203,13 +195,13 @@ class PDF{ ...@@ -203,13 +195,13 @@ class PDF{
throw new Exception('DOMPDF not created yet'); throw new Exception('DOMPDF not created yet');
} }
$this->dompdf->set_paper($this->paper, $this->orientation); $this->dompdf->setPaper($this->paper, $this->orientation);
$this->dompdf->render(); $this->dompdf->render();
if ( $this->showWarnings ) { if ( $this->showWarnings ) {
global $_dompdf_warnings; global $_dompdf_warnings;
if(count($_dompdf_warnings)){ if(!empty($_dompdf_warnings) && count($_dompdf_warnings)){
$warnings = ''; $warnings = '';
foreach ($_dompdf_warnings as $msg){ foreach ($_dompdf_warnings as $msg){
$warnings .= $msg . "\n"; $warnings .= $msg . "\n";
...@@ -227,6 +219,7 @@ class PDF{ ...@@ -227,6 +219,7 @@ class PDF{
protected function convertEntities($subject){ protected function convertEntities($subject){
$entities = array( $entities = array(
'€' => '&#0128;', '€' => '&#0128;',
'£' => '&pound;',
); );
foreach($entities as $search => $replace){ foreach($entities as $search => $replace){
......
<?php <?php
namespace Barryvdh\DomPDF; namespace Barryvdh\DomPDF;
use Dompdf\Dompdf;
use Exception; use Exception;
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
...@@ -25,13 +26,32 @@ class ServiceProvider extends IlluminateServiceProvider ...@@ -25,13 +26,32 @@ class ServiceProvider extends IlluminateServiceProvider
$configPath = __DIR__.'/../config/dompdf.php'; $configPath = __DIR__.'/../config/dompdf.php';
$this->mergeConfigFrom($configPath, 'dompdf'); $this->mergeConfigFrom($configPath, 'dompdf');
$this->app->bind('dompdf', function ($app) { $this->app->bind('dompdf.options', function(){
$dompdf = new \DOMPDF(); $defines = $this->app['config']->get('dompdf.defines');
$dompdf->set_base_path(realpath(base_path('public')));
if ($defines) {
$options = [];
foreach ($defines as $key => $value) {
$key = strtolower(str_replace('DOMPDF_', '', $key));
$options[$key] = $value;
}
} else {
$options = $this->app['config']->get('dompdf.options');
}
return $options;
});
$this->app->bind('dompdf', function() {
$options = $this->app->make('dompdf.options');
$dompdf = new Dompdf($options);
$dompdf->setBasePath(realpath(base_path('public')));
return $dompdf; return $dompdf;
}); });
$this->app->alias('dompdf', 'DOMPDF'); $this->app->alias('dompdf', Dompdf::class);
$this->app->bind('dompdf.wrapper', function ($app) { $this->app->bind('dompdf.wrapper', function ($app) {
return new PDF($app['dompdf'], $app['config'], $app['files'], $app['view']); return new PDF($app['dompdf'], $app['config'], $app['files'], $app['view']);
...@@ -55,29 +75,6 @@ class ServiceProvider extends IlluminateServiceProvider ...@@ -55,29 +75,6 @@ class ServiceProvider extends IlluminateServiceProvider
$configPath = __DIR__.'/../config/dompdf.php'; $configPath = __DIR__.'/../config/dompdf.php';
$this->publishes([$configPath => config_path('dompdf.php')], 'config'); $this->publishes([$configPath => config_path('dompdf.php')], 'config');
} }
$defines = $this->app['config']->get('dompdf.defines') ?: array();
foreach ($defines as $key => $value) {
$this->define($key, $value);
}
//Still load these values, in case config is not used.
$this->define("DOMPDF_ENABLE_REMOTE", true);
$this->define("DOMPDF_ENABLE_AUTOLOAD", false);
$this->define("DOMPDF_CHROOT", realpath(base_path()));
$this->define("DOMPDF_LOG_OUTPUT_FILE", storage_path('logs/dompdf.html'));
$config_file = $this->app['config']->get(
'dompdf.config_file'
) ?: base_path('vendor/dompdf/dompdf/dompdf_config.inc.php');
if (file_exists($config_file)) {
require_once $config_file;
} else {
throw new Exception(
"$config_file cannot be loaded, please configure correct config file (dompdf.config_file)"
);
}
} }
/** /**
...@@ -87,20 +84,7 @@ class ServiceProvider extends IlluminateServiceProvider ...@@ -87,20 +84,7 @@ class ServiceProvider extends IlluminateServiceProvider
*/ */
public function provides() public function provides()
{ {
return array('dompdf', 'dompdf.wrapper'); return array('dompdf', 'dompdf.options', 'dompdf.wrapper');
}
/**
* Define a value, if not already defined
*
* @param string $name
* @param string $value
*/
protected function define($name, $value)
{
if (! defined($name)) {
define($name, $value);
}
} }
} }
This diff could not be displayed because it is too large.
...@@ -27,7 +27,9 @@ return array( ...@@ -27,7 +27,9 @@ return array(
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'), 'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Svg\\' => array($vendorDir . '/phenx/php-svg-lib/src/Svg'),
'SuperClosure\\' => array($vendorDir . '/jeremeamia/superclosure/src'), 'SuperClosure\\' => array($vendorDir . '/jeremeamia/superclosure/src'),
'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'),
'Psy\\' => array($vendorDir . '/psy/psysh/src/Psy'), 'Psy\\' => array($vendorDir . '/psy/psysh/src/Psy'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
...@@ -43,8 +45,10 @@ return array( ...@@ -43,8 +45,10 @@ return array(
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'FontLib\\' => array($vendorDir . '/phenx/php-font-lib/src/FontLib'),
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'), 'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Dompdf\\' => array($vendorDir . '/dompdf/dompdf/src'),
'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'), 'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'),
'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'), 'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'),
'Barryvdh\\DomPDF\\' => array($vendorDir . '/barryvdh/laravel-dompdf/src'), 'Barryvdh\\DomPDF\\' => array($vendorDir . '/barryvdh/laravel-dompdf/src'),
......
This diff could not be displayed because it is too large.
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ac3c186e8c6551b2459919cfcbb59eb7d15d4e07', 'reference' => 'bd4117442be7f09d77eeb88f789781a536729f5c',
'name' => 'laravel/laravel', 'name' => 'laravel/laravel',
'dev' => true, 'dev' => true,
), ),
'versions' => array( 'versions' => array(
'barryvdh/laravel-dompdf' => array( 'barryvdh/laravel-dompdf' => array(
'pretty_version' => 'v0.6.1', 'pretty_version' => 'v0.8.2',
'version' => '0.6.1.0', 'version' => '0.8.2.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../barryvdh/laravel-dompdf', 'install_path' => __DIR__ . '/../barryvdh/laravel-dompdf',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b606788108833f7765801dca35455fb23ce9f869', 'reference' => '7dcdecfa125c174d0abe723603633dc2756ea3af',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'classpreloader/classpreloader' => array( 'classpreloader/classpreloader' => array(
...@@ -68,12 +68,12 @@ ...@@ -68,12 +68,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'dompdf/dompdf' => array( 'dompdf/dompdf' => array(
'pretty_version' => 'v0.6.2', 'pretty_version' => 'v0.8.3',
'version' => '0.6.2.0', 'version' => '0.8.3.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../dompdf/dompdf', 'install_path' => __DIR__ . '/../dompdf/dompdf',
'aliases' => array(), 'aliases' => array(),
'reference' => 'cc06008f75262510ee135b8cbb14e333a309f651', 'reference' => '75f13c700009be21a1965dc2c5b68a8708c22ba2',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'fzaninotto/faker' => array( 'fzaninotto/faker' => array(
...@@ -355,16 +355,16 @@ ...@@ -355,16 +355,16 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ac3c186e8c6551b2459919cfcbb59eb7d15d4e07', 'reference' => 'bd4117442be7f09d77eeb88f789781a536729f5c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'league/flysystem' => array( 'league/flysystem' => array(
'pretty_version' => '1.0.66', 'pretty_version' => '1.0.70',
'version' => '1.0.66.0', 'version' => '1.0.70.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../league/flysystem', 'install_path' => __DIR__ . '/../league/flysystem',
'aliases' => array(), 'aliases' => array(),
'reference' => '021569195e15f8209b1c4bebb78bd66aa4f08c21', 'reference' => '585824702f534f8d3cf7fab7225e8466cc4b7493',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'maatwebsite/excel' => array( 'maatwebsite/excel' => array(
...@@ -395,12 +395,12 @@ ...@@ -395,12 +395,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'monolog/monolog' => array( 'monolog/monolog' => array(
'pretty_version' => '1.25.3', 'pretty_version' => '1.27.1',
'version' => '1.25.3.0', 'version' => '1.27.1.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../monolog/monolog', 'install_path' => __DIR__ . '/../monolog/monolog',
'aliases' => array(), 'aliases' => array(),
'reference' => 'fa82921994db851a8becaf3787a9e73c5976b6f1', 'reference' => '904713c5929655dc9b97288b69cfeedad610c9a1',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'mtdowling/cron-expression' => array( 'mtdowling/cron-expression' => array(
...@@ -440,12 +440,21 @@ ...@@ -440,12 +440,21 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'phenx/php-font-lib' => array( 'phenx/php-font-lib' => array(
'pretty_version' => '0.2.2', 'pretty_version' => '0.5.6',
'version' => '0.2.2.0', 'version' => '0.5.6.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phenx/php-font-lib', 'install_path' => __DIR__ . '/../phenx/php-font-lib',
'aliases' => array(), 'aliases' => array(),
'reference' => 'c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82', 'reference' => 'a1681e9793040740a405ac5b189275059e2a9863',
'dev_requirement' => false,
),
'phenx/php-svg-lib' => array(
'pretty_version' => 'v0.3.3',
'version' => '0.3.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phenx/php-svg-lib',
'aliases' => array(),
'reference' => '5fa61b65e612ce1ae15f69b3d223cb14ecc60e32',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'php-amqplib/php-amqplib' => array( 'php-amqplib/php-amqplib' => array(
...@@ -566,12 +575,12 @@ ...@@ -566,12 +575,12 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'predis/predis' => array( 'predis/predis' => array(
'pretty_version' => 'v1.1.7', 'pretty_version' => 'v1.1.10',
'version' => '1.1.7.0', 'version' => '1.1.10.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../predis/predis', 'install_path' => __DIR__ . '/../predis/predis',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b240daa106d4e02f0c5b7079b41e31ddf66fddf8', 'reference' => 'a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/http-message' => array( 'psr/http-message' => array(
...@@ -590,12 +599,12 @@ ...@@ -590,12 +599,12 @@
), ),
), ),
'psr/log' => array( 'psr/log' => array(
'pretty_version' => '1.1.3', 'pretty_version' => '1.1.4',
'version' => '1.1.3.0', 'version' => '1.1.4.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/log', 'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(), 'aliases' => array(),
'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/log-implementation' => array( 'psr/log-implementation' => array(
...@@ -622,6 +631,15 @@ ...@@ -622,6 +631,15 @@
'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'sabberworm/php-css-parser' => array(
'pretty_version' => 'v8.7.0',
'version' => '8.7.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../sabberworm/php-css-parser',
'aliases' => array(),
'reference' => 'f414ff953002a9b18e3a116f5e462c56f21237cf',
'dev_requirement' => false,
),
'sebastian/comparator' => array( 'sebastian/comparator' => array(
'pretty_version' => '1.2.4', 'pretty_version' => '1.2.4',
'version' => '1.2.4.0', 'version' => '1.2.4.0',
...@@ -731,12 +749,12 @@ ...@@ -731,12 +749,12 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/event-dispatcher' => array( 'symfony/event-dispatcher' => array(
'pretty_version' => 'v3.4.39', 'pretty_version' => 'v3.4.47',
'version' => '3.4.39.0', 'version' => '3.4.47.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher', 'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(), 'aliases' => array(),
'reference' => '9d4e22943b73acc1ba50595b7de1a01fe9dbad48', 'reference' => '31fde73757b6bad247c54597beef974919ec6860',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/finder' => array( 'symfony/finder' => array(
...@@ -776,30 +794,30 @@ ...@@ -776,30 +794,30 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-mbstring' => array( 'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.15.0', 'pretty_version' => 'v1.19.0',
'version' => '1.15.0.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(), 'aliases' => array(),
'reference' => '81ffd3a9c6d707be22e3012b827de1c9775fc5ac', 'reference' => 'b5f7b932ee6fa802fc792eabd77c4c88084517ce',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php56' => array( 'symfony/polyfill-php56' => array(
'pretty_version' => 'v1.15.0', 'pretty_version' => 'v1.19.0',
'version' => '1.15.0.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php56', 'install_path' => __DIR__ . '/../symfony/polyfill-php56',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd51ec491c8ddceae7dca8dd6c7e30428f543f37d', 'reference' => 'ea19621731cbd973a6702cfedef3419768bf3372',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-util' => array( 'symfony/polyfill-util' => array(
'pretty_version' => 'v1.15.0', 'pretty_version' => 'v1.19.0',
'version' => '1.15.0.0', 'version' => '1.19.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-util', 'install_path' => __DIR__ . '/../symfony/polyfill-util',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd8e76c104127675d0ea3df3be0f2ae24a8619027', 'reference' => '8df0c3e6a4b85df9a5c6f3f2f46fba5c5c47058a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/process' => array( 'symfony/process' => array(
...@@ -878,12 +896,12 @@ ...@@ -878,12 +896,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'vlucas/phpdotenv' => array( 'vlucas/phpdotenv' => array(
'pretty_version' => 'v2.6.3', 'pretty_version' => 'v2.6.9',
'version' => '2.6.3.0', 'version' => '2.6.9.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../vlucas/phpdotenv', 'install_path' => __DIR__ . '/../vlucas/phpdotenv',
'aliases' => array(), 'aliases' => array(),
'reference' => 'df4c4d08a639be4ef5d6d1322868f9e477553679', 'reference' => '2e93cc98e2e8e869f8d9cfa61bb3a99ba4fc4141',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'webmozart/assert' => array( 'webmozart/assert' => array(
......
.DS_Store
composer.lock
vendor
.idea
.project
lib/fonts/*.afm.php
lib/fonts/*.ufm.php
lib/fonts/log.htm
[submodule "lib/php-font-lib"]
path = lib/php-font-lib
url = https://github.com/PhenX/php-font-lib.git
...@@ -57,20 +57,9 @@ Questions should be asked on the ...@@ -57,20 +57,9 @@ Questions should be asked on the
- Make sure you have a [GitHub Account](https://github.com/signup/free) - Make sure you have a [GitHub Account](https://github.com/signup/free)
- Fork [dompdf](https://github.com/dompdf/dompdf/) - Fork [dompdf](https://github.com/dompdf/dompdf/)
([how to fork a repo](https://help.github.com/articles/fork-a-repo)) ([how to fork a repo](https://help.github.com/articles/fork-a-repo))
- *Make your changes on the dev branch* or the most appropriate feature branch. Please only patch - *Make your changes on the `develop` branch* or the most appropriate feature branch. Please only patch
the master branch if you are attempting to address an urgent bug in the released code. the master branch if you are attempting to address an urgent bug in the released code.
- Add a simple test file in `www/test/`, with a comprehensive name. - Add a simple test file in `www/test/`, with a comprehensive name.
- Add a unit test in the ``test/Dompdf/Tests/`` directory.
- Submit a pull request - Submit a pull request
([how to create a pull request](https://help.github.com/articles/fork-a-repo)) ([how to create a pull request](https://help.github.com/articles/fork-a-repo))
### Coding standards
- 2 spaces per indentation level, no tabs.
- spaces inside `if` like this:
```php
if ( $foo == "bar" ) {
//
}
```
- booleans in lowercase
- opening braces *always* on the same line
<75f13c70>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf", "homepage": "https://github.com/dompdf/dompdf",
"license": "LGPL", "license": "LGPL-2.1",
"authors": [ "authors": [
{ {
"name": "Fabien Ménager", "name": "Fabien Ménager",
...@@ -12,12 +12,37 @@ ...@@ -12,12 +12,37 @@
{ {
"name": "Brian Sweeney", "name": "Brian Sweeney",
"email": "eclecticgeek@gmail.com" "email": "eclecticgeek@gmail.com"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com"
} }
], ],
"autoload": { "autoload": {
"classmap": ["include/"] "psr-4" : {
"Dompdf\\" : "src/"
},
"classmap" : ["lib/"]
}, },
"require": { "require": {
"phenx/php-font-lib": "0.2.*" "php": ">=5.4.0",
"ext-dom": "*",
"ext-mbstring": "*",
"phenx/php-font-lib": "0.5.*",
"phenx/php-svg-lib": "0.3.*"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5",
"squizlabs/php_codesniffer": "2.*"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-imagick": "Improves image processing performance",
"ext-gmagick": "Improves image processing performance"
},
"extra": {
"branch-alias": {
"dev-develop": "0.7-dev"
}
} }
} }
<?php
/**
* Command line utility to use dompdf.
* Can also be used with HTTP GET parameters
*
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* Display command line usage
*/
function dompdf_usage() {
$default_paper_size = DOMPDF_DEFAULT_PAPER_SIZE;
echo <<<EOD
Usage: {$_SERVER["argv"][0]} [options] html_file
html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' character to read from standard input.
Options:
-h Show this message
-l List available paper sizes
-p size Paper size; something like 'letter', 'A4', 'legal', etc.
The default is '$default_paper_size'
-o orientation Either 'portrait' or 'landscape'. Default is 'portrait'
-b path Set the 'document root' of the html_file.
Relative urls (for stylesheets) are resolved using this directory.
Default is the directory of html_file.
-f file The output filename. Default is the input [html_file].pdf
-v Verbose: display html parsing warnings and file not found errors.
-d Very verbose: display oodles of debugging output: every frame
in the tree printed to stdout.
-t Comma separated list of debugging types (page-break,reflow,split)
EOD;
exit;
}
/**
* Parses command line options
*
* @return array The command line options
*/
function getoptions() {
$opts = array();
if ( $_SERVER["argc"] == 1 )
return $opts;
$i = 1;
while ($i < $_SERVER["argc"]) {
switch ($_SERVER["argv"][$i]) {
case "--help":
case "-h":
$opts["h"] = true;
$i++;
break;
case "-l":
$opts["l"] = true;
$i++;
break;
case "-p":
if ( !isset($_SERVER["argv"][$i+1]) )
die("-p switch requires a size parameter\n");
$opts["p"] = $_SERVER["argv"][$i+1];
$i += 2;
break;
case "-o":
if ( !isset($_SERVER["argv"][$i+1]) )
die("-o switch requires an orientation parameter\n");
$opts["o"] = $_SERVER["argv"][$i+1];
$i += 2;
break;
case "-b":
if ( !isset($_SERVER["argv"][$i+1]) )
die("-b switch requires a path parameter\n");
$opts["b"] = $_SERVER["argv"][$i+1];
$i += 2;
break;
case "-f":
if ( !isset($_SERVER["argv"][$i+1]) )
die("-f switch requires a filename parameter\n");
$opts["f"] = $_SERVER["argv"][$i+1];
$i += 2;
break;
case "-v":
$opts["v"] = true;
$i++;
break;
case "-d":
$opts["d"] = true;
$i++;
break;
case "-t":
if ( !isset($_SERVER['argv'][$i + 1]) )
die("-t switch requires a comma separated list of types\n");
$opts["t"] = $_SERVER['argv'][$i+1];
$i += 2;
break;
default:
$opts["filename"] = $_SERVER["argv"][$i];
$i++;
break;
}
}
return $opts;
}
require_once("dompdf_config.inc.php");
global $_dompdf_show_warnings, $_dompdf_debug, $_DOMPDF_DEBUG_TYPES;
$sapi = php_sapi_name();
$options = array();
$dompdf = new DOMPDF();
switch ( $sapi ) {
case "cli":
$opts = getoptions();
if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) {
dompdf_usage();
exit;
}
if ( isset($opts["l"]) ) {
echo "\nUnderstood paper sizes:\n";
foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size)
echo " " . mb_strtoupper($size) . "\n";
exit;
}
$file = $opts["filename"];
if ( isset($opts["p"]) )
$paper = $opts["p"];
else
$paper = DOMPDF_DEFAULT_PAPER_SIZE;
if ( isset($opts["o"]) )
$orientation = $opts["o"];
else
$orientation = "portrait";
if ( isset($opts["b"]) )
$base_path = $opts["b"];
if ( isset($opts["f"]) )
$outfile = $opts["f"];
else {
if ( $file === "-" )
$outfile = "dompdf_out.pdf";
else
$outfile = str_ireplace(array(".html", ".htm"), "", $file) . ".pdf";
}
if ( isset($opts["v"]) )
$_dompdf_show_warnings = true;
if ( isset($opts["d"]) ) {
$_dompdf_show_warnings = true;
$_dompdf_debug = true;
}
if ( isset($opts['t']) ) {
$arr = split(',',$opts['t']);
$types = array();
foreach ($arr as $type)
$types[ trim($type) ] = 1;
$_DOMPDF_DEBUG_TYPES = $types;
}
$save_file = true;
break;
default:
$dompdf->set_option('enable_php', false);
if ( isset($_GET["input_file"]) )
$file = rawurldecode($_GET["input_file"]);
else
throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable).");
if ( isset($_GET["paper"]) )
$paper = rawurldecode($_GET["paper"]);
else
$paper = DOMPDF_DEFAULT_PAPER_SIZE;
if ( isset($_GET["orientation"]) )
$orientation = rawurldecode($_GET["orientation"]);
else
$orientation = "portrait";
if ( isset($_GET["base_path"]) ) {
$base_path = rawurldecode($_GET["base_path"]);
$file = $base_path . $file; # Set the input file
}
if ( isset($_GET["options"]) ) {
$options = $_GET["options"];
}
$file_parts = explode_url($file);
$outfile = "dompdf_out.pdf"; # Don't allow them to set the output file
$save_file = false; # Don't save the file
break;
}
if ( $file === "-" ) {
$str = "";
while ( !feof(STDIN) )
$str .= fread(STDIN, 4096);
$dompdf->load_html($str);
} else
$dompdf->load_html_file($file);
if ( isset($base_path) ) {
$dompdf->set_base_path($base_path);
}
$dompdf->set_paper($paper, $orientation);
$dompdf->render();
if ( $_dompdf_show_warnings ) {
global $_dompdf_warnings;
foreach ($_dompdf_warnings as $msg)
echo $msg . "\n";
echo $dompdf->get_canvas()->get_cpdf()->messages;
flush();
}
if ( $save_file ) {
// if ( !is_writable($outfile) )
// throw new DOMPDF_Exception("'$outfile' is not writable.");
if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" )
$outfile = str_replace(".pdf", ".png", $outfile);
list($proto, $host, $path, $file) = explode_url($outfile);
if ( $proto != "" ) // i.e. not file://
$outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file
$outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile);
if ( strpos($outfile, DOMPDF_CHROOT) !== 0 )
throw new DOMPDF_Exception("Permission denied.");
file_put_contents($outfile, $dompdf->output( array("compress" => 0) ));
exit(0);
}
if ( !headers_sent() ) {
$dompdf->stream($outfile, $options);
}
<?php
// Please refer to dompdf_config.inc.php for details on each configuration option.
//define("DOMPDF_TEMP_DIR", "/tmp");
//define("DOMPDF_FONT_DIR", DOMPDF_DIR."/lib/fonts/");
//define("DOMPDF_FONT_CACHE", DOMPDF_DIR."/lib/fonts/");
//define("DOMPDF_UNICODE_ENABLED", true);
//define("DOMPDF_PDF_BACKEND", "PDFLib");
//define("DOMPDF_DEFAULT_MEDIA_TYPE", "print");
//define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
//define("DOMPDF_DEFAULT_FONT", "serif");
//define("DOMPDF_DPI", 72);
//define("DOMPDF_ENABLE_CSS_FLOAT", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", false);
//define("DEBUGPNG", true);
//define("DEBUGKEEPTEMP", true);
//define("DEBUGCSS", true);
//define("DEBUG_LAYOUT", true);
//define("DEBUG_LAYOUT_LINES", false);
//define("DEBUG_LAYOUT_BLOCKS", false);
//define("DEBUG_LAYOUT_INLINE", false);
//define("DOMPDF_FONT_HEIGHT_RATIO", 1.0);
//define("DEBUG_LAYOUT_PADDINGBOX", false);
//define("DOMPDF_LOG_OUTPUT_FILE", DOMPDF_FONT_DIR."log.htm");
//define("DOMPDF_ENABLE_HTML5PARSER", true);
//define("DOMPDF_ENABLE_FONTSUBSETTING", true);
// Authentication for the dompdf/www
//define("DOMPDF_ADMIN_USERNAME", "user");
//define("DOMPDF_ADMIN_PASSWORD", "password");
/**
* Attention!
* The following settings may increase the risk of system exploit.
* Do not change these settings without understanding the consequences.
* Additional documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*/
//define("DOMPDF_CHROOT", DOMPDF_DIR);
//define("DOMPDF_ENABLE_PHP", false);
//define("DOMPDF_ENABLE_REMOTE", false);
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* DOMPDF autoload function
*
* If you have an existing autoload function, add a call to this function
* from your existing __autoload() implementation.
*
* @param string $class
*/
function DOMPDF_autoload($class) {
$filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
if ( is_file($filename) ) {
include_once $filename;
}
}
// If SPL autoload functions are available (PHP >= 5.1.2)
if ( function_exists("spl_autoload_register") ) {
$autoload = "DOMPDF_autoload";
$funcs = spl_autoload_functions();
// No functions currently in the stack.
if ( !DOMPDF_AUTOLOAD_PREPEND || $funcs === false ) {
spl_autoload_register($autoload);
}
// If PHP >= 5.3 the $prepend argument is available
else if ( PHP_VERSION_ID >= 50300 ) {
spl_autoload_register($autoload, true, true);
}
else {
// Unregister existing autoloaders...
$compat = (PHP_VERSION_ID <= 50102 && PHP_VERSION_ID >= 50100);
foreach ($funcs as $func) {
if (is_array($func)) {
// :TRICKY: There are some compatibility issues and some
// places where we need to error out
$reflector = new ReflectionMethod($func[0], $func[1]);
if (!$reflector->isStatic()) {
throw new Exception('This function is not compatible with non-static object methods due to PHP Bug #44144.');
}
// Suprisingly, spl_autoload_register supports the
// Class::staticMethod callback format, although call_user_func doesn't
if ($compat) $func = implode('::', $func);
}
spl_autoload_unregister($func);
}
// Register the new one, thus putting it at the front of the stack...
spl_autoload_register($autoload);
// Now, go back and re-register all of our old ones.
foreach ($funcs as $func) {
spl_autoload_register($func);
}
// Be polite and ensure that userland autoload gets retained
if ( function_exists("__autoload") ) {
spl_autoload_register("__autoload");
}
}
}
else if ( !function_exists("__autoload") ) {
/**
* Default __autoload() function
*
* @param string $class
*/
function __autoload($class) {
DOMPDF_autoload($class);
}
}
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* Caching canvas implementation
*
* Each rendered page is serialized and stored in the {@link Page_Cache}.
* This is useful for static forms/pages that do not need to be re-rendered
* all the time.
*
* This class decorates normal CPDF_Adapters. It is currently completely
* experimental.
*
* @access private
* @package dompdf
*/
class Cached_PDF_Decorator extends CPDF_Adapter implements Canvas {
/**
* @var CPDF_Adapter
*/
protected $_pdf;
protected $_cache_id;
protected $_current_page_id;
protected $_fonts; // fonts used in this document
function __construct($paper = "letter", $orientation = "portrait", DOMPDF $dompdf) {
$this->_fonts = array();
}
/**
* Must be called after constructor
*
* @param int $cache_id
* @param CPDF_Adapter $pdf
*/
function init($cache_id, CPDF_Adapter $pdf) {
$this->_cache_id = $cache_id;
$this->_pdf = $pdf;
$this->_current_page_id = $this->_pdf->open_object();
}
//........................................................................
function get_cpdf() { return $this->_pdf->get_cpdf(); }
function open_object() { $this->_pdf->open_object(); }
function reopen_object($object) { $this->_pdf->reopen_object($object); }
function close_object() { $this->_pdf->close_object(); }
function add_object($object, $where = 'all') { $this->_pdf->add_object($object, $where); }
function serialize_object($id) { $this->_pdf->serialize_object($id); }
function reopen_serialized_object($obj) { $this->_pdf->reopen_serialized_object($obj); }
//........................................................................
function get_width() { return $this->_pdf->get_width(); }
function get_height() { return $this->_pdf->get_height(); }
function get_page_number() { return $this->_pdf->get_page_number(); }
function get_page_count() { return $this->_pdf->get_page_count(); }
function set_page_number($num) { $this->_pdf->set_page_number($num); }
function set_page_count($count) { $this->_pdf->set_page_count($count); }
function line($x1, $y1, $x2, $y2, $color, $width, $style = array()) {
$this->_pdf->line($x1, $y1, $x2, $y2, $color, $width, $style);
}
function rectangle($x1, $y1, $w, $h, $color, $width, $style = array()) {
$this->_pdf->rectangle($x1, $y1, $w, $h, $color, $width, $style);
}
function filled_rectangle($x1, $y1, $w, $h, $color) {
$this->_pdf->filled_rectangle($x1, $y1, $w, $h, $color);
}
function polygon($points, $color, $width = null, $style = array(), $fill = false) {
$this->_pdf->polygon($points, $color, $width, $style, $fill);
}
function circle($x, $y, $r1, $color, $width = null, $style = null, $fill = false) {
$this->_pdf->circle($x, $y, $r1, $color, $width, $style, $fill);
}
function image($img_url, $x, $y, $w, $h, $resolution = "normal") {
$this->_pdf->image($img_url, $x, $y, $w, $h, $resolution);
}
function text($x, $y, $text, $font, $size, $color = array(0,0,0), $word_space = 0.0, $char_space = 0.0, $angle = 0.0) {
$this->_fonts[$font] = true;
$this->_pdf->text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
}
function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $word_space = 0.0, $char_space = 0.0, $angle = 0.0) {
// We want to remove this from cached pages since it may not be correct
$this->_pdf->close_object();
$this->_pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
$this->_pdf->reopen_object($this->_current_page_id);
}
function page_script($script, $type = 'text/php') {
// We want to remove this from cached pages since it may not be correct
$this->_pdf->close_object();
$this->_pdf->page_script($script, $type);
$this->_pdf->reopen_object($this->_current_page_id);
}
function new_page() {
$this->_pdf->close_object();
// Add the object to the current page
$this->_pdf->add_object($this->_current_page_id, "add");
$this->_pdf->new_page();
Page_Cache::store_page($this->_cache_id,
$this->_pdf->get_page_number() - 1,
$this->_pdf->serialize_object($this->_current_page_id));
$this->_current_page_id = $this->_pdf->open_object();
return $this->_current_page_id;
}
function stream($filename, $options = null) {
// Store the last page in the page cache
if ( !is_null($this->_current_page_id) ) {
$this->_pdf->close_object();
$this->_pdf->add_object($this->_current_page_id, "add");
Page_Cache::store_page($this->_cache_id,
$this->_pdf->get_page_number(),
$this->_pdf->serialize_object($this->_current_page_id));
Page_Cache::store_fonts($this->_cache_id, $this->_fonts);
$this->_current_page_id = null;
}
$this->_pdf->stream($filename);
}
function output($options = null) {
// Store the last page in the page cache
if ( !is_null($this->_current_page_id) ) {
$this->_pdf->close_object();
$this->_pdf->add_object($this->_current_page_id, "add");
Page_Cache::store_page($this->_cache_id,
$this->_pdf->get_page_number(),
$this->_pdf->serialize_object($this->_current_page_id));
$this->_current_page_id = null;
}
return $this->_pdf->output();
}
function get_messages() { return $this->_pdf->get_messages(); }
}
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author ...
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Helmut Tischer <htischer@weihenstephan.org>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* Decorates frames for list bullet rendering
*
* @access private
* @package dompdf
*/
class List_Bullet_Frame_Decorator extends Frame_Decorator {
const BULLET_PADDING = 1; // Distance from bullet to text in pt
// As fraction of font size (including descent). See also DECO_THICKNESS.
const BULLET_THICKNESS = 0.04; // Thickness of bullet outline. Screen: 0.08, print: better less, e.g. 0.04
const BULLET_DESCENT = 0.3; //descent of font below baseline. Todo: Guessed for now.
const BULLET_SIZE = 0.35; // bullet diameter. For now 0.5 of font_size without descent.
static $BULLET_TYPES = array("disc", "circle", "square");
//........................................................................
function __construct(Frame $frame, DOMPDF $dompdf) {
parent::__construct($frame, $dompdf);
}
function get_margin_width() {
$style = $this->_frame->get_style();
// Small hack to prevent extra indenting of list text on list_style_position === "inside"
// and on suppressed bullet
if ( $style->list_style_position === "outside" ||
$style->list_style_type === "none" ) {
return 0;
}
return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
}
//hits only on "inset" lists items, to increase height of box
function get_margin_height() {
$style = $this->_frame->get_style();
if ( $style->list_style_type === "none" ) {
return 0;
}
return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING;
}
function get_width() {
return $this->get_margin_height();
}
function get_height() {
return $this->get_margin_height();
}
//........................................................................
}
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* Caches individual rendered PDF pages
*
* Not totally implemented yet. Use at your own risk ;)
*
* @access private
* @package dompdf
* @static
*/
class Page_Cache {
const DB_USER = "dompdf_page_cache";
const DB_PASS = "some meaningful password";
const DB_NAME = "dompdf_page_cache";
static private $__connection = null;
static function init() {
if ( is_null(self::$__connection) ) {
$con_str = "host=" . DB_HOST .
" dbname=" . self::DB_NAME .
" user=" . self::DB_USER .
" password=" . self::DB_PASS;
if ( !self::$__connection = pg_connect($con_str) )
throw new Exception("Database connection failed.");
}
}
function __construct() { throw new Exception("Can not create instance of Page_Class. Class is static."); }
private static function __query($sql) {
if ( !($res = pg_query(self::$__connection, $sql)) )
throw new Exception(pg_last_error(self::$__connection));
return $res;
}
static function store_page($id, $page_num, $data) {
$where = "WHERE id='" . pg_escape_string($id) . "' AND ".
"page_num=". pg_escape_string($page_num);
$res = self::__query("SELECT timestamp FROM page_cache ". $where);
$row = pg_fetch_assoc($res);
if ( $row )
self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
else
self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
pg_escape_string($page_num) . ", ".
"'". pg_escape_string($data) . "')");
}
static function store_fonts($id, $fonts) {
self::__query("BEGIN");
// Update the font information
self::__query("DELETE FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
foreach (array_keys($fonts) as $font)
self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
pg_escape_string($id) . "', '" . pg_escape_string($font) . "')");
self::__query("COMMIT");
}
// static function retrieve_page($id, $page_num) {
// $res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "' AND ".
// "page_num=". pg_escape_string($page_num));
// $row = pg_fetch_assoc($res);
// return pg_unescape_bytea($row["data"]);
// }
static function get_page_timestamp($id, $page_num) {
$res = self::__query("SELECT timestamp FROM page_cache WHERE id='" . pg_escape_string($id) . "' AND ".
"page_num=". pg_escape_string($page_num));
$row = pg_fetch_assoc($res);
return $row["timestamp"];
}
// Adds the cached document referenced by $id to the provided pdf
static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
$res = self::__query("SELECT font_name FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
// Ensure that the fonts needed by the cached document are loaded into
// the pdf
while ($row = pg_fetch_assoc($res))
$pdf->get_cpdf()->selectFont($row["font_name"]);
$res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "'");
if ( $new_page )
$pdf->new_page();
$first = true;
while ($row = pg_fetch_assoc($res)) {
if ( !$first )
$pdf->new_page();
else
$first = false;
$page = $pdf->reopen_serialized_object($row["data"]);
//$pdf->close_object();
$pdf->add_object($page, "add");
}
}
}
Page_Cache::init();
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Brian Sweeney <eclecticgeek@gmail.com>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
/**
* Decorates Frame objects for text layout
*
* @access private
* @package dompdf
*/
class Text_Frame_Decorator extends Frame_Decorator {
// protected members
protected $_text_spacing;
// buggy DOMText::splitText (PHP < 5.2.7)
public static $_buggy_splittext;
function __construct(Frame $frame, DOMPDF $dompdf) {
if ( !$frame->is_text_node() )
throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");
parent::__construct($frame, $dompdf);
$this->_text_spacing = null;
}
//........................................................................
function reset() {
parent::reset();
$this->_text_spacing = null;
}
//........................................................................
// Accessor methods
function get_text_spacing() { return $this->_text_spacing; }
function get_text() {
// FIXME: this should be in a child class (and is incorrect)
// if ( $this->_frame->get_style()->content !== "normal" ) {
// $this->_frame->get_node()->data = $this->_frame->get_style()->content;
// $this->_frame->get_style()->content = "normal";
// }
// pre_r("---");
// $style = $this->_frame->get_style();
// var_dump($text = $this->_frame->get_node()->data);
// var_dump($asc = utf8_decode($text));
// for ($i = 0; $i < strlen($asc); $i++)
// pre_r("$i: " . $asc[$i] . " - " . ord($asc[$i]));
// pre_r("width: " . Font_Metrics::get_text_width($text, $style->font_family, $style->font_size));
return $this->_frame->get_node()->data;
}
//........................................................................
// Vertical margins & padding do not apply to text frames
// http://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced:
//
// The vertical padding, border and margin of an inline, non-replaced box
// start at the top and bottom of the content area, not the
// 'line-height'. But only the 'line-height' is used to calculate the
// height of the line box.
function get_margin_height() {
// This function is called in add_frame_to_line() and is used to
// determine the line height, so we actually want to return the
// 'line-height' property, not the actual margin box
$style = $this->get_parent()->get_style();
$font = $style->font_family;
$size = $style->font_size;
/*
pre_r('-----');
pre_r($style->line_height);
pre_r($style->font_size);
pre_r(Font_Metrics::get_font_height($font, $size));
pre_r(($style->line_height / $size) * Font_Metrics::get_font_height($font, $size));
*/
return ($style->line_height / ( $size > 0 ? $size : 1 )) * Font_Metrics::get_font_height($font, $size);
}
function get_padding_box() {
$pb = $this->_frame->get_padding_box();
$pb[3] = $pb["h"] = $this->_frame->get_style()->height;
return $pb;
}
//........................................................................
// Set method
function set_text_spacing($spacing) {
$style = $this->_frame->get_style();
$this->_text_spacing = $spacing;
$char_spacing = $style->length_in_pt($style->letter_spacing);
// Re-adjust our width to account for the change in spacing
$style->width = Font_Metrics::get_text_width($this->get_text(), $style->font_family, $style->font_size, $spacing, $char_spacing);
}
//........................................................................
// Recalculate the text width
function recalculate_width() {
$style = $this->get_style();
$text = $this->get_text();
$size = $style->font_size;
$font = $style->font_family;
$word_spacing = $style->length_in_pt($style->word_spacing);
$char_spacing = $style->length_in_pt($style->letter_spacing);
return $style->width = Font_Metrics::get_text_width($text, $font, $size, $word_spacing, $char_spacing);
}
//........................................................................
// Text manipulation methods
// split the text in this frame at the offset specified. The remaining
// text is added a sibling frame following this one and is returned.
function split_text($offset) {
if ( $offset == 0 )
return null;
if ( self::$_buggy_splittext ) {
// workaround to solve DOMText::spliText() bug parsing multibyte strings
$node = $this->_frame->get_node();
$txt0 = $node->substringData(0, $offset);
$txt1 = $node->substringData($offset, mb_strlen($node->textContent)-1);
$node->replaceData(0, mb_strlen($node->textContent), $txt0);
$split = $node->parentNode->appendChild(new DOMText($txt1));
}
else {
$split = $this->_frame->get_node()->splitText($offset);
}
$deco = $this->copy($split);
$p = $this->get_parent();
$p->insert_child_after($deco, $this, false);
if ( $p instanceof Inline_Frame_Decorator )
$p->split($deco);
return $deco;
}
//........................................................................
function delete_text($offset, $count) {
$this->_frame->get_node()->deleteData($offset, $count);
}
//........................................................................
function set_text($text) {
$this->_frame->get_node()->data = $text;
}
}
Text_Frame_Decorator::$_buggy_splittext = PHP_VERSION_ID < 50207;
<?php header("Location: www/"); ?>
\ No newline at end of file
This diff could not be displayed because it is too large.
...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 83 -70 517 580 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 83 -70 517 580 ;
C 164 ; WX 600 ; N currency ; B 54 49 546 517 ; C 164 ; WX 600 ; N currency ; B 54 49 546 517 ;
C 39 ; WX 600 ; N quotesingle ; B 227 277 373 562 ; C 39 ; WX 600 ; N quotesingle ; B 227 277 373 562 ;
C 147 ; WX 600 ; N quotedblleft ; B 71 277 535 562 ; C 147 ; WX 600 ; N quotedblleft ; B 71 277 535 562 ;
C 170 ; WX 600 ; N guillemotleft ; B 8 70 553 446 ; C 171 ; WX 600 ; N guillemotleft ; B 8 70 553 446 ;
C 139 ; WX 600 ; N guilsinglleft ; B 141 70 459 446 ; C 139 ; WX 600 ; N guilsinglleft ; B 141 70 459 446 ;
C 155 ; WX 600 ; N guilsinglright ; B 141 70 459 446 ; C 155 ; WX 600 ; N guilsinglright ; B 141 70 459 446 ;
C -1 ; WX 600 ; N fi ; B 12 0 593 626 ; C -1 ; WX 600 ; N fi ; B 12 0 593 626 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 74 -70 620 580 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 74 -70 620 580 ;
C 164 ; WX 600 ; N currency ; B 77 49 644 517 ; C 164 ; WX 600 ; N currency ; B 77 49 644 517 ;
C 39 ; WX 600 ; N quotesingle ; B 303 277 493 562 ; C 39 ; WX 600 ; N quotesingle ; B 303 277 493 562 ;
C 147 ; WX 600 ; N quotedblleft ; B 190 277 594 562 ; C 147 ; WX 600 ; N quotedblleft ; B 190 277 594 562 ;
C 170 ; WX 600 ; N guillemotleft ; B 62 70 639 446 ; C 171 ; WX 600 ; N guillemotleft ; B 62 70 639 446 ;
C 139 ; WX 600 ; N guilsinglleft ; B 195 70 545 446 ; C 139 ; WX 600 ; N guilsinglleft ; B 195 70 545 446 ;
C 155 ; WX 600 ; N guilsinglright ; B 165 70 514 446 ; C 155 ; WX 600 ; N guilsinglright ; B 165 70 514 446 ;
C -1 ; WX 600 ; N fi ; B 12 0 644 626 ; C -1 ; WX 600 ; N fi ; B 12 0 644 626 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 104 -78 590 580 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 104 -78 590 580 ;
C 164 ; WX 600 ; N currency ; B 94 58 628 506 ; C 164 ; WX 600 ; N currency ; B 94 58 628 506 ;
C 39 ; WX 600 ; N quotesingle ; B 345 328 460 562 ; C 39 ; WX 600 ; N quotesingle ; B 345 328 460 562 ;
C 147 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ; C 147 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ;
C 170 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ; C 171 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ;
C 139 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ; C 139 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ;
C 155 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ; C 155 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ;
C -1 ; WX 600 ; N fi ; B 3 0 619 629 ; C -1 ; WX 600 ; N fi ; B 3 0 619 629 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 113 -78 488 580 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 600 ; N section ; B 113 -78 488 580 ;
C 164 ; WX 600 ; N currency ; B 73 58 527 506 ; C 164 ; WX 600 ; N currency ; B 73 58 527 506 ;
C 39 ; WX 600 ; N quotesingle ; B 259 328 341 562 ; C 39 ; WX 600 ; N quotesingle ; B 259 328 341 562 ;
C 147 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ; C 147 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ;
C 170 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ; C 171 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ;
C 139 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ; C 139 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ;
C 155 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ; C 155 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ;
C -1 ; WX 600 ; N fi ; B 3 0 597 629 ; C -1 ; WX 600 ; N fi ; B 3 0 597 629 ;
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 34 -184 522 727 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 34 -184 522 727 ;
C 164 ; WX 556 ; N currency ; B -3 76 559 636 ; C 164 ; WX 556 ; N currency ; B -3 76 559 636 ;
C 39 ; WX 238 ; N quotesingle ; B 70 447 168 718 ; C 39 ; WX 238 ; N quotesingle ; B 70 447 168 718 ;
C 147 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ; C 147 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ;
C 170 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ; C 171 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ;
C 139 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ; C 139 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ;
C 155 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ; C 155 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ;
C -1 ; WX 611 ; N fi ; B 10 0 542 727 ; C -1 ; WX 611 ; N fi ; B 10 0 542 727 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 61 -184 598 727 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 61 -184 598 727 ;
C 164 ; WX 556 ; N currency ; B 27 76 680 636 ; C 164 ; WX 556 ; N currency ; B 27 76 680 636 ;
C 39 ; WX 238 ; N quotesingle ; B 165 447 321 718 ; C 39 ; WX 238 ; N quotesingle ; B 165 447 321 718 ;
C 147 ; WX 500 ; N quotedblleft ; B 160 454 588 727 ; C 147 ; WX 500 ; N quotedblleft ; B 160 454 588 727 ;
C 170 ; WX 556 ; N guillemotleft ; B 135 76 571 484 ; C 171 ; WX 556 ; N guillemotleft ; B 135 76 571 484 ;
C 139 ; WX 333 ; N guilsinglleft ; B 130 76 353 484 ; C 139 ; WX 333 ; N guilsinglleft ; B 130 76 353 484 ;
C 155 ; WX 333 ; N guilsinglright ; B 99 76 322 484 ; C 155 ; WX 333 ; N guilsinglright ; B 99 76 322 484 ;
C -1 ; WX 611 ; N fi ; B 87 0 696 727 ; C -1 ; WX 611 ; N fi ; B 87 0 696 727 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 76 -191 584 737 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 76 -191 584 737 ;
C 164 ; WX 556 ; N currency ; B 60 99 646 603 ; C 164 ; WX 556 ; N currency ; B 60 99 646 603 ;
C 39 ; WX 191 ; N quotesingle ; B 157 463 285 718 ; C 39 ; WX 191 ; N quotesingle ; B 157 463 285 718 ;
C 147 ; WX 333 ; N quotedblleft ; B 138 470 461 725 ; C 147 ; WX 333 ; N quotedblleft ; B 138 470 461 725 ;
C 170 ; WX 556 ; N guillemotleft ; B 146 108 554 446 ; C 171 ; WX 556 ; N guillemotleft ; B 146 108 554 446 ;
C 139 ; WX 333 ; N guilsinglleft ; B 137 108 340 446 ; C 139 ; WX 333 ; N guilsinglleft ; B 137 108 340 446 ;
C 155 ; WX 333 ; N guilsinglright ; B 111 108 314 446 ; C 155 ; WX 333 ; N guilsinglright ; B 111 108 314 446 ;
C -1 ; WX 500 ; N fi ; B 86 0 587 728 ; C -1 ; WX 500 ; N fi ; B 86 0 587 728 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 43 -191 512 737 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 556 ; N section ; B 43 -191 512 737 ;
C 164 ; WX 556 ; N currency ; B 28 99 528 603 ; C 164 ; WX 556 ; N currency ; B 28 99 528 603 ;
C 39 ; WX 191 ; N quotesingle ; B 59 463 132 718 ; C 39 ; WX 191 ; N quotesingle ; B 59 463 132 718 ;
C 147 ; WX 333 ; N quotedblleft ; B 38 470 307 725 ; C 147 ; WX 333 ; N quotedblleft ; B 38 470 307 725 ;
C 170 ; WX 556 ; N guillemotleft ; B 97 108 459 446 ; C 171 ; WX 556 ; N guillemotleft ; B 97 108 459 446 ;
C 139 ; WX 333 ; N guilsinglleft ; B 88 108 245 446 ; C 139 ; WX 333 ; N guilsinglleft ; B 88 108 245 446 ;
C 155 ; WX 333 ; N guilsinglright ; B 88 108 245 446 ; C 155 ; WX 333 ; N guilsinglright ; B 88 108 245 446 ;
C -1 ; WX 500 ; N fi ; B 14 0 434 728 ; C -1 ; WX 500 ; N fi ; B 14 0 434 728 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 57 -132 443 691 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 57 -132 443 691 ;
C 164 ; WX 500 ; N currency ; B -26 61 526 613 ; C 164 ; WX 500 ; N currency ; B -26 61 526 613 ;
C 39 ; WX 278 ; N quotesingle ; B 75 404 204 691 ; C 39 ; WX 278 ; N quotesingle ; B 75 404 204 691 ;
C 147 ; WX 500 ; N quotedblleft ; B 32 356 486 691 ; C 147 ; WX 500 ; N quotedblleft ; B 32 356 486 691 ;
C 170 ; WX 500 ; N guillemotleft ; B 23 36 473 415 ; C 171 ; WX 500 ; N guillemotleft ; B 23 36 473 415 ;
C 139 ; WX 333 ; N guilsinglleft ; B 51 36 305 415 ; C 139 ; WX 333 ; N guilsinglleft ; B 51 36 305 415 ;
C 155 ; WX 333 ; N guilsinglright ; B 28 36 282 415 ; C 155 ; WX 333 ; N guilsinglright ; B 28 36 282 415 ;
C -1 ; WX 556 ; N fi ; B 14 0 536 691 ; C -1 ; WX 556 ; N fi ; B 14 0 536 691 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 36 -143 459 685 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 36 -143 459 685 ;
C 164 ; WX 500 ; N currency ; B -26 34 526 586 ; C 164 ; WX 500 ; N currency ; B -26 34 526 586 ;
C 39 ; WX 278 ; N quotesingle ; B 128 398 268 685 ; C 39 ; WX 278 ; N quotesingle ; B 128 398 268 685 ;
C 147 ; WX 500 ; N quotedblleft ; B 53 369 513 685 ; C 147 ; WX 500 ; N quotedblleft ; B 53 369 513 685 ;
C 170 ; WX 500 ; N guillemotleft ; B 12 32 468 415 ; C 171 ; WX 500 ; N guillemotleft ; B 12 32 468 415 ;
C 139 ; WX 333 ; N guilsinglleft ; B 32 32 303 415 ; C 139 ; WX 333 ; N guilsinglleft ; B 32 32 303 415 ;
C 155 ; WX 333 ; N guilsinglright ; B 10 32 281 415 ; C 155 ; WX 333 ; N guilsinglright ; B 10 32 281 415 ;
C -1 ; WX 556 ; N fi ; B -188 -205 514 703 ; C -1 ; WX 556 ; N fi ; B -188 -205 514 703 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 53 -162 461 666 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 53 -162 461 666 ;
C 164 ; WX 500 ; N currency ; B -22 53 522 597 ; C 164 ; WX 500 ; N currency ; B -22 53 522 597 ;
C 39 ; WX 214 ; N quotesingle ; B 132 421 241 666 ; C 39 ; WX 214 ; N quotesingle ; B 132 421 241 666 ;
C 147 ; WX 556 ; N quotedblleft ; B 166 436 514 666 ; C 147 ; WX 556 ; N quotedblleft ; B 166 436 514 666 ;
C 170 ; WX 500 ; N guillemotleft ; B 53 37 445 403 ; C 171 ; WX 500 ; N guillemotleft ; B 53 37 445 403 ;
C 139 ; WX 333 ; N guilsinglleft ; B 51 37 281 403 ; C 139 ; WX 333 ; N guilsinglleft ; B 51 37 281 403 ;
C 155 ; WX 333 ; N guilsinglright ; B 52 37 282 403 ; C 155 ; WX 333 ; N guilsinglright ; B 52 37 282 403 ;
C -1 ; WX 500 ; N fi ; B -141 -207 481 681 ; C -1 ; WX 500 ; N fi ; B -141 -207 481 681 ;
......
...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 70 -148 426 676 ; ...@@ -130,7 +130,7 @@ C 167 ; WX 500 ; N section ; B 70 -148 426 676 ;
C 164 ; WX 500 ; N currency ; B -22 58 522 602 ; C 164 ; WX 500 ; N currency ; B -22 58 522 602 ;
C 39 ; WX 180 ; N quotesingle ; B 48 431 133 676 ; C 39 ; WX 180 ; N quotesingle ; B 48 431 133 676 ;
C 147 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ; C 147 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ;
C 170 ; WX 500 ; N guillemotleft ; B 42 33 456 416 ; C 171 ; WX 500 ; N guillemotleft ; B 42 33 456 416 ;
C 139 ; WX 333 ; N guilsinglleft ; B 63 33 285 416 ; C 139 ; WX 333 ; N guilsinglleft ; B 63 33 285 416 ;
C 155 ; WX 333 ; N guilsinglright ; B 48 33 270 416 ; C 155 ; WX 333 ; N guilsinglright ; B 48 33 270 416 ;
C -1 ; WX 556 ; N fi ; B 31 0 521 683 ; C -1 ; WX 556 ; N fi ; B 31 0 521 683 ;
......
<?php return array ( <?php
'sans-serif' => $distFontDir = $rootDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR;
array ( return array(
'normal' => DOMPDF_DIR . '/lib/fonts/Helvetica', 'sans-serif' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Helvetica-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Helvetica-Oblique', 'normal' => $distFontDir . 'Helvetica',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Helvetica-BoldOblique', 'bold' => $distFontDir . 'Helvetica-Bold',
), 'italic' => $distFontDir . 'Helvetica-Oblique',
'times' => 'bold_italic' => $distFontDir . 'Helvetica-BoldOblique'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Times-Roman', 'times' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Times-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Times-Italic', 'normal' => $distFontDir . 'Times-Roman',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Times-BoldItalic', 'bold' => $distFontDir . 'Times-Bold',
), 'italic' => $distFontDir . 'Times-Italic',
'times-roman' => 'bold_italic' => $distFontDir . 'Times-BoldItalic'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Times-Roman', 'times-roman' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Times-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Times-Italic', 'normal' => $distFontDir . 'Times-Roman',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Times-BoldItalic', 'bold' => $distFontDir . 'Times-Bold',
), 'italic' => $distFontDir . 'Times-Italic',
'courier' => 'bold_italic' => $distFontDir . 'Times-BoldItalic'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Courier', 'courier' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Courier-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Courier-Oblique', 'normal' => $distFontDir . 'Courier',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Courier-BoldOblique', 'bold' => $distFontDir . 'Courier-Bold',
), 'italic' => $distFontDir . 'Courier-Oblique',
'helvetica' => 'bold_italic' => $distFontDir . 'Courier-BoldOblique'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Helvetica', 'helvetica' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Helvetica-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Helvetica-Oblique', 'normal' => $distFontDir . 'Helvetica',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Helvetica-BoldOblique', 'bold' => $distFontDir . 'Helvetica-Bold',
), 'italic' => $distFontDir . 'Helvetica-Oblique',
'zapfdingbats' => 'bold_italic' => $distFontDir . 'Helvetica-BoldOblique'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/ZapfDingbats', 'zapfdingbats' =>
'bold' => DOMPDF_DIR . '/lib/fonts/ZapfDingbats', array(
'italic' => DOMPDF_DIR . '/lib/fonts/ZapfDingbats', 'normal' => $distFontDir . 'ZapfDingbats',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/ZapfDingbats', 'bold' => $distFontDir . 'ZapfDingbats',
), 'italic' => $distFontDir . 'ZapfDingbats',
'symbol' => 'bold_italic' => $distFontDir . 'ZapfDingbats'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Symbol', 'symbol' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Symbol', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Symbol', 'normal' => $distFontDir . 'Symbol',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Symbol', 'bold' => $distFontDir . 'Symbol',
), 'italic' => $distFontDir . 'Symbol',
'serif' => 'bold_italic' => $distFontDir . 'Symbol'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Times-Roman', 'serif' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Times-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Times-Italic', 'normal' => $distFontDir . 'Times-Roman',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Times-BoldItalic', 'bold' => $distFontDir . 'Times-Bold',
), 'italic' => $distFontDir . 'Times-Italic',
'monospace' => 'bold_italic' => $distFontDir . 'Times-BoldItalic'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Courier', 'monospace' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Courier-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Courier-Oblique', 'normal' => $distFontDir . 'Courier',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Courier-BoldOblique', 'bold' => $distFontDir . 'Courier-Bold',
), 'italic' => $distFontDir . 'Courier-Oblique',
'fixed' => 'bold_italic' => $distFontDir . 'Courier-BoldOblique'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/Courier', 'fixed' =>
'bold' => DOMPDF_DIR . '/lib/fonts/Courier-Bold', array(
'italic' => DOMPDF_DIR . '/lib/fonts/Courier-Oblique', 'normal' => $distFontDir . 'Courier',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/Courier-BoldOblique', 'bold' => $distFontDir . 'Courier-Bold',
), 'italic' => $distFontDir . 'Courier-Oblique',
'dejavu sans' => 'bold_italic' => $distFontDir . 'Courier-BoldOblique'
array ( ),
'bold' => DOMPDF_DIR . '/lib/fonts/DejaVuSans-Bold', 'dejavu sans' =>
'bold_italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSans-BoldOblique', array(
'italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSans-Oblique', 'bold' => $distFontDir . 'DejaVuSans-Bold',
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSans', 'bold_italic' => $distFontDir . 'DejaVuSans-BoldOblique',
), 'italic' => $distFontDir . 'DejaVuSans-Oblique',
'dejavu sans light' => 'normal' => $distFontDir . 'DejaVuSans'
array ( ),
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSans-ExtraLight', 'dejavu sans mono' =>
), array(
'dejavu sans condensed' => 'bold' => $distFontDir . 'DejaVuSansMono-Bold',
array ( 'bold_italic' => $distFontDir . 'DejaVuSansMono-BoldOblique',
'bold' => DOMPDF_DIR . '/lib/fonts/DejaVuSansCondensed-Bold', 'italic' => $distFontDir . 'DejaVuSansMono-Oblique',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSansCondensed-BoldOblique', 'normal' => $distFontDir . 'DejaVuSansMono'
'italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSansCondensed-Oblique', ),
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSansCondensed', 'dejavu serif' =>
), array(
'dejavu sans mono' => 'bold' => $distFontDir . 'DejaVuSerif-Bold',
array ( 'bold_italic' => $distFontDir . 'DejaVuSerif-BoldItalic',
'bold' => DOMPDF_DIR . '/lib/fonts/DejaVuSansMono-Bold', 'italic' => $distFontDir . 'DejaVuSerif-Italic',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSansMono-BoldOblique', 'normal' => $distFontDir . 'DejaVuSerif'
'italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSansMono-Oblique', )
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSansMono', );
), \ No newline at end of file
'dejavu serif' =>
array (
'bold' => DOMPDF_DIR . '/lib/fonts/DejaVuSerif-Bold',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSerif-BoldItalic',
'italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSerif-Italic',
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSerif',
),
'dejavu serif condensed' =>
array (
'bold' => DOMPDF_DIR . '/lib/fonts/DejaVuSerifCondensed-Bold',
'bold_italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSerifCondensed-BoldItalic',
'italic' => DOMPDF_DIR . '/lib/fonts/DejaVuSerifCondensed-Italic',
'normal' => DOMPDF_DIR . '/lib/fonts/DejaVuSerifCondensed',
),
) ?>
\ No newline at end of file
...@@ -56,8 +56,11 @@ class HTML5_Data ...@@ -56,8 +56,11 @@ class HTML5_Data
* reference. * reference.
*/ */
public static function getRealCodepoint($ref) { public static function getRealCodepoint($ref) {
if (!isset(self::$realCodepointTable[$ref])) return false; if (!isset(self::$realCodepointTable[$ref])) {
else return self::$realCodepointTable[$ref]; return false;
} else {
return self::$realCodepointTable[$ref];
}
} }
public static function getNamedCharacterReferences() { public static function getNamedCharacterReferences() {
...@@ -82,7 +85,7 @@ class HTML5_Data ...@@ -82,7 +85,7 @@ class HTML5_Data
return "\xEF\xBF\xBD"; return "\xEF\xBF\xBD";
}*/ }*/
$x = $y = $z = $w = 0; $y = $z = $w = 0;
if ($code < 0x80) { if ($code < 0x80) {
// regular ASCII character // regular ASCII character
$x = $code; $x = $code;
...@@ -93,7 +96,7 @@ class HTML5_Data ...@@ -93,7 +96,7 @@ class HTML5_Data
$y = (($code & 0x7FF) >> 6) | 0xC0; $y = (($code & 0x7FF) >> 6) | 0xC0;
} else { } else {
$y = (($code & 0xFC0) >> 6) | 0x80; $y = (($code & 0xFC0) >> 6) | 0x80;
if($code < 0x10000) { if ($code < 0x10000) {
$z = (($code >> 12) & 0x0F) | 0xE0; $z = (($code >> 12) & 0x0F) | 0xE0;
} else { } else {
$z = (($code >> 12) & 0x3F) | 0x80; $z = (($code >> 12) & 0x3F) | 0x80;
...@@ -103,9 +106,15 @@ class HTML5_Data ...@@ -103,9 +106,15 @@ class HTML5_Data
} }
// set up the actual character // set up the actual character
$ret = ''; $ret = '';
if($w) $ret .= chr($w); if ($w) {
if($z) $ret .= chr($z); $ret .= chr($w);
if($y) $ret .= chr($y); }
if ($z) {
$ret .= chr($z);
}
if ($y) {
$ret .= chr($y);
}
$ret .= chr($x); $ret .= chr($x);
return $ret; return $ret;
......
...@@ -51,7 +51,8 @@ class HTML5_InputStream { ...@@ -51,7 +51,8 @@ class HTML5_InputStream {
public $errors = array(); public $errors = array();
/** /**
* @param $data Data to parse * @param $data | Data to parse
* @throws Exception
*/ */
public function __construct($data) { public function __construct($data) {
...@@ -76,7 +77,7 @@ class HTML5_InputStream { ...@@ -76,7 +77,7 @@ class HTML5_InputStream {
$data = @iconv('UTF-8', 'UTF-8//IGNORE', $data); $data = @iconv('UTF-8', 'UTF-8//IGNORE', $data);
} else { } else {
// we can make a conforming native implementation // we can make a conforming native implementation
throw new Exception('Not implemented, please install mbstring or iconv'); throw new Exception('Not implemented, please install iconv');
} }
/* One leading U+FEFF BYTE ORDER MARK character must be /* One leading U+FEFF BYTE ORDER MARK character must be
...@@ -161,10 +162,12 @@ class HTML5_InputStream { ...@@ -161,10 +162,12 @@ class HTML5_InputStream {
/** /**
* Returns the current line that the tokenizer is at. * Returns the current line that the tokenizer is at.
*
* @return int
*/ */
public function getCurrentLine() { public function getCurrentLine() {
// Check the string isn't empty // Check the string isn't empty
if($this->EOF) { if ($this->EOF) {
// Add one to $this->char because we want the number for the next // Add one to $this->char because we want the number for the next
// byte to be processed. // byte to be processed.
return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1; return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1;
...@@ -176,6 +179,8 @@ class HTML5_InputStream { ...@@ -176,6 +179,8 @@ class HTML5_InputStream {
/** /**
* Returns the current column of the current line that the tokenizer is at. * Returns the current column of the current line that the tokenizer is at.
*
* @return int
*/ */
public function getColumnOffset() { public function getColumnOffset() {
// strrpos is weird, and the offset needs to be negative for what we // strrpos is weird, and the offset needs to be negative for what we
...@@ -187,18 +192,18 @@ class HTML5_InputStream { ...@@ -187,18 +192,18 @@ class HTML5_InputStream {
// However, for here we want the length up until the next byte to be // However, for here we want the length up until the next byte to be
// processed, so add one to the current byte ($this->char). // processed, so add one to the current byte ($this->char).
if($lastLine !== false) { if ($lastLine !== false) {
$findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine);
} else { } else {
$findLengthOf = substr($this->data, 0, $this->char); $findLengthOf = substr($this->data, 0, $this->char);
} }
// Get the length for the string we need. // Get the length for the string we need.
if(extension_loaded('iconv')) { if (extension_loaded('iconv')) {
return iconv_strlen($findLengthOf, 'utf-8'); return iconv_strlen($findLengthOf, 'utf-8');
} elseif(extension_loaded('mbstring')) { } elseif (extension_loaded('mbstring')) {
return mb_strlen($findLengthOf, 'utf-8'); return mb_strlen($findLengthOf, 'utf-8');
} elseif(extension_loaded('xml')) { } elseif (extension_loaded('xml')) {
return strlen(utf8_decode($findLengthOf)); return strlen(utf8_decode($findLengthOf));
} else { } else {
$count = count_chars($findLengthOf); $count = count_chars($findLengthOf);
...@@ -212,6 +217,8 @@ class HTML5_InputStream { ...@@ -212,6 +217,8 @@ class HTML5_InputStream {
/** /**
* Retrieve the currently consume character. * Retrieve the currently consume character.
* @note This performs bounds checking * @note This performs bounds checking
*
* @return bool|string
*/ */
public function char() { public function char() {
return ($this->char++ < $this->EOF) return ($this->char++ < $this->EOF)
...@@ -222,9 +229,11 @@ class HTML5_InputStream { ...@@ -222,9 +229,11 @@ class HTML5_InputStream {
/** /**
* Get all characters until EOF. * Get all characters until EOF.
* @note This performs bounds checking * @note This performs bounds checking
*
* @return string|bool
*/ */
public function remainingChars() { public function remainingChars() {
if($this->char < $this->EOF) { if ($this->char < $this->EOF) {
$data = substr($this->data, $this->char); $data = substr($this->data, $this->char);
$this->char = $this->EOF; $this->char = $this->EOF;
return $data; return $data;
...@@ -236,7 +245,10 @@ class HTML5_InputStream { ...@@ -236,7 +245,10 @@ class HTML5_InputStream {
/** /**
* Matches as far as possible until we reach a certain set of bytes * Matches as far as possible until we reach a certain set of bytes
* and returns the matched substring. * and returns the matched substring.
* @param $bytes Bytes to match. *
* @param $bytes | Bytes to match.
* @param null $max
* @return bool|string
*/ */
public function charsUntil($bytes, $max = null) { public function charsUntil($bytes, $max = null) {
if ($this->char < $this->EOF) { if ($this->char < $this->EOF) {
...@@ -256,7 +268,10 @@ class HTML5_InputStream { ...@@ -256,7 +268,10 @@ class HTML5_InputStream {
/** /**
* Matches as far as possible with a certain set of bytes * Matches as far as possible with a certain set of bytes
* and returns the matched substring. * and returns the matched substring.
* @param $bytes Bytes to match. *
* @param $bytes | Bytes to match.
* @param null $max
* @return bool|string
*/ */
public function charsWhile($bytes, $max = null) { public function charsWhile($bytes, $max = null) {
if ($this->char < $this->EOF) { if ($this->char < $this->EOF) {
......
...@@ -12,21 +12,22 @@ class HTML5_Parser ...@@ -12,21 +12,22 @@ class HTML5_Parser
{ {
/** /**
* Parses a full HTML document. * Parses a full HTML document.
* @param $text HTML text to parse * @param $text | HTML text to parse
* @param $builder Custom builder implementation * @param $builder | Custom builder implementation
* @return Parsed HTML as DOMDocument * @return DOMDocument|DOMNodeList Parsed HTML as DOMDocument
*/ */
static public function parse($text, $builder = null) { static public function parse($text, $builder = null) {
$tokenizer = new HTML5_Tokenizer($text, $builder); $tokenizer = new HTML5_Tokenizer($text, $builder);
$tokenizer->parse(); $tokenizer->parse();
return $tokenizer->save(); return $tokenizer->save();
} }
/** /**
* Parses an HTML fragment. * Parses an HTML fragment.
* @param $text HTML text to parse * @param $text | HTML text to parse
* @param $context String name of context element to pretend parsing is in. * @param $context String name of context element to pretend parsing is in.
* @param $builder Custom builder implementation * @param $builder | Custom builder implementation
* @return Parsed HTML as DOMDocument * @return DOMDocument|DOMNodeList Parsed HTML as DOMDocument
*/ */
static public function parseFragment($text, $context = null, $builder = null) { static public function parseFragment($text, $context = null, $builder = null) {
$tokenizer = new HTML5_Tokenizer($text, $builder); $tokenizer = new HTML5_Tokenizer($text, $builder);
......
This diff could not be displayed because it is too large.
<?xml version="1.0"?>
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg">
<g>
<rect stroke="#666666" id="svg_1" height="60.499994" width="60.166667" y="1.666669" x="1.999998" stroke-width="1.5" fill="none"/>
<line stroke-linecap="null" stroke-linejoin="null" id="svg_3" y2="59.333253" x2="59.749916" y1="4.333415" x1="4.250079" stroke-width="1.5" stroke="#999999" fill="none"/>
<line stroke-linecap="null" stroke-linejoin="null" id="svg_4" y2="59.999665" x2="4.062838" y1="3.750342" x1="60.062164" stroke-width="1.5" stroke="#999999" fill="none"/>
</g>
</svg>
\ No newline at end of file
/** /**
* dompdf default stylesheet. * dompdf default stylesheet.
*
* The Original Code is mozilla.org code.
* *
* The Initial Developer of the Original Code is Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer.
* All Rights Reserved.
*
* @package dompdf * @package dompdf
* @link http://dompdf.github.com/ * @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca> * @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Blake Ross <BlakeR1234@aol.com> * @author Blake Ross <BlakeR1234@aol.com>
* @author Fabien Ménager <fabien.menager@gmail.com> * @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @version $Id$ *
* Portions from Mozilla
* @link https://dxr.mozilla.org/mozilla-central/source/layout/style/res/html.css
* @license http://mozilla.org/MPL/2.0/ Mozilla Public License, v. 2.0
*
* Portions from W3C
* @link https://drafts.csswg.org/css-ui-3/#default-style-sheet
*
*/ */
@page { @page {
margin: 1.2cm; margin: 1.2cm;
} }
html { html {
display: -dompdf-page; display: -dompdf-page !important;
counter-reset: page; counter-reset: page;
} }
/* blocks */ /* blocks */
div, map, dt, isindex { article,
aside,
details,
div,
dt,
figcaption,
footer,
form,
header,
hgroup,
main,
nav,
noscript,
section,
summary {
display: block; display: block;
} }
...@@ -47,7 +62,7 @@ dd { ...@@ -47,7 +62,7 @@ dd {
margin-left: 40px; margin-left: 40px;
} }
blockquote { blockquote, figure {
display: block; display: block;
margin: 1em 40px; margin: 1em 40px;
} }
...@@ -64,7 +79,7 @@ center { ...@@ -64,7 +79,7 @@ center {
blockquote[type=cite] { blockquote[type=cite] {
display: block; display: block;
margin: 1em 0px; margin: 1em 0;
padding-left: 1em; padding-left: 1em;
border-left: solid; border-left: solid;
border-color: blue; border-color: blue;
...@@ -113,25 +128,18 @@ listing { ...@@ -113,25 +128,18 @@ listing {
margin: 1em 0; margin: 1em 0;
} }
plaintext, xmp, pre { plaintext, pre, xmp {
display: block; display: block;
font-family: fixed; font-family: fixed;
white-space: pre; white-space: pre;
margin: 1em 0; margin: 1em 0;
} }
article, aside, details,
figcaption, figure,
footer, header, hgroup,
nav, section {
display: block;
}
/* tables */ /* tables */
table { table {
display: table; display: table;
border-spacing: 2px; border-spacing: 2px;
border-collapse: separate; border-collapse: separate;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
...@@ -155,10 +163,10 @@ table[border] th { ...@@ -155,10 +163,10 @@ table[border] th {
td, th, tr { td, th, tr {
background: inherit; background: inherit;
} }
/* caption inherits from table not table-outer */ /* caption inherits from table not table-outer */
caption { caption {
display: block; display: table-caption;
text-align: center; text-align: center;
} }
...@@ -195,10 +203,10 @@ table > tr { ...@@ -195,10 +203,10 @@ table > tr {
vertical-align: middle; vertical-align: middle;
} }
td { td {
display: table-cell; display: table-cell;
vertical-align: inherit; vertical-align: inherit;
text-align: inherit; text-align: inherit;
padding: 1px; padding: 1px;
} }
...@@ -207,7 +215,6 @@ th { ...@@ -207,7 +215,6 @@ th {
vertical-align: inherit; vertical-align: inherit;
font-weight: bold; font-weight: bold;
padding: 1px; padding: 1px;
text-align: center;
} }
/* inlines */ /* inlines */
...@@ -248,10 +255,6 @@ s, strike, del { ...@@ -248,10 +255,6 @@ s, strike, del {
text-decoration: line-through; text-decoration: line-through;
} }
blink {
text-decoration: blink;
}
big { big {
font-size: larger; font-size: larger;
} }
...@@ -276,6 +279,17 @@ nobr { ...@@ -276,6 +279,17 @@ nobr {
white-space: nowrap; white-space: nowrap;
} }
mark {
background: yellow;
color: black;
}
/* titles */
abbr[title], acronym[title] {
text-decoration: dotted underline;
}
/* lists */ /* lists */
ul, menu, dir { ul, menu, dir {
...@@ -303,40 +317,32 @@ li { ...@@ -303,40 +317,32 @@ li {
}*/ }*/
/* nested lists have no top/bottom margins */ /* nested lists have no top/bottom margins */
ul ul, ul ol, ul dir, ul menu, ul dl, :matches(ul, ol, dir, menu, dl) ul,
ol ul, ol ol, ol dir, ol menu, ol dl, :matches(ul, ol, dir, menu, dl) ol,
dir ul, dir ol, dir dir, dir menu, dir dl, :matches(ul, ol, dir, menu, dl) dir,
menu ul, menu ol, menu dir, menu menu, menu dl, :matches(ul, ol, dir, menu, dl) menu,
dl ul, dl ol, dl dir, dl menu, dl dl { :matches(ul, ol, dir, menu, dl) dl {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} }
/* 2 deep unordered lists use a circle */ /* 2 deep unordered lists use a circle */
ol ul, ul ul, menu ul, dir ul, :matches(ul, ol, dir, menu) ul,
ol menu, ul menu, menu menu, dir menu, :matches(ul, ol, dir, menu) ul,
ol dir, ul dir, menu dir, dir dir { :matches(ul, ol, dir, menu) ul,
:matches(ul, ol, dir, menu) ul {
list-style-type: circle; list-style-type: circle;
} }
/* 3 deep (or more) unordered lists use a square */ /* 3 deep (or more) unordered lists use a square */
ol ol ul, ol ul ul, ol menu ul, ol dir ul, :matches(ul, ol, dir, menu) :matches(ul, ol, dir, menu) ul,
ol ol menu, ol ul menu, ol menu menu, ol dir menu, :matches(ul, ol, dir, menu) :matches(ul, ol, dir, menu) menu,
ol ol dir, ol ul dir, ol menu dir, ol dir dir, :matches(ul, ol, dir, menu) :matches(ul, ol, dir, menu) dir {
ul ol ul, ul ul ul, ul menu ul, ul dir ul,
ul ol menu, ul ul menu, ul menu menu, ul dir menu,
ul ol dir, ul ul dir, ul menu dir, ul dir dir,
menu ol ul, menu ul ul, menu menu ul, menu dir ul,
menu ol menu, menu ul menu, menu menu menu, menu dir menu,
menu ol dir, menu ul dir, menu menu dir, menu dir dir,
dir ol ul, dir ul ul, dir menu ul, dir dir ul,
dir ol menu, dir ul menu, dir menu menu, dir dir menu,
dir ol dir, dir ul dir, dir menu dir, dir dir dir {
list-style-type: square; list-style-type: square;
} }
/* forms */ /* forms */
/* From http://dev.w3.org/csswg/css3-ui/#appearance */ /* From https://drafts.csswg.org/css-ui-3/#default-style-sheet */
form { form {
display: block; display: block;
} }
...@@ -373,10 +379,13 @@ input[type=reset], ...@@ -373,10 +379,13 @@ input[type=reset],
input[type=file], input[type=file],
button { button {
background: #CCC; background: #CCC;
width: 8em;
text-align: center; text-align: center;
} }
input[type=file] {
width: 8em;
}
input[type=text]:before, input[type=text]:before,
input[type=button]:before, input[type=button]:before,
input[type=submit]:before, input[type=submit]:before,
...@@ -385,11 +394,11 @@ input[type=reset]:before { ...@@ -385,11 +394,11 @@ input[type=reset]:before {
} }
input[type=file]:before { input[type=file]:before {
content: "Chose a file"; content: "Choose a file";
} }
input[type=password][value]:before { input[type=password][value]:before {
font-family: "DejaVu Sans"; font-family: "DejaVu Sans" !important;
content: "\2022\2022\2022\2022\2022\2022\2022\2022"; content: "\2022\2022\2022\2022\2022\2022\2022\2022";
line-height: 1em; line-height: 1em;
} }
...@@ -397,7 +406,7 @@ input[type=password][value]:before { ...@@ -397,7 +406,7 @@ input[type=password][value]:before {
input[type=checkbox], input[type=checkbox],
input[type=radio], input[type=radio],
select:after { select:after {
font-family: "DejaVu Sans"; font-family: "DejaVu Sans" !important;
font-size: 18px; font-size: 18px;
line-height: 1; line-height: 1;
} }
...@@ -480,20 +489,24 @@ hr { ...@@ -480,20 +489,24 @@ hr {
margin: 0.5em auto 0.5em auto; margin: 0.5em auto 0.5em auto;
} }
hr[size="1"] {
border-style: solid none none none;
}
iframe { iframe {
border: 2px inset; border: 2px inset;
} }
noframes { noframes {
display: none; display: block;
} }
br { br {
display: -dompdf-br; display: -dompdf-br;
} }
img, img_generated { img, img_generated {
display: -dompdf-image; display: -dompdf-image !important;
} }
dompdf_generated { dompdf_generated {
...@@ -502,7 +515,7 @@ dompdf_generated { ...@@ -502,7 +515,7 @@ dompdf_generated {
/* hidden elements */ /* hidden elements */
area, base, basefont, head, meta, script, style, title, area, base, basefont, head, meta, script, style, title,
noembed, noscript, param { noembed, param {
display: none; display: none;
-dompdf-keep: yes; -dompdf-keep: yes;
} }
#!/usr/bin/php
<?php
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
require_once "dompdf_config.inc.php";
/**
* Display command line usage
*/
function usage() {
echo <<<EOD
Usage: {$_SERVER["argv"][0]} font_family [n_file [b_file] [i_file] [bi_file]]
font_family: the name of the font, e.g. Verdana, 'Times New Roman',
monospace, sans-serif. If it equals to "system_fonts",
all the system fonts will be installed.
n_file: the .ttf or .otf file for the normal, non-bold, non-italic
face of the font.
{b|i|bi}_file: the files for each of the respective (bold, italic,
bold-italic) faces.
If the optional b|i|bi files are not specified, load_font.php will search
the directory containing normal font file (n_file) for additional files that
it thinks might be the correct ones (e.g. that end in _Bold or b or B). If
it finds the files they will also be processed. All files will be
automatically copied to the DOMPDF font directory, and afm files will be
generated using php-font-lib (https://github.com/PhenX/php-font-lib).
Examples:
./load_font.php silkscreen /usr/share/fonts/truetype/slkscr.ttf
./load_font.php 'Times New Roman' /mnt/c_drive/WINDOWS/Fonts/times.ttf
EOD;
exit;
}
if ( $_SERVER["argc"] < 3 && @$_SERVER["argv"][1] != "system_fonts" ) {
usage();
}
/**
* Installs a new font family
* This function maps a font-family name to a font. It tries to locate the
* bold, italic, and bold italic versions of the font as well. Once the
* files are located, ttf versions of the font are copied to the fonts
* directory. Changes to the font lookup table are saved to the cache.
*
* @param string $fontname the font-family name
* @param string $normal the filename of the normal face font subtype
* @param string $bold the filename of the bold face font subtype
* @param string $italic the filename of the italic face font subtype
* @param string $bold_italic the filename of the bold italic face font subtype
*
* @throws DOMPDF_Exception
*/
function install_font_family($fontname, $normal, $bold = null, $italic = null, $bold_italic = null) {
Font_Metrics::init();
// Check if the base filename is readable
if ( !is_readable($normal) )
throw new DOMPDF_Exception("Unable to read '$normal'.");
$dir = dirname($normal);
$basename = basename($normal);
$last_dot = strrpos($basename, '.');
if ($last_dot !== false) {
$file = substr($basename, 0, $last_dot);
$ext = strtolower(substr($basename, $last_dot));
} else {
$file = $basename;
$ext = '';
}
if ( !in_array($ext, array(".ttf", ".otf")) ) {
throw new DOMPDF_Exception("Unable to process fonts of type '$ext'.");
}
// Try $file_Bold.$ext etc.
$path = "$dir/$file";
$patterns = array(
"bold" => array("_Bold", "b", "B", "bd", "BD"),
"italic" => array("_Italic", "i", "I"),
"bold_italic" => array("_Bold_Italic", "bi", "BI", "ib", "IB"),
);
foreach ($patterns as $type => $_patterns) {
if ( !isset($$type) || !is_readable($$type) ) {
foreach($_patterns as $_pattern) {
if ( is_readable("$path$_pattern$ext") ) {
$$type = "$path$_pattern$ext";
break;
}
}
if ( is_null($$type) )
echo ("Unable to find $type face file.\n");
}
}
$fonts = compact("normal", "bold", "italic", "bold_italic");
$entry = array();
// Copy the files to the font directory.
foreach ($fonts as $var => $src) {
if ( is_null($src) ) {
$entry[$var] = DOMPDF_FONT_DIR . mb_substr(basename($normal), 0, -4);
continue;
}
// Verify that the fonts exist and are readable
if ( !is_readable($src) )
throw new DOMPDF_Exception("Requested font '$src' is not readable");
$dest = DOMPDF_FONT_DIR . basename($src);
if ( !is_writeable(dirname($dest)) )
throw new DOMPDF_Exception("Unable to write to destination '$dest'.");
echo "Copying $src to $dest...\n";
if ( !copy($src, $dest) )
throw new DOMPDF_Exception("Unable to copy '$src' to '$dest'");
$entry_name = mb_substr($dest, 0, -4);
echo "Generating Adobe Font Metrics for $entry_name...\n";
$font_obj = Font::load($dest);
$font_obj->saveAdobeFontMetrics("$entry_name.ufm");
$entry[$var] = $entry_name;
}
// Store the fonts in the lookup table
Font_Metrics::set_font_family($fontname, $entry);
// Save the changes
Font_Metrics::save_font_families();
}
// If installing system fonts (may take a long time)
if ( $_SERVER["argv"][1] === "system_fonts" ) {
$fonts = Font_Metrics::get_system_fonts();
foreach ( $fonts as $family => $files ) {
echo " >> Installing '$family'... \n";
if ( !isset($files["normal"]) ) {
echo "No 'normal' style font file\n";
}
else {
install_font_family( $family, @$files["normal"], @$files["bold"], @$files["italic"], @$files["bold_italic"]);
echo "Done !\n";
}
echo "\n";
}
}
else {
call_user_func_array("install_font_family", array_slice($_SERVER["argv"], 1));
}
\ No newline at end of file
<?xml version="1.0"?>
<!--suppress XmlUnboundNsPrefix -->
<ruleset name="PHP-SDK">
<description>Coding standard ruleset based on the PSR-2 coding standard.</description>
<rule ref="PSR2"/>
<rule ref="Generic.Files.LineLength.TooLong">
<severity>0</severity>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<severity>0</severity>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<severity>0</severity>
</rule>
<rule ref="Squiz.Scope.MethodScope.Missing">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.ValidDefaultValue.NotAtEnd">
<severity>0</severity>
</rule>
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<severity>0</severity>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.ScopeMissing">
<severity>0</severity>
</rule>
<!-- These can be fixed automatically by phpcbf -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose">
<severity>0</severity>
</rule>
<rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceBeforeSemicolon">
<severity>0</severity>
</rule>
<rule ref="PSR2.Files.EndFileNewline.NoneFound">
<severity>0</severity>
</rule>
<rule ref="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.Indent">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace">
<severity>0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.MultipleArguments">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword">
<severity>0</severity>
</rule>
<rule ref="PSR2.Classes.ClassDeclaration.OpenBraceNewLine">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction">
<severity>0</severity>
</rule>
<rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
<severity>0</severity>
</rule>
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE">
<severity>0</severity>
</rule>
<rule ref="PSR2.Files.EndFileNewline.TooMany">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.MethodDeclaration.StaticBeforeVisibility">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
<severity>0</severity>
</rule>
</ruleset>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment