| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | Description: Generate PDF files and print WordPress posts/pages. Customize document header/footer styles and appearance. |
| 6 | 6 | Author: BestWebSoft |
| 7 | 7 | Text Domain: pdf-print |
| 8 | 8 | Domain Path: /languages |
| 9 | -Version: 2.4.7 | |
| 9 | +Version: 2.4.2 | |
| 10 | 10 | Author URI: https://bestwebsoft.com/ |
| 11 | 11 | License: GPLv2 or later |
| 12 | 12 | */ |
| 13 | 13 | |
| @@ -111,21 +111,8 @@ | ||
| 111 | 111 | /* Get/Register and check settings for plugin */ |
| 112 | 112 | if ( ! is_admin() || ( isset( $_GET['page'] ) && 'pdf-print.php' === $_GET['page'] ) ) { |
| 113 | 113 | pdfprnt_settings(); |
| 114 | 114 | } |
| 115 | - | |
| 116 | - if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) { | |
| 117 | - wp_register_block_types_from_metadata_collection( __DIR__ . '/includes/build', __DIR__ . '/includes/build/blocks-manifest.php' ); | |
| 118 | - return; | |
| 119 | - } | |
| 120 | - | |
| 121 | - if ( function_exists( 'wp_register_block_metadata_collection' ) ) { | |
| 122 | - wp_register_block_metadata_collection( __DIR__ . '/includes/build', __DIR__ . '/includes/build/blocks-manifest.php' ); | |
| 123 | - } | |
| 124 | - $manifest_data = require __DIR__ . '/includes/build/blocks-manifest.php'; | |
| 125 | - foreach ( array_keys( $manifest_data ) as $block_type ) { | |
| 126 | - register_block_type( __DIR__ . "/includes/build/{$block_type}" ); | |
| 127 | - } | |
| 128 | 115 | } |
| 129 | 116 | } |
| 130 | 117 | |
| 131 | 118 | if ( ! function_exists( 'pdfprnt_admin_init' ) ) { |
| @@ -269,10 +256,8 @@ | ||
| 269 | 256 | 'custom_css_code' => '', |
| 270 | 257 | 'do_shorcodes' => 1, |
| 271 | 258 | 'disable_links' => 0, |
| 272 | 259 | 'remove_links' => 0, |
| 273 | - 'replace_video' => 0, | |
| 274 | - 'qr_code_link' => 0, | |
| 275 | 260 | 'show_print_window' => 0, |
| 276 | 261 | 'additional_fonts' => 0, |
| 277 | 262 | 'show_title' => 1, |
| 278 | 263 | 'show_featured_image' => 0, |
| @@ -306,11 +291,9 @@ | ||
| 306 | 291 | 'suggest_feature_banner' => 1, |
| 307 | 292 | 'file_action' => 'open', |
| 308 | 293 | 'print_action' => 'plugin_function', |
| 309 | 294 | 'enabled_roles' => $enabled_roles, |
| 310 | - 'mpdf_library_version' => '8.2.6', | |
| 311 | - 'hide_classes' => array(), | |
| 312 | - 'count_generation' => 0, | |
| 295 | + 'mpdf_library_version' => '8.1.3', | |
| 313 | 296 | ); |
| 314 | 297 | |
| 315 | 298 | $options_default = apply_filters( 'pdfprnt_get_additional_options_default', $options_default ); |
| 316 | 299 | |
| @@ -445,15 +428,8 @@ | ||
| 445 | 428 | if ( 'print' === $value ) { |
| 446 | 429 | $buttons .= pdfprnt_get_button( 'print', $permalink ); |
| 447 | 430 | } |
| 448 | 431 | } |
| 449 | - if ( 1 === $pdfprnt_options['count_generation'] ) { | |
| 450 | - $post_type = get_post_type(); | |
| 451 | - if ( in_array( $post_type, $pdfprnt_options['button_post_types']['pdf'] ) || in_array( $post_type, $pdfprnt_options['button_post_types']['print'] ) ) { | |
| 452 | - $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true ); | |
| 453 | - $buttons .= ' <span class="pdfprnt-count-generation">' . $count . '</span>'; | |
| 454 | - } | |
| 455 | - } | |
| 456 | 432 | if ( ! empty( $buttons ) ) { |
| 457 | 433 | $buttons = sprintf( |
| 458 | 434 | '<div class="pdfprnt-buttons">%s</div>', |
| 459 | 435 | $buttons |
| @@ -476,68 +452,8 @@ | ||
| 476 | 452 | return ''; |
| 477 | 453 | } |
| 478 | 454 | } |
| 479 | 455 | |
| 480 | - | |
| 481 | -if ( ! function_exists( 'pdfprnt_qr_code_content' ) ) { | |
| 482 | - /** | |
| 483 | - * Add custom fields shortcodes button | |
| 484 | - * | |
| 485 | - * @param string $content Post content. | |
| 486 | - */ | |
| 487 | - function pdfprnt_qr_code_content( $content ) { | |
| 488 | - global $pdfprnt_options; | |
| 489 | - if ( 1 === $pdfprnt_options['replace_video'] ) { | |
| 490 | - $provider_match_masks = array( | |
| 491 | - 'youtube' => '/http.*(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/)[^\"\'>]+/', | |
| 492 | - 'vimeo' => '/http.*vimeo\.com\/[^\"\'>]+/', | |
| 493 | - 'dailymotion' => '/http.*dailymotion.com\/[^\"\'>]+/', | |
| 494 | - 'videopress' => array( | |
| 495 | - '/(?:http(?:s)?:\/\/)?videos\.files\.wordpress\.com\/[^\"\'>]+/i', | |
| 496 | - '/(?:http(?:s)?:\/\/)?(?:www\.)?video(?:\.word)?press\.com\/(?:v|embed)\/[^\"\'>]+/i', | |
| 497 | - ), | |
| 498 | - ); | |
| 499 | - $find_replace = array(); | |
| 500 | - foreach ( $provider_match_masks as $provider => $match_mask ) { | |
| 501 | - if ( ! is_array( $match_mask ) ) { | |
| 502 | - $match_mask = array( $match_mask ); | |
| 503 | - } | |
| 504 | - foreach ( $match_mask as $mask ) { | |
| 505 | - $matches = array(); | |
| 506 | - preg_match_all( $mask, $content, $matches, PREG_OFFSET_CAPTURE ); | |
| 507 | - if ( isset( $matches[0][0] ) ) { | |
| 508 | - $pos_start = strrpos( substr( $content, 0, $matches[0][0][1] ), '<', 0 ); | |
| 509 | - $pos_end = strpos( substr( $content, $pos_start ), '>', 0 ); | |
| 510 | - preg_match( '/<.*>/', substr( $content, $pos_start + $pos_end, 15 ), $matches2 ); | |
| 511 | - $text = substr( $content, $pos_start, $pos_end + 1 ) . $matches2[0]; | |
| 512 | - $find_replace[] = array( $matches[0][0][0], $matches[0][0][1], $text ); | |
| 513 | - } | |
| 514 | - } | |
| 515 | - } | |
| 516 | - if ( ! empty( $find_replace ) ) { | |
| 517 | - require_once( dirname( __FILE__ ) . '/includes/qr_code/qr_code.php' ); | |
| 518 | - | |
| 519 | - foreach( $find_replace as $replace ) { | |
| 520 | - $qr_code = QRCode::getMinimumQRCode( $replace[0], QR_ERROR_CORRECT_LEVEL_L ); | |
| 521 | - | |
| 522 | - $image = $qr_code->createImage( 6, 4 ); | |
| 523 | - ob_start(); | |
| 524 | - imagejpeg( $image ); | |
| 525 | - $contents = ob_get_contents(); | |
| 526 | - ob_end_clean(); | |
| 527 | - $image_data = "data:image/jpeg;base64," . base64_encode( $contents ); | |
| 528 | - | |
| 529 | - if ( 1 === $pdfprnt_options['qr_code_link'] ) { | |
| 530 | - $content = str_replace( $replace[2], '<a href="' . $replace[0] . '"><img src="' . $image_data . '" /></a>', $content ); | |
| 531 | - } else { | |
| 532 | - $content = str_replace( $replace[2], '<img src="' . $image_data . '" />', $content ); | |
| 533 | - } | |
| 534 | - } | |
| 535 | - } | |
| 536 | - } | |
| 537 | - return $content; | |
| 538 | - } | |
| 539 | -} | |
| 540 | 456 | if ( ! function_exists( 'pdfprnt_shortcode_button_content' ) ) { |
| 541 | 457 | /** |
| 542 | 458 | * Add shortcode content |
| 543 | 459 | * |
| @@ -630,9 +546,9 @@ | ||
| 630 | 546 | ) |
| 631 | 547 | : |
| 632 | 548 | ''; |
| 633 | 549 | if ( $pdfprnt_options['image_to_pdf'] && 'pdf' === $custom_query_arg ) { |
| 634 | - $url = 'javascript: imageToPdf(' . get_the_ID() . ')'; | |
| 550 | + $url = 'javascript: imageToPdf()'; | |
| 635 | 551 | $target = '_self'; |
| 636 | 552 | } |
| 637 | 553 | |
| 638 | 554 | if ( 'print' === $button && 'ctrl_p' === $pdfprnt_options['print_action'] ) { |
| @@ -640,9 +556,9 @@ | ||
| 640 | 556 | $target = '_self'; |
| 641 | 557 | } |
| 642 | 558 | |
| 643 | 559 | $link = sprintf( |
| 644 | - '<a href="%s" class="pdfprnt-button pdfprnt-button-%s" target="%s" >%s%s</a>', | |
| 560 | + '<a href="%s" class="pdfprnt-button pdfprnt-button-%s" target="%s">%s%s</a>', | |
| 645 | 561 | $url, |
| 646 | 562 | $button, |
| 647 | 563 | $target, |
| 648 | 564 | $image, |
| @@ -692,9 +608,9 @@ | ||
| 692 | 608 | $str = '<div class="pdfprnt-buttons pdfprnt-buttons-' . $post->post_type . ' pdfprnt-' . $pdfprnt_options['buttons_position'] . '">'; |
| 693 | 609 | if ( is_home() ) { |
| 694 | 610 | $permalink = get_permalink( $post ); |
| 695 | 611 | } else { |
| 696 | - $permalink = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) : ''; | |
| 612 | + $permalink = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; | |
| 697 | 613 | } |
| 698 | 614 | |
| 699 | 615 | if ( $show_button_pdf ) { |
| 700 | 616 | $str .= pdfprnt_get_button( 'pdf', $permalink ); |
| @@ -704,15 +620,8 @@ | ||
| 704 | 620 | } |
| 705 | 621 | if ( $show_button_print ) { |
| 706 | 622 | $str .= pdfprnt_get_button( 'print', $permalink ); |
| 707 | 623 | } |
| 708 | - if ( 1 === $pdfprnt_options['count_generation'] ) { | |
| 709 | - $post_type = get_post_type(); | |
| 710 | - if ( in_array( $post_type, $pdfprnt_options['button_post_types']['pdf'] ) || in_array( $post_type, $pdfprnt_options['button_post_types']['print'] ) ) { | |
| 711 | - $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true ); | |
| 712 | - $str .= ' <span class="pdfprnt-count-generation">' . $count . '</span>'; | |
| 713 | - } | |
| 714 | - } | |
| 715 | 624 | $str .= '</div>'; |
| 716 | 625 | |
| 717 | 626 | if ( 'top-left' === $pdfprnt_options['buttons_position'] || 'top-right' === $pdfprnt_options['buttons_position'] ) { |
| 718 | 627 | $content = $str . $content; |
| @@ -793,9 +702,9 @@ | ||
| 793 | 702 | } |
| 794 | 703 | |
| 795 | 704 | if ( $show_button_pdf || $show_button_print ) { |
| 796 | 705 | global $pdfprnt_is_search_archive; |
| 797 | - $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) ) : ''; | |
| 706 | + $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) : ''; | |
| 798 | 707 | $pdfprnt_is_search_archive = true; |
| 799 | 708 | $str = '<div class="pdfprnt-buttons pdfprnt-buttons-' . ( ( $is_search ) ? 'search' : 'archive' ) . ' pdfprnt-' . $pdfprnt_options['buttons_position'] . '">'; |
| 800 | 709 | if ( $show_button_pdf ) { |
| 801 | 710 | $str .= pdfprnt_get_button( 'pdf', $current_url, 'pdf-search' ); |
| @@ -854,9 +763,9 @@ | ||
| 854 | 763 | } |
| 855 | 764 | |
| 856 | 765 | if ( $show_button_pdf || $show_button_print ) { |
| 857 | 766 | global $pdfprnt_is_search_archive; |
| 858 | - $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) ) : ''; | |
| 767 | + $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) : ''; | |
| 859 | 768 | $pdfprnt_is_search_archive = true; |
| 860 | 769 | $str = '<div class="pdfprnt-buttons pdfprnt-buttons-' . ( ( $is_search ) ? 'search' : 'archive' ) . ' pdfprnt-' . $pdfprnt_options['buttons_position'] . '">'; |
| 861 | 770 | if ( $show_button_pdf ) { |
| 862 | 771 | $str .= pdfprnt_get_button( 'pdf', $current_url ); |
| @@ -988,9 +897,9 @@ | ||
| 988 | 897 | ( ! ( is_array( $user_query ) || is_string( $user_query ) ) ) |
| 989 | 898 | ) { |
| 990 | 899 | return; |
| 991 | 900 | } |
| 992 | - $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) ) : ''; | |
| 901 | + $current_url = isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ? set_url_scheme( ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) : ''; | |
| 993 | 902 | $current_url = esc_url( $current_url ); |
| 994 | 903 | $is_return = true; |
| 995 | 904 | |
| 996 | 905 | if ( empty( $user_query ) ) { /* set necessary values of parameters for pdf/print buttons */ |
| @@ -1056,12 +965,8 @@ | ||
| 1056 | 965 | } |
| 1057 | 966 | if ( $show_button_print ) { |
| 1058 | 967 | $str .= pdfprnt_get_button( 'print', $current_url, $print_query_parameter ); |
| 1059 | 968 | } |
| 1060 | - if ( 1 === $pdfprnt_options['count_generation'] && ( $show_button_pdf || $show_button_print ) ) { | |
| 1061 | - $count = get_post_meta( get_the_ID(), 'pdfprnt_count_generation', true ); | |
| 1062 | - $str .= ' <span class="pdfprnt-count-generation">' . $count . '</span>'; | |
| 1063 | - } | |
| 1064 | 969 | $str .= '</div>'; |
| 1065 | 970 | return $str; |
| 1066 | 971 | } |
| 1067 | 972 | } |
| @@ -1154,24 +1059,20 @@ | ||
| 1154 | 1059 | if ( 1 === intval( $pdfprnt_options['image_to_pdf'] ) ) { |
| 1155 | 1060 | $file_name = $post->post_title; |
| 1156 | 1061 | wp_enqueue_script( 'html2canvas.js', plugins_url( 'js/html2canvas.js', __FILE__ ), array(), $pdfprnt_plugin_info['Version'], false ); |
| 1157 | 1062 | wp_enqueue_script( 'jspdf.js', plugins_url( 'js/jspdf.js', __FILE__ ), array(), $pdfprnt_plugin_info['Version'], false ); |
| 1158 | - wp_enqueue_script( 'pdfprnt_front_script', plugins_url( 'js/front-script.js', __FILE__ ), array( 'jquery', 'html2canvas.js', 'jspdf.js' ), $pdfprnt_plugin_info['Version'] . '.7', false ); | |
| 1063 | + wp_enqueue_script( 'pdfprnt_front_script', plugins_url( 'js/front-script.js', __FILE__ ), array( 'jquery', 'html2canvas.js', 'jspdf.js' ), $pdfprnt_plugin_info['Version'], false ); | |
| 1159 | 1064 | wp_localize_script( |
| 1160 | 1065 | 'pdfprnt_front_script', |
| 1161 | 1066 | 'pdfprnt_file_settings', |
| 1162 | 1067 | array( |
| 1163 | - 'margin_left' => $pdfprnt_options['pdf_margins']['left'], | |
| 1164 | - 'margin_right' => $pdfprnt_options['pdf_margins']['right'], | |
| 1165 | - 'margin_top' => $pdfprnt_options['pdf_margins']['top'], | |
| 1166 | - 'margin_bottom' => $pdfprnt_options['pdf_margins']['bottom'], | |
| 1167 | - 'page_size' => $pdfprnt_options['pdf_page_size'], | |
| 1168 | - 'file_action' => $pdfprnt_options['file_action'], | |
| 1169 | - 'file_name' => $file_name, | |
| 1170 | - 'hide_classes' => implode( ', ', $pdfprnt_options['hide_classes'] ), | |
| 1171 | - 'ajax_nonce' => wp_create_nonce( 'pdfprnt_ajax_nonce' ), | |
| 1172 | - 'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
| 1173 | - 'count_generation' => $pdfprnt_options['count_generation'] | |
| 1068 | + 'margin_left' => $pdfprnt_options['pdf_margins']['left'], | |
| 1069 | + 'margin_right' => $pdfprnt_options['pdf_margins']['right'], | |
| 1070 | + 'margin_top' => $pdfprnt_options['pdf_margins']['top'], | |
| 1071 | + 'margin_bottom' => $pdfprnt_options['pdf_margins']['bottom'], | |
| 1072 | + 'page_size' => $pdfprnt_options['pdf_page_size'], | |
| 1073 | + 'file_action' => $pdfprnt_options['file_action'], | |
| 1074 | + 'file_name' => $file_name, | |
| 1174 | 1075 | ) |
| 1175 | 1076 | ); |
| 1176 | 1077 | } |
| 1177 | 1078 | } |
| @@ -1253,16 +1154,13 @@ | ||
| 1253 | 1154 | } |
| 1254 | 1155 | if ( $is_print && 1 === intval( $pdfprnt_options['show_print_window'] ) ) { |
| 1255 | 1156 | $html .= '<script>window.onload = function(){ window.print(); };</script>'; |
| 1256 | 1157 | } |
| 1257 | - if ( ! empty( $pdfprnt_options['hide_classes'] ) ) { | |
| 1258 | - $html .= '<style>' . implode( ',', $pdfprnt_options['hide_classes'] ) . '{ display: none; }</style>'; | |
| 1259 | - } | |
| 1260 | - $html .= apply_filters( 'pdfprnt_woocommerce_layout', $html, $is_print ); | |
| 1261 | - $html .= | |
| 1262 | - '</head> | |
| 1263 | - <body class="' . ( $is_print ? 'pdfprnt_print ' : '' ) . $wp_locale->text_direction . '">'; | |
| 1264 | - /* Remove inline 'font-family' and 'font' styles from content */ | |
| 1158 | + $html .= apply_filters( 'pdfprnt_woocommerce_layout', $html, $is_print ); | |
| 1159 | + $html .= | |
| 1160 | + '</head> | |
| 1161 | + <body class="' . ( $is_print ? 'pdfprnt_print ' : '' ) . $wp_locale->text_direction . '">'; | |
| 1162 | + /* Remove inline 'font-family' and 'font' styles from content */ | |
| 1265 | 1163 | if ( 0 === intval( $pdfprnt_options['additional_fonts'] ) ) { |
| 1266 | 1164 | $content = pdfprnt_preg_replace( array( 'font-family', 'font:' ), $content ); |
| 1267 | 1165 | } |
| 1268 | 1166 | if ( function_exists( 'has_blocks' ) && has_blocks( $content ) ) { |
| @@ -1319,9 +1217,9 @@ | ||
| 1319 | 1217 | function pdfprnt_print( $query ) { |
| 1320 | 1218 | global $pdfprnt_options, $posts, $post, $pdfprnt_is_old_php, $pdfprnt_links; |
| 1321 | 1219 | $print = get_query_var( 'print' ); |
| 1322 | 1220 | |
| 1323 | - if ( $pdfprnt_is_old_php || empty( $print ) || ! pdfprnt_is_user_role_enabled() || post_password_required() ) { | |
| 1221 | + if ( $pdfprnt_is_old_php || empty( $print ) || ! pdfprnt_is_user_role_enabled() ) { | |
| 1324 | 1222 | return; |
| 1325 | 1223 | } |
| 1326 | 1224 | |
| 1327 | 1225 | if ( apply_filters( 'bwsplgns_remove_content_filters', true ) ) { |
| @@ -1354,9 +1252,9 @@ | ||
| 1354 | 1252 | /* for search or archives */ |
| 1355 | 1253 | if ( isset( $doc_type[1] ) ) { |
| 1356 | 1254 | switch ( $doc_type[1] ) { |
| 1357 | 1255 | case 'custom': |
| 1358 | - $url_data = isset( $_SERVER['REQUEST_URI'] ) ? wp_parse_url( sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) ) : array(); | |
| 1256 | + $url_data = isset( $_SERVER['REQUEST_URI'] ) ? wp_parse_url( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) : array(); | |
| 1359 | 1257 | parse_str( $url_data['query'], $args ); |
| 1360 | 1258 | unset( $args['print'] ); |
| 1361 | 1259 | if ( ! empty( $args ) ) { |
| 1362 | 1260 | $posts = query_posts( $args ); |
| @@ -1369,9 +1267,9 @@ | ||
| 1369 | 1267 | break; |
| 1370 | 1268 | } |
| 1371 | 1269 | /* for single posts or pages */ |
| 1372 | 1270 | } elseif ( |
| 1373 | - ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( urldecode( $_SERVER['REQUEST_URI'] ) ) ) === get_home_url() . '/?print=' . $doc_type[0] | |
| 1271 | + ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) === get_home_url() . '/?print=' . $doc_type[0] | |
| 1374 | 1272 | && |
| 1375 | 1273 | 'page' === get_option( 'show_on_front' ) |
| 1376 | 1274 | ) { |
| 1377 | 1275 | $post_id = get_option( 'page_on_front' ); |
| @@ -1378,10 +1276,8 @@ | ||
| 1378 | 1276 | $posts = query_posts( array( 'page_id' => $post_id ) ); |
| 1379 | 1277 | } else { |
| 1380 | 1278 | if ( ! is_home() ) { |
| 1381 | 1279 | $posts = array( $post ); |
| 1382 | - $count_generation = get_post_meta( $post->ID, 'pdfprnt_count_generation', true ); | |
| 1383 | - update_post_meta( $post->ID, 'pdfprnt_count_generation', (int) ++$count_generation ); | |
| 1384 | 1280 | } |
| 1385 | 1281 | } |
| 1386 | 1282 | |
| 1387 | 1283 | switch ( $doc_type[0] ) { |
| @@ -1444,9 +1340,8 @@ | ||
| 1444 | 1340 | $shortcodes = implode( '|', apply_filters( 'bwsplgns_pdf_print_remove_shortcodes', array( 'vc_', 'az_', 'multilanguage_switcher' ) ) ); |
| 1445 | 1341 | $post_content = preg_replace( "/\[\/?({$shortcodes})[^\]]*?\]/", '', $post_content ); |
| 1446 | 1342 | $post_content = apply_filters( 'the_content', $post_content ); |
| 1447 | 1343 | $post_content = apply_filters( 'bwsplgns_pdf_customize_content', $post_content ); |
| 1448 | - $post_content = apply_filters( 'bwsplgns_pdf_replace_content', $post_content ); | |
| 1449 | 1344 | $separator = ''; |
| 1450 | 1345 | if ( ! empty( $author ) && ! empty( $date ) ) { |
| 1451 | 1346 | $separator = ' | '; |
| 1452 | 1347 | } |
| @@ -1950,28 +1845,8 @@ | ||
| 1950 | 1845 | } |
| 1951 | 1846 | } |
| 1952 | 1847 | } |
| 1953 | 1848 | |
| 1954 | -if ( ! function_exists( 'pdfprnt_pdf_count' ) ) { | |
| 1955 | - /** | |
| 1956 | - * Function to update pdf count generation | |
| 1957 | - */ | |
| 1958 | - function pdfprnt_pdf_count() { | |
| 1959 | - global $pdfprnt_options; | |
| 1960 | - if ( empty( $pdfprnt_options ) ) { | |
| 1961 | - $pdfprnt_options = get_option( 'pdfprnt_options' ); | |
| 1962 | - } | |
| 1963 | - if ( 1 === $pdfprnt_options['count_generation'] ) { | |
| 1964 | - $verified = isset( $_REQUEST['pdfprnt_ajax_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['pdfprnt_ajax_nonce'] ) ), 'pdfprnt_ajax_nonce' ) ? true : false; | |
| 1965 | - if ( true === $verified && isset( $_REQUEST['id'] ) ) { | |
| 1966 | - $count_generation = get_post_meta( intval( $_REQUEST['id'] ), 'pdfprnt_count_generation', true ); | |
| 1967 | - update_post_meta( intval( $_REQUEST['id'] ), 'pdfprnt_count_generation', (int) ++$count_generation ); | |
| 1968 | - } | |
| 1969 | - } | |
| 1970 | - wp_die(); | |
| 1971 | - } | |
| 1972 | -} | |
| 1973 | - | |
| 1974 | 1849 | if ( ! function_exists( 'pdfprnt_delete_old_library' ) ) { |
| 1975 | 1850 | /** |
| 1976 | 1851 | * Delete old library |
| 1977 | 1852 | * |
| @@ -2165,11 +2040,8 @@ | ||
| 2165 | 2040 | add_filter( 'query_vars', 'pdfprnt_print_vars_callback' ); |
| 2166 | 2041 | |
| 2167 | 2042 | add_shortcode( 'bws_pdfprint', 'pdfprnt_shortcode' ); |
| 2168 | 2043 | add_shortcode( 'bws_pdfprint_pagebreak', 'pdfprnt_shortcode_pagebreak' ); |
| 2169 | - | |
| 2170 | -add_filter( 'bwsplgns_pdf_replace_content', 'pdfprnt_qr_code_content', 10, 1 ); | |
| 2171 | - | |
| 2172 | 2044 | /* custom filter for bws button in tinyMCE */ |
| 2173 | 2045 | add_filter( 'bws_shortcode_button_content', 'pdfprnt_shortcode_button_content' ); |
| 2174 | 2046 | |
| 2175 | 2047 | /* Additional links on the plugin page */ |
| @@ -2182,10 +2054,8 @@ | ||
| 2182 | 2054 | /* load additional fonts */ |
| 2183 | 2055 | add_action( 'wp_ajax_pdfprnt_load_fonts', 'pdfprnt_load_fonts' ); |
| 2184 | 2056 | /* load mPDF library */ |
| 2185 | 2057 | add_action( 'wp_ajax_pdfprnt_upgrade_library', 'pdfprnt_upgrade_library' ); |
| 2186 | -add_action( 'wp_ajax_pdfprnt_pdf_count', 'pdfprnt_pdf_count' ); | |
| 2187 | -add_action( 'wp_ajax_nopriv_pdfprnt_pdf_count', 'pdfprnt_pdf_count' ); | |
| 2188 | 2058 | /* Adding banner */ |
| 2189 | 2059 | add_action( 'admin_notices', 'pdfprnt_plugin_banner' ); |
| 2190 | 2060 | |
| 2191 | 2061 | /* Register widget */ |