Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/pdf-poster/build/admin.asset.php
+++ b/pdf-poster/build/admin.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array(), 'version' => '4c38a938fd9f9307ccf9');
+<?php return array('dependencies' => array(), 'version' => '2d8f0a1d0d0332bb032e');
--- a/pdf-poster/build/blocks/pdf-poster/index.asset.php
+++ b/pdf-poster/build/blocks/pdf-poster/index.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'c81109e1fe74ffc644e2');
+<?php return array('dependencies' => array('react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'acbbb5e9cd1d896883b8');
--- a/pdf-poster/build/blocks/pdf-poster/view.asset.php
+++ b/pdf-poster/build/blocks/pdf-poster/view.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'react-dom'), 'version' => 'a7e811358c8dc08d4fba');
+<?php return array('dependencies' => array('react', 'react-dom'), 'version' => '15ba1d938d87b6891e02');
--- a/pdf-poster/build/blocks/selector/index.asset.php
+++ b/pdf-poster/build/blocks/selector/index.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-i18n'), 'version' => 'baab42c861fc303c0a02');
+<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-i18n'), 'version' => 'd3a7fe8bf0cf390070ab');
--- a/pdf-poster/build/dashboard.asset.php
+++ b/pdf-poster/build/dashboard.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react'), 'version' => '0bc587ad3e8a4c590bae');
+<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-i18n'), 'version' => '2faaa261185142f42614');
--- a/pdf-poster/inc/Base/Shortcodes.php
+++ b/pdf-poster/inc/Base/Shortcodes.php
@@ -73,9 +73,6 @@
}
}
-
-
-
public function pdf_embed($atts)
{
$attrs = shortcode_atts($this->pdf_embed_attrs(), $atts);
--- a/pdf-poster/inc/Helper/Functions.php
+++ b/pdf-poster/inc/Helper/Functions.php
@@ -104,54 +104,70 @@
public static function generate_pdf_poster_block($id){
- $post_meta = get_post_meta($id,"_fpdf", true);
+ if(!function_exists('pdfp__get_post_meta')) {
+ return [
+ 'blockName' => 'pdfp/pdfposter',
+ ];
+ }
+
$meta = pdfp__get_post_meta($id, '_fpdf', true);
- $height = self::isset($post_meta, 'height', ['height' => 1122, 'unit' => 'px']);
- $width = self::isset($post_meta, 'width', ['width' => 100, 'unit' => '%']);
- $popupBtnPadding = self::isset($post_meta, 'popup_btn_padding', [ "top"=> 10, "right"=> 20, "bottom"=> 10, "left"=> 10 ]);
+ $height = $meta('height', ['height' => 1122, 'unit' => 'px']);
+ $width = $meta('width', ['width' => 100, 'unit' => '%']);
+ $popup_image_height = $meta('popup_image_height', ['height' => 200, 'unit' => 'px']);
+ $popup_image_width = $meta('popup_image_width', ['width' => 300, 'unit' => 'px']);
+ $popupBtnPadding = $meta('popup_btn_padding', [ "top"=> 10, "right"=> 20, "bottom"=> 10, "left"=> 10 ]);
+ $popup_image = $meta('popup_image', []);
+ $popup_image = $popup_image['url'] ?? '';
return [
"blockName" => "pdfp/pdfposter",
"attrs" => [
'uniqueId' => wp_unique_id( 'pdfp' ),
- 'file' => self::isset($post_meta, 'source', ''),
+ 'file' => $meta('source', ''),
'title' => get_the_title( $id ),
'height' => $height['height'].$height['unit'],
'width' => $width['width'].$width['unit'],
- 'print' => self::isset($post_meta, 'print', false) === '1',
- 'fullscreenButton' => self::isset($post_meta, 'view_fullscreen_btn', '1') === '1',
- 'fullscreenButtonText' => self::isset($post_meta, 'fullscreen_btn_text', 'View Fullscreen'),
- 'newWindow' => self::isset($post_meta, 'view_fullscreen_btn_target_blank', false) === '1',
- 'showName' => self::isset($post_meta, 'show_filename', '1') === '1',
- 'downloadButton' => self::isset($post_meta, 'show_download_btn', false) === '1',
- 'downloadButtonText' => self::isset($post_meta, 'download_btn_text', 'Download File'),
- 'protect' => self::isset($post_meta, 'protect', false) === '1',
- 'onlyPDF' => self::isset($post_meta, 'only_pdf', false) === '1',
- 'defaultBrowser' => self::isset($post_meta, 'default_browser', false) === '1',
- 'thumbMenu' => self::isset($post_meta, 'thumbnail_toggle_menu', false) === '1',
- 'initialPage' => self::isset($post_meta, 'jump_to', 0),
- 'sidebarOpen' => self::isset($post_meta, 'sidebar_open', false) === '1',
- 'lastVersion' => self::isset($post_meta, 'ppv_load_last_version', false) === '1',
- 'hrScroll' => self::isset($post_meta, 'hr_scroll', 0) === '1',
- 'zoomLevel' => self::isset($post_meta, 'zoomLevel', null),
- 'alert' => self::isset($post_meta, 'disable_alert', true) !== '1',
+ 'print' => $meta('print', false, true),
+ 'fullscreenButton' => $meta('view_fullscreen_btn', '1', true),
+ 'fullscreenButtonText' => $meta('fullscreen_btn_text', 'View Fullscreen', true),
+ 'newWindow' => $meta('view_fullscreen_btn_target_blank', false, true),
+ 'showName' => $meta('show_filename', '1', true),
+ 'downloadButton' => $meta('show_download_btn', false, true),
+ 'downloadButtonText' => $meta('download_btn_text', 'Download File', true),
+ 'protect' => $meta('protect', false, true) ,
+ 'onlyPDF' => $meta('only_pdf', false, true),
+ 'defaultBrowser' => $meta('default_browser', false, true),
+ 'thumbMenu' => $meta('thumbnail_toggle_menu', false, true),
+ 'initialPage' => $meta('jump_to', 0, true),
+ 'sidebarOpen' => $meta('sidebar_open', false, true),
+ 'lastVersion' => $meta('ppv_load_last_version', false, true),
+ 'hrScroll' => $meta('hr_scroll', 0, true),
+ 'zoomLevel' => $meta('zoomLevel', null, true),
+ 'alert' => $meta('disable_alert', true, true),
'btnStyles' => [
- "background" => self::isset($post_meta, 'popup_btn_bg', '#1e73be'),
- "color" => self::isset($post_meta, 'popup_btn_color', '#fff'),
- "fontSize" => self::isset($post_meta, 'popup_btn_font_size', null).'rem',
+ "background" => $meta('popup_btn_bg', '#1e73be'),
+ "color" => $meta('popup_btn_color', '#fff'),
+ "fontSize" => $meta('popup_btn_font_size', 1).'rem',
"padding" => $popupBtnPadding
],
"popupOptions" => [
- "enabled" => self::isset($post_meta, 'popup', 0) === '1',
- "text" => self::isset($post_meta, 'popup_btn_text', 'Open PDF'),
+ "enabled" => $meta('popup', 0, true),
+ "text" => $meta('popup_btn_text', 'Open PDF'),
+ "triggerType" => $meta('popup_trigger_type', 'button'),
+ "image" => $popup_image,
+ "imageHeight" => $popup_image_height['height'].$popup_image_height['unit'],
+ "imageWidth" => $popup_image_width['width'].$popup_image_width['unit'],
+ "imagePdfIcon" => $meta('popup_image_pdf_icon', true, true),
+ "triggerAlignment" => $meta('popup_trigger_alignment', 'center'),
"btnStyle" => [
- "background" => self::isset($post_meta, 'popup_btn_bg', '#1e73be'),
- "color" => self::isset($post_meta, 'popup_btn_color', '#fff'),
- "fontSize" => self::isset($post_meta, 'popup_btn_font_size', null).'rem',
+ "background" => $meta('popup_btn_bg', '#1e73be'),
+ "color" => $meta('popup_btn_color', '#fff'),
+ "fontSize" => $meta('popup_btn_font_size', 1).'rem',
"padding" => $popupBtnPadding
]
],
+ "actionsPosition" => $meta('actions_position', 'top', false),
'socialShare' => [
'enabled' => $meta('social_share', false, true),
'facebook' => $meta('social_share_facebook', false, true),
--- a/pdf-poster/inc/PostType/PDFPoster.php
+++ b/pdf-poster/inc/PostType/PDFPoster.php
@@ -28,8 +28,10 @@
add_filter('filter_block_editor_meta_boxes', [$this, 'remove_metabox']);
add_action('use_block_editor_for_post', [$this, 'forceGutenberg'], 10, 2);
+
+
+ add_action('edit_form_after_title', [$this, 'shortcode_area']);
- add_action('add_meta_boxes', [$this, 'shortcode_area_metabox']);
// add_action('add_meta_boxes', [$this, 'myplugin_add_meta_box']);
}
}
@@ -235,36 +237,27 @@
);
}
- // shortcode area
- public function shortcode_area_metabox()
- {
- global $post;
- if(!$post){
- return;
- }
- if ($post->post_type == $this->post_type) {
- add_meta_box(
- 'shortcode_area',
- __('Shortcode', 'pdfp'),
- [$this, 'shortcode_area'],
- 'pdfposter',
- 'side',
- 'default'
- );
- }
- }
+
function shortcode_area(){
+
+ if ($this->post_type != get_post_type()) {
+ return;
+ }
global $post;
$id = $post->ID;
$shortcode = "[pdf id='" . esc_attr($id) . "']";
?>
- <div class="pdfp-down-arrow"></div>
- <div class="pdfp_front_shortcode_area">
+ <div class="pdfp_shortcode_area_after_title">
<label><?php esc_html_e('Copy and paste this shortcode into your posts, pages and widget', 'pdfp'); ?></label>
- <br />
- <button class="button button-primary button-large pdfp_shortcode_copy_btn" data-clipboard-text="<?php echo esc_attr($shortcode) ?>"><?php esc_html_e('Copy Shortcode', 'pdfp'); ?></button>
+ <div class="shortcode_area">
+ <button class="button button-bplugins button-large pdfp_shortcode_copy_btn" data-clipboard-text="<?php echo esc_attr($shortcode) ?>"><?php echo esc_html($shortcode); ?></button>
+ <svg class='pdfp_shortcode_copy_btn' data-type="icon" data-clipboard-text='<?php echo esc_attr($shortcode) ?>' width='22px' height='22px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'>
+ <path d='M8 4V16C8 17.1046 8.89543 18 10 18L18 18C19.1046 18 20 17.1046 20 16V7.24162C20 6.7034 19.7831 6.18789 19.3982 5.81161L16.0829 2.56999C15.7092 2.2046 15.2074 2 14.6847 2H10C8.89543 2 8 2.89543 8 4Z' stroke='#000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' />
+ <path d='M16 18V20C16 21.1046 15.1046 22 14 22H6C4.89543 22 4 21.1046 4 20V9C4 7.89543 4.89543 7 6 7H8' stroke='#000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' />
+ </svg>
+ </div>
</div>
<?php
}
--- a/pdf-poster/inc/Rest/getMeta.php
+++ b/pdf-poster/inc/Rest/getMeta.php
@@ -42,7 +42,7 @@
$post_type = get_post_type($id);
$post = get_post($id);
- if ($post_type !== 'pdfposter') {
+ if ($post_type !== 'pdfposter' || $post->post_status !== 'publish') {
return new WP_REST_Response([]);
}
--- a/pdf-poster/inc/admin.php
+++ b/pdf-poster/inc/admin.php
@@ -48,7 +48,7 @@
add_submenu_page(
'edit.php?post_type=pdfposter',
__('Demo and Help', 'pdfp'),
- __('Demo and Help', 'pdfp'),
+ '<span style="color: #f18500;">' . __('Demo and Help', 'pdfp') . '</span>',
'edit_others_posts',
'pdf-poster',
[$this, 'dashboardPage'],
@@ -61,7 +61,8 @@
<div id='pdfpAdminDashboard' data-info='<?php echo esc_attr(wp_json_encode([
'version' => PDFPRO_VER,
'isPremium' => pdfp_fs()->can_use_premium_code(),
- 'hasPro' => true
+ 'hasPro' => file_exists(PDFPRO_PATH . 'inc/Base/LicenseActivation.php'),
+ 'licenseActiveNonce' => wp_create_nonce('bPlLicenseActivation')
])); ?>'></div>
<?php }
--- a/pdf-poster/pdf-poster.php
+++ b/pdf-poster/pdf-poster.php
@@ -4,7 +4,7 @@
* Plugin Name: PDF Poster
* Plugin URI: https://bplugins.com/products/pdf-poster/
* Description: You can easily embed/ show pdf file in your wordress website using this plugin.
- * Version: 2.4.1
+ * Version: 2.5.0
* Author: bPlugins
* Author URI: https://profiles.wordpress.org/abuhayat
* License: GPLv2
@@ -19,17 +19,11 @@
/*Some Set-up*/
define( 'PDFPRO_PLUGIN_DIR', plugin_dir_url( __FILE__ ) );
define( 'PDFPRO_PATH', plugin_dir_path( __FILE__ ) );
- define( 'PDFPRO_VER', ( defined( 'WP_DEBUG' ) ? time() : '2.4.0' ) );
+ define( 'PDFPRO_VER', ( defined( 'WP_DEBUG' ) ? time() : '2.5.0' ) );
define( 'PDFPRO_IMPORT_VER', '1.0.0' );
if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
}
- if ( file_exists( dirname( __FILE__ ) . '/inc/functions.php' ) ) {
- require_once dirname( __FILE__ ) . '/inc/functions.php';
- }
- if ( file_exists( dirname( __FILE__ ) . '/inc/admin.php' ) ) {
- require_once dirname( __FILE__ ) . '/inc/admin.php';
- }
// DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
if ( !function_exists( 'pdfp_fs' ) ) {
// Create a helper function for easy SDK access.
@@ -39,21 +33,22 @@
// Include Freemius SDK.
// SDK is auto-loaded through composer
$pdfp_fs = fs_dynamic_init( array(
- 'id' => '14261',
- 'slug' => 'pdf-poster',
- 'premium_slug' => 'pdf-poster-pro',
- 'type' => 'plugin',
- 'public_key' => 'pk_6e833032174d131283193892a44a2',
- 'is_premium' => false,
- 'premium_suffix' => 'Pro',
- 'has_addons' => false,
- 'has_paid_plans' => true,
- 'menu' => array(
+ 'id' => '14261',
+ 'slug' => 'pdf-poster',
+ 'premium_slug' => 'pdf-poster-pro',
+ 'type' => 'plugin',
+ 'public_key' => 'pk_6e833032174d131283193892a44a2',
+ 'is_premium' => false,
+ 'premium_suffix' => 'Pro',
+ 'has_addons' => false,
+ 'has_paid_plans' => true,
+ 'menu' => array(
'slug' => 'edit.php?post_type=pdfposter',
'support' => false,
'contact' => false,
),
- 'is_live' => true,
+ 'is_live' => true,
+ 'is_org_compliant' => true,
) );
}
return $pdfp_fs;
@@ -64,10 +59,12 @@
// Signal that SDK was initiated.
do_action( 'pdfp_fs_loaded' );
}
+ if ( file_exists( __DIR__ . '/upgrade.php' ) ) {
+ require_once __DIR__ . '/upgrade.php';
+ }
if ( class_exists( 'PDFPro\Init' ) ) {
PDFProInit::register_services();
}
- require_once __DIR__ . '/upgrade.php';
function get_p_option( $array, $key = array(), $default = null ) {
if ( is_array( $array ) && array_key_exists( $key, $array ) ) {
return $array[$key];
--- a/pdf-poster/upgrade.php
+++ b/pdf-poster/upgrade.php
@@ -1,5 +1,17 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
-require_once(__DIR__ . '/vendor/codestar-framework/codestar-framework.php');
-require_once(__DIR__ . '/blocks.php');
+$required_files = [
+ 'inc/functions.php',
+ 'inc/admin.php',
+ 'vendor/codestar-framework/codestar-framework.php',
+ 'blocks.php',
+ 'inc/Base/LicenseActivation.php',
+
+];
+
+foreach ($required_files as $file) {
+ if(file_exists(__DIR__ . '/' . $file)) {
+ require_once(__DIR__ . '/' . $file);
+ }
+}