1616 * Plugin Name: CBX PhpSpreadSheet Library
1717 * Plugin URI: https://codeboxr.com/php-spreadsheet-library-wordpress-plugin/
1818 * Description: A pure PHP library for reading and writing spreadsheet files https://phpspreadsheet.readthedocs.io/
19- * Version: 1.0.4
19+ * Version: 1.0.3
2020 * Author: Codeboxr
2121 * Author URI: https://github.com/PHPOffice/PhpSpreadsheet
2222 * License: GPL-2.0+
2626 */
2727
2828// If this file is called directly, abort.
29- if ( ! defined ( 'WPINC ' ) ) {
29+
30+ use Cbx \Phpspreadsheet \Hooks ;
31+
32+ if (!defined ('WPINC ' )) {
3033 die;
3134}
3235
33- defined ( 'CBXPHPSPREADSHEET_PLUGIN_NAME ' ) or define ( 'CBXPHPSPREADSHEET_PLUGIN_NAME ' , 'cbxphpspreadsheet ' );
34- defined ( 'CBXPHPSPREADSHEET_PLUGIN_VERSION ' ) or define ( 'CBXPHPSPREADSHEET_PLUGIN_VERSION ' , '1.0.4 ' );
35- defined ( 'CBXPHPSPREADSHEET_BASE_NAME ' ) or define ( 'CBXPHPSPREADSHEET_BASE_NAME ' , plugin_basename ( __FILE__ ) );
36- defined ( 'CBXPHPSPREADSHEET_ROOT_PATH ' ) or define ( 'CBXPHPSPREADSHEET_ROOT_PATH ' , plugin_dir_path ( __FILE__ ) );
37- defined ( 'CBXPHPSPREADSHEET_ROOT_URL ' ) or define ( 'CBXPHPSPREADSHEET_ROOT_URL ' , plugin_dir_url ( __FILE__ ) );
36+ defined ('CBXPHPSPREADSHEET_PLUGIN_NAME ' ) or define ('CBXPHPSPREADSHEET_PLUGIN_NAME ' , 'cbxphpspreadsheet ' );
37+ defined ('CBXPHPSPREADSHEET_PLUGIN_VERSION ' ) or define ('CBXPHPSPREADSHEET_PLUGIN_VERSION ' , '1.0.4 ' );
38+ defined ('CBXPHPSPREADSHEET_BASE_NAME ' ) or define ('CBXPHPSPREADSHEET_BASE_NAME ' , plugin_basename (__FILE__ ) );
39+ defined ('CBXPHPSPREADSHEET_ROOT_PATH ' ) or define ('CBXPHPSPREADSHEET_ROOT_PATH ' , plugin_dir_path (__FILE__ ) );
40+ defined ('CBXPHPSPREADSHEET_ROOT_URL ' ) or define ('CBXPHPSPREADSHEET_ROOT_URL ' , plugin_dir_url (__FILE__ ) );
3841
3942
40- register_activation_hook ( __FILE__ , array ( 'CBXPhpSpreadSheet ' , 'activation ' ) );
43+ register_activation_hook (__FILE__ , array ('CBXPhpSpreadSheet ' , 'activation ' ) );
4144
42- /**
43- * Class CBXPhpSpreadSheet
44- */
45- class CBXPhpSpreadSheet {
46- function __construct () {
45+
46+
47+ new Hooks ;
48+ /**
49+ * Class CBXPhpSpreadSheet
50+ */
51+ class CBXPhpSpreadSheet
52+ {
53+ function __construct ()
54+ {
4755 //load text domain
4856 load_plugin_textdomain ('cbxphpspreadsheet ' , false , dirname (plugin_basename (__FILE__ )) . '/languages/ ' );
4957
50- add_filter ( 'plugin_row_meta ' , array ($ this , 'plugin_row_meta ' ), 10 , 2 );
58+ add_filter ('plugin_row_meta ' , array ($ this , 'plugin_row_meta ' ), 10 , 2 );
59+
60+
5161 }
5262
5363 /**
5464 * Activation hook
5565 */
56- public static function activation () {
57- /*$requirements = array(
58- 'PHP 7.4.0' => version_compare(PHP_VERSION, '7.4.0', '>='),
59- 'PHP extension XML' => extension_loaded('xml'),
60- 'PHP extension xmlwriter' => extension_loaded('xmlwriter'),
61- 'PHP extension mbstring' => extension_loaded('mbstring'),
62- 'PHP extension ZipArchive' => extension_loaded('zip'),
63- 'PHP extension GD (optional)' => extension_loaded('gd'),
64- 'PHP extension dom (optional)' => extension_loaded('dom'),
65- );*/
66-
67-
66+ public static function activation ()
67+ {
6868 if (!CBXPhpSpreadSheet::php_version_check ()) {
6969
7070 // Deactivate the plugin
@@ -82,7 +82,10 @@ public static function activation() {
8282 deactivate_plugins (__FILE__ );
8383
8484 // Throw an error in the wordpress admin console
85- $ error_message = __ ('This plugin requires PHP php_zip extension installed and enabled ' , 'cbxphpspreadsheet ' );
85+ $ error_message = __ (
86+ 'This plugin requires PHP php_zip extension installed and enabled ' ,
87+ 'cbxphpspreadsheet '
88+ );
8689 die ($ error_message );
8790 }
8891
@@ -92,7 +95,10 @@ public static function activation() {
9295 deactivate_plugins (__FILE__ );
9396
9497 // Throw an error in the wordpress admin console
95- $ error_message = __ ('This plugin requires PHP php_xml extension installed and enabled ' , 'cbxphpspreadsheet ' );
98+ $ error_message = __ (
99+ 'This plugin requires PHP php_xml extension installed and enabled ' ,
100+ 'cbxphpspreadsheet '
101+ );
96102 die ($ error_message );
97103 }
98104
@@ -102,7 +108,10 @@ public static function activation() {
102108 deactivate_plugins (__FILE__ );
103109
104110 // Throw an error in the wordpress admin console
105- $ error_message = __ ('This plugin requires PHP php_gd2 extension installed and enabled ' , 'cbxphpspreadsheet ' );
111+ $ error_message = __ (
112+ 'This plugin requires PHP php_gd2 extension installed and enabled ' ,
113+ 'cbxphpspreadsheet '
114+ );
106115 die ($ error_message );
107116 }
108117
@@ -113,7 +122,8 @@ public static function activation() {
113122 *
114123 * @return bool
115124 */
116- public static function php_version_check (){
125+ public static function php_version_check ()
126+ {
117127 if (version_compare (PHP_VERSION , '7.4.0 ' , '< ' )) {
118128 return false ;
119129 }
@@ -126,10 +136,12 @@ public static function php_version_check(){
126136 *
127137 * @return bool
128138 */
129- public static function php_zip_enabled_check (){
139+ public static function php_zip_enabled_check ()
140+ {
130141 if (extension_loaded ('zip ' )) {
131142 return true ;
132143 }
144+
133145 return false ;
134146 }//end method php_zip_enabled_check
135147
@@ -138,10 +150,12 @@ public static function php_zip_enabled_check(){
138150 *
139151 * @return bool
140152 */
141- public static function php_xml_enabled_check (){
153+ public static function php_xml_enabled_check ()
154+ {
142155 if (extension_loaded ('xml ' )) {
143156 return true ;
144157 }
158+
145159 return false ;
146160 }//end method php_xml_enabled_check
147161
@@ -150,10 +164,12 @@ public static function php_xml_enabled_check(){
150164 *
151165 * @return bool
152166 */
153- public static function php_gd_enabled_check (){
167+ public static function php_gd_enabled_check ()
168+ {
154169 if (extension_loaded ('gd ' )) {
155170 return true ;
156171 }
172+
157173 return false ;
158174 }//end method php_gd_enabled_check
159175
@@ -165,15 +181,22 @@ public static function php_gd_enabled_check(){
165181 *
166182 * @return array
167183 */
168- public function plugin_row_meta ( $ links , $ file ) {
184+ public function plugin_row_meta ($ links , $ file )
185+ {
169186
170- if ( strpos ( $ file , 'cbxphpspreadsheet.php ' ) !== false ) {
187+ if (strpos ($ file , 'cbxphpspreadsheet.php ' ) !== false ) {
171188 $ new_links = array (
172- 'support ' => '<a href="https://codeboxr.com/php-spreadsheet-library-wordpress-plugin/" target="_blank"> ' .esc_html__ ('Support ' , 'cbxphpspreadsheet ' ).'</a> ' ,
173- 'doc ' => '<a href="https://phpspreadsheet.readthedocs.io/en/latest/" target="_blank"> ' .esc_html__ ('PHP Spreadsheet Doc ' , 'cbxphpspreadsheet ' ).'</a> '
189+ 'support ' => '<a href="https://codeboxr.com/php-spreadsheet-library-wordpress-plugin/" target="_blank"> ' . esc_html__ (
190+ 'Support ' ,
191+ 'cbxphpspreadsheet '
192+ ) . '</a> ' ,
193+ 'doc ' => '<a href="https://phpspreadsheet.readthedocs.io/en/latest/" target="_blank"> ' . esc_html__ (
194+ 'PHP Spreadsheet Doc ' ,
195+ 'cbxphpspreadsheet '
196+ ) . '</a> '
174197 );
175198
176- $ links = array_merge ( $ links , $ new_links );
199+ $ links = array_merge ($ links , $ new_links );
177200 }
178201
179202 return $ links ;
@@ -182,8 +205,9 @@ public function plugin_row_meta( $links, $file ) {
182205}//end method CBXPhpSpreadSheet
183206
184207
185- function cbxphpspreadsheet_load_plugin () {
208+ function cbxphpspreadsheet_load_plugin ()
209+ {
186210 new CBXPhpSpreadSheet ();
187211}
188212
189- add_action ( 'plugins_loaded ' , 'cbxphpspreadsheet_load_plugin ' , 5 );
213+ add_action ('plugins_loaded ' , 'cbxphpspreadsheet_load_plugin ' , 5 );
0 commit comments