init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
2
vendor/whiteoctober/tcpdf-bundle/.gitignore
vendored
Normal file
2
vendor/whiteoctober/tcpdf-bundle/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
composer.lock
|
||||
/vendor/
|
||||
51
vendor/whiteoctober/tcpdf-bundle/Controller/TCPDFController.php
vendored
Normal file
51
vendor/whiteoctober/tcpdf-bundle/Controller/TCPDFController.php
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace WhiteOctober\TCPDFBundle\Controller;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
use \TCPDF;
|
||||
|
||||
class TCPDFController
|
||||
{
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param string $className The class name to use. Default is TCPDF. Must be based on TCPDF
|
||||
*/
|
||||
public function __construct($className)
|
||||
{
|
||||
$this->setClassName($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of TCPDF/the class name to use as supplied
|
||||
* Any arguments passed here will be passed directly
|
||||
* to the TCPDF class as constructor arguments
|
||||
*
|
||||
* @return TCPDF
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$rc = new ReflectionClass($this->className);
|
||||
return $rc->newInstanceArgs(func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the class name to use for instantiation
|
||||
*
|
||||
* @param $className
|
||||
* @throws \LogicException if the class is not, or does not inherit from, TCPDF
|
||||
*/
|
||||
public function setClassName($className)
|
||||
{
|
||||
$rc = new ReflectionClass($className);
|
||||
if (!$rc->isSubclassOf('TCPDF') && $rc->getName() != 'TCPDF')
|
||||
{
|
||||
throw new \LogicException("Class '{$className}' must inherit from TCPDF");
|
||||
}
|
||||
$this->className = $className;
|
||||
}
|
||||
}
|
||||
96
vendor/whiteoctober/tcpdf-bundle/DependencyInjection/Configuration.php
vendored
Normal file
96
vendor/whiteoctober/tcpdf-bundle/DependencyInjection/Configuration.php
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace WhiteOctober\TCPDFBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* Builds our configuration
|
||||
*
|
||||
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('white_october_tcpdf');
|
||||
|
||||
if (method_exists($treeBuilder, 'getRootNode')) {
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
} else {
|
||||
$rootNode = $treeBuilder->root('white_october_tcpdf');
|
||||
}
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
->scalarNode('file')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/tcpdf.php')->end()
|
||||
->scalarNode('class')->defaultValue('TCPDF')->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
$this->addTCPDFConfig($rootNode);
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the core TCPDF configuration
|
||||
*
|
||||
* @param $rootNode
|
||||
*/
|
||||
protected function addTCPDFConfig(ArrayNodeDefinition $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('tcpdf')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
|
||||
// Core configuration values
|
||||
// These get defined when the TCPDF bundle is booted
|
||||
->scalarNode('k_path_url')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/')->end()
|
||||
->scalarNode('k_path_main')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/')->end()
|
||||
->scalarNode('k_path_fonts')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/fonts/')->end()
|
||||
->scalarNode('k_path_cache')->defaultValue('%kernel.cache_dir%/tcpdf')->end()
|
||||
->scalarNode('k_path_url_cache')->defaultValue('%kernel.cache_dir%/tcpdf')->end()
|
||||
->scalarNode('k_path_images')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/examples/images/')->end()
|
||||
->scalarNode('k_blank_image')->defaultValue('%kernel.root_dir%/../vendor/tecnickcom/tcpdf/examples/images/_blank.png')->end()
|
||||
->scalarNode('k_cell_height_ratio')->defaultValue(1.25)->end()
|
||||
->scalarNode('k_title_magnification')->defaultValue(1.3)->end()
|
||||
->scalarNode('k_small_ratio')->defaultValue(2/3)->end()
|
||||
->scalarNode('k_thai_topchars')->defaultTrue()->end()
|
||||
->scalarNode('k_tcpdf_calls_in_html')->defaultFalse()->end()
|
||||
->scalarNode('k_tcpdf_external_config')->defaultTrue()->end()
|
||||
->scalarNode('k_tcpdf_throw_exception_error')->defaultTrue()->end()
|
||||
|
||||
// Optional nice-to-have values
|
||||
->scalarNode('head_magnification')->defaultValue(1.1)->end()
|
||||
->scalarNode('pdf_page_format')->defaultValue('A4')->end()
|
||||
->scalarNode('pdf_page_orientation')->defaultValue('P')->end()
|
||||
->scalarNode('pdf_creator')->defaultValue('TCPDF')->end()
|
||||
->scalarNode('pdf_author')->defaultValue('TCPDF')->end()
|
||||
->scalarNode('pdf_header_title')->defaultValue('')->end()
|
||||
->scalarNode('pdf_header_string')->defaultValue('')->end()
|
||||
->scalarNode('pdf_header_logo')->defaultValue('')->end()
|
||||
->scalarNode('pdf_header_logo_width')->defaultValue('')->end()
|
||||
->scalarNode('pdf_unit')->defaultValue('mm')->end()
|
||||
->scalarNode('pdf_margin_header')->defaultValue(5)->end()
|
||||
->scalarNode('pdf_margin_footer')->defaultValue(10)->end()
|
||||
->scalarNode('pdf_margin_top')->defaultValue(27)->end()
|
||||
->scalarNode('pdf_margin_bottom')->defaultValue(25)->end()
|
||||
->scalarNode('pdf_margin_left')->defaultValue(15)->end()
|
||||
->scalarNode('pdf_margin_right')->defaultValue(15)->end()
|
||||
->scalarNode('pdf_font_name_main')->defaultValue('helvetica')->end()
|
||||
->scalarNode('pdf_font_size_main')->defaultValue(10)->end()
|
||||
->scalarNode('pdf_font_name_data')->defaultValue('helvetica')->end()
|
||||
->scalarNode('pdf_font_size_data')->defaultValue(8)->end()
|
||||
->scalarNode('pdf_font_monospaced')->defaultValue('courier')->end()
|
||||
->scalarNode('pdf_image_scale_ratio')->defaultValue(1.25)->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
}
|
||||
36
vendor/whiteoctober/tcpdf-bundle/DependencyInjection/WhiteOctoberTCPDFExtension.php
vendored
Normal file
36
vendor/whiteoctober/tcpdf-bundle/DependencyInjection/WhiteOctoberTCPDFExtension.php
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace WhiteOctober\TCPDFBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension,
|
||||
Symfony\Component\DependencyInjection\ContainerBuilder,
|
||||
Symfony\Component\DependencyInjection\Definition,
|
||||
Symfony\Component\DependencyInjection\Loader\XmlFileLoader,
|
||||
Symfony\Component\Config\Definition\Processor,
|
||||
Symfony\Component\Config\FileLocator;
|
||||
|
||||
use WhiteOctober\TCPDFBundle\DependencyInjection\Configuration;
|
||||
|
||||
class WhiteOctoberTCPDFExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* Load our configuration
|
||||
*
|
||||
* @param array $configs
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
* @return void
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$config = $processor->processConfiguration($configuration, $configs);
|
||||
|
||||
$container->setParameter('white_october_tcpdf.file', $config['file']);
|
||||
$container->setParameter('white_october_tcpdf.class', $config['class']);
|
||||
$container->setParameter('white_october_tcpdf.tcpdf', $config['tcpdf']);
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
}
|
||||
}
|
||||
144
vendor/whiteoctober/tcpdf-bundle/README.md
vendored
Normal file
144
vendor/whiteoctober/tcpdf-bundle/README.md
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
WhiteOctoberTCPDFBundle
|
||||
=======================
|
||||
|
||||
This bundle facilitates easy use of the TCPDF PDF generation library in
|
||||
Symfony2 applications.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
### Step 1: Setup Bundle and dependencies
|
||||
```
|
||||
composer require whiteoctober/tcpdf-bundle
|
||||
```
|
||||
|
||||
#### Version constraining (optional)
|
||||
|
||||
By default, this bundle does not constrain the version of TCPDF that composer installs.
|
||||
([An explanation of this unusual decision is here](https://github.com/whiteoctober/WhiteOctoberTCPDFBundle/issues/53)).
|
||||
This means that a `composer update` could update to a new major version of TCPDF.
|
||||
Since this bundle is only a thin wrapper around TCPDF, you can normally do such an upgrade without issue.
|
||||
|
||||
However, if you do wish to constrain the TCPDF version, find out what version you currently have installed with:
|
||||
|
||||
```bash
|
||||
composer show tecnickcom/tcpdf
|
||||
```
|
||||
|
||||
And amend your project's `composer.json` to add a TCPDF version constraint in the `requires` section.
|
||||
For example, if TCPDF version `6.2.17` was installed, `"tecnickcom/tcpdf": "^6.2.17"` will allow anything < 7 when upgrading.
|
||||
|
||||
### Step 2: Enable the bundle in the kernel
|
||||
|
||||
Add the bundle to the `registerBundles()` method in your kernel:
|
||||
|
||||
In Symfony < 4:
|
||||
|
||||
``` php
|
||||
// app/AppKernel.php
|
||||
<?php
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = array(
|
||||
// ...
|
||||
new WhiteOctober\TCPDFBundle\WhiteOctoberTCPDFBundle(),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
In Symfony 4:
|
||||
|
||||
```php
|
||||
// config/bundles.php
|
||||
return [
|
||||
// ...
|
||||
WhiteOctober\TCPDFBundle\WhiteOctoberTCPDFBundle::class => ['all' => true],
|
||||
// ...
|
||||
];
|
||||
```
|
||||
|
||||
(This project is not yet configured with Symfony Flex, so this change to `config/bundles.php` won't be done automatically.)
|
||||
|
||||
If you want to do service autowiring, you'll need to add an alias for the service:
|
||||
|
||||
```yaml
|
||||
# app/config/services.yml (Symfony 3)
|
||||
# config/services.yaml (Symfony 4)
|
||||
services:
|
||||
# ...
|
||||
|
||||
# the `white_october.tcpdf` service will be injected when a
|
||||
# `WhiteOctober\TCPDFBundle\Controller\TCPDFController` type-hint is detected
|
||||
WhiteOctober\TCPDFBundle\Controller\TCPDFController: '@white_october.tcpdf'
|
||||
```
|
||||
|
||||
Using TCPDF
|
||||
-----------
|
||||
|
||||
You can obtain the `white_october.tcpdf` service from the container,
|
||||
and then create a new TCPDF object via the service:
|
||||
|
||||
``` php
|
||||
$pdfObj = $container->get("white_october.tcpdf")->create();
|
||||
```
|
||||
|
||||
From hereon in, you are using a TCPDF object to work with as normal.
|
||||
|
||||
Configuration
|
||||
--------------
|
||||
|
||||
### Configuration values
|
||||
|
||||
You can pass parameters to TCPDF like this:
|
||||
|
||||
```yaml
|
||||
# app/config/config.yml (Symfony < 4)
|
||||
# config/packages/white_october_tcpdf.yaml (Symfony 4)
|
||||
white_october_tcpdf:
|
||||
tcpdf:
|
||||
k_title_magnification: 2
|
||||
```
|
||||
|
||||
You can see the default parameter values in
|
||||
`WhiteOctober\TCPDFBundle\DependencyInjection\Configuration::addTCPDFConfig`.
|
||||
|
||||
If you want, you can use TCPDF's own defaults instead:
|
||||
|
||||
```yaml
|
||||
white_october_tcpdf:
|
||||
tcpdf:
|
||||
k_tcpdf_external_config: false # the values set by this bundle will be ignored
|
||||
```
|
||||
|
||||
### Using a custom class
|
||||
|
||||
If you want to use your own custom TCPDF-based class, you can use
|
||||
the `class` parameter in your configuration:
|
||||
|
||||
```yaml
|
||||
# app/config/config.yml (Symfony < 4)
|
||||
# config/packages/white_october_tcpdf.yaml (Symfony 4)
|
||||
white_october_tcpdf:
|
||||
class: 'Acme\MyBundle\MyTCPDFClass'
|
||||
```
|
||||
|
||||
The class must extend from the `TCPDF` class; an exception will be
|
||||
thrown if this is not the case.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This bundle is under the MIT license. See the complete license in the bundle:
|
||||
|
||||
Resources/meta/LICENSE
|
||||
|
||||
Contributing
|
||||
-------------
|
||||
|
||||
We welcome contributions to this project, including pull requests and issues (and discussions on existing issues).
|
||||
|
||||
If you'd like to contribute code but aren't sure what, the [issues list](https://github.com/whiteoctober/WhiteOctoberTCPDFBundle/issues) is a good place to start.
|
||||
If you're a first-time code contributor, you may find Github's guide to [forking projects](https://guides.github.com/activities/forking/) helpful.
|
||||
|
||||
All contributors (whether contributing code, involved in issue discussions, or involved in any other way) must abide by our [code of conduct](https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md).
|
||||
16
vendor/whiteoctober/tcpdf-bundle/Resources/config/services.xml
vendored
Normal file
16
vendor/whiteoctober/tcpdf-bundle/Resources/config/services.xml
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
|
||||
<!-- TCPDF service -->
|
||||
<service id="white_october.tcpdf" class="WhiteOctober\TCPDFBundle\Controller\TCPDFController">
|
||||
<file>%white_october_tcpdf.file%</file>
|
||||
<argument>%white_october_tcpdf.class%</argument>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
</container>
|
||||
19
vendor/whiteoctober/tcpdf-bundle/Resources/meta/LICENSE
vendored
Normal file
19
vendor/whiteoctober/tcpdf-bundle/Resources/meta/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2012 White October Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
72
vendor/whiteoctober/tcpdf-bundle/WhiteOctoberTCPDFBundle.php
vendored
Normal file
72
vendor/whiteoctober/tcpdf-bundle/WhiteOctoberTCPDFBundle.php
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace WhiteOctober\TCPDFBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class WhiteOctoberTCPDFBundle extends Bundle
|
||||
{
|
||||
/**
|
||||
* Ran on bundle boot, our TCPDF configuration constants
|
||||
* get defined here if required
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (!$this->container->hasParameter('white_october_tcpdf.tcpdf')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Define our TCPDF variables
|
||||
$config = $this->container->getParameter('white_october_tcpdf.tcpdf');
|
||||
|
||||
// TCPDF needs some constants defining if our configuration
|
||||
// determines we should do so (default true)
|
||||
// Set tcpdf.k_tcpdf_external_config to false to use the TCPDF
|
||||
// core defaults
|
||||
if ($config['k_tcpdf_external_config'])
|
||||
{
|
||||
foreach ($config as $k => $v)
|
||||
{
|
||||
$constKey = strtoupper($k);
|
||||
|
||||
if (!defined($constKey))
|
||||
{
|
||||
$value = $this->container->getParameterBag()->resolveValue($v);
|
||||
|
||||
// All K_ constants are required
|
||||
if (preg_match("/^k_/i", $k))
|
||||
{
|
||||
|
||||
if (($k === 'k_path_cache' || $k === 'k_path_url_cache') && !is_dir($value)) {
|
||||
$this->createDir($value);
|
||||
}
|
||||
|
||||
if(in_array($constKey, ['K_PATH_URL','K_PATH_MAIN','K_PATH_FONTS','K_PATH_CACHE','K_PATH_URL_CACHE','K_PATH_IMAGES'])) {
|
||||
$value .= (substr($value, -1) == '/' ? '' : '/');
|
||||
}
|
||||
|
||||
}
|
||||
define($constKey, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a directory
|
||||
*
|
||||
* @param string $filePath
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
private function createDir($filePath)
|
||||
{
|
||||
$filesystem = new Filesystem();
|
||||
if (false === $filesystem->mkdir($filePath)) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
'Could not create directory %s', $filePath
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
1
vendor/whiteoctober/tcpdf-bundle/code-of-conduct.md
vendored
Normal file
1
vendor/whiteoctober/tcpdf-bundle/code-of-conduct.md
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
This project's code-of-conduct can be found at [https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md](https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md).
|
||||
22
vendor/whiteoctober/tcpdf-bundle/composer.json
vendored
Normal file
22
vendor/whiteoctober/tcpdf-bundle/composer.json
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "whiteoctober/tcpdf-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "A bundle to easily integrate TCPDF into Symfony2",
|
||||
"keywords": ["pdf", "tcpdf"],
|
||||
"homepage": "https://github.com/whiteoctober/WhiteOctoberTCPDFBundle",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rich Sage",
|
||||
"email": "rich.sage@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"symfony/framework-bundle": ">=2.0",
|
||||
"tecnickcom/tcpdf": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "WhiteOctober\\TCPDFBundle\\": "" }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue