1616 * Plugin Name: CBX PHPFPDF Library
1717 * Plugin URI: https://github.com/codeboxrcodehub/cbxphpfpdf
1818 * Description: fpdf library as WordPress plugin based on https://github.com/fawno/FPDF
19- * Version: 1.0.3
19+ * Version: 1.0.4
2020 * Author: Codeboxr
2121 * Author URI: https://github.com/PHPOffice/PhpDomPDF
2222 * License: MIT
3131}
3232
3333defined ('CBXPHPFPDF_PLUGIN_NAME ' ) or define ('CBXPHPFPDF_PLUGIN_NAME ' , 'cbxphpfpdf ' );
34- defined ('CBXPHPFPDF_PLUGIN_VERSION ' ) or define ('CBXPHPFPDF_PLUGIN_VERSION ' , '1.0.3 ' );
34+ defined ('CBXPHPFPDF_PLUGIN_VERSION ' ) or define ('CBXPHPFPDF_PLUGIN_VERSION ' , '1.0.4 ' );
3535defined ('CBXPHPFPDF_BASE_NAME ' ) or define ('CBXPHPFPDF_BASE_NAME ' , plugin_basename (__FILE__ ));
3636defined ('CBXPHPFPDF_ROOT_PATH ' ) or define ('CBXPHPFPDF_ROOT_PATH ' , plugin_dir_path (__FILE__ ));
3737defined ('CBXPHPFPDF_ROOT_URL ' ) or define ('CBXPHPFPDF_ROOT_URL ' , plugin_dir_url (__FILE__ ));
@@ -45,7 +45,7 @@ class CBXPhpFpdf
4545{
4646 function __construct ()
4747 {
48- add_filter ('plugin_row_meta ' , array ($ this , 'plugin_row_meta ' ), 10 , 2 );
48+ add_filter ('plugin_row_meta ' , array ($ this , 'plugin_row_meta ' ), 10 , 4 );
4949 add_action ( 'admin_notices ' , [ $ this , 'activation_error_display ' ] );
5050
5151 add_action ( 'init ' , [ $ this , 'load_plugin_textdomain ' ]);
@@ -74,9 +74,6 @@ public static function activation()
7474
7575 if ( sizeof ( $ errors ) > 0 ) {
7676 update_option ( 'cbxphpfpdf_activation_error ' , $ errors );
77- //deactivate_plugins(plugin_basename(__FILE__));
78- //wp_die('Plugin not activated due to dependency not fulfilled.');
79- //die();
8077 }
8178
8279 }//end method activation
@@ -139,27 +136,31 @@ public static function environment_ready() {
139136 return self ::php_version_check () && self ::extension_check ( [ 'zip ' , 'xml ' , 'gd ' , 'mbstring ' , 'dom ' ]);
140137 }//end method environment_ready
141138
142- /**
143- * Plugin support and doc page url
144- *
145- * @param $links
146- * @param $file
147- *
148- * @return array
149- */
150- public function plugin_row_meta ($ links , $ file )
151- {
152- if (strpos ($ file , 'cbxphpfpdf.php ' ) !== false ) {
153- $ new_links = array (
154- 'support ' => '<a href="https://github.com/codeboxrcodehub/cbxphpfpdf" target="_blank"> ' . esc_html__ ('Support ' , 'cbxphpfpdf ' ) . '</a> ' ,
155- 'doc ' => '<a href="https://github.com/dompdf/dompdf" target="_blank"> ' . esc_html__ ('PHP Dompdf Doc ' , 'cbxphpfpdf ' ) . '</a> '
156- );
157-
158- $ links = array_merge ($ links , $ new_links );
159- }
139+ /**
140+ * Filters the array of row meta for each/specific plugin in the Plugins list table.
141+ * Appends additional links below each/specific plugin on the plugins page.
142+ *
143+ * @access public
144+ *
145+ * @param array $links_array An array of the plugin's metadata
146+ * @param string $plugin_file_name Path to the plugin file
147+ * @param array $plugin_data An array of plugin data
148+ * @param string $status Status of the plugin
149+ *
150+ * @return array $links_array
151+ */
152+ public function plugin_row_meta ( $ links_array , $ plugin_file_name , $ plugin_data , $ status ) {
153+ if ( strpos ( $ plugin_file_name , CBXPHPFPDF_BASE_NAME ) !== false ) {
154+ if ( ! function_exists ( 'is_plugin_active ' ) ) {
155+ include_once ( ABSPATH . 'wp-admin/includes/plugin.php ' );
156+ }
157+
158+ $ links_array [] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxphpfpdf" aria-label=" ' . esc_attr__ ( 'Github Repo ' , 'cbxphpfpdf ' ) . '"> ' . esc_html__ ( 'Github Repo ' , 'cbxphpfpdf ' ) . '</a> ' ;
159+ $ links_array [] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxphpfpdf/releases" aria-label=" ' . esc_attr__ ( 'Download ' , 'cbxphpfpdf ' ) . '"> ' . esc_html__ ( 'Download Latest ' , 'cbxphpfpdf ' ) . '</a> ' ;
160+ }
160161
161- return $ links ;
162- }
162+ return $ links_array ;
163+ } //end plugin_row_meta
163164
164165 /**
165166 * Load textdomain
0 commit comments