PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | vendor/team-updraft/lib-central/central/bootstrap.php +103 -83 3.7.0 → 4.7.0 View file →
@@ -44,9 +44,10 @@
44 44 'plugin' => 'UpdraftCentral_Plugin_Commands',
45 45 'theme' => 'UpdraftCentral_Theme_Commands',
46 46 'posts' => 'UpdraftCentral_Posts_Commands',
47 47 'media' => 'UpdraftCentral_Media_Commands',
48 - 'pages' => 'UpdraftCentral_Pages_Commands'
48 + 'pages' => 'UpdraftCentral_Pages_Commands',
49 + 'backups' => 'UpdraftCentral_Backups_Commands'
49 50 ));
50 51
51 52 // N.B. This "updraftplus_remotecontrol_command_classes" filter has been marked as deprecated and will be remove after May 2021.
52 53 // Please see above code comment for further explanation and its alternative.
@@ -178,22 +179,35 @@
178 179
179 180 $result = $this->receive_public_key();
180 181 if (!is_array($result) || empty($result['responsetype'])) die;
181 182
182 - $style = 'body {text-align: center;font-family: Helvetica,Arial,Lucida,sans-serif;background-color: #A64C1A;color: #FFF;height: 100%;width: 100%;margin: 0;padding: 0;}#main {height: 100%;width: 100%;display: table;}#wrapper {display: table-cell;height: 100%;vertical-align: middle;}h1 {margin-bottom: 5px;}h2 {margin-top: 0;font-size: 22px;color: #FFF;}#btn-close {color: #FFF;font-size: 20px;font-weight: 500;padding: .3em 1em;line-height: 1.7em !important;background-color: transparent;background-size: cover;background-position: 50%;background-repeat: no-repeat;border: 2px solid;border-radius: 3px;-webkit-transition-duration: .2s;transition-duration: .2s;-webkit-transition-property: all !important;transition-property: all !important;text-decoration: none;}#btn-close:hover {background-color: #DE6726;}';
183 -
184 - echo '<html><head><title>UpdraftCentral</title><style>'.$style.'</style></head><body><div id="main"><div id="wrapper"><img src="'.UPDRAFTCENTRAL_CLIENT_URL.'/images/ud-logo.png" width="60" /> <h1>'.$updraftcentral_host_plugin->retrieve_show_message('updraftcentral_connection').'</h1><h2>'.htmlspecialchars(network_site_url()).'</h2><p>';
185 -
183 + ?>
184 + <html>
185 + <head>
186 + <title>UpdraftCentral</title>
187 + <style>
188 + body {text-align: center;font-family: Helvetica,Arial,Lucida,sans-serif;background-color: #A64C1A;color: #FFF;height: 100%;width: 100%;margin: 0;padding: 0;}#main {height: 100%;width: 100%;display: table;}#wrapper {display: table-cell;height: 100%;vertical-align: middle;}h1 {margin-bottom: 5px;}h2 {margin-top: 0;font-size: 22px;color: #FFF;}#btn-close {color: #FFF;font-size: 20px;font-weight: 500;padding: .3em 1em;line-height: 1.7em !important;background-color: transparent;background-size: cover;background-position: 50%;background-repeat: no-repeat;border: 2px solid;border-radius: 3px;-webkit-transition-duration: .2s;transition-duration: .2s;-webkit-transition-property: all !important;transition-property: all !important;text-decoration: none;}#btn-close:hover {background-color: #DE6726;}
189 + </style>
190 + </head>
191 + <body>
192 + <div id="main">
193 + <div id="wrapper"><img src="<?php echo esc_url(UPDRAFTCENTRAL_CLIENT_URL).'/images/ud-logo.png'; ?>" width="60" /> <h1><?php $updraftcentral_host_plugin->retrieve_show_message('updraftcentral_connection', true); ?></h1><h2><?php echo esc_html(network_site_url()); ?></h2><p>
194 + <?php
186 195 if ('ok' == $result['responsetype']) {
187 196 $updraftcentral_host_plugin->retrieve_show_message('updraftcentral_connection_successful', true);
188 197 } else {
189 - echo '<strong><span id="udc-connect-failed">'.$updraftcentral_host_plugin->retrieve_show_message('updraftcentral_connection_failed').'</span></strong><br>';
198 + ?>
199 + <strong><span id="udc-connect-failed">
200 + <?php $updraftcentral_host_plugin->retrieve_show_message('updraftcentral_connection_failed', true); ?>
201 + </span></strong><br>
202 + <?php
190 203 switch ($result['code']) {
191 204 case 'unknown_key':
192 205 $updraftcentral_host_plugin->retrieve_show_message('unknown_key', true);
193 206 break;
194 207 case 'not_logged_in':
195 - echo $updraftcentral_host_plugin->retrieve_show_message('not_logged_in').' '.$updraftcentral_host_plugin->retrieve_show_message('must_visit_url');
208 + echo esc_html($updraftcentral_host_plugin->retrieve_show_message('not_logged_in')).' ';
209 + $updraftcentral_host_plugin->retrieve_show_message('must_visit_url', true);
196 210 break;
197 211 case 'nonce_failure':
198 212 $updraftcentral_host_plugin->retrieve_show_message('security_check', true);
199 213 $updraftcentral_host_plugin->retrieve_show_message('must_visit_link', true);
@@ -204,14 +218,17 @@
204 218 case 'insufficient_privilege':
205 219 $updraftcentral_host_plugin->retrieve_show_message('insufficient_privilege', true);
206 220 break;
207 221 default:
208 - echo htmlspecialchars(print_r($result, true));
222 + echo esc_html(print_r($result, true));
209 223 break;
210 224 }
211 225 }
212 -
213 - echo '</p><p><a id="btn-close" href="'.esc_url($this->get_current_clean_url()).'" onclick="window.close();">'.$updraftcentral_host_plugin->retrieve_show_message('close').'</a></p></div></div>';
226 + ?>
227 + </p>
228 + <p><a id="btn-close" href="<?php echo esc_url($this->get_current_clean_url()); ?>" onclick="window.close();"><?php $updraftcentral_host_plugin->retrieve_show_message('close', true); ?></a>
229 + </p></div></div>
230 + <?php
214 231 die;
215 232 }
216 233
217 234 /**
@@ -580,74 +597,33 @@
580 597
581 598 /**
582 599 * Get the HTML for the keys table
583 600 *
601 + * @param Boolean $echo_instead_of_return Whether the result should be echoed or returned
584 602 * @return String
585 603 */
586 - public function get_keys_table() {
604 + public function get_keys_table($echo_instead_of_return = false) {
587 605
588 606 // This is an additional check - it implies requirement for a dashboard context
589 607 if (!current_user_can('manage_options')) return;
590 608
591 609 global $updraftcentral_host_plugin;
592 -
593 - $ret = '';
594 -
610 +
611 + if (!$echo_instead_of_return) ob_start();
612 +
595 613 $our_keys = $this->get_central_localkeys();
596 614 if (!is_array($our_keys)) $our_keys = array();
597 615
598 616 if (empty($our_keys)) {
599 - $ret .= '<tr><td colspan="2"><em>'.$updraftcentral_host_plugin->retrieve_show_message('no_updraftcentral_dashboards').'</em></td></tr>';
617 + ?>
618 + <tr><td colspan="2"><em><?php $updraftcentral_host_plugin->retrieve_show_message('no_updraftcentral_dashboards', true); ?></em></td></tr>
619 + <?php
600 620 }
601 621
602 - foreach ($our_keys as $i => $key) {
603 -
604 - if (empty($key['extra_info'])) continue;
605 -
606 - $user_id = $key['extra_info']['user_id'];
607 -
608 - if (!empty($key['extra_info']['mothership'])) {
609 -
610 - $mothership_url = $key['extra_info']['mothership'];
611 -
612 - if ('__updraftpluscom' == $mothership_url) {
613 - $reconstructed_url = 'https://updraftplus.com';
614 - } else {
615 - $purl = parse_url($mothership_url);
616 - $path = empty($purl['path']) ? '' : $purl['path'];
617 -
618 - $reconstructed_url = $purl['scheme'].'://'.$purl['host'].(!empty($purl['port']) ? ':'.$purl['port'] : '').$path;
619 - }
620 -
621 - } else {
622 - $reconstructed_url = $updraftcentral_host_plugin->retrieve_show_message('unknown');
623 - }
624 -
625 - $name = $key['name'];
626 -
627 - $user = get_user_by('id', $user_id);
628 -
629 - $user_display = is_a($user, 'WP_User') ? $user->user_login.' ('.$user->user_email.')' : $updraftcentral_host_plugin->retrieve_show_message('unknown');
630 -
631 - $ret .= '<tr class="updraft_debugrow"><td style="vertical-align:top;">'.htmlspecialchars($name).' ('.htmlspecialchars($i).')</td><td>'.$updraftcentral_host_plugin->retrieve_show_message('access_as_user')." ".htmlspecialchars($user_display)."<br>".$updraftcentral_host_plugin->retrieve_show_message('public_key_sent').' '.htmlspecialchars($reconstructed_url).'<br>';
632 -
633 - if (!empty($key['created'])) {
634 - $ret .= $updraftcentral_host_plugin->retrieve_show_message('created').' '.date_i18n(get_option('date_format').' '.get_option('time_format'), $key['created']).'.';
635 - if (!empty($key['extra_info']['key_size'])) {
636 - $ret .= ' '.sprintf($updraftcentral_host_plugin->retrieve_show_message('key_size'), $key['extra_info']['key_size']).'.';
637 - }
638 - $ret .= '<br>';
639 - }
640 -
641 - $ret .= '<a href="'.esc_url($this->get_current_clean_url()).'" data-key_id="'.esc_attr($i).'" class="updraftcentral_key_delete">'.$updraftcentral_host_plugin->retrieve_show_message('delete').'</a></td></tr>';
642 - }
643 -
644 -
645 - ob_start();
646 622 ?>
647 623 <div id="updraftcentral_keys_content" style="margin: 10px 0;">
648 624 <?php if (!empty($our_keys)) { ?>
649 - <a href="<?php echo esc_url($this->get_current_clean_url()); ?>" class="updraftcentral_keys_show hidden-in-updraftcentral"><?php printf($updraftcentral_host_plugin->retrieve_show_message('manage_keys'), count($our_keys)); ?></a>
625 + <a href="<?php echo esc_url($this->get_current_clean_url()); ?>" class="updraftcentral_keys_show hidden-in-updraftcentral"><?php echo wp_kses_post(sprintf($updraftcentral_host_plugin->retrieve_show_message('manage_keys'), count($our_keys))); ?></a>
650 626 <?php } ?>
651 627 <table id="updraftcentral_keys_table">
652 628 <thead>
653 629 <tr>
@@ -657,27 +633,70 @@
657 633 </thead>
658 634 <tbody>
659 635 <?php
660 636
661 - echo $ret;
637 + foreach ($our_keys as $i => $key) {
638 +
639 + if (empty($key['extra_info'])) continue;
640 +
641 + $user_id = $key['extra_info']['user_id'];
642 +
643 + if (!empty($key['extra_info']['mothership'])) {
644 +
645 + $mothership_url = $key['extra_info']['mothership'];
646 +
647 + if ('__updraftpluscom' == $mothership_url) {
648 + $reconstructed_url = 'https://updraftplus.com';
649 + } else {
650 + $purl = parse_url($mothership_url);
651 + $path = empty($purl['path']) ? '' : $purl['path'];
652 +
653 + $reconstructed_url = $purl['scheme'].'://'.$purl['host'].(!empty($purl['port']) ? ':'.$purl['port'] : '').$path;
654 + }
655 +
656 + } else {
657 + $reconstructed_url = $updraftcentral_host_plugin->retrieve_show_message('unknown');
658 + }
662 659
660 + $name = $key['name'];
661 +
662 + $user = get_user_by('id', $user_id);
663 +
664 + $user_display = is_a($user, 'WP_User') ? $user->user_login.' ('.$user->user_email.')' : $updraftcentral_host_plugin->retrieve_show_message('unknown');
665 + ?>
666 + <tr class="updraft_debugrow"><td style="vertical-align:top;"><?php echo esc_html($name.' ('.$i.')'); ?></td><td><?php $updraftcentral_host_plugin->retrieve_show_message('access_as_user', true); ?> <?php echo esc_html($user_display); ?> <br> <?php $updraftcentral_host_plugin->retrieve_show_message('public_key_sent', true); ?> <?php echo esc_html($reconstructed_url); ?><br>
667 + <?php
668 + if (!empty($key['created'])) {
669 + echo esc_html($updraftcentral_host_plugin->retrieve_show_message('created').' '.date_i18n(get_option('date_format').' '.get_option('time_format'), $key['created'])).'.';
670 + if (!empty($key['extra_info']['key_size'])) {
671 + echo ' '.esc_html(sprintf($updraftcentral_host_plugin->retrieve_show_message('key_size'), $key['extra_info']['key_size'])).'.';
672 + }
673 + ?>
674 + <br>
675 + <?php
676 + }
677 + ?>
678 + <a href="<?php echo esc_url($this->get_current_clean_url()); ?>" data-key_id="<?php echo esc_attr($i); ?>" class="updraftcentral_key_delete"><?php $updraftcentral_host_plugin->retrieve_show_message('delete', true); ?></a></td></tr>
679 + <?php
680 + }
663 681 ?>
664 682 </tbody>
665 683 </table>
666 684 </div>
667 685 <?php
668 - return ob_get_clean();
686 + if (!$echo_instead_of_return) return ob_get_clean();
669 687 }
670 688
671 689 /**
672 690 * Return HTML markup for the 'create key' section
673 691 *
674 - * @return String - the HTML
692 + * @param Boolean $echo_instead_of_return Whether the result should be echoed or returned
693 + * @return String|Void - the HTML
675 694 */
676 - private function create_key_markup() {
695 + private function create_key_markup($echo_instead_of_return = false) {
677 696 global $updraftcentral_host_plugin;
678 697
679 - ob_start();
698 + if (!$echo_instead_of_return) ob_start();
680 699 ?>
681 700 <div class="create_key_container">
682 701 <h4 class="updraftcentral_wizard_stage1"> <?php $updraftcentral_host_plugin->retrieve_show_message('connect_to_updraftcentral_dashboard', true); ?></h4>
683 702 <table style="width: 100%; table-layout:fixed;">
@@ -687,11 +706,11 @@
687 706 <td>
688 707 <div class="updraftcentral_wizard_mothership updraftcentral_wizard_option">
689 708 <label class="button-primary" tabindex="0">
690 709 <input checked="checked" type="radio" name="updraftcentral_mothership" id="updraftcentral_mothership_updraftpluscom" style="display: none;">
691 - UpdraftPlus.Com
710 + TeamUpdraft.com
692 711 </label><br>
693 - <div><?php printf($updraftcentral_host_plugin->retrieve_show_message('in_example'), '<a target="_blank" href="https://updraftplus.com/my-account/">'.$updraftcentral_host_plugin->retrieve_show_message('an_account').'</a>'); ?></div>
712 + <div><?php echo wp_kses_post(sprintf(esc_html($updraftcentral_host_plugin->retrieve_show_message('in_example')), '<a target="_blank" href="https://teamupdraft.com/my-account/?utm_source=udp-plugin&utm_medium=referral&utm_campaign=paac&utm_content=an-account&utm_creative_format=text">'.esc_html($updraftcentral_host_plugin->retrieve_show_message('an_account')).'</a>')); ?></div>
694 713
695 714 </div>
696 715 <div class="updraftcentral_wizard_self_hosted_stage1 updraftcentral_wizard_option">
697 716 <label class="button-primary" tabindex="0">
@@ -697,12 +716,12 @@
697 716 <label class="button-primary" tabindex="0">
698 717 <input type="radio" name="updraftcentral_mothership" id="updraftcentral_mothership_other" style="display: none;">
699 718 <?php $updraftcentral_host_plugin->retrieve_show_message('self_hosted_dashboard', true);?>
700 719 </label><br>
701 - <div><?php printf($updraftcentral_host_plugin->retrieve_show_message('website_installed'), '<a target="_blank" href="https://wordpress.org/plugins/updraftcentral/">UpdraftCentral</a>'); ?></div>
720 + <div><?php echo wp_kses_post(sprintf(esc_html($updraftcentral_host_plugin->retrieve_show_message('website_installed')), '<a target="_blank" href="https://wordpress.org/plugins/updraftcentral/">UpdraftCentral</a>')); ?></div>
702 721 </div>
703 722 <div class="updraftcentral_wizard_self_hosted_stage2" style="float:left; clear:left;display:none;">
704 - <p style="font-size: 13px;"><?php echo $updraftcentral_host_plugin->retrieve_show_message('enter_url');?></p>
723 + <p style="font-size: 13px;"><?php $updraftcentral_host_plugin->retrieve_show_message('enter_url', true); ?></p>
705 724 <p style="font-size: 13px;" id="updraftcentral_wizard_stage1_error"></p>
706 725 <input disabled="disabled" id="updraftcentral_keycreate_mothership" type="text" size="40" placeholder="<?php $updraftcentral_host_plugin->retrieve_show_message('updraftcentral_dashboard_url', true); ?>" value="">
707 726 <button type="button" class="button button-primary" id="updraftcentral_stage2_go"><?php $updraftcentral_host_plugin->retrieve_show_message('next', true); ?></button>
708 727 </div>
@@ -720,12 +739,12 @@
720 739 <tr class="updraft_debugrow updraftcentral_wizard_stage2" style="display: none;">
721 740 <td>
722 741 <?php $updraftcentral_host_plugin->retrieve_show_message('encryption_key_size', true); ?>
723 742 <select style="" id="updraftcentral_keycreate_keysize">
724 - <option value="512"><?php echo sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('easy_to_break'), '512'); ?></option>
725 - <option value="1024"><?php echo sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('faster'), '1024'); ?></option>
726 - <option value="2048" selected="selected"><?php echo sprintf($updraftcentral_host_plugin->retrieve_show_message('bytes').' - '.$updraftcentral_host_plugin->retrieve_show_message('recommended'), '2048'); ?></option>
727 - <option value="4096"><?php echo sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('slower'), '4096'); ?></option>
743 + <option value="512"><?php echo wp_kses_post(sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('easy_to_break'), '512')); ?></option>
744 + <option value="1024"><?php echo wp_kses_post(sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('faster'), '1024')); ?></option>
745 + <option value="2048" selected="selected"><?php echo wp_kses_post(sprintf($updraftcentral_host_plugin->retrieve_show_message('bytes').' - '.$updraftcentral_host_plugin->retrieve_show_message('recommended'), '2048')); ?></option>
746 + <option value="4096"><?php echo wp_kses_post(sprintf($updraftcentral_host_plugin->retrieve_show_message('bits').' - '.$updraftcentral_host_plugin->retrieve_show_message('slower'), '4096')); ?></option>
728 747 </select>
729 748 <br>
730 749 <div id="updraftcentral_keycreate_mothership_firewalled_container">
731 750 <label>
@@ -751,27 +770,28 @@
751 770 </td>
752 771 </tr>
753 772 </tbody>
754 773 </table>
755 - <div id="updraft-copy-modal" title="<?php _e('Copy to clipboard', 'updraftplus');?>">
774 + <div id="updraft-copy-modal" title="<?php esc_html_e('Copy to clipboard', 'updraftplus');?>">
756 775 <p>
757 - <?php echo __('Your web browser prevented the copy operation.', 'updraftplus').' '.'<a href="https://updraftplus.com/faqs/how-do-i-set-clipboard-permissions-for-different-browsers/" target="__blank">'.' '.__('Follow this link to read about how to set browser permission', 'updraftplus').'</a>'; ?>
776 + <?php echo esc_html__('Your web browser prevented the copy operation.', 'updraftplus').' '.'<a href="https://updraftplus.com/faqs/how-do-i-set-clipboard-permissions-for-different-browsers/" target="__blank">'.' '.esc_html__('Follow this link to read about how to set browser permission', 'updraftplus').'</a>'; ?>
758 777 </p>
759 778 </div>
760 779 </div>
761 780 <?php
762 - return ob_get_clean();
781 + if (!$echo_instead_of_return) return ob_get_clean();
763 782 }
764 783
765 784 /**
766 785 * Get log event viewer mark-up
767 786 *
787 + * @param Boolean $echo_instead_of_return Whether the result should be echoed or returned
768 788 * @return String - the HTML
769 789 */
770 - private function get_log_markup() {
790 + private function get_log_markup($echo_instead_of_return = false) {
771 791 global $updraftcentral_host_plugin;
772 792
773 - ob_start();
793 + if (!$echo_instead_of_return) ob_start();
774 794 ?>
775 795 <div id="updraftcentral_view_log_container" style="margin: 10px 0;">
776 796 <a href="<?php echo esc_url($this->get_current_clean_url()); ?>" id="updraftcentral_view_log"><?php $updraftcentral_host_plugin->retrieve_show_message('view_log_events', true); ?>...</a><br>
777 797 <pre id="updraftcentral_view_log_contents" style="min-height: 110px; padding: 0 4px;">
@@ -777,9 +797,9 @@
777 797 <pre id="updraftcentral_view_log_contents" style="min-height: 110px; padding: 0 4px;">
778 798 </pre>
779 799 </div>
780 800 <?php
781 - return ob_get_clean();
801 + if (!$echo_instead_of_return) return ob_get_clean();
782 802 }
783 803
784 804 /**
785 805 * Echo the debug-tools dashboard HTML. Called by the WP action updraftplus_debugtools_dashboard.
@@ -811,15 +831,15 @@
811 831 ?>
812 832 <div class="advanced_tools updraft_central">
813 833 <h3><?php $updraftcentral_host_plugin->retrieve_show_message('updraftcentral_remote_control', true); ?></h3>
814 834 <p>
815 - <?php echo $updraftcentral_description.' <a target="_blank" href="https://updraftcentral.com">'.$updraftcentral_host_plugin->retrieve_show_message('read_more').'</a>'; ?>
835 + <?php echo esc_html($updraftcentral_description); ?> <a target="_blank" href="https://teamupdraft.com/updraftcentral/?utm_source=udp-plugin&utm_medium=referral&utm_campaign=paac&utm_content=read-more-here&utm_creative_format=text"><?php $updraftcentral_host_plugin->retrieve_show_message('read_more', true); ?></a>
816 836 </p>
817 837 <div style="min-height: 310px;" id="updraftcentral_keys">
818 - <?php echo $this->create_key_markup(); ?>
819 - <?php echo $this->get_keys_table(); ?>
838 + <?php $this->create_key_markup(true); ?>
839 + <?php $this->get_keys_table(true); ?>
820 840 <button style="display: none;" type="button" class="button button-primary" id="updraftcentral_wizard_go"><?php $updraftcentral_host_plugin->retrieve_show_message('create_another_key', true); ?></button>
821 - <?php echo $this->get_log_markup(); ?>
841 + <?php $this->get_log_markup(true); ?>
822 842 </div>
823 843 </div>
824 844 <?php
825 845 }