<?php

/**
 * Theme Updater Page
 */
global $spyropress;
// Clear transients
delete_transient('_spyropress_api_theme_updater');
delete_transient('_spyropress_api_framework_updater');
// Theme Log
$theme_log = spyropress_get_theme_changelog();
$is_theme_updateable = is_theme_updateable();
$theme_name = $spyropress->theme_name;
$theme_version = $spyropress->theme_version;
// Framework Log
$framework_log = spyropress_get_framework_changelog();
// Getting Filesystem intact
$method = get_filesystem_method();
$to = ABSPATH . 'wp-content/themes/' . get_option('template');
if (isset($_POST['password'])) {
    $cred = $_POST;
    $filesystem = WP_Filesystem($cred);
} elseif (isset($_POST['spyropress_ftp_cred'])) {
    $cred = spyropress_decode($_POST['spyropress_ftp_cred']);
    $filesystem = WP_Filesystem($cred);
} else {
    $filesystem = WP_Filesystem();
}
$url = admin_url('admin.php?page=spyropress-update');
?>
 /**
  * Spyropress Menu/Pages Function
  * Create spyropress menu array for the admin pages.
  */
 function construct_admin_menu()
 {
     global $spyropress;
     // Dashboard
     $this->admin_menu_parent = array('page_title' => __('Welcome to SpyroPress', 'spyropress'), 'menu_title' => __('Spyropress', 'spyropress'), 'slug' => 'spyropress', 'position' => '55');
     $this->admin_menus['spyropress'] = array('page_title' => __('Welcome to SpyroPress', 'spyropress'), 'menu_title' => __('Dashboard', 'spyropress'), 'page_file' => 'page-dashboard.php', 'isactive' => true, 'hidden' => false);
     // Get theme-supported options
     $registered_options = get_theme_support('spyropress-options');
     if (!empty($registered_options)) {
         foreach ($registered_options[0] as $option => $option_meta) {
             $key = 'spyropress-' . $option;
             $this->admin_menus[$key] = array_merge($option_meta, array('page_file' => 'page-option-machine.php'));
         }
     }
     if ($spyropress->is_builder_verified) {
         $count = is_theme_updateable() ? '<span class="update-plugins count-1"><span class="update-count">1</span></span>' : '';
         $this->admin_menus['spyropress-update'] = array('page_title' => __('Theme Updates', 'spyropress'), 'menu_title' => __('Theme Updates', 'spyropress') . $count, 'page_file' => 'page-theme-update.php', 'isactive' => true, 'hidden' => false);
     }
 }