File "admin-upgrade.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/advanced-custom-fields/includes/admin/admin-upgrade.php
File
size: 3.04 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
if (!defined('ABSPATH')) {
exit;
}
if (!class_exists('ACF_Admin_Upgrade')) {
class ACF_Admin_Upgrade
{
function __construct()
{
add_action('admin_menu', array($this, 'admin_menu'), 20);
if (is_multisite()) {
add_action('network_admin_menu', array($this, 'network_admin_menu'), 20);
}
}
function admin_menu()
{
if (acf_has_upgrade()) {
add_action('admin_notices', array($this, 'admin_notices'));
$page = add_submenu_page('index.php', __('Upgrade Database', 'acf'), __('Upgrade Database', 'acf'), acf_get_setting('capability'), 'acf-upgrade', array($this, 'admin_html'));
add_action('load-' . $page, array($this, 'admin_load'));
}
}
function network_admin_menu()
{
$upgrade = false;
$sites = get_sites(array('number' => 0));
if ($sites) {
remove_action('switch_blog', 'wp_switch_roles_and_user', 1);
foreach ($sites as $site) {
switch_to_blog($site->blog_id);
$site_upgrade = acf_has_upgrade();
restore_current_blog();
if ($site_upgrade) {
$upgrade = true;
break;
}
}
add_action('switch_blog', 'wp_switch_roles_and_user', 1, 2);
}
if (!$upgrade) {
return;
}
add_action('network_admin_notices', array($this, 'network_admin_notices'));
$page = add_submenu_page('index.php', __('Upgrade Database', 'acf'), __('Upgrade Database', 'acf'), acf_get_setting('capability'), 'acf-upgrade-network', array($this, 'network_admin_html'));
add_action("load-{$page}", array($this, 'network_admin_load'));
}
function admin_load()
{
remove_action('admin_notices', array($this, 'admin_notices'));
acf_enqueue_script('acf');
}
function network_admin_load()
{
remove_action('network_admin_notices', array($this, 'network_admin_notices'));
acf_enqueue_script('acf');
}
function admin_notices()
{
$view = array('button_text' => __('Upgrade Database', 'acf'), 'button_url' => admin_url('index.php?page=acf-upgrade'), 'confirm' => true);
acf_get_view('html-notice-upgrade', $view);
}
function network_admin_notices()
{
$view = array('button_text' => __('Review sites & upgrade', 'acf'), 'button_url' => network_admin_url('index.php?page=acf-upgrade-network'), 'confirm' => false);
acf_get_view('html-notice-upgrade', $view);
}
function admin_html()
{
acf_get_view('html-admin-page-upgrade');
}
function network_admin_html()
{
acf_get_view('html-admin-page-upgrade-network');
}
}
acf_new_instance('ACF_Admin_Upgrade');
}