Commit ebc91793 authored by Erick Hitter's avatar Erick Hitter

PHPCS

parent 0f83df9d
Pipeline #453 failed with stage
in 2 minutes and 30 seconds
...@@ -45,6 +45,10 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an ...@@ -45,6 +45,10 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an
## Changelog ## ## Changelog ##
### 0.9.2 ###
* Introduce PHPCS tests
* Update plugin based on PHPCS results
### 0.9.1 ### ### 0.9.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. * 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.
...@@ -95,6 +99,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an ...@@ -95,6 +99,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an
## Upgrade Notice ## ## Upgrade Notice ##
### 0.9.2 ###
Adds support for PHP 7.3 and fixes various PHPCS errors, neither of which should impact the plugin's functionality.
### 0.9.1 ### ### 0.9.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. 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.
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
# This file is distributed under the same license as the View All Posts Pages package. # This file is distributed under the same license as the View All Posts Pages package.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: View All Posts Pages 0.9.1\n" "Project-Id-Version: View All Posts Pages 0.9.2\n"
"Report-Msgid-Bugs-To: " "Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/view-all-posts-pages\n" "https://wordpress.org/support/plugin/view-all-posts-pages\n"
"POT-Creation-Date: 2019-02-05 17:47:01+00:00\n" "POT-Creation-Date: 2019-02-05 18:43:53+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
...@@ -25,101 +25,104 @@ msgstr "" ...@@ -25,101 +25,104 @@ msgstr ""
"X-Poedit-Bookmarks: \n" "X-Poedit-Bookmarks: \n"
"X-Textdomain-Support: yes\n" "X-Textdomain-Support: yes\n"
#: view-all-posts-pages.php:147 view-all-posts-pages.php:154 #: view-all-posts-pages.php:179 view-all-posts-pages.php:186
msgid "View All" msgid "View All"
msgstr "" msgstr ""
#: view-all-posts-pages.php:437 view-all-posts-pages.php:466 #: view-all-posts-pages.php:464 view-all-posts-pages.php:495
#. translators: 1: Plugin name.
#. translators: 1: WordPress function name.
msgid "%s Options" msgid "%s Options"
msgstr "" msgstr ""
#: view-all-posts-pages.php:468 #: view-all-posts-pages.php:499
msgid "" msgid ""
"A \"view all\" link can be appended to WordPress' standard page navigation " "A \"view all\" link can be appended to WordPress' standard page navigation "
"using the options below." "using the options below."
msgstr "" msgstr ""
#: view-all-posts-pages.php:472 #: view-all-posts-pages.php:503
msgid "Automatically append link to post's page navigation?" msgid "Automatically append link to post's page navigation?"
msgstr "" msgstr ""
#: view-all-posts-pages.php:474 view-all-posts-pages.php:510 #: view-all-posts-pages.php:505 view-all-posts-pages.php:548
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#: view-all-posts-pages.php:475 view-all-posts-pages.php:511 #: view-all-posts-pages.php:506 view-all-posts-pages.php:549
msgid "No" msgid "No"
msgstr "" msgstr ""
#: view-all-posts-pages.php:479 view-all-posts-pages.php:531 #: view-all-posts-pages.php:510 view-all-posts-pages.php:576
msgid "Link text:" msgid "Link text:"
msgstr "" msgstr ""
#: view-all-posts-pages.php:485 view-all-posts-pages.php:537 #: view-all-posts-pages.php:516 view-all-posts-pages.php:582
msgid "Link's CSS class(es):" msgid "Link's CSS class(es):"
msgstr "" msgstr ""
#: view-all-posts-pages.php:489 view-all-posts-pages.php:541 #: view-all-posts-pages.php:520 view-all-posts-pages.php:586
msgid "" msgid ""
"Be aware that Internet Explorer will only interpret the first two CSS " "Be aware that Internet Explorer will only interpret the first two CSS "
"classes." "classes."
msgstr "" msgstr ""
#: view-all-posts-pages.php:493 view-all-posts-pages.php:523 #: view-all-posts-pages.php:524 view-all-posts-pages.php:561
msgid "Display automatically on:" msgid "Display automatically on:"
msgstr "" msgstr ""
#: view-all-posts-pages.php:502 #: view-all-posts-pages.php:540
msgid "Standalone Link Options" msgid "Standalone Link Options"
msgstr "" msgstr ""
#: view-all-posts-pages.php:504 #: view-all-posts-pages.php:542
msgid "" msgid ""
"In addition to appending the \"view all\" link to WordPress' standard " "In addition to appending the \"view all\" link to WordPress' standard "
"navigation, link(s) can be added above and below post content." "navigation, link(s) can be added above and below post content."
msgstr "" msgstr ""
#: view-all-posts-pages.php:508 #: view-all-posts-pages.php:546
msgid "Automatically add links based on settings below?" msgid "Automatically add links based on settings below?"
msgstr "" msgstr ""
#: view-all-posts-pages.php:515 #: view-all-posts-pages.php:553
msgid "Automatically place link:" msgid "Automatically place link:"
msgstr "" msgstr ""
#: view-all-posts-pages.php:517 #: view-all-posts-pages.php:555
msgid "Above content" msgid "Above content"
msgstr "" msgstr ""
#: view-all-posts-pages.php:518 #: view-all-posts-pages.php:556
msgid "Below content" msgid "Below content"
msgstr "" msgstr ""
#: view-all-posts-pages.php:519 #: view-all-posts-pages.php:557
msgid "Above and below content" msgid "Above and below content"
msgstr "" msgstr ""
#: view-all-posts-pages.php:545 #: view-all-posts-pages.php:590
msgid "Link's priority:" msgid "Link's priority:"
msgstr "" msgstr ""
#: view-all-posts-pages.php:549 #: view-all-posts-pages.php:594
msgid "" msgid ""
"Priority determines when the link is added to a post's content. You can use " "Priority determines when the link is added to a post's content. You can use "
"the above setting to modulate the link's placement." "the above setting to modulate the link's placement."
msgstr "" msgstr ""
#: view-all-posts-pages.php:550 #: view-all-posts-pages.php:595
msgid "" msgid ""
"The default value is <strong>10</strong>. Lower values mean the link will " "The default value is <strong>10</strong>. Lower values mean the link will "
"be added earlier, while higher values will add the link later." "be added earlier, while higher values will add the link later."
msgstr "" msgstr ""
#: view-all-posts-pages.php:689 #: view-all-posts-pages.php:739
msgid "View All Post's Pages" msgid "View All Post's Pages"
msgstr "" msgstr ""
#: view-all-posts-pages.php:691 #: view-all-posts-pages.php:744
#. translators: 1: Permalinks settings page URL.
msgid "" msgid ""
"You must refresh your site's permalinks before <em>View All Post's " "You must refresh your site's permalinks before <em>View All Post's "
"Pages</em> is fully activated. To do so, go to <a " "Pages</em> is fully activated. To do so, go to <a "
...@@ -127,7 +130,8 @@ msgid "" ...@@ -127,7 +130,8 @@ msgid ""
"Changes</em></strong> button at the bottom of the screen." "Changes</em></strong> button at the bottom of the screen."
msgstr "" msgstr ""
#: view-all-posts-pages.php:693 #: view-all-posts-pages.php:756
#. translators: 1: URL to dismiss admin notice.
msgid "When finished, click <a href=\"%s\">here</a> to hide this message." msgid "When finished, click <a href=\"%s\">here</a> to hide this message."
msgstr "" msgstr ""
......
...@@ -45,6 +45,10 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an ...@@ -45,6 +45,10 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an
== Changelog == == Changelog ==
= 0.9.2 =
* Introduce PHPCS tests
* Update plugin based on PHPCS results
= 0.9.1 = = 0.9.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. * 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.
...@@ -95,6 +99,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an ...@@ -95,6 +99,9 @@ This plugin is known to conflict with certain plugins, many pertaining to SEO an
== Upgrade Notice == == Upgrade Notice ==
= 0.9.2 =
Adds support for PHP 7.3 and fixes various PHPCS errors, neither of which should impact the plugin's functionality.
= 0.9.1 = = 0.9.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. 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.
......
<?php <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/** /**
* View All Posts Pages
*
* Plugin Name: View All Posts Pages * Plugin Name: View All Posts Pages
* Plugin URI: http://www.oomphinc.com/plugins-modules/view-all-posts-pages/ * Plugin URI: http://www.oomphinc.com/plugins-modules/view-all-posts-pages/
* Description: Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="http://codex.wordpress.org/Write_Post_SubPanel#Quicktags" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts). * Description: Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="http://codex.wordpress.org/Write_Post_SubPanel#Quicktags" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts).
...@@ -7,7 +9,7 @@ ...@@ -7,7 +9,7 @@
* Author URI: http://www.oomphinc.com/ * Author URI: http://www.oomphinc.com/
* Text Domain: view_all_posts_pages * Text Domain: view_all_posts_pages
* Domain Path: /languages * Domain Path: /languages
* Version: 0.9.1 * Version: 0.9.2
* *
* @package View_All_Posts_Pages * @package View_All_Posts_Pages
* *
...@@ -26,22 +28,50 @@ ...@@ -26,22 +28,50 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
class view_all_posts_pages { /**
* Class view_all_posts_pages
*/
class view_all_posts_pages { // phpcs:ignore PEAR.NamingConventions.ValidClassName, Generic.Classes.OpeningBraceSameLine.ContentAfterBrace
/** /**
* Singleton * Singleton
*
* @var self
*/ */
private static $__instance = null; private static $__instance = null;
/** /**
* Class variables * Class variables
*
* @var string
*/ */
private $query_var = 'view-all'; private $query_var = 'view-all';
/**
* Namespace.
*
* @var string
*/
private $ns = 'view_all_posts_pages'; private $ns = 'view_all_posts_pages';
private $settings_key = 'vapp'; /**
* Option name.
*
* @var string
*/
private $settings_key = 'vapp';
/**
* Default settings
*
* @var array|null
*/
private $settings_defaults = null; private $settings_defaults = null;
/**
* Option indicating admin notice was dismissed.
*
* @var string
*/
private $notice_key = 'vapp_admin_notice_dismissed'; private $notice_key = 'vapp_admin_notice_dismissed';
/** /**
...@@ -70,7 +100,6 @@ class view_all_posts_pages { ...@@ -70,7 +100,6 @@ class view_all_posts_pages {
* *
* @uses register_deactivation_hook * @uses register_deactivation_hook
* @uses add_action * @uses add_action
* @return null
*/ */
private function setup() { private function setup() {
register_deactivation_hook( __FILE__, array( $this, 'deactivation_hook' ) ); register_deactivation_hook( __FILE__, array( $this, 'deactivation_hook' ) );
...@@ -90,10 +119,9 @@ class view_all_posts_pages { ...@@ -90,10 +119,9 @@ class view_all_posts_pages {
* @uses flush_rewrite_rules * @uses flush_rewrite_rules
* @uses delete_option * @uses delete_option
* @action register_deactivation_hook * @action register_deactivation_hook
* @return null
*/ */
public function deactivation_hook() { public function deactivation_hook() {
flush_rewrite_rules(); flush_rewrite_rules(); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules
delete_option( $this->settings_key ); delete_option( $this->settings_key );
delete_option( $this->notice_key ); delete_option( $this->notice_key );
...@@ -106,12 +134,15 @@ class view_all_posts_pages { ...@@ -106,12 +134,15 @@ class view_all_posts_pages {
* @uses apply_filters * @uses apply_filters
* @uses update_option * @uses update_option
* @action admin_init * @action admin_init
* @return null
*/ */
public function action_admin_init() { public function action_admin_init() {
register_setting( $this->settings_key, $this->settings_key, array( $this, 'admin_options_validate' ) ); register_setting( $this->settings_key, $this->settings_key, array( $this, 'admin_options_validate' ) );
if ( isset( $_GET[ $this->notice_key ] ) && apply_filters( 'vapp_display_rewrite_rules_notice', true ) ) { if (
isset( $_GET[ $this->notice_key ], $_GET[ $this->notice_key . '_nonce' ] ) &&
wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[ $this->notice_key . '_nonce' ] ) ), $this->notice_key ) &&
apply_filters( 'vapp_display_rewrite_rules_notice', true )
) {
update_option( $this->notice_key, 1 ); update_option( $this->notice_key, 1 );
} }
} }
...@@ -140,10 +171,9 @@ class view_all_posts_pages { ...@@ -140,10 +171,9 @@ class view_all_posts_pages {
* @uses add_action * @uses add_action
* @uses add_rewrite_endpoint * @uses add_rewrite_endpoint
* @action init * @action init
* @return null
*/ */
public function action_init() { public function action_init() {
// Populate default settings, with translation support // Populate default settings, with translation support.
$this->settings_defaults = array( $this->settings_defaults = array(
'wlp' => true, 'wlp' => true,
'wlp_text' => __( 'View All', 'view_all_posts_pages' ), 'wlp_text' => __( 'View All', 'view_all_posts_pages' ),
...@@ -176,18 +206,18 @@ class view_all_posts_pages { ...@@ -176,18 +206,18 @@ class view_all_posts_pages {
add_action( 'admin_notices', array( $this, 'action_admin_notices_activation' ) ); add_action( 'admin_notices', array( $this, 'action_admin_notices_activation' ) );
} }
// Register rewrite endpoint, which handles most of our rewrite needs // Register rewrite endpoint, which handles most of our rewrite needs.
add_rewrite_endpoint( $this->query_var, EP_ALL ); add_rewrite_endpoint( $this->query_var, EP_ALL );
// Extra rules needed if verbose page rules are requested // Extra rules needed if verbose page rules are requested.
global $wp_rewrite; global $wp_rewrite;
if ( $wp_rewrite->use_verbose_page_rules ) { if ( $wp_rewrite->use_verbose_page_rules ) {
// Build regex // Build regex.
$regex = substr( str_replace( $wp_rewrite->rewritecode, $wp_rewrite->rewritereplace, $wp_rewrite->permalink_structure ), 1 ); $regex = substr( str_replace( $wp_rewrite->rewritecode, $wp_rewrite->rewritereplace, $wp_rewrite->permalink_structure ), 1 );
$regex = trailingslashit( $regex ); $regex = trailingslashit( $regex );
$regex .= $this->query_var . '/?$'; $regex .= $this->query_var . '/?$';
// Build corresponding query string // Build corresponding query string.
$query = substr( str_replace( $wp_rewrite->rewritecode, $wp_rewrite->queryreplace, $wp_rewrite->permalink_structure ), 1 ); $query = substr( str_replace( $wp_rewrite->rewritecode, $wp_rewrite->queryreplace, $wp_rewrite->permalink_structure ), 1 );
$query = explode( '/', $query ); $query = explode( '/', $query );
$query = array_filter( $query ); $query = array_filter( $query );
...@@ -202,7 +232,7 @@ class view_all_posts_pages { ...@@ -202,7 +232,7 @@ class view_all_posts_pages {
$query = implode( '&', $query ); $query = implode( '&', $query );
// Add rule // Add rule.
add_rewrite_rule( $regex, $wp_rewrite->index . '?' . $query, 'top' ); add_rewrite_rule( $regex, $wp_rewrite->index . '?' . $query, 'top' );
} }
} }
...@@ -210,10 +240,10 @@ class view_all_posts_pages { ...@@ -210,10 +240,10 @@ class view_all_posts_pages {
/** /**
* Prevent canonical redirect if full-post page is requested. * Prevent canonical redirect if full-post page is requested.
* *
* @param string $url * @param string $url Canonical URL.
* @uses this::is_view_all * @uses this::is_view_all
* @filter redirect_canonical * @filter redirect_canonical
* @return string or false * @return string|false
*/ */
public function filter_redirect_canonical( $url ) { public function filter_redirect_canonical( $url ) {
if ( $this->is_view_all() ) { if ( $this->is_view_all() ) {
...@@ -227,10 +257,9 @@ class view_all_posts_pages { ...@@ -227,10 +257,9 @@ class view_all_posts_pages {
* Modify post variables to display entire post on one page. * Modify post variables to display entire post on one page.
* *
* @global $pages, $more * @global $pages, $more
* @param object $post * @param WP_Post $post Post object.
* @uses this::is_view_all * @uses this::is_view_all
* @action the_post * @action the_post
* @return null
*/ */
public function action_the_post( $post ) { public function action_the_post( $post ) {
if ( $this->is_view_all() ) { if ( $this->is_view_all() ) {
...@@ -253,7 +282,7 @@ class view_all_posts_pages { ...@@ -253,7 +282,7 @@ class view_all_posts_pages {
* Automatic inclusion can be disabled by passing false through the vapp_display_link filter. * Automatic inclusion can be disabled by passing false through the vapp_display_link filter.
* *
* @global $post * @global $post
* @param array $args * @param array $args wp_link_pages arguments.
* @uses this::get_options * @uses this::get_options
* @uses apply_filters * @uses apply_filters
* @uses add_filter * @uses add_filter
...@@ -265,7 +294,7 @@ class view_all_posts_pages { ...@@ -265,7 +294,7 @@ class view_all_posts_pages {
$options = $this->get_options(); $options = $this->get_options();
if ( in_array( $post->post_type, $options['wlp_post_types'] ) && apply_filters( 'vapp_display_link', true, (int) $post->ID, $options, $post ) ) { if ( in_array( $post->post_type, $options['wlp_post_types'], true ) && apply_filters( 'vapp_display_link', true, (int) $post->ID, $options, $post ) ) {
add_filter( 'wp_link_pages_args', array( $this, 'filter_wp_link_pages_args' ), 999 ); add_filter( 'wp_link_pages_args', array( $this, 'filter_wp_link_pages_args' ), 999 );
} }
...@@ -276,7 +305,7 @@ class view_all_posts_pages { ...@@ -276,7 +305,7 @@ class view_all_posts_pages {
* Filter wp_link_pages arguments to append "View all" link to output. * Filter wp_link_pages arguments to append "View all" link to output.
* *
* @global $more * @global $more
* @param array $args * @param array $args wp_link_pages arguments.
* @uses this::get_options * @uses this::get_options
* @uses this::is_view_all * @uses this::is_view_all
* @uses esc_attr * @uses esc_attr
...@@ -289,7 +318,7 @@ class view_all_posts_pages { ...@@ -289,7 +318,7 @@ class view_all_posts_pages {
if ( is_array( $options ) ) { if ( is_array( $options ) ) {
extract( $options ); extract( $options );
// Set global $more to false so that wp_link_pages outputs links for all pages when viewing full post page // Set global $more to false so that wp_link_pages outputs links for all pages when viewing full post page.
if ( $this->is_view_all() ) { if ( $this->is_view_all() ) {
$GLOBALS['more'] = false; $GLOBALS['more'] = false;
} }
...@@ -297,7 +326,7 @@ class view_all_posts_pages { ...@@ -297,7 +326,7 @@ class view_all_posts_pages {
// Process link text, respecting pagelink parameter. // Process link text, respecting pagelink parameter.
$link_text = str_replace( '%', $wlp_text, $args['pagelink'] ); $link_text = str_replace( '%', $wlp_text, $args['pagelink'] );
// View all // View all.
$link = ' ' . $args['link_before']; $link = ' ' . $args['link_before'];
if ( $this->is_view_all() ) { if ( $this->is_view_all() ) {
...@@ -318,7 +347,7 @@ class view_all_posts_pages { ...@@ -318,7 +347,7 @@ class view_all_posts_pages {
* Filter the content if automatic link inclusion is selected. * Filter the content if automatic link inclusion is selected.
* *
* @global $post * @global $post
* @param string $content * @param string $content Post content.
* @uses this::get_options * @uses this::get_options
* @uses this::is_view_all * @uses this::is_view_all
* @uses esc_attr * @uses esc_attr
...@@ -337,11 +366,11 @@ class view_all_posts_pages { ...@@ -337,11 +366,11 @@ class view_all_posts_pages {
$link = '<p class="vapp_wrapper"><a class="' . esc_attr( $link_class ) . '" href="' . esc_url( $this->url() ) . '">' . esc_html( $link_text ) . '</a></p><!-- .vapp_wrapper -->'; $link = '<p class="vapp_wrapper"><a class="' . esc_attr( $link_class ) . '" href="' . esc_url( $this->url() ) . '">' . esc_html( $link_text ) . '</a></p><!-- .vapp_wrapper -->';
if ( 'above' == $link_position ) { if ( 'above' === $link_position ) {
$content = $link . $content; $content = $link . $content;
} elseif ( 'below' == $link_position ) { } elseif ( 'below' === $link_position ) {
$content = $content . $link; $content = $content . $link;
} elseif ( 'both' == $link_position ) { } elseif ( 'both' === $link_position ) {
$content = $link . $content . $link; $content = $link . $content . $link;
} }
} }
...@@ -354,7 +383,7 @@ class view_all_posts_pages { ...@@ -354,7 +383,7 @@ class view_all_posts_pages {
* *
* @global $post * @global $post
* @global $wp_rewrite * @global $wp_rewrite
* @param int $post_id * @param int|false $post_id Post ID.
* @uses is_singular * @uses is_singular
* @uses in_the_loop * @uses in_the_loop
* @uses get_permalink * @uses get_permalink
...@@ -377,7 +406,7 @@ class view_all_posts_pages { ...@@ -377,7 +406,7 @@ class view_all_posts_pages {
public function url( $post_id = false ) { public function url( $post_id = false ) {
$link = false; $link = false;
// Get link base specific to page type being viewed // Get link base specific to page type being viewed.
if ( is_singular() || in_the_loop() ) { if ( is_singular() || in_the_loop() ) {
$post_id = intval( $post_id ); $post_id = intval( $post_id );
...@@ -397,21 +426,7 @@ class view_all_posts_pages { ...@@ -397,21 +426,7 @@ class view_all_posts_pages {
$link = get_category_link( get_query_var( 'cat' ) ); $link = get_category_link( get_query_var( 'cat' ) );
} elseif ( is_tag() ) { } elseif ( is_tag() ) {
$link = get_tag_link( get_query_var( 'tag_id' ) ); $link = get_tag_link( get_query_var( 'tag_id' ) );
} } elseif ( is_tax() ) {
/** DISABLED FOR NOW AS PRINTING OF DATE-BASED ARCHIVES DOESN'T WORK YET
elseif ( is_date() ) {
$year = get_query_var( 'year' );
$monthnum = get_query_var( 'monthnum' );
$day = get_query_var( 'day' );
if ( $day )
$link = get_day_link( $year, $monthnum, $day );
elseif ( $monthnum )
$link = get_month_link( $year, $monthnum );
else
$link = get_year_link( $year );
}*/
elseif ( is_tax() ) {
$queried_object = get_queried_object(); $queried_object = get_queried_object();
if ( is_object( $queried_object ) && property_exists( $queried_object, 'taxonomy' ) && property_exists( $queried_object, 'term_id' ) ) { if ( is_object( $queried_object ) && property_exists( $queried_object, 'taxonomy' ) && property_exists( $queried_object, 'term_id' ) ) {
...@@ -419,7 +434,7 @@ class view_all_posts_pages { ...@@ -419,7 +434,7 @@ class view_all_posts_pages {
} }
} }
// If link base is set, build link // If link base is set, build link.
if ( false !== $link ) { if ( false !== $link ) {
global $wp_rewrite; global $wp_rewrite;
...@@ -443,9 +458,9 @@ class view_all_posts_pages { ...@@ -443,9 +458,9 @@ class view_all_posts_pages {
* @uses __ * @uses __
* @uses add_options_page * @uses add_options_page
* @action admin_menu * @action admin_menu
* @return null
*/ */
public function action_admin_menu() { public function action_admin_menu() {
/* translators: 1: Plugin name. */
add_options_page( sprintf( __( '%s Options', 'view_all_posts_pages' ), "View All Post's Pages" ), "View All Post's Pages", 'manage_options', $this->ns, array( $this, 'admin_options' ) ); add_options_page( sprintf( __( '%s Options', 'view_all_posts_pages' ), "View All Post's Pages" ), "View All Post's Pages", 'manage_options', $this->ns, array( $this, 'admin_options' ) );
} }
...@@ -460,7 +475,6 @@ class view_all_posts_pages { ...@@ -460,7 +475,6 @@ class view_all_posts_pages {
* @uses checked * @uses checked
* @uses esc_attr * @uses esc_attr
* @uses submit_button * @uses submit_button
* @return string
*/ */
public function admin_options() { public function admin_options() {
?> ?>
...@@ -475,101 +489,110 @@ class view_all_posts_pages { ...@@ -475,101 +489,110 @@ class view_all_posts_pages {
$post_types = $this->post_types_array(); $post_types = $this->post_types_array();
?> ?>
<h3><?php printf( __( '%s Options', 'view_all_posts_pages' ), '<em>wp_link_pages</em>' ); ?></h3> <h3>
<?php
/* translators: 1: WordPress function name. */
printf( wp_kses_post( __( '%s Options', 'view_all_posts_pages' ) ), '<em>wp_link_pages</em>' );
?>
</h3>
<p class="description"><?php _e( 'A "view all" link can be appended to WordPress\' standard page navigation using the options below.', 'view_all_posts_pages' ); ?></p> <p class="description"><?php esc_html_e( 'A "view all" link can be appended to WordPress\' standard page navigation using the options below.', 'view_all_posts_pages' ); ?></p>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row"><?php _e( 'Automatically append link to post\'s page navigation?', 'view_all_posts_pages' ); ?></th> <th scope="row"><?php esc_html_e( 'Automatically append link to post\'s page navigation?', 'view_all_posts_pages' ); ?></th>
<td> <td>
<input type="radio" name="<?php echo $this->settings_key; ?>[wlp]" id="wlp-true" value="1"<?php checked( $options['wlp'], true, true ); ?> /> <label for="wlp-true"><?php _e( 'Yes', 'view_all_posts_pages' ); ?></label><br /> <input type="radio" name="<?php echo esc_attr( $this->settings_key ); ?>[wlp]" id="wlp-true" value="1"<?php checked( $options['wlp'], true, true ); ?> /> <label for="wlp-true"><?php esc_html_e( 'Yes', 'view_all_posts_pages' ); ?></label><br />
<input type="radio" name="<?php echo $this->settings_key; ?>[wlp]" id="wlp-false" value="0"<?php checked( $options['wlp'], false, true ); ?> /> <label for="wlp-false"><?php _e( 'No', 'view_all_posts_pages' ); ?></label> <input type="radio" name="<?php echo esc_attr( $this->settings_key ); ?>[wlp]" id="wlp-false" value="0"<?php checked( $options['wlp'], false, true ); ?> /> <label for="wlp-false"><?php esc_html_e( 'No', 'view_all_posts_pages' ); ?></label>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"><label for="wlp_text"><?php _e( 'Link text:', 'view_all_posts_pages' ); ?></label></th> <th scope="row"><label for="wlp_text"><?php esc_html_e( 'Link text:', 'view_all_posts_pages' ); ?></label></th>
<td> <td>
<input type="text" name="<?php echo $this->settings_key; ?>[wlp_text]" id="wlp_text" value="<?php echo