Rename plugin to wp-seoprostack-plugin, update file structure

This commit is contained in:
Marcus Quinn
2025-03-24 02:48:06 +00:00
parent 18b0a2c246
commit aee3cb91e2
35 changed files with 5455 additions and 655 deletions

View File

@ -0,0 +1,193 @@
<?php
/**
* The admin settings page class.
*
* @package SEO_Pro_Stack
* @subpackage SEO_Pro_Stack/Admin/Settings
*/
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
/**
* The admin settings page class.
*/
class SEOProStack_Settings_Page {
/**
* Register the settings page.
*/
public function add_menu_page() {
add_options_page(
'SEO Pro Stack Settings', // Page title
'SEO Pro Stack', // Menu title
'manage_options', // Capability
'seoprostack', // Menu slug
array($this, 'render_settings_page') // Function to display the page
);
}
/**
* Register settings.
*/
public function register_settings() {
register_setting('seoprostack_settings', 'seoprostack_workflow_options');
register_setting('seoprostack_settings', 'seoprostack_advanced_options');
}
/**
* Render the settings page.
*/
public function render_settings_page() {
$active_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'general';
$tabs = $this->get_tabs();
?>
<div class="wrap seoprostack-wrap">
<div class="seoprostack-header">
<h1><?php echo esc_html('SEO Pro Stack'); ?></h1>
<p class="seoprostack-description"><?php echo esc_html('Speed up your WordPress site with our optimization tools.'); ?></p>
</div>
<div class="seoprostack-settings-container">
<div class="seoprostack-nav">
<h2 class="nav-tab-wrapper">
<?php foreach ($tabs as $tab_id => $tab) : ?>
<a href="?page=seoprostack&tab=<?php echo esc_attr($tab_id); ?>"
class="nav-tab <?php echo $active_tab === $tab_id ? 'nav-tab-active' : ''; ?>">
<?php echo esc_html($tab['label']); ?>
</a>
<?php endforeach; ?>
</h2>
</div>
<div class="seoprostack-settings-content">
<?php
if (isset($tabs[$active_tab]) && isset($tabs[$active_tab]['callback'])) {
call_user_func($tabs[$active_tab]['callback']);
}
?>
</div>
</div>
</div>
<?php
}
/**
* Get all available tabs.
*
* @return array Array of tab configurations.
*/
private function get_tabs() {
$tabs = array(
'general' => array(
'label' => __('General', 'seoprostack'),
'callback' => array($this, 'render_general_tab'),
),
'advanced' => array(
'label' => __('Advanced', 'seoprostack'),
'callback' => array($this, 'render_advanced_tab'),
),
'workflow' => array(
'label' => __('Workflow', 'seoprostack'),
'callback' => array($this, 'render_workflow_tab'),
),
'recommended' => array(
'label' => __('Free Plugins', 'seoprostack'),
'callback' => array($this, 'render_recommended_plugins_tab'),
),
'pro' => array(
'label' => __('Pro Plugins', 'seoprostack'),
'callback' => array($this, 'render_pro_plugins_tab'),
),
'theme' => array(
'label' => __('Theme', 'seoprostack'),
'callback' => array($this, 'render_theme_tab'),
),
'hosting' => array(
'label' => __('Hosting', 'seoprostack'),
'callback' => array($this, 'render_hosting_tab'),
),
'tools' => array(
'label' => __('Tools', 'seoprostack'),
'callback' => array($this, 'render_tools_tab'),
),
);
return $tabs;
}
/**
* Render the General tab.
*/
public function render_general_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-general.php';
$tab = new SEOProStack_Tab_General();
$tab->render();
}
/**
* Render the Advanced tab.
*/
public function render_advanced_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-advanced.php';
$tab = new SEOProStack_Tab_Advanced();
$tab->render();
}
/**
* Render the Workflow tab.
*/
public function render_workflow_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-workflow.php';
$tab = new SEOProStack_Tab_Workflow();
$tab->render();
}
/**
* Render the Recommended Plugins tab.
*/
public function render_recommended_plugins_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-recommended-plugins.php';
$tab = new SEOProStack_Tab_Recommended_Plugins();
$tab->render();
}
/**
* Render the Pro Plugins tab.
*/
public function render_pro_plugins_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-pro-plugins.php';
$tab = new SEOProStack_Tab_Pro_Plugins();
$tab->render();
}
/**
* Render the Theme tab.
*/
public function render_theme_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-theme.php';
$tab = new SEOProStack_Tab_Theme();
$tab->render();
}
/**
* Render the Hosting tab.
*/
public function render_hosting_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-hosting.php';
$tab = new SEOProStack_Tab_Hosting();
$tab->render();
}
/**
* Render the Tools tab.
*/
public function render_tools_tab() {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/class-seoprostack-tab-tools.php';
$tab = new SEOProStack_Tab_Tools();
$tab->render();
}
}