Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Untitled diff
Creato
11 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
2 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
78 linee
Copia tutti
7 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
82 linee
Copia tutti
<?php
<?php
/**
/**
* @package View All Pages
* @package View All Pages
* @author Michael Pretty
* @author Michael Pretty
Copia
Copiato
Copia
Copiato
* @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)
Copia
Copiato
Copia
Copiato
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) {
Copia
Copiato
Copia
Copiato
// 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;
}
}
}
}
Copia
Copiato
Copia
Copiato
add_action('init', array(new View_All_Pages(), 'initialize'));
add_action('init', array(new View_All_Pages(), 'initialize'));
Diff salvati
Testo originale
Apri 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'));
Testo modificato
Apri 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'));
Trovare la differenza