Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
Untitled diff
Erstellt
vor 11 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
2 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
78 Zeilen
Kopieren
7 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
82 Zeilen
Kopieren
<?php
<?php
/**
/**
* @package View All Pages
* @package View All Pages
* @author Michael Pretty
* @author Michael Pretty
Kopieren
Kopiert
Kopieren
Kopiert
* @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)
Kopieren
Kopiert
Kopieren
Kopiert
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) {
Kopieren
Kopiert
Kopieren
Kopiert
// 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;
}
}
}
}
Kopieren
Kopiert
Kopieren
Kopiert
add_action('init', array(new View_All_Pages(), 'initialize'));
add_action('init', array(new View_All_Pages(), 'initialize'));
Gespeicherte Diffs
Originaltext
Datei öffnen
<?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'));
Bearbeitung
Datei öffnen
<?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'));
Unterschied finden