Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
11 years ago
Diff never expires
Clear
Export
Share
Explain
2 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
78 lines
Copy
7 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
82 lines
Copy
<?php
<?php
/**
/**
* @package View All Pages
* @package View All Pages
* @author Michael Pretty
* @author Michael Pretty
Copy
Copied
Copy
Copied
* @version
0.1.0
* @version
99
*/
*/
/*
/*
Plugin Name: View All Pages
Plugin Name: View All Pages
Plugin URI: http://vocecommunications.com/services/web-development/wordpress/plugins/view-all-pages/
Plugin URI: http://vocecommunications.com/services/web-development/wordpress/plugins/view-all-pages/
Description: Adds a "All Pages" link to the wp_link_pages output that will show all pages for a post on singe page.
Description: Adds a "All Pages" link to the wp_link_pages output that will show all pages for a post on singe page.
Author: Michael Pretty (prettyboymp)
Author: Michael Pretty (prettyboymp)
Copy
Copied
Copy
Copied
Version:
0.1.1
Version:
99
Author URI: http://voceconnect.com
Author URI: http://voceconnect.com
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
*/
class View_All_Pages {
class View_All_Pages {
public function initialize() {
public function initialize() {
add_action('parse_query', array($this, 'on_parse_query'));
add_action('parse_query', array($this, 'on_parse_query'));
add_action('the_post', array($this, 'on_action_the_post'));
add_action('the_post', array($this, 'on_action_the_post'));
add_filter('wp_link_pages_args', array($this, 'filter_wp_link_pages_args'));
add_filter('wp_link_pages_args', array($this, 'filter_wp_link_pages_args'));
}
}
/**
/**
* Sets up a special query_var to mark to view all pages before query_posts converts the empty page var into 0
* Sets up a special query_var to mark to view all pages before query_posts converts the empty page var into 0
* making it indistinguishable
* making it indistinguishable
*
*
* @param WP_Query $wp_query
* @param WP_Query $wp_query
*/
*/
public function on_parse_query($wp_query) {
public function on_parse_query($wp_query) {
if(isset($wp_query->query_vars['page']) && '0' === trim($wp_query->query_vars['page'], '/')) {
if(isset($wp_query->query_vars['page']) && '0' === trim($wp_query->query_vars['page'], '/')) {
$wp_query->query_vars['all-pages'] = true;
$wp_query->query_vars['all-pages'] = true;
}
}
}
}
public function on_action_the_post($post) {
public function on_action_the_post($post) {
global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages;
global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages;
if(true === get_query_var('all-pages') && $multipage) {
if(true === get_query_var('all-pages') && $multipage) {
$page = 0;
$page = 0;
$pages[-1] = $post->post_content; //we're setting it to -1 since WP uses $page - 1 to pull from the pages array
$pages[-1] = $post->post_content; //we're setting it to -1 since WP uses $page - 1 to pull from the pages array
}
}
}
}
public function filter_wp_link_pages_args($r) {
public function filter_wp_link_pages_args($r) {
Copy
Copied
Copy
Copied
// Added by Bill Erickson to optionally disable this feature
if( isset( $r['show_all_link'] ) && !$r['show_all_link'] )
return $r;
global $multipage, $post, $more, $page;
global $multipage, $post, $more, $page;
if($multipage) {
if($multipage) {
$text = str_replace('%', isset($r['allpageslink']) ? $r['allpageslink'] : __('All Pages', 'view-all-pages'), $r['pagelink']);
$text = str_replace('%', isset($r['allpageslink']) ? $r['allpageslink'] : __('All Pages', 'view-all-pages'), $r['pagelink']);
if(true === get_query_var('all-pages')) {
if(true === get_query_var('all-pages')) {
$link = '';
$link = '';
$link_close = '';
$link_close = '';
} else {
} else {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) {
$link = '<a href="' . add_query_arg('page', 0, get_permalink()) . '">';
$link = '<a href="' . add_query_arg('page', 0, get_permalink()) . '">';
} elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) {
} elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) {
$link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/0', 'single_paged'). '">';
$link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/0', 'single_paged'). '">';
} else {
} else {
$link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('0', 'single_paged') . '">';
$link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('0', 'single_paged') . '">';
}
}
$link_close = '</a>';
$link_close = '</a>';
}
}
$all_pages_link = "{$link}{$r['link_before']}{$text}{$r['link_after']}{$link_close}";
$all_pages_link = "{$link}{$r['link_before']}{$text}{$r['link_after']}{$link_close}";
if ( 'number' == $r['next_or_number']) {
if ( 'number' == $r['next_or_number']) {
$r['after'] = ' ' . $all_pages_link . $r['after'];
$r['after'] = ' ' . $all_pages_link . $r['after'];
} else {
} else {
$r['before'] .= $all_pages_link;
$r['before'] .= $all_pages_link;
if(true === get_query_var('all-pages')) {
if(true === get_query_var('all-pages')) {
//hack to keep Previous page link from going to /-1/ since WP checks if the $page == 1 instead of $page < 2
//hack to keep Previous page link from going to /-1/ since WP checks if the $page == 1 instead of $page < 2
$page = 1;
$page = 1;
$r['before'] .= '<a href="' . get_permalink() . '">' .$r['link_before']. (isset($r['firstpagelink']) ? $r['firstpagelink'] : __('First page', 'view-all-pages') ) . $r['link_after'] . '</a>';
$r['before'] .= '<a href="' . get_permalink() . '">' .$r['link_before']. (isset($r['firstpagelink']) ? $r['firstpagelink'] : __('First page', 'view-all-pages') ) . $r['link_after'] . '</a>';
}
}
}
}
}
}
return $r;
return $r;
}
}
}
}
Copy
Copied
Copy
Copied
add_action('init', array(new View_All_Pages(), 'initialize'));
add_action('init', array(new View_All_Pages(), 'initialize'));
Saved diffs
Original text
Open file
<?php /** * @package View All Pages * @author Michael Pretty * @version 0.1.0 */ /* Plugin Name: View All Pages Plugin URI: http://vocecommunications.com/services/web-development/wordpress/plugins/view-all-pages/ Description: Adds a "All Pages" link to the wp_link_pages output that will show all pages for a post on singe page. Author: Michael Pretty (prettyboymp) Version: 0.1.1 Author URI: http://voceconnect.com License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ class View_All_Pages { public function initialize() { add_action('parse_query', array($this, 'on_parse_query')); add_action('the_post', array($this, 'on_action_the_post')); add_filter('wp_link_pages_args', array($this, 'filter_wp_link_pages_args')); } /** * Sets up a special query_var to mark to view all pages before query_posts converts the empty page var into 0 * making it indistinguishable * * @param WP_Query $wp_query */ public function on_parse_query($wp_query) { if(isset($wp_query->query_vars['page']) && '0' === trim($wp_query->query_vars['page'], '/')) { $wp_query->query_vars['all-pages'] = true; } } public function on_action_the_post($post) { global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages; if(true === get_query_var('all-pages') && $multipage) { $page = 0; $pages[-1] = $post->post_content; //we're setting it to -1 since WP uses $page - 1 to pull from the pages array } } public function filter_wp_link_pages_args($r) { global $multipage, $post, $more, $page; if($multipage) { $text = str_replace('%', isset($r['allpageslink']) ? $r['allpageslink'] : __('All Pages', 'view-all-pages'), $r['pagelink']); if(true === get_query_var('all-pages')) { $link = ''; $link_close = ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) { $link = '<a href="' . add_query_arg('page', 0, get_permalink()) . '">'; } elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) { $link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/0', 'single_paged'). '">'; } else { $link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('0', 'single_paged') . '">'; } $link_close = '</a>'; } $all_pages_link = "{$link}{$r['link_before']}{$text}{$r['link_after']}{$link_close}"; if ( 'number' == $r['next_or_number']) { $r['after'] = ' ' . $all_pages_link . $r['after']; } else { $r['before'] .= $all_pages_link; if(true === get_query_var('all-pages')) { //hack to keep Previous page link from going to /-1/ since WP checks if the $page == 1 instead of $page < 2 $page = 1; $r['before'] .= '<a href="' . get_permalink() . '">' .$r['link_before']. (isset($r['firstpagelink']) ? $r['firstpagelink'] : __('First page', 'view-all-pages') ) . $r['link_after'] . '</a>'; } } } return $r; } } add_action('init', array(new View_All_Pages(), 'initialize'));
Changed text
Open file
<?php /** * @package View All Pages * @author Michael Pretty * @version 99 */ /* Plugin Name: View All Pages Plugin URI: http://vocecommunications.com/services/web-development/wordpress/plugins/view-all-pages/ Description: Adds a "All Pages" link to the wp_link_pages output that will show all pages for a post on singe page. Author: Michael Pretty (prettyboymp) Version: 99 Author URI: http://voceconnect.com License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ class View_All_Pages { public function initialize() { add_action('parse_query', array($this, 'on_parse_query')); add_action('the_post', array($this, 'on_action_the_post')); add_filter('wp_link_pages_args', array($this, 'filter_wp_link_pages_args')); } /** * Sets up a special query_var to mark to view all pages before query_posts converts the empty page var into 0 * making it indistinguishable * * @param WP_Query $wp_query */ public function on_parse_query($wp_query) { if(isset($wp_query->query_vars['page']) && '0' === trim($wp_query->query_vars['page'], '/')) { $wp_query->query_vars['all-pages'] = true; } } public function on_action_the_post($post) { global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages; if(true === get_query_var('all-pages') && $multipage) { $page = 0; $pages[-1] = $post->post_content; //we're setting it to -1 since WP uses $page - 1 to pull from the pages array } } public function filter_wp_link_pages_args($r) { // Added by Bill Erickson to optionally disable this feature if( isset( $r['show_all_link'] ) && !$r['show_all_link'] ) return $r; global $multipage, $post, $more, $page; if($multipage) { $text = str_replace('%', isset($r['allpageslink']) ? $r['allpageslink'] : __('All Pages', 'view-all-pages'), $r['pagelink']); if(true === get_query_var('all-pages')) { $link = ''; $link_close = ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) { $link = '<a href="' . add_query_arg('page', 0, get_permalink()) . '">'; } elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) { $link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/0', 'single_paged'). '">'; } else { $link = '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('0', 'single_paged') . '">'; } $link_close = '</a>'; } $all_pages_link = "{$link}{$r['link_before']}{$text}{$r['link_after']}{$link_close}"; if ( 'number' == $r['next_or_number']) { $r['after'] = ' ' . $all_pages_link . $r['after']; } else { $r['before'] .= $all_pages_link; if(true === get_query_var('all-pages')) { //hack to keep Previous page link from going to /-1/ since WP checks if the $page == 1 instead of $page < 2 $page = 1; $r['before'] .= '<a href="' . get_permalink() . '">' .$r['link_before']. (isset($r['firstpagelink']) ? $r['firstpagelink'] : __('First page', 'view-all-pages') ) . $r['link_after'] . '</a>'; } } } return $r; } } add_action('init', array(new View_All_Pages(), 'initialize'));
Find difference