Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
11 年前
差異永不過期
清除
匯出
分享
解釋
2 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
78 行
全部複製
7 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
82 行
全部複製
<?php
<?php
/**
/**
* @package View All Pages
* @package View All Pages
* @author Michael Pretty
* @author Michael Pretty
複製
已複製
複製
已複製
* @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)
複製
已複製
複製
已複製
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) {
複製
已複製
複製
已複製
// 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;
}
}
}
}
複製
已複製
複製
已複製
add_action('init', array(new View_All_Pages(), 'initialize'));
add_action('init', array(new View_All_Pages(), 'initialize'));
已保存差異
原始文本
開啟檔案
<?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'));
更改後文本
開啟檔案
<?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'));
尋找差異