PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.4
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.4
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / modules / api-backups / classes / class-api-backups-overview.php

class-api-backups-overview.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.4, at modules/api-backups/classes/class-api-backups-overview.php

123 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * =======================================
4 * MainWP API Backups Overview
5 * =======================================
6 *
7 * @package MainWP\Dashboard
8 * @version 5.0
9 */
10
11 namespace MainWP\Dashboard\Module\ApiBackups;
12
13 /**
14 * MainWP API Backups Overview
15 */
16 class Api_Backups_Overview {
17
18
19 /**
20 * Public static variable to hold the single instance of the class.
21 *
22 * @var mixed Default null
23 */
24 public static $instance = null;
25
26 /**
27 * Get Instance
28 *
29 * Creates public static instance.
30 *
31 * @static
32 *
33 * @return Api_Backups_Overview
34 */
35 public static function get_instance() {
36 if ( null === static::$instance ) {
37 static::$instance = new self();
38 }
39 return static::$instance;
40 }
41
42
43 /**
44 * Constructor.
45 *
46 * Run each time the class is called.
47 */
48 public function __construct() {
49 }
50
51 /**
52 * Sites Page Check
53 *
54 * Checks if the current page is individual site Cache Control page.
55 *
56 * @return bool True if correct, false if not.
57 */
58 public static function is_managesites_page() {
59 if ( isset( $_GET['page'] ) && ( 'ManageSitesApiBackups' === $_GET['page'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
60 return true;
61 }
62 return false;
63 }
64
65 /**
66 * Get current tab.
67 */
68 public function get_current_tab() {
69 $curent_tab = 'backups';
70 if ( isset( $_GET['tab'] ) && 'settings' === $_GET['tab'] ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
71 $curent_tab = 'settings';
72 }
73 return $curent_tab;
74 }
75
76 /**
77 * Render Tabs.
78 *
79 * Renders the page tabs.
80 */
81 public function render_individual_tabs() {
82 do_action( 'mainwp_pageheader_sites', 'ApiBackups' );
83 ?>
84 <div>
85 <?php
86 if ( static::is_managesites_page() ) {
87 $site_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
88 $website = Api_Backups_Helper::get_website_by_id( $site_id );
89 if ( empty( $site_id ) || empty( $website ) ) {
90 echo '<div class="ui yellow message">' . esc_html__( 'Error: empty site ID', 'mainwp' ) . '</div>';
91 } else {
92 $curent_tab = $this->get_current_tab();
93 if ( 'backups' === $curent_tab ) :
94 Api_Backups_3rd_Party::instance()->render_api_backups_site( $website );
95 elseif ( 'settings' === $curent_tab ) :
96 Api_Backups_Settings::get_instance()->render_settings_content( true );
97 endif;
98 }
99 }
100 ?>
101 </div>
102 <?php
103 do_action( 'mainwp_pagefooter_sites', 'ApiBackups' );
104 }
105
106 /**
107 * Render backups list.
108 */
109 public function render_backups_list() {
110
111 if ( ! \mainwp_current_user_can( 'dashboard', 'manage_api_backups' ) ) {
112 \mainwp_do_not_have_permissions( esc_html__( 'manage api backups', 'mainwp' ) );
113 return;
114 }
115 Api_Backups_Admin::render_header();
116 ?>
117 <div id="mainwp-module-api-backups-dashboard">
118 <?php Api_Backups_3rd_Party::render_mainwp_backups_page(); ?>
119 </div>
120 <?php
121 }
122 }
123