Commit ea08c00c authored by Erick Hitter's avatar Erick Hitter

Merge branch 'add/ci' into 'master'

Add PHPCS and update accordingly

See merge request !1
parents 5b04fadc 4481d54a
Pipeline #476 passed with stage
in 2 minutes and 25 seconds
# A set of files you probably don't want in your distribution
# This file is for unifying the coding style for different editors and IDEs
# WordPress Coding Standards
root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
indent_style = space
indent_size = 2
end_of_line = crlf
# Configure mysql service (
MYSQL_DATABASE: wordpress_tests
- $HOME/.composer
- /root/.composer
# Set up WordPress tests
- bash bin/ $MYSQL_DATABASE root $MYSQL_ROOT_PASSWORD mysql latest true
# PHPUnit
- |
if [[ $(php -v) =~ "PHP 7." ]]; then
composer global require "phpunit/phpunit=6.1.*"
composer global require "phpunit/phpunit=4.8.*"
# Install PHPCS and WPCS
- composer global require automattic/vipwpcs
- composer global require phpcompatibility/phpcompatibility-wp
- phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs,$HOME/.composer/vendor/phpcompatibility/php-compatibility,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp
- mysql:5.6
- find . -type "f" -iname "*.php" | xargs -L "1" php -l
- phpcs -n
- phpunit
<?xml version="1.0"?>
<ruleset name="View All Posts Pages">
<description>Generally-applicable sniffs for WordPress plugins.</description>
<!-- What to scan -->
<!-- How to scan -->
<!-- Usage instructions: -->
<!-- Annotated ruleset: -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
<!-- Rules: Check PHP version compatibility -->
<!-- -->
<config name="testVersion" value="7.2-"/>
<!-- -->
<rule ref="PHPCompatibilityWP"/>
<!-- Rules: WordPress Coding Standards -->
<!-- -->
<!-- -->
<config name="minimum_supported_wp_version" value="3.2.1"/>
<rule ref="WordPress" />
<rule ref="WordPressVIPMinimum" />
<rule ref="WordPress-VIP-Go" />
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
<property name="prefixes" type="array" value="view_all_posts_pages,vapp"/>
<rule ref="WordPress.WP.I18n">
<!-- Value: replace the text domain used. -->
<property name="text_domain" type="array" value="view_all_posts_pages"/>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<property name="blank_line_check" value="true"/>
module.exports = function( grunt ) {
'use strict';
// Project configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
addtextdomain: {
options: {
textdomain: 'view_all_posts_pages',
update_all_domains: {
options: {
updateDomains: true
src: [ '*.php', '**/*.php', '!\.git/**/*', '!bin/**/*', '!node_modules/**/*', '!tests/**/*' ]
wp_readme_to_markdown: {
your_target: {
files: {
'': 'readme.txt'
makepot: {
target: {
options: {
domainPath: '/languages',
exclude: [ '\.git/*', 'bin/*', 'node_modules/*', 'tests/*' ],
mainFile: 'view-all-posts-pages.php',
potFilename: 'view-all-posts-pages.pot',
potHeaders: {
poedit: true,
'x-poedit-keywordslist': true
type: 'wp-plugin',
updateTimestamp: true
} );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );
grunt.registerTask( 'default', [ 'i18n','readme' ] );
grunt.registerTask( 'i18n', ['addtextdomain', 'makepot'] );
grunt.registerTask( 'readme', ['wp_readme_to_markdown'] );
grunt.util.linefeed = '\n';
# View All Post's Pages #
**Contributors:** ethitter, thinkoomph
**Donate link:**
**Tags:** view all, pages, paged, paged post, multipage, single view, single page, wp_link_pages, nextpage, next page, quicktag
**Requires at least:** 3.2.1
**Tested up to:** 5.0
**Stable tag:** 0.9.1
**License:** GPLv2 or later
**License URI:**
Provides a "view all" (single page) option for content paged using WordPress' &lt;!--nextpage--&gt; Quicktag (multipage posts).
## Description ##
Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts).
Your theme must use `wp_link_pages()` to generate post page links, or you must use either the automatic or manual link capabilities provided in the plugin.
**IMPORTANT**: There are certain plugins that may interfere with this plugin's functionality. See the **FAQ** for more information.
## Installation ##
1. Upload view-all-posts-pages.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 ##
### Links don't work ###
First, navigate to Options > Permalinks in WP Admin, click *Save Changes*, and try again.
If clicking on a 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 []( and leave a comment detailing the problem.
### How do I add a link to my template? ###
The function `vapp_the_link` will add a link to the full-content version of whatever page it appears on. This function accepts the following arguments:
* **$link_text**: Set to text that should appear for the link. Defaults to *View All*.
* **$class**: Specifies the CSS class for the link. Defaults to *vapp*.
### 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 View All Post's Pages' ability to display full content. Both must be disabled, and the site's rewrite rules regenerated (by visiting Options > Permalinks and clicking *Save Changes*), for View All Post's Pages to function.
## Changelog ##
### 0.9.2 ###
* Introduce PHPCS tests
* Update plugin based on PHPCS results
### 0.9.1 ###
* Security update: correct misuse of `add_query_arg()` as identified by Sucuri:
### 0.9 ###
* Move conditional registration of some filters to `init`, both to ensure external code can interact with filters and to avoid PHP notices.
### 0.8.1 ###
* Correct translation implementation issue introduced in v0.8.
### 0.8 ###
* When WordPress determines a request is a 404, don't activate the plugin's functionality.
* Convert the plugin to a singleton.
* Audit entire plugin for translation readyness.
* Correct phpdoc.
### 0.7 ###
* Further ensure that WordPress doesn't think a post is paged when viewing the full post content unpaged. Ensures that code checking the `$multipage` variable will function properly. Props @batmoo.
### 0.6.1 ###
* Revert change in is_view_all() method made in version 0.6 as it breaks the method, rendering the plugin inoperable.
### 0.6 ###
* 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.
### 0.5 ###
* Change how post content is modified for View All display. Rather than using the `the_content` filter, global variables are overridden in the `the_post` action. Ensures that infinite loops don't result from shortcode processing and other uses of the `the_content` filter. Props to the VIP Support team (batmoo) and stevenkword.
* Introduces the `vapp_display_link` filter to allow plugins and themes to suppress the automatic View All link on specific posts. Return `false` to suppress the link. Filter also passes post ID, plugin options, and post object.
### 0.4.1 ###
* Eliminate use of plugins_loaded action since plugin has no dependencies on other plugins. All code previously located in the associated method has been moved to the class's constructor. Props danielbachhuber.
### 0.4 ###
* Add filter to disable rewrite rules notice.
* Apply esc_html() to link text during output.
* Update code to conform to WordPress Coding Standards.
### 0.3 ###
* Simplify rewrite rule creation, resolving 404 errors in most cases.
### 0.2 ###
* Change how wp_link_pages arguments are filtered to better support as-needed filtering.
### 0.1 ###
* Initial release
## 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 ###
Security update: correct misuse of `add_query_arg()` as identified by Sucuri:
### 0.9 ###
Recommended update for anyone hoping to use plugin's filters to modify its behaviour.
### 0.8.1 ###
Recommended upgrade for anyone translating plugin's interface.
### 0.8 ###
Plugin won't unnecessarily execute its functionality if no posts are available and is now more thoroughly translatable.
### 0.7 ###
Further ensures plugins and themes correctly see a "View All" page as full post content.
### 0.6.1 ###
Resolves a problem where requests for view-all templates redirect to the article.
### 0.6 ###
Adds better support for sites that use verbose page rules, resolving situations where requests for view-all template redirect to the post.
### 0.5 ###
Infinite loops may result from previous method used to display entire post's content for the View All display. This update eliminates that possibility by using the the_post action rather than the the_content filter. Props to the VIP Support team (batmoo) and stevenkword.
### 0.4.1 ###
Eliminates use of plugins_loaded action since plugin has no dependencies on other plugins. All code previously located in the associated method has been moved to the class's constructor. props danielbachhuber.
### 0.4 ###
Adds filter to disable rewrite rules notice. Also applies esc_html() to link text when output since HTML isn't permitted in the link text.
### 0.3 ###
Simplifies rewrite rules, resolving 404 errors in most cases.
### 0.2 ###
Introduces helper function for wp_link_pages arguments and split filtering from plugin options.
#!/usr/bin/env bash
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
exit 1
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
# http serves a single offer, whereas https serves multiple. we only want one
download /tmp/wp-latest.json
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
if [[ -z "$LATEST_VERSION" ]]; then
echo "Latest WordPress version could not be found"
exit 1
set -ex
install_wp() {
if [ -d $WP_CORE_DIR ]; then
mkdir -p $WP_CORE_DIR
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
mkdir -p $TMPDIR/wordpress-nightly
download $TMPDIR/wordpress-nightly/
unzip -q $TMPDIR/wordpress-nightly/ -d $TMPDIR/wordpress-nightly/
mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
if [ $WP_VERSION == 'latest' ]; then
local ARCHIVE_NAME='latest'
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
# https serves multiple offers, whereas http serves single.
download $TMPDIR/wp-latest.json
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
# otherwise, scan the releases and get the most up to date minor version of the major release
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
if [[ -z "$LATEST_VERSION" ]]; then
local ARCHIVE_NAME="wordpress-$WP_VERSION"
local ARCHIVE_NAME="wordpress-$WP_VERSION"
download${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
download $WP_CORE_DIR/wp-content/db.php
install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i.bak'
local ioption='-i'
# set up testing suite if it doesn't yet exist
if [ ! -d $WP_TESTS_DIR ]; then
# set up testing suite
mkdir -p $WP_TESTS_DIR
svn co --quiet${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
if [ ! -f wp-tests-config.php ]; then
download${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
# remove all forward slashes in the end
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
install_db() {
if [ ${SKIP_DB_CREATE} = "true" ]; then
return 0
# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
local DB_SOCK_OR_PORT=${PARTS[1]};
local EXTRA=""
if ! [ -z $DB_HOSTNAME ] ; then
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
EXTRA=" --socket=$DB_SOCK_OR_PORT"
elif ! [ -z $DB_HOSTNAME ] ; then
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
# Copyright (C) 2019 Erick Hitter & Oomph, Inc.
# This file is distributed under the same license as the View All Posts Pages package.
msgid ""
msgstr ""
"Project-Id-Version: View All Posts Pages 0.9.2\n"
"Report-Msgid-Bugs-To: "
"POT-Creation-Date: 2019-02-05 18:43:53+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 <>\n"
"X-Generator: grunt-wp-i18n 0.5.4\n"
"X-Poedit-KeywordsList: "
"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"
#: view-all-posts-pages.php:179 view-all-posts-pages.php:186
msgid "View All"
msgstr ""
#: view-all-posts-pages.php:464 view-all-posts-pages.php:495
#. translators: 1: Plugin name.
#. translators: 1: WordPress function name.
msgid "%s Options"
msgstr ""
#: view-all-posts-pages.php:499
msgid ""
"A \"view all\" link can be appended to WordPress' standard page navigation "
"using the options below."
msgstr ""
#: view-all-posts-pages.php:503
msgid "Automatically append link to post's page navigation?"
msgstr ""
#: view-all-posts-pages.php:505 view-all-posts-pages.php:548
msgid "Yes"
msgstr ""
#: view-all-posts-pages.php:506 view-all-posts-pages.php:549
msgid "No"
msgstr ""
#: view-all-posts-pages.php:510 view-all-posts-pages.php:576
msgid "Link text:"
msgstr ""
#: view-all-posts-pages.php:516 view-all-posts-pages.php:582
msgid "Link's CSS class(es):"
msgstr ""
#: view-all-posts-pages.php:520 view-all-posts-pages.php:586
msgid ""
"Be aware that Internet Explorer will only interpret the first two CSS "
msgstr ""
#: view-all-posts-pages.php:524 view-all-posts-pages.php:561
msgid "Display automatically on:"
msgstr ""
#: view-all-posts-pages.php:540
msgid "Standalone Link Options"
msgstr ""
#: view-all-posts-pages.php:542
msgid ""
"In addition to appending the \"view all\" link to WordPress' standard "
"navigation, link(s) can be added above and below post content."
msgstr ""
#: view-all-posts-pages.php:546
msgid "Automatically add links based on settings below?"
msgstr ""
#: view-all-posts-pages.php:553
msgid "Automatically place link:"
msgstr ""
#: view-all-posts-pages.php:555
msgid "Above content"
msgstr ""
#: view-all-posts-pages.php:556
msgid "Below content"
msgstr ""
#: view-all-posts-pages.php:557
msgid "Above and below content"
msgstr ""
#: view-all-posts-pages.php:590
msgid "Link's priority:"
msgstr ""
#: view-all-posts-pages.php:594
msgid ""
"Priority determines when the link is added to a post's content. You can use "
"the above setting to modulate the link's placement."
msgstr ""
#: view-all-posts-pages.php:595
msgid ""
"The default value is <strong>10</strong>. Lower values mean the link will "
"be added earlier, while higher values will add the link later."
msgstr ""
#: view-all-posts-pages.php:739
msgid "View All Post's Pages"
msgstr ""
#: view-all-posts-pages.php:744
#. translators: 1: Permalinks settings page URL.
msgid ""
"You must refresh your site's permalinks before <em>View All Post's "
"Pages</em> 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 ""
#: 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."
msgstr ""
#. Plugin Name of the plugin/theme
msgid "View All Posts Pages"
msgstr ""
#. Plugin URI of the plugin/theme
msgid ""
msgstr ""
#. Description of the plugin/theme
msgid ""
"Provides a \"view all\" (single page) option for posts, pages, and custom "
"post types paged using WordPress' <a "
"href=\"\" "
"target=\"_blank\"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> "