| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: PDF Poster |
| 4 |
* Plugin URI: https://bplugins.com/products/pdf-poster/ |
| 5 |
* Description: You can easily embed/ show pdf file in your wordress website using this plugin. |
| 6 |
* Version: 2.5.2 |
| 7 |
* Author: bPlugins |
| 8 |
* Author URI: https://profiles.wordpress.org/abuhayat |
| 9 |
* License: GPLv2 |
| 10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 11 |
* Text Domain: pdfp |
| 12 |
* Domain Path: /languages |
| 13 |
* Requires at least: 6.3 |
| 14 |
* Requires PHP: 7.1 |
| 15 |
*/ |
| 16 |
|
| 17 |
if (!defined('ABSPATH')) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
if (function_exists('pdfp_fs')) { |
| 22 |
pdfp_fs()->set_basename(true, __FILE__); |
| 23 |
} else { |
| 24 |
/*Some Set-up*/ |
| 25 |
define('PDFPRO_PLUGIN_DIR', plugin_dir_url(__FILE__)); |
| 26 |
define('PDFPRO_PATH', plugin_dir_path(__FILE__)); |
| 27 |
define('PDFPRO_VER', '2.5.2'); |
| 28 |
define('PDFPRO_IMPORT_VER', '1.0.0'); |
| 29 |
|
| 30 |
// Load Autoloader |
| 31 |
if (file_exists(PDFPRO_PATH . 'includes/class-pdfp-autoloader.php')) { |
| 32 |
require_once PDFPRO_PATH . 'includes/class-pdfp-autoloader.php'; |
| 33 |
} |
| 34 |
|
| 35 |
if (file_exists(dirname(__FILE__) . '/vendor/autoload.php')) { |
| 36 |
require_once(dirname(__FILE__) . '/vendor/autoload.php'); |
| 37 |
} |
| 38 |
|
| 39 |
if (!class_exists('CSF')) { |
| 40 |
if (file_exists(PDFPRO_PATH . 'vendor/codestar-framework/codestar-framework.php')) { |
| 41 |
require_once PDFPRO_PATH . 'vendor/codestar-framework/codestar-framework.php'; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
if (!function_exists('pdfp_fs')) { |
| 46 |
function pdfp_fs() |
| 47 |
{ |
| 48 |
global $pdfp_fs; |
| 49 |
|
| 50 |
if (!isset($pdfp_fs)) { |
| 51 |
$pdfp_fs = fs_dynamic_init(array( |
| 52 |
'id' => '14261', |
| 53 |
'slug' => 'pdf-poster', |
| 54 |
'premium_slug' => 'pdf-poster-pro', |
| 55 |
'type' => 'plugin', |
| 56 |
'public_key' => 'pk_6e833032174d131283193892a44a2', |
| 57 |
'is_premium' => false, |
| 58 |
'menu' => array( |
| 59 |
'slug' => 'edit.php?post_type=pdfposter', |
| 60 |
'first-path' => 'edit.php?post_type=pdfposter&page=pdf-poster#/welcome', |
| 61 |
'support' => false, |
| 62 |
'contact' => false, |
| 63 |
), |
| 64 |
)); |
| 65 |
} |
| 66 |
|
| 67 |
return $pdfp_fs; |
| 68 |
} |
| 69 |
|
| 70 |
// Init Freemius. |
| 71 |
pdfp_fs(); |
| 72 |
// Signal that SDK was initiated. |
| 73 |
do_action('pdfp_fs_loaded'); |
| 74 |
} |
| 75 |
|
| 76 |
if (file_exists(PDFPRO_PATH . 'includes/database/upgrade.php')) { |
| 77 |
require_once PDFPRO_PATH . 'includes/database/upgrade.php'; |
| 78 |
} |
| 79 |
|
| 80 |
if (class_exists('PDFPro\PDFP_Init')) { |
| 81 |
\PDFPro\PDFP_Init::register_services(); |
| 82 |
} |
| 83 |
|
| 84 |
function pdfp_get_p_option($array, $key = array(), $default = null) |
| 85 |
{ |
| 86 |
if (is_array($array) && array_key_exists($key, $array)) { |
| 87 |
return $array[$key]; |
| 88 |
} |
| 89 |
return $default; |
| 90 |
} |
| 91 |
|
| 92 |
add_action('media_buttons', 'pdfp_my_media_button', 3); |
| 93 |
function pdfp_my_media_button() |
| 94 |
{ |
| 95 |
echo wp_kses_post('<a href="#" id="insert-pdf" class="button pdfp_insert_pdf_btn"> |
| 96 |
<img src="' . PDFPRO_PLUGIN_DIR . '/assets/images/icn.png' . '" alt="" width="20" height="20" style="position:relative; top:-1px"> |
| 97 |
' . esc_html__('Add PDF', 'pdfp') . '</a>'); |
| 98 |
} |
| 99 |
|
| 100 |
add_action('admin_init', 'pdfp_admin_init'); |
| 101 |
function pdfp_admin_init() |
| 102 |
{ |
| 103 |
// Import logic removed (premium only) |
| 104 |
} |
| 105 |
|
| 106 |
add_action('wp_head', function () { |
| 107 |
$option = get_option('fpdf_option'); |
| 108 |
?> |
| 109 |
<style> |
| 110 |
<?php echo esc_html($option['custom_css'] ?? '') ?> |
| 111 |
</style> |
| 112 |
<?php |
| 113 |
}); |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|