Skip to content

Commit 29856c7

Browse files
committed
first commit
0 parents  commit 29856c7

Some content is hidden

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

78 files changed

+12391
-0
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 PhpSpreadsheet Authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Open source FPDF php library released as WordPress plugin to use easily
2+
3+
## Description
4+
5+
Software requirements
6+
7+
The following software is required:
8+
9+
- PHP version 7.4 or newer
10+
11+
## Installation
12+
13+
1. Download the latest zip from [here](https://github.com/codeboxrcodehub/cbxphpfpdf/releases)
14+
2. WordPress has clear documentation about [how to install a plugin.](https://codex.wordpress.org/Managing_Plugins)
15+
3. After install activate the plugin "CBX PhpDompdf Library" through the 'Plugins' menu in WordPress
16+
4. This plugin doesn't load any library by default, it doesn't create extra folder or menu.
17+
18+
## Licence
19+
20+
[MIT](https://github.com/codeboxrcodehub/cbxphpfpdf/blob/master/LICENSE.txt)

README.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
=== CBX PHPFPDF Library ===
2+
Contributors: codeboxr, manchumahara
3+
Requires at least: 3.5
4+
Tested up to: 6.6.2
5+
Stable tag: 1.0.0
6+
License: MIT
7+
License URI: https://github.com/codeboxrcodehub/cbxphpfpdf/blob/master/LICENSE.txt
8+
9+
Open source FPDF php library released as WordPress plugin to use easily
10+
11+
== Description ==
12+
13+
14+
Software requirements
15+
16+
The following software is required:
17+
18+
- PHP version 7.4 or newer
19+
20+
https://github.com/fawno/FPDF
21+
https://github.com/fawno/FPDF/tree/master/scripts
22+
23+
based on https://github.com/Setasign/FPDF which is based on original sourcecode of http://www.fpdf.org/
24+
25+
== Installation ==
26+
27+
1. Download the latest zip from here (https://github.com/codeboxrcodehub/cbxphpfpdf/releases)
28+
2. [WordPress has clear documentation about how to install a plugin].(https://codex.wordpress.org/Managing_Plugins)
29+
3. After install activate the plugin "CBX PhpDompdf Library" through the 'Plugins' menu in WordPress
30+
4. This plugin doesn't load any library by default, it doesn't create extra folder or menu.
31+
32+
33+
== Changelog ==
34+
35+
= 1.0.0 =
36+
* First public release

cbxphpfpdf.php

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
<?php
2+
3+
/**
4+
* The plugin bootstrap file
5+
*
6+
* This file is read by WordPress to generate the plugin information in the plugin
7+
* admin area. This file also includes all of the dependencies used by the plugin,
8+
* registers the activation and deactivation functions, and defines a function
9+
* that starts the plugin.
10+
*
11+
* @link http://codeboxr.com
12+
* @since 1.0.0
13+
* @package cbxphpfpdf
14+
*
15+
* @wordpress-plugin
16+
* Plugin Name: CBX PHPFPDF Library
17+
* Plugin URI: https://github.com/codeboxrcodehub/cbxphpfpdf
18+
* Description: fpdf library as WordPress plugin based on https://github.com/fawno/FPDF
19+
* Version: 1.0.0
20+
* Author: Codeboxr
21+
* Author URI: https://github.com/PHPOffice/PhpDomPDF
22+
* License: GPL-2.0+
23+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
24+
* Text Domain: cbxphpfpdf
25+
* Domain Path: /languages
26+
*/
27+
28+
// If this file is called directly, abort.
29+
if (!defined('WPINC')) {
30+
die;
31+
}
32+
use Cbx\Phpfpdf\Hooks;
33+
34+
defined('CBXPHPFPDF_PLUGIN_NAME') or define('CBXPHPFPDF_PLUGIN_NAME', 'cbxphpfpdf');
35+
defined('CBXPHPFPDF_PLUGIN_VERSION') or define('CBXPHPFPDF_PLUGIN_VERSION', '1.0.0');
36+
defined('CBXPHPFPDF_BASE_NAME') or define('CBXPHPFPDF_BASE_NAME', plugin_basename(__FILE__));
37+
defined('CBXPHPFPDF_ROOT_PATH') or define('CBXPHPFPDF_ROOT_PATH', plugin_dir_path(__FILE__));
38+
defined('CBXPHPFPDF_ROOT_URL') or define('CBXPHPFPDF_ROOT_URL', plugin_dir_url(__FILE__));
39+
40+
register_activation_hook(__FILE__, array('CBXPhpFpdf', 'activation'));
41+
require_once CBXPHPFPDF_ROOT_PATH . "lib/vendor/autoload.php";
42+
43+
/**
44+
* Class CBXPhpFpdf
45+
*/
46+
class CBXPhpFpdf
47+
{
48+
function __construct()
49+
{
50+
//load text domain
51+
load_plugin_textdomain('cbxphpfpdf', false, dirname(plugin_basename(__FILE__)) . '/languages/');
52+
53+
add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
54+
new Hooks();
55+
}
56+
57+
/**
58+
* Activation hook
59+
*/
60+
public static function activation()
61+
{
62+
/*$requirements = array(
63+
'PHP 7.1.0' => version_compare(PHP_VERSION, '7.1.0', '>='),
64+
'PHP extension XML' => extension_loaded('xml'),
65+
'PHP extension xmlwriter' => extension_loaded('xmlwriter'),
66+
'PHP extension mbstring' => extension_loaded('mbstring'),
67+
'PHP extension ZipArchive' => extension_loaded('zip'),
68+
'PHP extension GD (optional)' => extension_loaded('gd'),
69+
'PHP extension dom (optional)' => extension_loaded('dom'),
70+
);*/
71+
72+
if (!CBXPhpFpdf::php_version_check()) {
73+
74+
// Deactivate the plugin
75+
deactivate_plugins(__FILE__);
76+
77+
// Throw an error in the wordpress admin console
78+
$error_message = esc_html__('This plugin requires PHP version 7.1 or newer', 'cbxphpfpdf');
79+
die($error_message);
80+
}
81+
82+
if (!CBXPhpFpdf::php_zip_enabled_check()) {
83+
84+
// Deactivate the plugin
85+
deactivate_plugins(__FILE__);
86+
87+
// Throw an error in the wordpress admin console
88+
$error_message = esc_html__('This plugin requires PHP php_zip extension installed and enabled', 'cbxphpfpdf');
89+
die($error_message);
90+
}
91+
92+
if (!CBXPhpFpdf::php_xml_enabled_check()) {
93+
94+
// Deactivate the plugin
95+
deactivate_plugins(__FILE__);
96+
97+
// Throw an error in the wordpress admin console
98+
$error_message = esc_html__('This plugin requires PHP php_xml extension installed and enabled', 'cbxphpfpdf');
99+
die($error_message);
100+
}
101+
102+
if (!CBXPhpFpdf::php_gd_enabled_check()) {
103+
104+
// Deactivate the plugin
105+
deactivate_plugins(__FILE__);
106+
107+
// Throw an error in the wordpress admin console
108+
$error_message = esc_html__('This plugin requires PHP php_gd2 extension installed and enabled', 'cbxphpfpdf');
109+
die($error_message);
110+
}
111+
112+
if (!CBXPhpFpdf::php_mbstring_enabled_check()) {
113+
114+
// Deactivate the plugin
115+
deactivate_plugins(__FILE__);
116+
117+
// Throw an error in the wordpress admin console
118+
$error_message = esc_html__('This plugin requires PHP php_MBString extension installed and enabled', 'cbxphpfpdf');
119+
die($error_message);
120+
}
121+
122+
if (!CBXPhpFpdf::php_dom_enabled_check()) {
123+
124+
// Deactivate the plugin
125+
deactivate_plugins(__FILE__);
126+
127+
// Throw an error in the wordpress admin console
128+
$error_message = esc_html__('This plugin requires PHP DOM extension installed and enabled', 'cbxphpfpdf');
129+
die($error_message);
130+
}
131+
132+
}//end method activation
133+
134+
/**
135+
* PHP version compatibility check
136+
*
137+
* @return bool
138+
*/
139+
public static function php_version_check()
140+
{
141+
if (version_compare(PHP_VERSION, '7.1.0', '<')) {
142+
return false;
143+
}
144+
145+
return true;
146+
}//end method php_version_check
147+
148+
/**
149+
* php_zip enabled check
150+
*
151+
* @return bool
152+
*/
153+
public static function php_zip_enabled_check()
154+
{
155+
if (extension_loaded('zip')) {
156+
return true;
157+
}
158+
return false;
159+
}//end method php_zip_enabled_check
160+
161+
/**
162+
* php_xml enabled check
163+
*
164+
* @return bool
165+
*/
166+
public static function php_xml_enabled_check()
167+
{
168+
if (extension_loaded('xml')) {
169+
return true;
170+
}
171+
return false;
172+
}//end method php_xml_enabled_check
173+
174+
/**
175+
* php_gd2 enabled check
176+
*
177+
* @return bool
178+
*/
179+
public static function php_gd_enabled_check()
180+
{
181+
if (extension_loaded('gd')) {
182+
return true;
183+
}
184+
return false;
185+
}//end method php_gd_enabled_check
186+
187+
/**
188+
* php_mbstring enabled check
189+
*
190+
* @return bool
191+
*/
192+
public static function php_mbstring_enabled_check()
193+
{
194+
if (extension_loaded('mbstring')) {
195+
return true;
196+
}
197+
return false;
198+
}//end method php_mbstring_enabled_check
199+
200+
/**
201+
* php_dom enabled check
202+
*
203+
* @return bool
204+
*/
205+
public static function php_dom_enabled_check()
206+
{
207+
if (extension_loaded('dom')) {
208+
return true;
209+
}
210+
return false;
211+
}//end method php_dom_enabled_check
212+
213+
/**
214+
* Plugin support and doc page url
215+
*
216+
* @param $links
217+
* @param $file
218+
*
219+
* @return array
220+
*/
221+
public function plugin_row_meta($links, $file)
222+
{
223+
if (strpos($file, 'cbxphpfpdf.php') !== false) {
224+
$new_links = array(
225+
'support' => '<a href="https://github.com/codeboxrcodehub/cbxphpfpdf" target="_blank">' . esc_html__('Support', 'cbxphpfpdf') . '</a>',
226+
'doc' => '<a href="https://github.com/dompdf/dompdf" target="_blank">' . esc_html__('PHP Dompdf Doc', 'cbxphpfpdf') . '</a>'
227+
);
228+
229+
$links = array_merge($links, $new_links);
230+
}
231+
232+
return $links;
233+
}
234+
235+
}//end method CBXPhpFpdf
236+
237+
238+
function cbxphpfpdf_load_plugin()
239+
{
240+
new CBXPhpFpdf();
241+
}
242+
243+
add_action('plugins_loaded', 'cbxphpfpdf_load_plugin', 5);

composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"config": {
3+
"vendor-dir": "lib/vendor"
4+
},
5+
"require": {
6+
"fawno/fpdf": "^1.86"
7+
},
8+
"autoload": {
9+
"psr-4": {
10+
"Cbx\\Phpfpdf\\": "includes/"
11+
},
12+
"files": []
13+
}
14+
}

0 commit comments

Comments
 (0)