Changeset 3017188
- Timestamp:
- 01/03/2024 09:19:20 PM (7 months ago)
- Location:
- wp-rollback
- Files:
-
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
wp-rollback/tags/2.0.4/build/admin.asset.php
r3015797 r3017188 1 <?php return array('dependencies' => array('wp-components', 'wp-dom-ready', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-url'), 'version' => ' 9ec969e696dc68bb2222');1 <?php return array('dependencies' => array('wp-components', 'wp-dom-ready', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-url'), 'version' => ''); -
wp-rollback/tags/2.0.4/build/admin.js
r3015797 r3017188 1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.components,l=window.wp.i18n, n=window.wp.domReady;var r=e.n(n);const s=window.wp.htmlEntities,o=window.wp.url,c=({text:e})=>{const[n,r]=(0,t.useState)(!1),s=e.length>=200;return(0,t.createElement)("div",{className:"wpr-theme-description"},(0,t.createElement)("p",null,n||!s?e:`${e.substring(0,200)}...`,s&&(0,t.createElement)("span",{className:"wpr-expand-text",onClick:()=>{r(!n)}},n?(0,t.createElement)("span",null,(0,t.createElement)(a.Dashicon,{icon:"arrow-up"}),(0,l.__)("Read less","wp-rollback")):(0,t.createElement)("span",null,(0,t.createElement)(a.Dashicon,{icon:"arrow-down"}),(0,l.__)("Read more","wp-rollback")))))},i=()=>{const[e,n]=(0,t.useState)(!0),[r,i]=(0,t.useState)(!1),[m,p]=(0,t.useState)(null),w=(0,o.getQueryArgs)(window.location.search),[d,u]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[E,_]=(0,t.useState)(w.current_version),{adminUrl:b,referrer:v}=wprData,k=()=>u(!1);function N(e,t){var a=new Image;a.onload=()=>t(!0),a.onerror=()=>t(!1),a.src=e}return(0,t.useEffect)((()=>{let e=`${wprData.baseUrl}/wp-json/wp-rollback/v1/fetch-info/?type=${w.type}&slug=${"theme"===w.type?w.theme_file:w.plugin_slug}`;fetch(e).then((e=>e.json())).then((e=>{i(e),n(!1)})).catch((e=>{console.error("Error fetching data:",e)}))}),[]),(0,t.useEffect)((()=>{r&&r.slug&&N(`https://ps.w.org/${r.slug}/assets/icon-128x128.png`,(e=>{e?p(`https://ps.w.org/${r.slug}/assets/icon-128x128.png`):N(`https://ps.w.org/${r.slug}/assets/icon-128x128.jpg`,(e=>{e?p(`https://ps.w.org/${r.slug}/assets/icon-128x128.jpg`):N(`https://ps.w.org/${r.slug}/assets/icon-128x128.gif`,(e=>{p(e?`https://ps.w.org/${r.slug}/assets/icon-128x128.gif`:wprData.avatarFallback)}))}))}))}),[r]),e?(0,t.createElement)("div",{id:"wpr-wrap",className:"wpr-wrap"},(0,t.createElement)("div",{className:"wpr-loading-content"},(0,t.createElement)("div",{className:"wpr-loading-text"},(0,t.createElement)(a.Spinner,{style:{height:"calc(4px * 20)",width:"calc(4px * 20)"}}),(0,t.createElement)("p",null,(0,l.__)("Loading...","wp-rollback"))))):r.message?(0,t.createElement)("div",{id:"wpr-wrap",className:"wpr-wrap"},(0,t.createElement)("div",{className:"wpr-api-error"},(0,t.createElement)("h1",null,r.code),(0,t.createElement)("p",null,r.message))):(console.log(r),console.log(w),(0,t.createElement)("div",{className:"wpr-wrapper"},(0,t.createElement)("div",{className:"wpr-logo-wrap"},(0,t.createElement)("div",{className:"wpr-logo"},(0,t.createElement)("h1",null,(0,l.__)("WP Rollback","wp-rollback")),(0,t.createElement)("a",{href:"https://wprollback.com/",target:"_blank"},(0,t.createElement)("img",{src:wprData.logo,width:250,height:"auto",alt:"WP Rollback"}))),(0,t.createElement)("p",{className:"wpr-intro-text"},(0,l.__)("Select which version you would like to rollback to from the releases listed below.","wp-rollback"))),(0,t.createElement)("div",{className:"wpr-content-wrap"},r.banners&&"plugin"===w.type&&(r.banners.high||r.banners.low)&&(0,t.createElement)("div",{className:"wpr-content-banner"},(0,t.createElement)("img",{src:!1!==r.banners.high?r.banners.high:r.banners.low,width:800,height:"auto",className:"wpr-plugin-banner",alt:r.name})),(0,t.createElement)("div",{className:"wpr-content-header"},r.screenshot_url&&"theme"===w.type&&(0,t.createElement)("div",{className:"wpr-content-banner wpr-content-banner__theme"},(0,t.createElement)("img",{src:r.screenshot_url,width:240,height:180,className:"wpr-theme-screenshot",alt:r.name})),m&&"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-plugin-avatar-wrap"},(0,t.createElement)("img",{src:m,width:96,height:96,className:"wpr-plugin-avatar",alt:r.name})),(0,t.createElement)("div",{className:"wpr-plugin-info"},(0,t.createElement)("h2",{className:"wpr-plugin-name"},"plugin"===w.type&&(0,t.createElement)("a",{href:`https://wordpress.org/plugins/${r.slug}/`,target:"_blank",className:"wpr-heading-link",alt:(0,l.sprintf)((0,l.__)("View %s on WordPress.org","wp-rollback"),r.name)},(0,s.decodeEntities)(r.name),(0,t.createElement)(a.Dashicon,{icon:"external"})),"theme"===w.type&&(0,t.createElement)("a",{href:r.homepage,target:"_blank",className:"wpr-heading-link",alt:(0,l.sprintf)((0,l.__)("View %s on WordPress.org","wp-rollback"),r.name)},(0,s.decodeEntities)(r.name),(0,t.createElement)(a.Dashicon,{icon:"external"}))),"theme"===w.type&&r.sections.description&&(0,t.createElement)("div",{className:"wpr-theme-description"},(0,t.createElement)(c,{text:r.sections.description})),(0,t.createElement)("div",{className:"wpr-pill-wrap"},(0,t.createElement)("div",{className:"wpr-pill wpr-pill__black"},(0,t.createElement)("span",{className:"wpr-pill-text"},(0,l.__)("Installed version:","wp-rollback")," ",(0,t.createElement)("strong",null,w.current_version))),"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-pill wpr-pill__author"},(0,t.createElement)("span",{className:"wpr-pill-text"},(0,l.__)("Plugin author:","wp-rollback")," ",(0,t.createElement)("span",{className:"wpr-pill__link",dangerouslySetInnerHTML:{__html:r.author}}))))),(0,t.createElement)("div",{className:"wpr-meta-wrap"},"theme"===w.type&&(0,t.createElement)("div",{className:"wpr-meta-item wpr-meta-item__author-wrap"},(0,t.createElement)("h3",null,(0,l.__)("Theme Author","wp-rollback")),(0,t.createElement)("div",{className:"wpr-theme-author-inner"},(0,t.createElement)("img",{src:r.author.avatar,width:64,height:64}),(0,t.createElement)("div",{className:"wpr-theme-author-info"},(0,t.createElement)("a",{href:r.author.author_url,target:"_blank"},r.author.display_name)))),"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-meta-wrap__plugins"},(0,t.createElement)("div",{className:"wpr-view-changelog"},(0,t.createElement)(a.Button,{isSecondary:!0,onClick:()=>g(!0),className:"wpr-version-changelog"},(0,l.__)("View Changelog","wp-rollback"))),(0,t.createElement)("h3",null,(0,l.__)("Last Updated","wp-rollback")),(0,t.createElement)("div",{className:"wpr-updater-info"},(0,t.createElement)(a.Dashicon,{icon:"clock"}),(0,t.createElement)("span",{className:"wpr-plugin-lastupdate"},function(e){let t=e.replace("am"," AM").replace("pm"," PM").replace(" GMT","");t=new Date(t).toLocaleString("en-US",{timeZone:"GMT"});const a=new Date(t);if(isNaN(a.getTime()))return console.error("Invalid date:",t),"Invalid date";const n=new Date,r=Math.floor((n-a)/1e3);return r<60?(0,l.sprintf)((0,l._n)("%s second ago","%s seconds ago",r,"wp-rollback"),r):r<3600?(0,l.sprintf)((0,l._n)("%s minute ago","%s minutes ago",Math.floor(r/60),"wp-rollback"),Math.floor(r/60)):r<86400?(0,l.sprintf)((0,l._n)("%s hour ago","%s hours ago",Math.floor(r/3600),"wp-rollback"),Math.floor(r/3600)):r<2592e3?(0,l.sprintf)((0,l._n)("%s day ago","%s days ago",Math.floor(r/86400),"wp-rollback"),Math.floor(r/86400)):r<31536e3?(0,l.sprintf)((0,l._n)("%s month ago","%s months ago",Math.floor(r/2592e3),"wp-rollback"),Math.floor(r/2592e3)):(0,l.sprintf)((0,l._n)("%s year ago","%s years ago",Math.floor(r/31536e3),"wp-rollback"),Math.floor(r/31536e3))}(r.last_updated)))))),(0,t.createElement)("div",{className:"wpr-versions-container"},Object.keys(r.versions).filter((e=>"trunk"!==e)).sort(((e,t)=>t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}))).map(((e,a)=>(0,t.createElement)("div",{key:a,className:"wpr-version-wrap "+(E===e?"wpr-active-row":"")},(0,t.createElement)("div",{className:"wpr-version-radio-wrap"},(0,t.createElement)("label",{htmlFor:"version-"+a},(0,t.createElement)("input",{id:"version-"+a,type:"radio",name:"version",value:e,checked:E===e,onChange:()=>_(e)}),(0,t.createElement)("span",{className:"wpr-version-lineitem"},e),w.current_version===e&&"trunk"!==e&&(0,t.createElement)("span",{className:"wpr-version-lineitem-current"},(0,l.__)("Currently Installed","wp-rollback")))))))),(0,t.createElement)("div",{className:"wpr-button-wrap"},(0,t.createElement)(a.Button,{isPrimary:!0,onClick:()=>u(!0),className:"wpr-button-submit"},(0,l.__)("Rollback","wp-rollback")),(0,t.createElement)(a.Button,{isSecondary:!0,onClick:()=>window.location.href=v,className:"wpr-button-cancel"},(0,l.__)("Cancel","wp-rollback"))),h&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Plugin Changelog","wp-rollback"),onRequestClose:()=>g(!1),disabled:!1===E,className:"wpr-modal wpr-modal__changelog",icon:(0,t.createElement)(a.Dashicon,{icon:"hammer"})},(0,t.createElement)("div",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:r.sections.changelog}})),d&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Are you sure you want to proceed?","wp-rollback"),onRequestClose:k,disabled:!1===E,className:"wpr-modal",icon:(0,t.createElement)(a.Dashicon,{icon:"warning"})},(0,t.createElement)("p",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:(0,l.sprintf)(1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.components,l=window.wp.i18n,.sections.changelog}})),d&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Are you sure you want to proceed?","wp-rollback"),onRequestClose:k,disabled:!1===E,className:"wpr-modal",icon:(0,t.createElement)(a.Dashicon,{icon:"warning"})},(0,t.createElement)("p",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:(0,l.sprintf)( 2 2 // Translators: %1$s: Plugin name, %2$s: Rollback version 3 3 // Translators: %1$s: Plugin name, %2$s: Rollback version 4 (0,l.__)("You are about to rollback %1$s to version %2$s. Please confirm you would like to proceed.","wp-rollback"),`<strong>${ r.name}</strong>`,`<strong>${E}</strong>`)}}),(0,t.createElement)("div",{className:"rollback-details"},(0,t.createElement)("table",{className:"widefat"},(0,t.createElement)("tbody",null,(0,t.createElement)("tr",null,(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},"plugin"===w.type?(0,l.__)("Plugin Name:","wp-rollback"):(0,l.__)("Theme Name:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-plugin-name"},r.name))),(0,t.createElement)("tr",{className:"alternate"},(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},(0,l.__)("Installed Version:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-installed-version"},w.current_version))),(0,t.createElement)("tr",null,(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},(0,l.__)("New Version:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-new-version"},E)))))),(0,t.createElement)("div",{className:"wpr-modal-notice notice notice-warning",dangerouslySetInnerHTML:{__html:(0,l.__)("<p><strong>Notice:</strong> We strongly recommend you <strong>create a complete backup</strong> of your WordPress files and database prior to performing a rollback. We are not responsible for any misuse, deletions, white screens, fatal errors, or any other issue resulting from the use of this plugin.</p>","wp-rollback")}}),(0,t.createElement)("form",{name:"check_for_rollbacks",className:"rollback-form",action:b},(0,t.createElement)("input",{type:"hidden",name:"page",value:"wp-rollback"}),(0,t.createElement)("input",{type:"hidden",name:"wpr_rollback_nonce",value:wprData.rollback_nonce}),(0,t.createElement)("input",{type:"hidden",name:"_wpnonce",value:wprData.rollback_nonce}),"plugin"===w.type&&(0,t.createElement)("div",null,(0,t.createElement)("input",{type:"hidden",name:"plugin_file",value:w.plugin_file}),(0,t.createElement)("input",{type:"hidden",name:"plugin_version",value:E}),(0,t.createElement)("input",{type:"hidden",name:"plugin_slug",value:r.slug})),"theme"===w.type&&(0,t.createElement)("div",null,(0,t.createElement)("input",{type:"hidden",name:"theme_file",value:w.theme_file}),(0,t.createElement)("input",{type:"hidden",name:"theme_version",value:E})),(0,t.createElement)("input",{type:"hidden",name:"rollback_name",value:w.rollback_name}),(0,t.createElement)("input",{type:"hidden",name:"installed_version",value:w.current_version}),(0,t.createElement)("div",{className:"wpr-modal-button-wrap"},(0,t.createElement)(a.Button,{isPrimary:!0,type:"submit"},(0,l.__)("Rollback","wp-rollback")),(0,t.createElement)(a.Button,{isSecondary:!0,onClick:k,className:"wpr-button-cancel"},(0,l.__)("Cancel","wp-rollback"))))))))};r()((function(){document.getElementById("root-wp-rollback-admin")&&(0,t.render)((0,t.createElement)(i,null),document.getElementById("root-wp-rollback-admin"))}))})();4 (0,l.__)("You are about to rollback %1$s to version %2$s. Please confirm you would like to proceed.","wp-rollback"),`<strong>${()((function(){document.getElementById("root-wp-rollback-admin")&&(0,t.render)((0,t.createElement)(i,null),document.getElementById("root-wp-rollback-admin"))}))})(); -
wp-rollback/tags/2.0.4/languages/wp-rollback.pot
r3015797 r3017188 1 # Copyright (C) 202 3WP Rollback1 # Copyright (C) 202 WP Rollback 2 2 # This file is distributed under the same license as the WP Rollback plugin. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WP Rollback 2.0. 3\n"5 "Project-Id-Version: WP Rollback 2.0.\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-rollback\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 3-12-30T16:34:53+00:00\n"12 "POT-Creation-Date: 202+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.9.0\n" … … 31 31 32 32 #: src/class-rollback-multisite-compatibility.php:83 33 #: wp-rollback.php:246 33 #: wp-rollback.php:241 34 #: wp-rollback.php:403 34 35 #: wp-rollback.php:404 35 #: wp-rollback.php:405 36 #: wp-rollback.php:510 36 #: wp-rollback.php:514 37 37 #: build/admin.js:1 38 38 #: build/admin.js:4 … … 49 49 msgstr "" 50 50 51 #: wp-rollback.php:24 751 #: wp-rollback.php:24 52 52 msgid "No Rollback Available: This is a non-WordPress.org theme." 53 53 msgstr "" 54 54 55 #: wp-rollback.php:2 5155 #: wp-rollback.php:2 56 56 #: build/admin.js:1 57 57 msgid "Loading..." … … 59 59 60 60 #. translators: %s Link. 61 #: wp-rollback.php:2 8261 #: wp-rollback.php:2 62 62 msgid "Sorry, we couldn't find a changelog entry found for this version. Try checking the <a href=\"%s\" target=\"_blank\">developer log</a> on WP.org." 63 63 msgstr "" 64 64 65 #: wp-rollback.php:28 865 #: wp-rollback.php:28 66 66 msgid "Please select a version number to perform a rollback." 67 67 msgstr "" 68 68 69 #: wp-rollback.php:3 6069 #: wp-rollback.php:3 70 70 msgid "You do not have sufficient permissions to perform rollbacks for this site." 71 71 msgstr "" 72 72 73 #: wp-rollback.php:6 2773 #: wp-rollback.php:6 74 74 msgid "An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href=\"https://wordpress.org/support/\">support forums</a>." 75 75 msgstr "" 76 76 77 #: wp-rollback.php:63 077 #: wp-rollback.php:63 78 78 msgid "(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)" 79 79 msgstr "" -
wp-rollback/tags/2.0.4/readme.txt
r3015797 r3017188 6 6 Tested up to: 6.5 7 7 Requires PHP: 7.4 8 Stable tag: 2.0. 38 Stable tag: 2.0. 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 44 44 = Minimum Requirements = 45 45 46 * WordPress 4.8or greater47 * PHP version 5.3or greater46 * WordPress or greater 47 * PHP version or greater 48 48 * MySQL version 5.0 or greater 49 49 … … 106 106 107 107 == Changelog == 108 109 110 111 108 112 109 113 = 2.0.3 = -
wp-rollback/tags/2.0.4/wp-rollback.php
r3015797 r3017188 6 6 * Author: WP Rollback 7 7 * Author URI: https://wprollback.com/ 8 * Version: 2.0. 38 * Version: 2.0. 9 9 * Text Domain: wp-rollback 10 10 * Domain Path: /languages … … 189 189 190 190 // Multisite compatibility: only loads on main site. 191 if ( is_network_admin() ) { 192 $this->multisite_compatibility = new WP_Rollback_Multisite_Compatibility( $this ); 193 } 194 195 if ( is_multisite() && ! is_network_admin() ) { 196 return; 197 } 191 $this->multisite_compatibility = new WP_Rollback_Multisite_Compatibility( $this ); 198 192 199 193 // i18n … … 227 221 */ 228 222 public function scripts( $hook ): void { 229 if ( 'themes.php' === $hook ) { 223 224 // Theme's listing page JS 225 if ( 'themes.php' === $hook && !is_multisite() ) { 230 226 $theme_script_asset = require WP_ROLLBACK_PLUGIN_DIR . '/build/themes.asset.php'; 231 227 232 228 wp_enqueue_script( 233 229 'wp-rollback-themes-script', 234 plugin_dir_url( __FILE__ ). 'build/themes.js',230 . 'build/themes.js', 235 231 $theme_script_asset['dependencies'], 236 232 $theme_script_asset['version'] … … 240 236 'wp-rollback-themes-script', 'wprData', [ 241 237 'ajaxurl' => admin_url(), 242 'logo' => plugins_url( 'src/assets/logo.svg', __FILE__ ),243 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', __FILE__ ),244 238 'rollback_nonce' => wp_create_nonce( 'wpr_rollback_nonce' ), 245 'apiNonce' => wp_create_nonce( 'wpr_rollback_api_nonce' ), 239 'logo' => plugins_url( 'src/assets/logo.svg', WP_ROLLBACK_PLUGIN_FILE ), 240 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', WP_ROLLBACK_PLUGIN_FILE ), 246 241 'text_rollback_label' => __( 'Rollback', 'wp-rollback' ), 247 242 'text_not_rollbackable' => __( … … 273 268 wp_localize_script( 'wp-rollback-plugin-admin-editor', 'wprData', [ 274 269 'rollback_nonce' => wp_create_nonce( 'wpr_rollback_nonce' ), 270 275 271 'adminUrl' => admin_url( 'index.php' ), 276 ' baseUrl' => get_site_url(),277 'logo' => plugins_url( 'src/assets/logo.svg', __FILE__),278 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', __FILE__),272 '), 273 'logo' ), 274 'avatarFallback' ), 279 275 'referrer' => wp_get_referer(), 280 276 'text_no_changelog_found' => isset( $_GET['plugin_slug'] ) ? sprintf( 281 277 // translators: %s Link. 282 278 __( 283 279 'Sorry, we couldn\'t find a changelog entry found for this version. Try checking the <a href="%s" target="_blank">developer log</a> on WP.org.', … … 333 329 334 330 register_rest_route( 'wp-rollback/v1', '/fetch-info/', [ 335 'methods' => 'GET',336 'callback' => function ( WP_REST_Request $request ) {331 'methods' => 'GET', 332 'callback' => function ( WP_REST_Request $request ) { 337 333 $fetcher = new WP_Rollback_API_Fetcher(); 338 334 339 335 return $fetcher->fetch_plugin_or_theme_info( $request['type'], $request['slug'] ); 340 336 }, 341 'args' => [ 337 'permission_callback' => function () { 338 return current_user_can( 'update_plugins' ); 339 }, 340 'args' => [ 342 341 'type' => [ 343 342 'required' => true, … … 473 472 */ 474 473 public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ): array { 474 475 476 477 478 475 479 // Filter for other devs. 476 480 $plugin_data = apply_filters( 'wpr_plugin_data', $plugin_data ); … … 478 482 // If plugin is missing package data do not output Rollback option. 479 483 if ( ! isset( $plugin_data['package'] ) || 480 ( strpos($plugin_data['package'], 'downloads.wordpress.org') === false) ) {484 () ) { 481 485 return $actions; 482 486 } … … 488 492 489 493 // Base rollback URL 490 $rollback_url = admin_url( 'index.php' );494 $rollback_url = admin_url( 'index.php' ); 491 495 492 496 $rollback_url = add_query_arg( … … 684 688 // Loop through themes and provide a 'hasRollback' boolean key for JS. 685 689 foreach ( $prepared_themes as $key => $value ) { 686 $themes[ $key ] = $ prepared_themes[ $key ];690 $themes[ $key ] = $; 687 691 $themes[ $key ]['hasRollback'] = isset( $rollbacks[ $key ] ); 688 692 } -
wp-rollback/trunk/build/admin.asset.php
r3015797 r3017188 1 <?php return array('dependencies' => array('wp-components', 'wp-dom-ready', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-url'), 'version' => ' 9ec969e696dc68bb2222');1 <?php return array('dependencies' => array('wp-components', 'wp-dom-ready', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-url'), 'version' => ''); -
wp-rollback/trunk/build/admin.js
r3015797 r3017188 1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.components,l=window.wp.i18n, n=window.wp.domReady;var r=e.n(n);const s=window.wp.htmlEntities,o=window.wp.url,c=({text:e})=>{const[n,r]=(0,t.useState)(!1),s=e.length>=200;return(0,t.createElement)("div",{className:"wpr-theme-description"},(0,t.createElement)("p",null,n||!s?e:`${e.substring(0,200)}...`,s&&(0,t.createElement)("span",{className:"wpr-expand-text",onClick:()=>{r(!n)}},n?(0,t.createElement)("span",null,(0,t.createElement)(a.Dashicon,{icon:"arrow-up"}),(0,l.__)("Read less","wp-rollback")):(0,t.createElement)("span",null,(0,t.createElement)(a.Dashicon,{icon:"arrow-down"}),(0,l.__)("Read more","wp-rollback")))))},i=()=>{const[e,n]=(0,t.useState)(!0),[r,i]=(0,t.useState)(!1),[m,p]=(0,t.useState)(null),w=(0,o.getQueryArgs)(window.location.search),[d,u]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[E,_]=(0,t.useState)(w.current_version),{adminUrl:b,referrer:v}=wprData,k=()=>u(!1);function N(e,t){var a=new Image;a.onload=()=>t(!0),a.onerror=()=>t(!1),a.src=e}return(0,t.useEffect)((()=>{let e=`${wprData.baseUrl}/wp-json/wp-rollback/v1/fetch-info/?type=${w.type}&slug=${"theme"===w.type?w.theme_file:w.plugin_slug}`;fetch(e).then((e=>e.json())).then((e=>{i(e),n(!1)})).catch((e=>{console.error("Error fetching data:",e)}))}),[]),(0,t.useEffect)((()=>{r&&r.slug&&N(`https://ps.w.org/${r.slug}/assets/icon-128x128.png`,(e=>{e?p(`https://ps.w.org/${r.slug}/assets/icon-128x128.png`):N(`https://ps.w.org/${r.slug}/assets/icon-128x128.jpg`,(e=>{e?p(`https://ps.w.org/${r.slug}/assets/icon-128x128.jpg`):N(`https://ps.w.org/${r.slug}/assets/icon-128x128.gif`,(e=>{p(e?`https://ps.w.org/${r.slug}/assets/icon-128x128.gif`:wprData.avatarFallback)}))}))}))}),[r]),e?(0,t.createElement)("div",{id:"wpr-wrap",className:"wpr-wrap"},(0,t.createElement)("div",{className:"wpr-loading-content"},(0,t.createElement)("div",{className:"wpr-loading-text"},(0,t.createElement)(a.Spinner,{style:{height:"calc(4px * 20)",width:"calc(4px * 20)"}}),(0,t.createElement)("p",null,(0,l.__)("Loading...","wp-rollback"))))):r.message?(0,t.createElement)("div",{id:"wpr-wrap",className:"wpr-wrap"},(0,t.createElement)("div",{className:"wpr-api-error"},(0,t.createElement)("h1",null,r.code),(0,t.createElement)("p",null,r.message))):(console.log(r),console.log(w),(0,t.createElement)("div",{className:"wpr-wrapper"},(0,t.createElement)("div",{className:"wpr-logo-wrap"},(0,t.createElement)("div",{className:"wpr-logo"},(0,t.createElement)("h1",null,(0,l.__)("WP Rollback","wp-rollback")),(0,t.createElement)("a",{href:"https://wprollback.com/",target:"_blank"},(0,t.createElement)("img",{src:wprData.logo,width:250,height:"auto",alt:"WP Rollback"}))),(0,t.createElement)("p",{className:"wpr-intro-text"},(0,l.__)("Select which version you would like to rollback to from the releases listed below.","wp-rollback"))),(0,t.createElement)("div",{className:"wpr-content-wrap"},r.banners&&"plugin"===w.type&&(r.banners.high||r.banners.low)&&(0,t.createElement)("div",{className:"wpr-content-banner"},(0,t.createElement)("img",{src:!1!==r.banners.high?r.banners.high:r.banners.low,width:800,height:"auto",className:"wpr-plugin-banner",alt:r.name})),(0,t.createElement)("div",{className:"wpr-content-header"},r.screenshot_url&&"theme"===w.type&&(0,t.createElement)("div",{className:"wpr-content-banner wpr-content-banner__theme"},(0,t.createElement)("img",{src:r.screenshot_url,width:240,height:180,className:"wpr-theme-screenshot",alt:r.name})),m&&"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-plugin-avatar-wrap"},(0,t.createElement)("img",{src:m,width:96,height:96,className:"wpr-plugin-avatar",alt:r.name})),(0,t.createElement)("div",{className:"wpr-plugin-info"},(0,t.createElement)("h2",{className:"wpr-plugin-name"},"plugin"===w.type&&(0,t.createElement)("a",{href:`https://wordpress.org/plugins/${r.slug}/`,target:"_blank",className:"wpr-heading-link",alt:(0,l.sprintf)((0,l.__)("View %s on WordPress.org","wp-rollback"),r.name)},(0,s.decodeEntities)(r.name),(0,t.createElement)(a.Dashicon,{icon:"external"})),"theme"===w.type&&(0,t.createElement)("a",{href:r.homepage,target:"_blank",className:"wpr-heading-link",alt:(0,l.sprintf)((0,l.__)("View %s on WordPress.org","wp-rollback"),r.name)},(0,s.decodeEntities)(r.name),(0,t.createElement)(a.Dashicon,{icon:"external"}))),"theme"===w.type&&r.sections.description&&(0,t.createElement)("div",{className:"wpr-theme-description"},(0,t.createElement)(c,{text:r.sections.description})),(0,t.createElement)("div",{className:"wpr-pill-wrap"},(0,t.createElement)("div",{className:"wpr-pill wpr-pill__black"},(0,t.createElement)("span",{className:"wpr-pill-text"},(0,l.__)("Installed version:","wp-rollback")," ",(0,t.createElement)("strong",null,w.current_version))),"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-pill wpr-pill__author"},(0,t.createElement)("span",{className:"wpr-pill-text"},(0,l.__)("Plugin author:","wp-rollback")," ",(0,t.createElement)("span",{className:"wpr-pill__link",dangerouslySetInnerHTML:{__html:r.author}}))))),(0,t.createElement)("div",{className:"wpr-meta-wrap"},"theme"===w.type&&(0,t.createElement)("div",{className:"wpr-meta-item wpr-meta-item__author-wrap"},(0,t.createElement)("h3",null,(0,l.__)("Theme Author","wp-rollback")),(0,t.createElement)("div",{className:"wpr-theme-author-inner"},(0,t.createElement)("img",{src:r.author.avatar,width:64,height:64}),(0,t.createElement)("div",{className:"wpr-theme-author-info"},(0,t.createElement)("a",{href:r.author.author_url,target:"_blank"},r.author.display_name)))),"plugin"===w.type&&(0,t.createElement)("div",{className:"wpr-meta-wrap__plugins"},(0,t.createElement)("div",{className:"wpr-view-changelog"},(0,t.createElement)(a.Button,{isSecondary:!0,onClick:()=>g(!0),className:"wpr-version-changelog"},(0,l.__)("View Changelog","wp-rollback"))),(0,t.createElement)("h3",null,(0,l.__)("Last Updated","wp-rollback")),(0,t.createElement)("div",{className:"wpr-updater-info"},(0,t.createElement)(a.Dashicon,{icon:"clock"}),(0,t.createElement)("span",{className:"wpr-plugin-lastupdate"},function(e){let t=e.replace("am"," AM").replace("pm"," PM").replace(" GMT","");t=new Date(t).toLocaleString("en-US",{timeZone:"GMT"});const a=new Date(t);if(isNaN(a.getTime()))return console.error("Invalid date:",t),"Invalid date";const n=new Date,r=Math.floor((n-a)/1e3);return r<60?(0,l.sprintf)((0,l._n)("%s second ago","%s seconds ago",r,"wp-rollback"),r):r<3600?(0,l.sprintf)((0,l._n)("%s minute ago","%s minutes ago",Math.floor(r/60),"wp-rollback"),Math.floor(r/60)):r<86400?(0,l.sprintf)((0,l._n)("%s hour ago","%s hours ago",Math.floor(r/3600),"wp-rollback"),Math.floor(r/3600)):r<2592e3?(0,l.sprintf)((0,l._n)("%s day ago","%s days ago",Math.floor(r/86400),"wp-rollback"),Math.floor(r/86400)):r<31536e3?(0,l.sprintf)((0,l._n)("%s month ago","%s months ago",Math.floor(r/2592e3),"wp-rollback"),Math.floor(r/2592e3)):(0,l.sprintf)((0,l._n)("%s year ago","%s years ago",Math.floor(r/31536e3),"wp-rollback"),Math.floor(r/31536e3))}(r.last_updated)))))),(0,t.createElement)("div",{className:"wpr-versions-container"},Object.keys(r.versions).filter((e=>"trunk"!==e)).sort(((e,t)=>t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}))).map(((e,a)=>(0,t.createElement)("div",{key:a,className:"wpr-version-wrap "+(E===e?"wpr-active-row":"")},(0,t.createElement)("div",{className:"wpr-version-radio-wrap"},(0,t.createElement)("label",{htmlFor:"version-"+a},(0,t.createElement)("input",{id:"version-"+a,type:"radio",name:"version",value:e,checked:E===e,onChange:()=>_(e)}),(0,t.createElement)("span",{className:"wpr-version-lineitem"},e),w.current_version===e&&"trunk"!==e&&(0,t.createElement)("span",{className:"wpr-version-lineitem-current"},(0,l.__)("Currently Installed","wp-rollback")))))))),(0,t.createElement)("div",{className:"wpr-button-wrap"},(0,t.createElement)(a.Button,{isPrimary:!0,onClick:()=>u(!0),className:"wpr-button-submit"},(0,l.__)("Rollback","wp-rollback")),(0,t.createElement)(a.Button,{isSecondary:!0,onClick:()=>window.location.href=v,className:"wpr-button-cancel"},(0,l.__)("Cancel","wp-rollback"))),h&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Plugin Changelog","wp-rollback"),onRequestClose:()=>g(!1),disabled:!1===E,className:"wpr-modal wpr-modal__changelog",icon:(0,t.createElement)(a.Dashicon,{icon:"hammer"})},(0,t.createElement)("div",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:r.sections.changelog}})),d&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Are you sure you want to proceed?","wp-rollback"),onRequestClose:k,disabled:!1===E,className:"wpr-modal",icon:(0,t.createElement)(a.Dashicon,{icon:"warning"})},(0,t.createElement)("p",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:(0,l.sprintf)(1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.components,l=window.wp.i18n,.sections.changelog}})),d&&(0,t.createElement)(a.Modal,{title:(0,l.__)("Are you sure you want to proceed?","wp-rollback"),onRequestClose:k,disabled:!1===E,className:"wpr-modal",icon:(0,t.createElement)(a.Dashicon,{icon:"warning"})},(0,t.createElement)("p",{className:"wpr-modal-intro",dangerouslySetInnerHTML:{__html:(0,l.sprintf)( 2 2 // Translators: %1$s: Plugin name, %2$s: Rollback version 3 3 // Translators: %1$s: Plugin name, %2$s: Rollback version 4 (0,l.__)("You are about to rollback %1$s to version %2$s. Please confirm you would like to proceed.","wp-rollback"),`<strong>${ r.name}</strong>`,`<strong>${E}</strong>`)}}),(0,t.createElement)("div",{className:"rollback-details"},(0,t.createElement)("table",{className:"widefat"},(0,t.createElement)("tbody",null,(0,t.createElement)("tr",null,(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},"plugin"===w.type?(0,l.__)("Plugin Name:","wp-rollback"):(0,l.__)("Theme Name:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-plugin-name"},r.name))),(0,t.createElement)("tr",{className:"alternate"},(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},(0,l.__)("Installed Version:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-installed-version"},w.current_version))),(0,t.createElement)("tr",null,(0,t.createElement)("td",{className:"row-title"},(0,t.createElement)("label",{htmlFor:"tablecell"},(0,l.__)("New Version:","wp-rollback"))),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"wpr-new-version"},E)))))),(0,t.createElement)("div",{className:"wpr-modal-notice notice notice-warning",dangerouslySetInnerHTML:{__html:(0,l.__)("<p><strong>Notice:</strong> We strongly recommend you <strong>create a complete backup</strong> of your WordPress files and database prior to performing a rollback. We are not responsible for any misuse, deletions, white screens, fatal errors, or any other issue resulting from the use of this plugin.</p>","wp-rollback")}}),(0,t.createElement)("form",{name:"check_for_rollbacks",className:"rollback-form",action:b},(0,t.createElement)("input",{type:"hidden",name:"page",value:"wp-rollback"}),(0,t.createElement)("input",{type:"hidden",name:"wpr_rollback_nonce",value:wprData.rollback_nonce}),(0,t.createElement)("input",{type:"hidden",name:"_wpnonce",value:wprData.rollback_nonce}),"plugin"===w.type&&(0,t.createElement)("div",null,(0,t.createElement)("input",{type:"hidden",name:"plugin_file",value:w.plugin_file}),(0,t.createElement)("input",{type:"hidden",name:"plugin_version",value:E}),(0,t.createElement)("input",{type:"hidden",name:"plugin_slug",value:r.slug})),"theme"===w.type&&(0,t.createElement)("div",null,(0,t.createElement)("input",{type:"hidden",name:"theme_file",value:w.theme_file}),(0,t.createElement)("input",{type:"hidden",name:"theme_version",value:E})),(0,t.createElement)("input",{type:"hidden",name:"rollback_name",value:w.rollback_name}),(0,t.createElement)("input",{type:"hidden",name:"installed_version",value:w.current_version}),(0,t.createElement)("div",{className:"wpr-modal-button-wrap"},(0,t.createElement)(a.Button,{isPrimary:!0,type:"submit"},(0,l.__)("Rollback","wp-rollback")),(0,t.createElement)(a.Button,{isSecondary:!0,onClick:k,className:"wpr-button-cancel"},(0,l.__)("Cancel","wp-rollback"))))))))};r()((function(){document.getElementById("root-wp-rollback-admin")&&(0,t.render)((0,t.createElement)(i,null),document.getElementById("root-wp-rollback-admin"))}))})();4 (0,l.__)("You are about to rollback %1$s to version %2$s. Please confirm you would like to proceed.","wp-rollback"),`<strong>${()((function(){document.getElementById("root-wp-rollback-admin")&&(0,t.render)((0,t.createElement)(i,null),document.getElementById("root-wp-rollback-admin"))}))})(); -
wp-rollback/trunk/languages/wp-rollback.pot
r3015797 r3017188 1 # Copyright (C) 202 3WP Rollback1 # Copyright (C) 202 WP Rollback 2 2 # This file is distributed under the same license as the WP Rollback plugin. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WP Rollback 2.0. 3\n"5 "Project-Id-Version: WP Rollback 2.0.\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-rollback\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 3-12-30T16:34:53+00:00\n"12 "POT-Creation-Date: 202+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.9.0\n" … … 31 31 32 32 #: src/class-rollback-multisite-compatibility.php:83 33 #: wp-rollback.php:246 33 #: wp-rollback.php:241 34 #: wp-rollback.php:403 34 35 #: wp-rollback.php:404 35 #: wp-rollback.php:405 36 #: wp-rollback.php:510 36 #: wp-rollback.php:514 37 37 #: build/admin.js:1 38 38 #: build/admin.js:4 … … 49 49 msgstr "" 50 50 51 #: wp-rollback.php:24 751 #: wp-rollback.php:24 52 52 msgid "No Rollback Available: This is a non-WordPress.org theme." 53 53 msgstr "" 54 54 55 #: wp-rollback.php:2 5155 #: wp-rollback.php:2 56 56 #: build/admin.js:1 57 57 msgid "Loading..." … … 59 59 60 60 #. translators: %s Link. 61 #: wp-rollback.php:2 8261 #: wp-rollback.php:2 62 62 msgid "Sorry, we couldn't find a changelog entry found for this version. Try checking the <a href=\"%s\" target=\"_blank\">developer log</a> on WP.org." 63 63 msgstr "" 64 64 65 #: wp-rollback.php:28 865 #: wp-rollback.php:28 66 66 msgid "Please select a version number to perform a rollback." 67 67 msgstr "" 68 68 69 #: wp-rollback.php:3 6069 #: wp-rollback.php:3 70 70 msgid "You do not have sufficient permissions to perform rollbacks for this site." 71 71 msgstr "" 72 72 73 #: wp-rollback.php:6 2773 #: wp-rollback.php:6 74 74 msgid "An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href=\"https://wordpress.org/support/\">support forums</a>." 75 75 msgstr "" 76 76 77 #: wp-rollback.php:63 077 #: wp-rollback.php:63 78 78 msgid "(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)" 79 79 msgstr "" -
wp-rollback/trunk/readme.txt
r3015797 r3017188 6 6 Tested up to: 6.5 7 7 Requires PHP: 7.4 8 Stable tag: 2.0. 38 Stable tag: 2.0. 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 44 44 = Minimum Requirements = 45 45 46 * WordPress 4.8or greater47 * PHP version 5.3or greater46 * WordPress or greater 47 * PHP version or greater 48 48 * MySQL version 5.0 or greater 49 49 … … 106 106 107 107 == Changelog == 108 109 110 111 108 112 109 113 = 2.0.3 = -
wp-rollback/trunk/wp-rollback.php
r3015797 r3017188 6 6 * Author: WP Rollback 7 7 * Author URI: https://wprollback.com/ 8 * Version: 2.0. 38 * Version: 2.0. 9 9 * Text Domain: wp-rollback 10 10 * Domain Path: /languages … … 189 189 190 190 // Multisite compatibility: only loads on main site. 191 if ( is_network_admin() ) { 192 $this->multisite_compatibility = new WP_Rollback_Multisite_Compatibility( $this ); 193 } 194 195 if ( is_multisite() && ! is_network_admin() ) { 196 return; 197 } 191 $this->multisite_compatibility = new WP_Rollback_Multisite_Compatibility( $this ); 198 192 199 193 // i18n … … 227 221 */ 228 222 public function scripts( $hook ): void { 229 if ( 'themes.php' === $hook ) { 223 224 // Theme's listing page JS 225 if ( 'themes.php' === $hook && !is_multisite() ) { 230 226 $theme_script_asset = require WP_ROLLBACK_PLUGIN_DIR . '/build/themes.asset.php'; 231 227 232 228 wp_enqueue_script( 233 229 'wp-rollback-themes-script', 234 plugin_dir_url( __FILE__ ). 'build/themes.js',230 . 'build/themes.js', 235 231 $theme_script_asset['dependencies'], 236 232 $theme_script_asset['version'] … … 240 236 'wp-rollback-themes-script', 'wprData', [ 241 237 'ajaxurl' => admin_url(), 242 'logo' => plugins_url( 'src/assets/logo.svg', __FILE__ ),243 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', __FILE__ ),244 238 'rollback_nonce' => wp_create_nonce( 'wpr_rollback_nonce' ), 245 'apiNonce' => wp_create_nonce( 'wpr_rollback_api_nonce' ), 239 'logo' => plugins_url( 'src/assets/logo.svg', WP_ROLLBACK_PLUGIN_FILE ), 240 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', WP_ROLLBACK_PLUGIN_FILE ), 246 241 'text_rollback_label' => __( 'Rollback', 'wp-rollback' ), 247 242 'text_not_rollbackable' => __( … … 273 268 wp_localize_script( 'wp-rollback-plugin-admin-editor', 'wprData', [ 274 269 'rollback_nonce' => wp_create_nonce( 'wpr_rollback_nonce' ), 270 275 271 'adminUrl' => admin_url( 'index.php' ), 276 ' baseUrl' => get_site_url(),277 'logo' => plugins_url( 'src/assets/logo.svg', __FILE__),278 'avatarFallback' => plugins_url( 'src/assets/avatar-plugin-fallback.jpg', __FILE__),272 '), 273 'logo' ), 274 'avatarFallback' ), 279 275 'referrer' => wp_get_referer(), 280 276 'text_no_changelog_found' => isset( $_GET['plugin_slug'] ) ? sprintf( 281 277 // translators: %s Link. 282 278 __( 283 279 'Sorry, we couldn\'t find a changelog entry found for this version. Try checking the <a href="%s" target="_blank">developer log</a> on WP.org.', … … 333 329 334 330 register_rest_route( 'wp-rollback/v1', '/fetch-info/', [ 335 'methods' => 'GET',336 'callback' => function ( WP_REST_Request $request ) {331 'methods' => 'GET', 332 'callback' => function ( WP_REST_Request $request ) { 337 333 $fetcher = new WP_Rollback_API_Fetcher(); 338 334 339 335 return $fetcher->fetch_plugin_or_theme_info( $request['type'], $request['slug'] ); 340 336 }, 341 'args' => [ 337 'permission_callback' => function () { 338 return current_user_can( 'update_plugins' ); 339 }, 340 'args' => [ 342 341 'type' => [ 343 342 'required' => true, … �� 473 472 */ 474 473 public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ): array { 474 475 476 477 478 475 479 // Filter for other devs. 476 480 $plugin_data = apply_filters( 'wpr_plugin_data', $plugin_data ); … … 478 482 // If plugin is missing package data do not output Rollback option. 479 483 if ( ! isset( $plugin_data['package'] ) || 480 ( strpos($plugin_data['package'], 'downloads.wordpress.org') === false) ) {484 () ) { 481 485 return $actions; 482 486 } … … 488 492 489 493 // Base rollback URL 490 $rollback_url = admin_url( 'index.php' );494 $rollback_url = admin_url( 'index.php' ); 491 495 492 496 $rollback_url = add_query_arg( … … 684 688 // Loop through themes and provide a 'hasRollback' boolean key for JS. 685 689 foreach ( $prepared_themes as $key => $value ) { 686 $themes[ $key ] = $ prepared_themes[ $key ];690 $themes[ $key ] = $; 687 691 $themes[ $key ]['hasRollback'] = isset( $rollbacks[ $key ] ); 688 692 }
Note: See TracChangeset
for help on using the changeset viewer.