Skip to content

Commit 2c16842

Browse files
author
Raymond J. Kolbe
committed
Removed external package dependency on dino/dompdf and added it directly to this package.
1 parent f10d3c7 commit 2c16842

File tree

426 files changed

+162537
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+162537
-26
lines changed

.travis/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"require": {
33
"php": ">=5.3.3",
4-
"zendframework/zendframework": "dev-master",
5-
"dino/dompdf-module": "dev-master"
4+
"zendframework/zendframework": "dev-master"
65
}
76
}

Module.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require_once __DIR__ . '/src/DOMPDFModule/Module.php';

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,4 @@ class ReportController extends AbstractActionController
6464
```
6565

6666
## To-do
67-
- Create tests
6867
- Add support for DOMPDF CLI

composer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
"type": "library",
44
"description": "A Zend Framework 2 module for incorporating DOMPDF support.",
55
"keywords": ["pdf","dompdf", "zf2"],
6-
"homepage": "",
6+
"homepage": "http://raymondkolbe.com",
77
"license": "MIT",
88
"authors": [
9-
{
10-
"name": "Raymond Kolbe",
11-
"email": "[email protected]"
9+
{
10+
"name": "Raymond Kolbe",
11+
"email": "[email protected]"
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.3.0",
16-
"dino/dompdf": "0.1.*"
15+
"php": ">=5.3.0"
1716
},
1817
"autoload": {
1918
"psr-0": {
20-
"DOMPDFModule": "src/"
21-
}
19+
"DOMPDFModule": "src/"
20+
}
2221
}
2322
}

config/module.config.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*
3030
* *Please note the trailing slash.*
3131
*/
32-
'font_directory' => __DIR__ . '/../../dompdf/lib/vendor/fonts/',
32+
'font_directory' => __DIR__ . '/../vendor/dompdf/lib/fonts/',
3333

3434
/**
3535
* The location of the DOMPDF font cache directory
@@ -39,7 +39,7 @@
3939
* It contains the .afm files, on demand parsed, converted to php syntax and cached
4040
* This folder can be the same as DOMPDF_FONT_DIR
4141
*/
42-
'font_cache_directory' => __DIR__ . '/../../data/dompdf/cache/',
42+
'font_cache_directory' => __DIR__ . '/../vendor/dompdf/data/dompdf/cache/',
4343

4444
/**
4545
* The location of a temporary directory.
@@ -62,7 +62,7 @@
6262
* direct class use like:
6363
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
6464
*/
65-
'chroot' => realpath(__DIR__ . '/../'),
65+
'chroot' => realpath(__DIR__ . '/../vendor/dompdf/'),
6666

6767
/**
6868
* Whether to use Unicode fonts or not.
@@ -273,6 +273,6 @@
273273
'factories' => array(
274274
'ViewPdfRenderer' => 'DOMPDFModule\Mvc\Service\ViewPdfRendererFactory',
275275
'ViewPdfStrategy' => 'DOMPDFModule\Mvc\Service\ViewPdfStrategyFactory',
276-
),
276+
)
277277
),
278278
);

config/module.dompdf.local.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/DOMPDFModule/Module.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,26 @@ public function init(ModuleManager $moduleManager)
7676
* @param ModuleEvent $e
7777
* @return void
7878
*/
79-
public function loadConfiguration(ModuleEvent $e)
79+
public function loadConfiguration(ModuleEvent $event)
8080
{
81-
define("DOMPDF_LIB_DIR", __DIR__ . '/../../../dompdf/lib/vendor');
81+
define("DOMPDF_DIR", __DIR__ . '/../../vendor/dompdf');
82+
define("DOMPDF_INC_DIR", DOMPDF_DIR . "/include");
83+
define("DOMPDF_LIB_DIR", DOMPDF_DIR . "/lib");
8284

83-
$mergedConfig = $e->getConfigListener()->getMergedConfig();
84-
$config = $mergedConfig['dompdf_module'];
85-
86-
foreach ($config as $key => $value) {
85+
$config = $event->getConfigListener()->getMergedConfig();
86+
foreach ($config['dompdf_module'] as $key => $value) {
8787
if (! array_key_exists($key, self::$configCompatMapping)) {
8888
continue;
8989
}
9090

9191
define(self::$configCompatMapping[$key], $value);
9292
}
9393

94-
require_once __DIR__ . "/../../../dompdf/lib/DOMPDF/functions.inc.php";
94+
define("DOMPDF_AUTOLOAD_PREPEND", false);
95+
96+
require_once DOMPDF_INC_DIR . '/functions.inc.php';
97+
require_once DOMPDF_LIB_DIR . '/html5lib/Parser.php';
98+
require_once DOMPDF_INC_DIR . '/autoload.inc.php';
9599
require_once __DIR__ . '/../../config/module.compat.php';
96100
}
97101

@@ -102,4 +106,15 @@ public function getConfig()
102106
{
103107
return include __DIR__ . '/../../config/module.config.php';
104108
}
109+
110+
public function getAutoloaderConfig()
111+
{
112+
return array(
113+
'Zend\Loader\StandardAutoloader' => array(
114+
'namespaces' => array(
115+
__NAMESPACE__ => __DIR__ ,
116+
),
117+
),
118+
);
119+
}
105120
}

src/DOMPDFModule/Mvc/Service/ViewPdfStrategyFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
3838
{
3939
$pdfRenderer = $serviceLocator->get('ViewPdfRenderer');
4040
$pdfStrategy = new PdfStrategy($pdfRenderer);
41-
41+
4242
return $pdfStrategy;
4343
}
4444
}

0 commit comments

Comments
 (0)