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