Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 11 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
2 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
78 lignes
Copier tout
7 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
82 lignes
Copier tout
<?php
<?php
/**
/**
* @package View All Pages
* @package View All Pages
* @author Michael Pretty
* @author Michael Pretty
Copier
Copié
Copier
Copié
* @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)
Copier
Copié
Copier
Copié
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) {
Copier
Copié
Copier
Copié
// 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;
}
}
}
}
Copier
Copié
Copier
Copié
add_action('init', array(new View_All_Pages(), 'initialize'));
add_action('init', array(new View_All_Pages(), 'initialize'));
Différences enregistrées
Texte d'origine
Ouvrir un fichier
<?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'));
Texte modifié
Ouvrir un fichier
<?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'));
Trouver la différence