%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom405686/wp-content/plugins/pws-core/admin/partials/
Upload File :
Create Path :
Current File : /dom405686/wp-content/plugins/pws-core/admin/partials/GD-cORe-admin-themes.php

<?php
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Provide an admin area view for the plugin
 *
 * @since      3.0.0
 * @package    GD_cORe
 * @subpackage GD_cORe/admin/partials
 */

use GD_cORe\handlers\Themes;

$themes_handler = new Themes();
$available_themes = $themes_handler->lookup_theme_access();

// Ensure we have a valid array before sorting
if (!is_array($available_themes)) {
    $available_themes = [];
}

require_once plugin_dir_path(dirname(__FILE__)) . 'partials/form_handlers/GD-cORe-admin-themes-forms.php';
include_once 'GD-cORe-admin-actionLoader.php';
?>

<div class="core-main">
    <!--start main layout-->
    <h1>Themes</h1>
    <span class="error-notice">
    <?php
    if (isset($error)) {
        echo htmlentities($error, ENT_QUOTES, "utf-8");
    }
    ?>
  </span>

    <div class="core-plugins">
        <!--start core plugins layout-->

        <div class="top-bar">
            <!--start top bar-->
            <span class="section-title">Manage Themes</span>
        </div>
        <!--end top bar-->

        <div class="plugin-sec">
            <!--start plugin section-->

            <?php
            // Sort alphabetically by theme name
            if (!empty($available_themes)) {
                uasort($available_themes, function ($a, $b) {
                    return strcasecmp($a['name'], $b['name']);
                });
            }

            foreach ($available_themes as $key => $theme) {
                $theme['slug'] = $key;

                if (!isset($theme['effort']) || !in_array($theme['effort'], $themes_handler->getAllowedEfforts())) {
                    continue;
                }

                $theme_status = $themes_handler->check_theme_installs($theme['key']);

                // 1 = installed + active, 2 = installed not active, 3 = not installed, 4 = needs update
                switch ($theme_status) {
                    case 1:
                        $theme_status_text = 'is active';
                        $action_status = 'Nothing To Do';
                        $theme_class = 'active';
                        $theme_circle_color = 'green';
                        break;
                    case 2:
                        $theme_status_text = 'is installed, but not active';
                        $action_status = 'Activate';
                        $theme_class = 'deactive';
                        $theme_circle_color = 'yellow';
                        break;
                    case 3:
                        $theme_status_text = 'is not installed';
                        $action_status = 'Install';
                        $theme_class = 'default';
                        $theme_circle_color = 'red';
                        break;
                    default:
                        $theme_status_text = 'needs an update';
                        $action_status = 'Update';
                        $theme_class = 'update';
                        $theme_circle_color = 'orange';
                        break;
                }
                ?>

                <div class="single-plugin plugin-<?php echo $theme_class; ?>">
                    <!--start single plugin-->

                    <div class="plugin-status">
                        <div class="circle-icon circle-<?php echo $theme_circle_color; ?>"></div>
                    </div>

                    <div class="plugin-name">
                        [ <?php echo htmlentities($theme['name']); ?> ]
                        <span class="status-text">Theme <?php echo $theme_status_text; ?></span>
                    </div>

                    <div class="plugin-action">
                        <?php if ($theme_status !== 1): ?>
                            <form action="" method="POST">
                                <?php wp_nonce_field( 'gd_core_themes_action' ); ?>
                                <input type="hidden" name="theme-<?php echo $action_status; ?>" value="1" />
                                <input type="hidden" name="theme-key" value="<?php echo $theme['key']; ?>" />
                                <input type="hidden" name="theme-slug" value="<?php echo $theme['slug']; ?>" />
                                <button class="plugin-btn" data-id="action-button"><?php echo $action_status; ?></button>
                            </form>
                        <?php endif; ?>
                    </div>

                </div>
                <!--end single plugin-->

            <?php } ?>
        </div>
        <!--end plugin section-->

    </div>
    <!--end core plugins layout-->
</div>
<!--end main layout-->

Zerion Mini Shell 1.0