From d672d8b0c1ce96bb02b4b07ecb644cdcf53e878f Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sun, 14 Apr 2019 14:26:04 -0700 Subject: [PATCH] PHP 7.3 compatiblity, Grunt tasks --- README.md | 206 ++++++++++++++++++++++++++++++++ languages/wp-print-friendly.pot | 171 ++++++++++++++++++++++++++ package.json | 2 +- readme.txt | 10 +- wp-print-friendly.php | 4 +- 5 files changed, 388 insertions(+), 5 deletions(-) create mode 100644 README.md create mode 100644 languages/wp-print-friendly.pot diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd4051d --- /dev/null +++ b/README.md @@ -0,0 +1,206 @@ +# WP Print Friendly # +**Contributors:** ethitter, stevenkword, thinkoomph +**Donate link:** http://www.thinkoomph.com/plugins-modules/wp-print-friendly/ +**Tags:** print, template, printer, printable +**Requires at least:** 3.1 +**Tested up to:** 5.2 +**Stable tag:** 0.6.2 +**License:** GPLv2 or later +**License URI:** http://www.gnu.org/licenses/gpl-2.0.html + +Extends WordPress' template system to support printer-friendly templates. Works with permalink structures to support nice URLs. + +## Description ## + +Extends WordPress' template system to support printer-friendly templates for posts, pages, and custom post types. Uses WP standard template naming to support templates on a post-type basis. Supports printing paged posts on single page. Adds nice URLs for printer-friendly pages. + +**IMPORTANT**: There are certain plugins that may interfere with this plugin's functionality. See the **FAQ** for more information. + +## Installation ## + +1. Upload wp-print-friendly.php to /wp-content/plugins/. +2. Activate plugin through the WordPress Plugins menu. +3. Navigate to Options > Permalinks and click *Save Changes* to update navigation. + +## Frequently Asked Questions ## + +### Print links don't work ### +First, navigate to Options > Permalinks in WP Admin, click *Save Changes*, and try again. + +If clicking on a print link takes you back to the post or page where the link appeared, see the **Known Plugin Conflicts** item below. + +If, after reviewing the remaining FAQ, you are still experiencing problems, visit [http://www.thinkoomph.com/plugins-modules/wp-print-friendly/](http://www.thinkoomph.com/plugins-modules/wp-print-friendly/) and leave a comment detailing the problem. + +### How should I name print templates? ### +Print templates should be prefixed with *wpf* and follow WordPress template conventions from there. To use one template for all contexts unless otherwise specified, name your template *wpf.php.* + +For both built-in and custom post types, *wpf-[post type name].php* will be used for that post type. To use a template for a single post type object, name your template *wpf-[post type name]-[slug].php*. + +For custom taxonomies, follow the naming conventions for post types. + +Similarly, *wpf-home.php* will load that template for the front page of your site. + +The plugin also includes a default template that may suit many needs. + +### How do I add a print link to my templates? ### +The function `wpf_the_print_link` will add a link to the print-friendly version of whatever page it appears on. This function accepts the following arguments: + +* **$page_link**: Set to true to add a link to the current page in a paged post in addition a to a link for the entire post. +* **$link_text**: Set to text that should appear for the print link. Defaults to *Print this post*. +* **$class**: Specifies the CSS class for the print link. Defaults to *print_link*. +* **$page_link_separator**: If $page_link is true, specifies what separator will appear between the print link for the entire post and the print link for the current page of the post. +* **$page_link_text**: If $page_link is true, specifies what text will appear for the print link for the current page. Defaults to *Print this page*. +* **$link_target**: If set to "new", print links will open in a new window. + +### Known Plugin Conflicts ### +This plugin is known to conflict with certain plugins, many pertaining to SEO and permalinks. Conflicting plugins include, but are not limited to, the following: + +* **WordPress SEO by Yoast:** This plugin's `Permalink` options, particularly *Redirect attachment URL's to parent post URL* and *Redirect ugly URL's to clean permalinks. (Not recommended in many cases!)*, interfere with WP Print Friendly's ability to display print templates. Both must be disabled, and the site's rewrite rules regenerated (by visiting Options > Permalinks and clicking *Save Changes*), for WP Print Friendly to function. + +## Changelog ## + +### 0.6.2 ### +* PHP 7.3 compatibility. + +### 0.6.1 ### +* Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html. + +### 0.6 ### +* Revert security hotfixes made in 0.5.3 and address the vulnerabilities in the WordPress way. +* If current user can't read a private post, don't display the print template, allowing the standard theme to handle requests. +* If a post is password protected and the viewer hasn't provided the right password, display the password form and prevent plugin from exposing any information about the post that WordPress doesn't already. +* When WordPress determines a request is a 404, don't activate the plugin's templating functionality. +* Convert the plugin to a singleton. +* Audit entire plugin for translation readyness. +* Correct phpdoc. + +### 0.5.3 ### +* Creates is_protected() method to determine if the print page should be visible to the current user +* Correct security vulnerability allowing both private and password protected posts from being accessed through the print page +* Remove print_url links from the content when the current user does not have the necessary capabilities to view the print page + +### 0.5.2 ### +* Revert change in is_print() method made in version 0.5 as it breaks the method when no page number is specified. See [https://github.com/ethitter/WP-Print-Friendly/issues/2](https://github.com/ethitter/WP-Print-Friendly/issues/2). + +### 0.5.1 ### +* Correct construction of query needed in situations where verbose page rules are required. + +### 0.5 ### +* Add additional rewrite rules for situations where verbose page rules are required. +* Disable canonical redirect when print template is requested. +* Update is_print() method to use WordPress API. +* Correct translation string implementation. +* Update code to better conform to WordPress Coding Standards. + +### 0.4.4.1 ### +* Remove unnecessary query_var filter. + +### 0.4.4 ### +* Full support for child themes. +* Expand template choosing to fully support WordPress template hierarchy as described at [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy). +* Simplify rewrite rules creation. + +### 0.4.3.3 ### +* Correct error that would display wrong page's content when printing a single page of a paged post. +* Correct error in link generation for page-specific print links. +* Increase compatibility with View All Post's Pages plugin. + +### 0.4.3.2 ### +* Resolve PHP notice in options retrieval. +* Add compatibility with View All Post's Pages plugin (release forthcoming). + +### 0.4.3.1 ### +* Fix bug in options retrieval that caused print links to be added to default post types if no post types were selected. +* Resolve PHP notice when using default permalinks. + +### 0.4.3 ### +* Fix bug in page number function. +* Rewrite endnote link processing, including a refined regex pattern. +* Introduce class property for print slug. +* Correct minor bug in print link generation. +* Add canonical link attribute and nofollow declaration to default template. + +### 0.4.2.2 ### +* Correct generation of custom post type rewrite rules. + +### 0.4.2.1 ### +* Version 0.4.2 omitted the default template. + +### 0.4.2 ### +* Correct page rewrite rules to accomodate situations necessitating verbose rules, such as when the permalink structure starts with `%postname%`. Thanks to Wes Herzik at ikonic for discovering and reporting this issue. + +### 0.4.1 ### +* Fix bug that displayed post links automatically on the wrong post types. + +### 0.4 ### +* Child pages now fully supported. +* Generates and registers rewrite rules more efficiently. +* Rewrite setting for all post types and taxonomies are now considered when adding print support. +* Add option to disable endnotes representing links found in content. +* Move copyright and other static elements from content filters to default template. +* Add function to display page numbers when printing single page of post. +* Options page is now fully translation-ready. +* Notices are translation-ready. +* Correct various other bugs, including many related to non-standard permalink structures, custom post types, and custom taxonomies. + +### 0.3.2 ### +* Add option to open print-friendly views in a new window. + +### 0.3.1 ### +* Correct PHP error in `is_print()`. + +### 0.3 ### +* Initial version. + +## Upgrade Notice ## + +### 0.6.2 ### +Resolves a warning arising in PHP 7.3. + +### 0.6.1 ### +Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html. + +### 0.6 ### +Recommended for all users as this release addresses security vulnerabilities related to privately-published and password-protected posts. + +### 0.5.2 ### +Resolves a problem where requests for print templates redirect to the article. + +### 0.5.1 ### +Ensure that proper query string is built when verbose page rules are required. + +### 0.5 ### +Adds better support for sites that use verbose page rules, resolving situations where requests for print template redirect to the post. + +### 0.4.4.1 ### +Removes unnecessary query_var filter. + +### 0.4.4 ### +Adds full child theme and template hierarchy support for template selection. Simplifies rewrite rules. + +### 0.4.3.3 ### +Corrects a few errors related to paged posts and further enhances compatibility with View All Post's Pages plugin. + +### 0.4.3.2 ### +Fixes a minor bug in plugin's options retrieval and enhances compatibility with forthcoming View All Post's Pages plugin. + +### 0.4.3.1 ### +Fixes a bug in plugin's options retrieval that caused print links to be added to default post types if no post types were chosen. Also resolves a PHP notice encountered when using default permalinks. + +### 0.4.3 ### +Fixes various bugs in the print link, page numbering, and endnote generating functions. Also introduces a class variable for permalink component. Default template is updated to be more SEO friendly, now containing both canonical URL and nofollow declarations. + +### 0.4.2.2 ### +Rewrite rules for custom post types are now generated correctly. + +### 0.4.2.1 ### +Version 0.4.2 omitted the default template. + +### 0.4.2 ### +This release expands the plugin's page rewrite rules to accomodate permalink structures that necessitate verbose rules, such as when the structure begins with `%postname%`. + +### 0.4.1 ### +This release fixes bug that displayed post links automatically on the wrong post types. + +### 0.4 ### +This release addresses numerous bugs reported by the community, including print templates for child pages. All admin text, save the plugin's name, are now ready for translation. Templates are now completely customizable, and new template functions are included. diff --git a/languages/wp-print-friendly.pot b/languages/wp-print-friendly.pot new file mode 100644 index 0000000..7cdba61 --- /dev/null +++ b/languages/wp-print-friendly.pot @@ -0,0 +1,171 @@ +# Copyright (C) 2019 Erick Hitter, Steven K Word, and Oomph, Inc. +# This file is distributed under the same license as the WP Print Friendly package. +msgid "" +msgstr "" +"Project-Id-Version: WP Print Friendly 0.6.2\n" +"Report-Msgid-Bugs-To: " +"https://wordpress.org/support/plugin/wp-print-friendly\n" +"POT-Creation-Date: 2019-04-14 21:25:11+00:00\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"X-Generator: grunt-wp-i18n 0.5.4\n" +"X-Poedit-KeywordsList: " +"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_" +"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-Country: United States\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-Basepath: ../\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-Bookmarks: \n" +"X-Textdomain-Support: yes\n" + +#: wp-print-friendly.php:120 +msgid "Print this entry" +msgstr "" + +#: wp-print-friendly.php:121 +msgid "Print this page" +msgstr "" + +#: wp-print-friendly.php:125 +msgid "Endnotes:" +msgstr "" + +#: wp-print-friendly.php:670 +msgid "Automatically add print links based on settings below?" +msgstr "" + +#: wp-print-friendly.php:672 wp-print-friendly.php:736 +msgid "Yes" +msgstr "" + +#: wp-print-friendly.php:673 +msgid "No" +msgstr "" + +#: wp-print-friendly.php:677 +msgid "Automatically place link:" +msgstr "" + +#: wp-print-friendly.php:679 +msgid "Above content" +msgstr "" + +#: wp-print-friendly.php:680 +msgid "Below content" +msgstr "" + +#: wp-print-friendly.php:681 +msgid "Above and below content" +msgstr "" + +#: wp-print-friendly.php:685 +msgid "Display automatically on:" +msgstr "" + +#: wp-print-friendly.php:698 +msgid "Text for link to print entire item:" +msgstr "" + +#: wp-print-friendly.php:704 +msgid "Text for link to print current page:" +msgstr "" + +#: wp-print-friendly.php:708 +msgid "" +"If viewing a multipage post (set by using the <!--nextpage--> tag), " +"the text above is used for a link to print just the current page." +msgstr "" + +#: wp-print-friendly.php:709 +msgid "<strong>To hide this link,</strong> clear the field's contents." +msgstr "" + +#: wp-print-friendly.php:713 +msgid "CSS for print links:" +msgstr "" + +#: wp-print-friendly.php:717 +msgid "" +"For page-specific print links, a second class, created by appending " +"<strong>_cur</strong> to the above text, is added to each link." +msgstr "" + +#: wp-print-friendly.php:718 +msgid "" +"Be aware that Internet Explorer will only interpret the first two CSS " +"classes, so if multiple classes are entered above, the page-specific class " +"may not be available in IE." +msgstr "" + +#: wp-print-friendly.php:722 +msgid "Open print-friendly views:" +msgstr "" + +#: wp-print-friendly.php:724 +msgid "In the same window" +msgstr "" + +#: wp-print-friendly.php:725 +msgid "In a new window" +msgstr "" + +#: wp-print-friendly.php:734 +msgid "Include endnotes for links found in content?" +msgstr "" + +#: wp-print-friendly.php:738 +msgid "" +"If enabled, content is automatically scanned for links and an endnote is " +"added for each link found. This can be helpful for users if your content " +"includes many links." +msgstr "" + +#: wp-print-friendly.php:742 +msgid "Endnotes heading:" +msgstr "" + +#: wp-print-friendly.php:746 +msgid "" +"If endnotes are enabled, the text entered above will be output above the " +"list of links." +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "WP Print Friendly" +msgstr "" + +#: wp-print-friendly.php:882 +msgid "" +"You must refresh your site's permalinks before WP Print Friendly is fully " +"activated. To do so, go to <a href=\"%s\">Permalinks</a> and click the " +"<strong><em>Save Changes</em></strong> button at the bottom of the screen." +msgstr "" + +#: wp-print-friendly.php:884 +msgid "When finished, click <a href=\"%s\">here</a> to hide this message." +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://oomphinc.com/plugins-modules/wp-print-friendly/" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"Extends WordPress' template system to support printer-friendly templates. " +"Works with permalink structures to support nice URLs." +msgstr "" + +#. Author of the plugin/theme +msgid "Erick Hitter, Steven K Word, and Oomph, Inc." +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://oomphinc.com/" +msgstr "" \ No newline at end of file diff --git a/package.json b/package.json index 693ade6..465704c 100755 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "wp-print-friendly", "version": "0.1.0", "main": "Gruntfile.js", - "author": "Erick Hitter & Oomphc, Inc.", + "author": "Erick Hitter, Steven K Word, and Oomph, Inc.", "devDependencies": { "grunt": "~0.4.5", "grunt-wp-i18n": "~0.5.0", diff --git a/readme.txt b/readme.txt index 7538866..03826f8 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: ethitter, stevenkword, thinkoomph Donate link: http://www.thinkoomph.com/plugins-modules/wp-print-friendly/ Tags: print, template, printer, printable Requires at least: 3.1 -Tested up to: 4.6 -Stable tag: 0.6.1 +Tested up to: 5.2 +Stable tag: 0.6.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -59,6 +59,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an == Changelog == += 0.6.2 = +* PHP 7.3 compatibility. + = 0.6.1 = * Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html. @@ -151,6 +154,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an == Upgrade Notice == += 0.6.2 = +Resolves a warning arising in PHP 7.3. + = 0.6.1 = Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html. diff --git a/wp-print-friendly.php b/wp-print-friendly.php index e700bd5..3218727 100644 --- a/wp-print-friendly.php +++ b/wp-print-friendly.php @@ -4,7 +4,7 @@ Plugin Name: WP Print Friendly Plugin URI: http://oomphinc.com/plugins-modules/wp-print-friendly/ Description: Extends WordPress' template system to support printer-friendly templates. Works with permalink structures to support nice URLs. Author: Erick Hitter, Steven K Word, and Oomph, Inc. -Version: 0.6.1 +Version: 0.6.2 Author URI: http://oomphinc.com/ Text Domain: wp_print_friendly @@ -820,7 +820,7 @@ class wp_print_friendly { break; default: - continue; + continue 2; break; } } -- GitLab