Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Print |
Version | 2.58.1 |
Comparing to | |
See all releases |
Code changes from version 2.58 to 2.58.1
- print-posts.php +2 -4
- readme.txt +30 -27
- wp-print.php +9 -9
print-posts.php
CHANGED
@@ -11,8 +11,6 @@
|
|
11 |
* - Printer Friendly Post/Page Template
|
12 |
* - wp-content/plugins/wp-print/print-posts.php
|
13 |
*/
|
14 |
-
|
15 |
-
global $text_direction;
|
16 |
?>
|
17 |
<!DOCTYPE html>
|
18 |
<html lang="en">
|
@@ -27,7 +25,7 @@ global $text_direction;
|
|
27 |
<?php else: ?>
|
28 |
<link rel="stylesheet" href="<?php echo plugins_url('wp-print/print-css.css'); ?>" type="text/css" media="screen, print" />
|
29 |
<?php endif; ?>
|
30 |
-
<?php if(
|
31 |
<?php if(@file_exists(get_stylesheet_directory().'/print-css-rtl.css')): ?>
|
32 |
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/print-css-rtl.css" type="text/css" media="screen, print" />
|
33 |
<?php else: ?>
|
@@ -130,7 +128,7 @@ global $text_direction;
|
|
130 |
<p><?php print_links(); ?></p>
|
131 |
<?php endif; ?>
|
132 |
|
133 |
-
<p style="text-align: <?php echo (
|
134 |
<a href="#Print" onclick="window.print(); return false;" title="<?php _e('Click here to print.', 'wp-print'); ?>">
|
135 |
<?php _e('Click', 'wp-print'); ?>
|
136 |
<?php _e('here', 'wp-print'); ?>
|
11 |
* - Printer Friendly Post/Page Template
|
12 |
* - wp-content/plugins/wp-print/print-posts.php
|
13 |
*/
|
|
|
|
|
14 |
?>
|
15 |
<!DOCTYPE html>
|
16 |
<html lang="en">
|
25 |
<?php else: ?>
|
26 |
<link rel="stylesheet" href="<?php echo plugins_url('wp-print/print-css.css'); ?>" type="text/css" media="screen, print" />
|
27 |
<?php endif; ?>
|
28 |
+
<?php if ( is_rtl() ) : ?>
|
29 |
<?php if(@file_exists(get_stylesheet_directory().'/print-css-rtl.css')): ?>
|
30 |
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/print-css-rtl.css" type="text/css" media="screen, print" />
|
31 |
<?php else: ?>
|
128 |
<p><?php print_links(); ?></p>
|
129 |
<?php endif; ?>
|
130 |
|
131 |
+
<p style="text-align: <?php echo ( is_rtl() ) ? 'left' : 'right'; ?>;" id="print-link">
|
132 |
<a href="#Print" onclick="window.print(); return false;" title="<?php _e('Click here to print.', 'wp-print'); ?>">
|
133 |
<?php _e('Click', 'wp-print'); ?>
|
134 |
<?php _e('here', 'wp-print'); ?>
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
|
2 |
Contributors: GamerZ
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: print, printer, wp-print
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4
|
7 |
-
Stable tag: 2.58
|
8 |
|
9 |
Displays a printable version of your WordPress blog's post/page.
|
10 |
|
11 |
-
|
12 |
|
13 |
Once installed take the following steps to set it up:
|
14 |
|
@@ -16,7 +16,7 @@ Once installed take the following steps to set it up:
|
|
16 |
1. You Need To Re-Generate The Permalink (WP-Admin -> Settings -> Permalinks -> Save Changes)
|
17 |
1. Refer To Usage For Further Instructions
|
18 |
|
19 |
-
|
20 |
|
21 |
1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`. You should place it in single.php, post.php, page.php, etc also if they exist.
|
22 |
1. Find: `<?php while (have_posts()) : the_post(); ?>`
|
@@ -28,31 +28,31 @@ Once installed take the following steps to set it up:
|
|
28 |
* Alternatively, you can set the text in 'WP-Admin -> Settings -> Print'.
|
29 |
* If you DO NOT want the print link to appear in every post/page, DO NOT use the code above. Just type in <strong>[print_link]</strong> into the selected post/page content and it will embed the print link into that post/page only.
|
30 |
|
31 |
-
|
32 |
[![Build Status](https://travis-ci.org/lesterchan/wp-print.svg?branch=master)](https://travis-ci.org/lesterchan/wp-print)
|
33 |
|
34 |
-
|
35 |
[https://github.com/lesterchan/wp-print](https://github.com/lesterchan/wp-print "https://github.com/lesterchan/wp-print")
|
36 |
|
37 |
-
|
38 |
[http://dev.wp-plugins.org/browser/wp-print/i18n/](http://dev.wp-plugins.org/browser/wp-print/i18n/ "http://dev.wp-plugins.org/browser/wp-print/i18n/")
|
39 |
|
40 |
-
|
41 |
* Plugin icon by [SimpleIcon](http://www.simpleicon.com) from [Flaticon](http://www.flaticon.com)
|
42 |
* Icons courtesy of [FamFamFam](http://www.famfamfam.com/)
|
43 |
|
44 |
-
|
45 |
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks as my school allowance, I will really appreciate it. If not feel free to use it without any obligations.
|
46 |
|
47 |
-
|
48 |
|
49 |
1. Admin Print Options
|
50 |
2. Print Post Link
|
51 |
3. Print Page
|
52 |
|
53 |
-
|
54 |
|
55 |
-
|
56 |
|
57 |
1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`
|
58 |
You may place it in single.php, post.php, page.php, etc also.
|
@@ -66,7 +66,7 @@ if(function_exists('wp_print')) {
|
|
66 |
}
|
67 |
</code>
|
68 |
|
69 |
-
|
70 |
<code>
|
71 |
[donotprint]Text within this tag will not be displayed when printing[/donotprint]
|
72 |
</code>
|
@@ -74,49 +74,52 @@ if(function_exists('wp_print')) {
|
|
74 |
* However, it will still be displayed as normal on a normal post or page view.
|
75 |
* Do note that if you are using WP-Email, any text within [donotprint][/donotprint] will not be emailed as well.
|
76 |
|
77 |
-
|
78 |
* WP-Print will load 'print-css.css', 'print-posts.php' and 'print-comments.php' from your theme's directory if it exists.
|
79 |
* If it doesn't exists, it will just load the respective default file that comes with WP-Print.
|
80 |
* This will allow you to upgrade WP-Print without worrying about overwriting your printing styles or templates that you have created.
|
81 |
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
84 |
* NEW: Ability to print thumbnail. Props @MatthieuMota.
|
85 |
|
86 |
-
|
87 |
* FIXED: Check both parent and child theme
|
88 |
|
89 |
-
|
90 |
* NEW: Use translate.wordpress.org to translate the plugin
|
91 |
* FIXED: Unable to update options
|
92 |
|
93 |
-
|
94 |
* FIXED: Notices
|
95 |
|
96 |
-
|
97 |
* NEW: Updated print HTML code. Props @Luanramos
|
98 |
|
99 |
-
|
100 |
* NEW: Bump to 4.1
|
101 |
* FIXED: get_the_category_list() optional secondary argument
|
102 |
* FIXED: Replace font with p
|
103 |
|
104 |
-
|
105 |
* NEW: Finally there is custom post type support. Props [nimmolo](http://andrewnimmo.org/ "nimmolo").
|
106 |
* NEW: Allow Multisite Network Activate
|
107 |
* NEW: Uses WordPress uninstall.php file to uninstall the plugin
|
108 |
|
109 |
-
|
110 |
* FIXED: Use get_stylesheet_directory() instead of TEMPLATEPATH
|
111 |
|
112 |
-
|
113 |
* FIXED: Added nonce to Options. Credits to Charlie Eriksen via Secunia SVCRP.
|
114 |
|
115 |
-
|
116 |
* NEW: Support for links that start with "//"
|
117 |
* FIXED: Unable to load WP-Print on Password Protected posts
|
118 |
|
119 |
-
|
120 |
* NEW: Uses jQuery Framework
|
121 |
* NEW: [donotprint][/donotprint] ShortCode Will Not Be Displayed As Well When Using WP-Email (Refer To Usage Tab)
|
122 |
* NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()
|
1 |
+
# WP-Print
|
2 |
Contributors: GamerZ
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: print, printer, wp-print
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.4
|
7 |
+
Stable tag: 2.58.1
|
8 |
|
9 |
Displays a printable version of your WordPress blog's post/page.
|
10 |
|
11 |
+
## Description
|
12 |
|
13 |
Once installed take the following steps to set it up:
|
14 |
|
16 |
1. You Need To Re-Generate The Permalink (WP-Admin -> Settings -> Permalinks -> Save Changes)
|
17 |
1. Refer To Usage For Further Instructions
|
18 |
|
19 |
+
### Usage
|
20 |
|
21 |
1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`. You should place it in single.php, post.php, page.php, etc also if they exist.
|
22 |
1. Find: `<?php while (have_posts()) : the_post(); ?>`
|
28 |
* Alternatively, you can set the text in 'WP-Admin -> Settings -> Print'.
|
29 |
* If you DO NOT want the print link to appear in every post/page, DO NOT use the code above. Just type in <strong>[print_link]</strong> into the selected post/page content and it will embed the print link into that post/page only.
|
30 |
|
31 |
+
### Build Status
|
32 |
[![Build Status](https://travis-ci.org/lesterchan/wp-print.svg?branch=master)](https://travis-ci.org/lesterchan/wp-print)
|
33 |
|
34 |
+
### Development
|
35 |
[https://github.com/lesterchan/wp-print](https://github.com/lesterchan/wp-print "https://github.com/lesterchan/wp-print")
|
36 |
|
37 |
+
### Translations
|
38 |
[http://dev.wp-plugins.org/browser/wp-print/i18n/](http://dev.wp-plugins.org/browser/wp-print/i18n/ "http://dev.wp-plugins.org/browser/wp-print/i18n/")
|
39 |
|
40 |
+
### Credits
|
41 |
* Plugin icon by [SimpleIcon](http://www.simpleicon.com) from [Flaticon](http://www.flaticon.com)
|
42 |
* Icons courtesy of [FamFamFam](http://www.famfamfam.com/)
|
43 |
|
44 |
+
### Donations
|
45 |
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks as my school allowance, I will really appreciate it. If not feel free to use it without any obligations.
|
46 |
|
47 |
+
## Screenshots
|
48 |
|
49 |
1. Admin Print Options
|
50 |
2. Print Post Link
|
51 |
3. Print Page
|
52 |
|
53 |
+
## Frequently Asked Questions
|
54 |
|
55 |
+
### How do I add this to my theme?
|
56 |
|
57 |
1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`
|
58 |
You may place it in single.php, post.php, page.php, etc also.
|
66 |
}
|
67 |
</code>
|
68 |
|
69 |
+
### If you do not want to print a portion of your post's content
|
70 |
<code>
|
71 |
[donotprint]Text within this tag will not be displayed when printing[/donotprint]
|
72 |
</code>
|
74 |
* However, it will still be displayed as normal on a normal post or page view.
|
75 |
* Do note that if you are using WP-Email, any text within [donotprint][/donotprint] will not be emailed as well.
|
76 |
|
77 |
+
### Custom Template
|
78 |
* WP-Print will load 'print-css.css', 'print-posts.php' and 'print-comments.php' from your theme's directory if it exists.
|
79 |
* If it doesn't exists, it will just load the respective default file that comes with WP-Print.
|
80 |
* This will allow you to upgrade WP-Print without worrying about overwriting your printing styles or templates that you have created.
|
81 |
|
82 |
+
## Changelog
|
83 |
+
### 2.58.1
|
84 |
+
* FIXED: Strip iframe tags as well.
|
85 |
+
|
86 |
+
### 2.58
|
87 |
* NEW: Ability to print thumbnail. Props @MatthieuMota.
|
88 |
|
89 |
+
### 2.57.2
|
90 |
* FIXED: Check both parent and child theme
|
91 |
|
92 |
+
### 2.57.1
|
93 |
* NEW: Use translate.wordpress.org to translate the plugin
|
94 |
* FIXED: Unable to update options
|
95 |
|
96 |
+
### 2.57
|
97 |
* FIXED: Notices
|
98 |
|
99 |
+
### 2.56
|
100 |
* NEW: Updated print HTML code. Props @Luanramos
|
101 |
|
102 |
+
### 2.55
|
103 |
* NEW: Bump to 4.1
|
104 |
* FIXED: get_the_category_list() optional secondary argument
|
105 |
* FIXED: Replace font with p
|
106 |
|
107 |
+
### 2.54
|
108 |
* NEW: Finally there is custom post type support. Props [nimmolo](http://andrewnimmo.org/ "nimmolo").
|
109 |
* NEW: Allow Multisite Network Activate
|
110 |
* NEW: Uses WordPress uninstall.php file to uninstall the plugin
|
111 |
|
112 |
+
### 2.53
|
113 |
* FIXED: Use get_stylesheet_directory() instead of TEMPLATEPATH
|
114 |
|
115 |
+
### 2.52
|
116 |
* FIXED: Added nonce to Options. Credits to Charlie Eriksen via Secunia SVCRP.
|
117 |
|
118 |
+
### 2.51
|
119 |
* NEW: Support for links that start with "//"
|
120 |
* FIXED: Unable to load WP-Print on Password Protected posts
|
121 |
|
122 |
+
### 2.50
|
123 |
* NEW: Uses jQuery Framework
|
124 |
* NEW: [donotprint][/donotprint] ShortCode Will Not Be Displayed As Well When Using WP-Email (Refer To Usage Tab)
|
125 |
* NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()
|
wp-print.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Print
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Displays a printable version of your WordPress blog's post/page.
|
6 |
-
Version: 2.58
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-print
|
@@ -11,7 +11,7 @@ Text Domain: wp-print
|
|
11 |
|
12 |
|
13 |
/*
|
14 |
-
Copyright
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
@@ -78,8 +78,8 @@ function print_link($print_post_text = '', $print_page_text = '', $echo = true)
|
|
78 |
$print_link = get_permalink();
|
79 |
$print_html = stripslashes($print_options['print_html']);
|
80 |
// Fix For Static Page
|
81 |
-
if(get_option('show_on_front')
|
82 |
-
if(
|
83 |
$print_link = _get_page_link();
|
84 |
}
|
85 |
}
|
@@ -303,7 +303,6 @@ function print_comments_content($display = true) {
|
|
303 |
### Function: Print Comments
|
304 |
function print_comments_number() {
|
305 |
global $post;
|
306 |
-
$comment_text = '';
|
307 |
$comment_status = $post->comment_status;
|
308 |
if($comment_status == 'open') {
|
309 |
$num_comments = get_comments_number();
|
@@ -383,9 +382,10 @@ function remove_image($content) {
|
|
383 |
|
384 |
|
385 |
### Function: Remove Video From Text
|
386 |
-
function remove_video($content) {
|
387 |
-
$content= preg_replace('/<object[^>]*?>.*?<\/object>/', '',$content);
|
388 |
-
$content= preg_replace('/<embed[^>]*?>.*?<\/embed>/', '',$content);
|
|
|
389 |
return $content;
|
390 |
}
|
391 |
|
@@ -422,7 +422,7 @@ function print_activation( $network_wide ) {
|
|
422 |
if ( is_multisite() && $network_wide ) {
|
423 |
$ms_sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
|
424 |
|
425 |
-
if( 0 <
|
426 |
foreach ( $ms_sites as $ms_site ) {
|
427 |
$blog_id = isset( $ms_site['blog_id'] ) ? $ms_site['blog_id'] : $ms_site->blog_id;
|
428 |
switch_to_blog( $blog_id );
|
3 |
Plugin Name: WP-Print
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Displays a printable version of your WordPress blog's post/page.
|
6 |
+
Version: 2.58.1
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-print
|
11 |
|
12 |
|
13 |
/*
|
14 |
+
Copyright 2019 Lester Chan (email : lesterchan@gmail.com)
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
78 |
$print_link = get_permalink();
|
79 |
$print_html = stripslashes($print_options['print_html']);
|
80 |
// Fix For Static Page
|
81 |
+
if ( get_option( 'show_on_front' ) === 'page' && is_page() ) {
|
82 |
+
if ( (int) get_option( 'page_on_front' ) > 0 ) {
|
83 |
$print_link = _get_page_link();
|
84 |
}
|
85 |
}
|
303 |
### Function: Print Comments
|
304 |
function print_comments_number() {
|
305 |
global $post;
|
|
|
306 |
$comment_status = $post->comment_status;
|
307 |
if($comment_status == 'open') {
|
308 |
$num_comments = get_comments_number();
|
382 |
|
383 |
|
384 |
### Function: Remove Video From Text
|
385 |
+
function remove_video( $content ) {
|
386 |
+
$content= preg_replace( '/<object[^>]*?>.*?<\/object>/', '',$content );
|
387 |
+
$content= preg_replace( '/<embed[^>]*?>.*?<\/embed>/', '',$content );
|
388 |
+
$content= preg_replace( '/<iframe[^>]*?>.*?<\/iframe>/', '',$content );
|
389 |
return $content;
|
390 |
}
|
391 |
|
422 |
if ( is_multisite() && $network_wide ) {
|
423 |
$ms_sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
|
424 |
|
425 |
+
if( 0 < count( $ms_sites ) ) {
|
426 |
foreach ( $ms_sites as $ms_site ) {
|
427 |
$blog_id = isset( $ms_site['blog_id'] ) ? $ms_site['blog_id'] : $ms_site->blog_id;
|
428 |
switch_to_blog( $blog_id );
|