Skip to content

Commit

Permalink
version 2.1.17a
Browse files Browse the repository at this point in the history
re-added method of passing default and print-trigger specific data to js script using wp_add_inline_script
  • Loading branch information
baden03 committed Jun 4, 2022
1 parent 62e1017 commit 6710843
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Print-O-Matic
* Tags: print, print element, print shortcode, send to print, print button, print me, jQuery, print page, javascript, twinpictures, plugin oven
* Requires at least: 4.9
* Tested up to: 6.0
* Stable tag: 2.1.6
* Stable tag: 2.1.7a
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down
12 changes: 6 additions & 6 deletions print-o-matic.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Text Domain: print-o-matic
Plugin URI: https://pluginoven.com/plugins/print-o-matic/
Description: Shortcode that adds a printer icon, allowing the user to print the post or a specified HTML element in the post.
Version: 2.1.6
Version: 2.1.7a
Author: twinpictures
Author URI: https://twinpictures.de
License: GPL2
Expand All @@ -17,7 +17,7 @@
*/
class WP_Print_O_Matic {

var $version = '2.1.6';
var $version = '2.1.7a';
var $domain = 'printomat';
var $options_name = 'WP_Print_O_Matic_options';
var $options = array(
Expand Down Expand Up @@ -75,8 +75,8 @@ function printMaticInit() {
'pom_do_not_print' => $this->options['do_not_print'],
'pom_pause_time' => $this->options['pause_time'],
];
//wp_add_inline_script( 'printomatic-js', 'const print_data = ' . json_encode( $print_data ), 'before' );
wp_localize_script( 'printomatic-js', 'print_data', $print_data);
wp_add_inline_script( 'printomatic-js', 'const print_data = ' . json_encode( $print_data ), 'before' );
//wp_localize_script( 'printomatic-js', 'print_data', $print_data);

//css
wp_register_style( 'printomatic-css', plugins_url('/css/style.css', __FILE__) , array (), '2.0' );
Expand Down Expand Up @@ -200,8 +200,8 @@ function shortcode($atts, $content = null){
$print_data['pom_pause_time'] = $pause_before_print;
}
if(!empty($print_data)){
//wp_add_inline_script( 'printomatic-js', 'const print_data_'.$id.' = ' . json_encode( $print_data ) );
wp_localize_script( 'printomatic-js', 'print_data', $print_data);
wp_add_inline_script( 'printomatic-js', 'const print_data_'.$id.' = ' . json_encode( $print_data ) );
//wp_localize_script( 'printomatic-js', 'print_data', $print_data);
}

//return nothing if usign an external button
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://pluginoven.com/panares-fund/
Tags: print, print element, print shortcode, send to print, print button, print me, jQuery, print page, javascript, twinpictures, plugin oven
Requires at least: 4.9
Tested up to: 6.0
Stable tag: 2.1.6
Stable tag: 2.1.7a
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -50,6 +50,9 @@ We like to rock the party.

== Changelog ==

= 2.1.7 =
* re-added method of passing default and print-trigger specific data to js script using wp_add_inline_script

= 2.1.6 =
* pause before print is now pause time to allow the browser to render the print-preview before resetting back to display layout

Expand Down Expand Up @@ -244,5 +247,5 @@ We like to rock the party.
* The plug-in was forked and completely rewritten from Print Button Shortcode by MyWebsiteAdvisor.

== Upgrade Notice ==
* pause before print is now pause time to allow the browser to render the print-preview before resetting back to display layout
* re-added method of passing default and print-trigger specific data to js script using wp_add_inline_script

0 comments on commit 6710843

Please sign in to comment.