Rename plugin to wp-seoprostack-plugin, update file structure
This commit is contained in:
@ -4,35 +4,49 @@
|
||||
*/
|
||||
|
||||
// Add menu item
|
||||
function wp_allstars_admin_menu() {
|
||||
function wp_seoprostack_admin_menu() {
|
||||
add_options_page(
|
||||
'WP ALLSTARS Settings',
|
||||
'WP ALLSTARS',
|
||||
'SEO Pro Stack Settings',
|
||||
'SEO Pro Stack',
|
||||
'manage_options',
|
||||
'wp-allstars',
|
||||
'wp_allstars_settings_page'
|
||||
'wp_seoprostack_settings_page'
|
||||
);
|
||||
}
|
||||
add_action('admin_menu', 'wp_allstars_admin_menu');
|
||||
// Backward compatibility alias
|
||||
function wp_allstars_admin_menu() {
|
||||
return wp_seoprostack_admin_menu();
|
||||
}
|
||||
add_action('admin_menu', 'wp_seoprostack_admin_menu');
|
||||
|
||||
// Register settings
|
||||
function wp_allstars_register_settings() {
|
||||
function wp_seoprostack_register_settings() {
|
||||
// Removed minification settings
|
||||
}
|
||||
add_action('admin_init', 'wp_allstars_register_settings');
|
||||
// Backward compatibility alias
|
||||
function wp_allstars_register_settings() {
|
||||
return wp_seoprostack_register_settings();
|
||||
}
|
||||
add_action('admin_init', 'wp_seoprostack_register_settings');
|
||||
|
||||
// AJAX handler for settings
|
||||
function wp_allstars_update_option() {
|
||||
check_ajax_referer('wp-allstars-nonce', 'nonce');
|
||||
function wp_seoprostack_update_option() {
|
||||
check_ajax_referer('wp-seoprostack-nonce', 'nonce');
|
||||
$option = sanitize_text_field($_POST['option']);
|
||||
$value = intval($_POST['value']);
|
||||
update_option($option, $value);
|
||||
wp_send_json_success('Option updated');
|
||||
}
|
||||
add_action('wp_ajax_wp_allstars_update_option', 'wp_allstars_update_option');
|
||||
// Backward compatibility alias
|
||||
function wp_allstars_update_option() {
|
||||
return wp_seoprostack_update_option();
|
||||
}
|
||||
add_action('wp_ajax_wp_seoprostack_update_option', 'wp_seoprostack_update_option');
|
||||
// Add new AJAX action with updated name
|
||||
add_action('wp_ajax_wp_seoprostack_update_option', 'wp_seoprostack_update_option');
|
||||
|
||||
// Define tools
|
||||
function wp_allstars_get_tools() {
|
||||
function wp_seoprostack_get_tools() {
|
||||
return array(
|
||||
'advise' => array(
|
||||
'name' => 'Advise.so',
|
||||
@ -555,7 +569,7 @@ function wp_allstars_get_tools() {
|
||||
}
|
||||
|
||||
// Define hosting providers
|
||||
function wp_allstars_get_hosting_providers() {
|
||||
function wp_seoprostack_get_hosting_providers() {
|
||||
return array(
|
||||
'closte' => array(
|
||||
'name' => 'Closte',
|
||||
@ -703,7 +717,7 @@ function wp_allstars_get_hosting_providers() {
|
||||
}
|
||||
|
||||
// Define recommended plugins
|
||||
function wp_allstars_get_recommended_plugins() {
|
||||
function wp_seoprostack_get_recommended_plugins() {
|
||||
return array(
|
||||
'minimal' => array(
|
||||
'antispam-bee',
|
||||
@ -860,8 +874,8 @@ function wp_allstars_get_recommended_plugins() {
|
||||
}
|
||||
|
||||
// Add transient caching for plugin data
|
||||
function wp_allstars_get_cached_plugins($category) {
|
||||
$cache_key = 'wp_allstars_plugins_' . $category;
|
||||
function wp_seoprostack_get_cached_plugins($category) {
|
||||
$cache_key = 'wp_seoprostack_plugins_' . $category;
|
||||
$cached_data = get_transient($cache_key);
|
||||
|
||||
if ($cached_data !== false) {
|
||||
@ -871,15 +885,15 @@ function wp_allstars_get_cached_plugins($category) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function wp_allstars_set_cached_plugins($category, $data) {
|
||||
$cache_key = 'wp_allstars_plugins_' . $category;
|
||||
function wp_seoprostack_set_cached_plugins($category, $data) {
|
||||
$cache_key = 'wp_seoprostack_plugins_' . $category;
|
||||
set_transient($cache_key, $data, 12 * HOUR_IN_SECONDS);
|
||||
}
|
||||
|
||||
// Add AJAX endpoint for plugin list
|
||||
function wp_allstars_ajax_get_plugins() {
|
||||
function wp_seoprostack_ajax_get_plugins() {
|
||||
// Check nonce with the correct action name
|
||||
if (!check_ajax_referer('wp-allstars-nonce', '_wpnonce', false)) {
|
||||
if (!check_ajax_referer('wp-seoprostack-nonce', 'nonce', false)) {
|
||||
wp_send_json_error('Invalid security token sent.');
|
||||
return;
|
||||
}
|
||||
@ -893,19 +907,19 @@ function wp_allstars_ajax_get_plugins() {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
// Get our recommended plugins for this category
|
||||
$recommended_plugins = wp_allstars_get_recommended_plugins();
|
||||
$recommended_plugins = wp_seoprostack_get_recommended_plugins();
|
||||
if (!isset($recommended_plugins[$category])) {
|
||||
wp_send_json_error('Invalid category: ' . $category);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get cached data first
|
||||
$cached_data = wp_allstars_get_cached_plugins($category);
|
||||
$cached_data = wp_seoprostack_get_cached_plugins($category);
|
||||
if ($cached_data !== false) {
|
||||
error_log('Using cached data for category: ' . $category);
|
||||
try {
|
||||
// Generate plugin cards HTML
|
||||
$html = wp_allstars_generate_plugin_cards($cached_data->plugins);
|
||||
$html = wp_seoprostack_generate_plugin_cards($cached_data->plugins);
|
||||
wp_send_json_success($html);
|
||||
return;
|
||||
} catch (Exception $e) {
|
||||
@ -979,21 +993,24 @@ function wp_allstars_ajax_get_plugins() {
|
||||
);
|
||||
|
||||
// Cache the results
|
||||
wp_allstars_set_cached_plugins($category, $res);
|
||||
wp_seoprostack_set_cached_plugins($category, $res);
|
||||
|
||||
// Generate plugin cards HTML
|
||||
$html = wp_allstars_generate_plugin_cards($plugins);
|
||||
$html = wp_seoprostack_generate_plugin_cards($plugins);
|
||||
wp_send_json_success($html);
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log('Failed to fetch plugin data: ' . $e->getMessage());
|
||||
wp_send_json_error('Failed to fetch plugin data: ' . $e->getMessage());
|
||||
} catch (Error $e) {
|
||||
error_log('Failed to fetch plugin data: ' . $e->getMessage());
|
||||
wp_send_json_error('Failed to fetch plugin data: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
add_action('wp_ajax_wp_allstars_get_plugins', 'wp_allstars_ajax_get_plugins');
|
||||
add_action('wp_ajax_wp_seoprostack_get_plugins', 'wp_seoprostack_ajax_get_plugins');
|
||||
|
||||
// Function to generate plugin cards HTML
|
||||
function wp_allstars_generate_plugin_cards($plugins) {
|
||||
function wp_seoprostack_generate_plugin_cards($plugins) {
|
||||
if (empty($plugins)) {
|
||||
return '<div class="notice notice-error"><p>No plugins found.</p></div>';
|
||||
}
|
||||
@ -1032,7 +1049,7 @@ function wp_allstars_generate_plugin_cards($plugins) {
|
||||
}
|
||||
|
||||
// Add "Go Pro" button if applicable
|
||||
$pro_plugins = wp_allstars_get_pro_plugins_config();
|
||||
$pro_plugins = wp_seoprostack_get_pro_plugins_config();
|
||||
foreach ($pro_plugins as $pro_plugin) {
|
||||
if (isset($pro_plugin['free_slug']) && $pro_plugin['free_slug'] === $plugin->slug) {
|
||||
// Find the primary button URL in the button_group array
|
||||
@ -1102,16 +1119,16 @@ function wp_allstars_generate_plugin_cards($plugins) {
|
||||
}
|
||||
|
||||
// Helper function to add pro button to plugin cards
|
||||
function wp_allstars_add_pro_button($action_links, $plugin) {
|
||||
function wp_seoprostack_add_pro_button($action_links, $plugin) {
|
||||
// Get pro plugins configuration
|
||||
$pro_plugins = wp_allstars_get_pro_plugins_config();
|
||||
$pro_plugins = wp_seoprostack_get_pro_plugins_config();
|
||||
|
||||
// Check if this plugin has a pro version
|
||||
foreach ($pro_plugins as $pro_plugin) {
|
||||
if (isset($pro_plugin['free_slug']) && $pro_plugin['free_slug'] === $plugin['slug']) {
|
||||
$action_links[] = sprintf(
|
||||
'<a class="button button-primary" href="%s" target="_blank">%s</a>',
|
||||
esc_url(wp_allstars_get_pro_plugin_url($pro_plugin)),
|
||||
esc_url(wp_seoprostack_get_pro_plugin_url($pro_plugin)),
|
||||
esc_html__('Go Pro', 'wp-allstars')
|
||||
);
|
||||
break;
|
||||
@ -1127,7 +1144,7 @@ function wp_allstars_add_pro_button($action_links, $plugin) {
|
||||
* @param array $pro_plugin The pro plugin configuration array
|
||||
* @return string The URL for the pro plugin
|
||||
*/
|
||||
function wp_allstars_get_pro_plugin_url($pro_plugin) {
|
||||
function wp_seoprostack_get_pro_plugin_url($pro_plugin) {
|
||||
// Find the primary button URL in the button_group array
|
||||
$pro_url = '';
|
||||
|
||||
@ -1150,66 +1167,65 @@ function wp_allstars_get_pro_plugin_url($pro_plugin) {
|
||||
}
|
||||
|
||||
// Remove the old plugins API filter since we're handling everything in the AJAX endpoint
|
||||
remove_filter('plugins_api_result', 'wp_allstars_plugins_api_result');
|
||||
remove_filter('plugins_api_result', 'wp_seoprostack_plugins_api_result');
|
||||
|
||||
// Clear plugin cache when plugins are updated, activated, or deactivated
|
||||
function wp_allstars_clear_plugin_cache() {
|
||||
$recommended_plugins = wp_allstars_get_recommended_plugins();
|
||||
function wp_seoprostack_clear_plugin_cache() {
|
||||
$recommended_plugins = wp_seoprostack_get_recommended_plugins();
|
||||
foreach (array_keys($recommended_plugins) as $category) {
|
||||
delete_transient('wp_allstars_plugins_' . $category);
|
||||
delete_transient('wp_seoprostack_plugins_' . $category);
|
||||
}
|
||||
}
|
||||
add_action('upgrader_process_complete', 'wp_allstars_clear_plugin_cache', 10, 0);
|
||||
add_action('activated_plugin', 'wp_allstars_clear_plugin_cache');
|
||||
add_action('deactivated_plugin', 'wp_allstars_clear_plugin_cache');
|
||||
add_action('deleted_plugin', 'wp_allstars_clear_plugin_cache');
|
||||
add_action('update_option_active_plugins', 'wp_allstars_clear_plugin_cache');
|
||||
add_action('upgrader_process_complete', 'wp_seoprostack_clear_plugin_cache', 10, 0);
|
||||
add_action('activated_plugin', 'wp_seoprostack_clear_plugin_cache');
|
||||
add_action('deactivated_plugin', 'wp_seoprostack_clear_plugin_cache');
|
||||
add_action('deleted_plugin', 'wp_seoprostack_clear_plugin_cache');
|
||||
add_action('update_option_active_plugins', 'wp_seoprostack_clear_plugin_cache');
|
||||
|
||||
// Add transient caching for theme data
|
||||
function wp_allstars_get_cached_theme() {
|
||||
$cache_key = 'wp_allstars_theme_kadence';
|
||||
function wp_seoprostack_get_cached_theme() {
|
||||
$cache_key = 'wp_seoprostack_theme_kadence';
|
||||
return get_transient($cache_key);
|
||||
}
|
||||
|
||||
function wp_allstars_set_cached_theme($data) {
|
||||
$cache_key = 'wp_allstars_theme_kadence';
|
||||
function wp_seoprostack_set_cached_theme($data) {
|
||||
$cache_key = 'wp_seoprostack_theme_kadence';
|
||||
set_transient($cache_key, $data, 12 * HOUR_IN_SECONDS);
|
||||
}
|
||||
|
||||
// Add AJAX endpoint for theme
|
||||
function wp_allstars_ajax_get_themes() {
|
||||
error_log('WP ALLSTARS: Theme AJAX handler started');
|
||||
function wp_seoprostack_ajax_get_themes() {
|
||||
error_log('SEO Pro Stack: Theme AJAX handler started');
|
||||
|
||||
// Check nonce with the correct action name
|
||||
if (!isset($_POST['_wpnonce'])) {
|
||||
error_log('WP ALLSTARS: No nonce provided');
|
||||
error_log('SEO Pro Stack: No nonce provided');
|
||||
wp_send_json_error('No security token provided.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_ajax_referer('wp-allstars-nonce', '_wpnonce', false)) {
|
||||
error_log('WP ALLSTARS: Invalid nonce: ' . sanitize_text_field($_POST['_wpnonce']));
|
||||
if (!check_ajax_referer('wp-seoprostack-nonce', '_wpnonce', false)) {
|
||||
error_log('SEO Pro Stack: Invalid nonce: ' . sanitize_text_field($_POST['_wpnonce']));
|
||||
wp_send_json_error('Invalid security token sent.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current_user_can('install_themes')) {
|
||||
error_log('WP ALLSTARS: User does not have permission to install themes');
|
||||
wp_send_json_error('Permission denied');
|
||||
return;
|
||||
error_log('SEO Pro Stack: User does not have permission to install themes');
|
||||
wp_die(-1);
|
||||
}
|
||||
|
||||
error_log('WP ALLSTARS: Starting theme fetch process');
|
||||
error_log('SEO Pro Stack: Starting theme fetch process');
|
||||
|
||||
try {
|
||||
error_log('WP ALLSTARS: Fetching theme data for kadence');
|
||||
error_log('SEO Pro Stack: Fetching theme data for kadence');
|
||||
|
||||
// Check if we have cached data first
|
||||
$theme_data = wp_allstars_get_cached_theme();
|
||||
$theme_data = wp_seoprostack_get_cached_theme();
|
||||
|
||||
// If no cached data, fetch from API
|
||||
if (empty($theme_data)) {
|
||||
error_log('WP ALLSTARS: No cached theme data, fetching from API');
|
||||
error_log('SEO Pro Stack: No cached theme data, fetching from API');
|
||||
|
||||
// Get theme data with minimal fields
|
||||
$theme_data = themes_api('theme_information', array(
|
||||
@ -1236,19 +1252,19 @@ function wp_allstars_ajax_get_themes() {
|
||||
|
||||
// Cache the result if successful
|
||||
if (!is_wp_error($theme_data)) {
|
||||
wp_allstars_set_cached_theme($theme_data);
|
||||
wp_seoprostack_set_cached_theme($theme_data);
|
||||
}
|
||||
} else {
|
||||
error_log('WP ALLSTARS: Using cached theme data');
|
||||
error_log('SEO Pro Stack: Using cached theme data');
|
||||
}
|
||||
|
||||
if (is_wp_error($theme_data)) {
|
||||
error_log('WP ALLSTARS Theme API Error: ' . $theme_data->get_error_message());
|
||||
error_log('SEO Pro Stack Theme API Error: ' . $theme_data->get_error_message());
|
||||
wp_send_json_error('Theme API Error: ' . $theme_data->get_error_message());
|
||||
return;
|
||||
}
|
||||
|
||||
error_log('WP ALLSTARS: Successfully fetched theme data');
|
||||
error_log('SEO Pro Stack: Successfully fetched theme data');
|
||||
|
||||
// Format author data
|
||||
$author = '';
|
||||
@ -1258,7 +1274,7 @@ function wp_allstars_ajax_get_themes() {
|
||||
$author = isset($theme_data->author['display_name']) ? $theme_data->author['display_name'] : '';
|
||||
}
|
||||
|
||||
error_log('WP ALLSTARS: Theme data retrieved, generating HTML');
|
||||
error_log('SEO Pro Stack: Theme data retrieved, generating HTML');
|
||||
|
||||
// Generate custom HTML for the theme using our template partial
|
||||
ob_start();
|
||||
@ -1266,55 +1282,55 @@ function wp_allstars_ajax_get_themes() {
|
||||
$html = ob_get_clean();
|
||||
|
||||
if (empty($html)) {
|
||||
error_log('WP ALLSTARS: Empty HTML generated');
|
||||
error_log('SEO Pro Stack: Empty HTML generated');
|
||||
wp_send_json_error('Failed to generate theme display');
|
||||
return;
|
||||
}
|
||||
|
||||
error_log('WP ALLSTARS: Successfully generated theme display, HTML length: ' . strlen($html));
|
||||
error_log('SEO Pro Stack: Successfully generated theme display, HTML length: ' . strlen($html));
|
||||
wp_send_json_success($html);
|
||||
exit; // Ensure we exit after sending the JSON response
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log('WP ALLSTARS Theme loading exception: ' . $e->getMessage());
|
||||
error_log('WP ALLSTARS Theme loading exception trace: ' . $e->getTraceAsString());
|
||||
error_log('SEO Pro Stack Theme loading exception: ' . $e->getMessage());
|
||||
error_log('SEO Pro Stack Theme loading exception trace: ' . $e->getTraceAsString());
|
||||
wp_send_json_error('Theme loading error: ' . $e->getMessage());
|
||||
} catch (Error $e) {
|
||||
error_log('WP ALLSTARS Theme loading error: ' . $e->getMessage());
|
||||
error_log('WP ALLSTARS Theme loading error trace: ' . $e->getTraceAsString());
|
||||
error_log('SEO Pro Stack Theme loading error: ' . $e->getMessage());
|
||||
error_log('SEO Pro Stack Theme loading error trace: ' . $e->getTraceAsString());
|
||||
wp_send_json_error('Theme loading error: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
add_action('wp_ajax_wp_allstars_get_themes', 'wp_allstars_ajax_get_themes');
|
||||
add_action('wp_ajax_wp_seoprostack_get_themes', 'wp_seoprostack_ajax_get_themes');
|
||||
|
||||
// Clear theme cache when themes are updated
|
||||
function wp_allstars_clear_theme_cache() {
|
||||
delete_transient('wp_allstars_theme_kadence');
|
||||
function wp_seoprostack_clear_theme_cache() {
|
||||
delete_transient('wp_seoprostack_theme_kadence');
|
||||
}
|
||||
add_action('upgrader_process_complete', 'wp_allstars_clear_theme_cache', 10, 0);
|
||||
add_action('switch_theme', 'wp_allstars_clear_theme_cache');
|
||||
add_action('upgrader_process_complete', 'wp_seoprostack_clear_theme_cache', 10, 0);
|
||||
add_action('switch_theme', 'wp_seoprostack_clear_theme_cache');
|
||||
|
||||
// Add AJAX handler for theme activation
|
||||
function wp_allstars_activate_theme() {
|
||||
function wp_seoprostack_activate_theme() {
|
||||
// Debug information
|
||||
error_log('Theme activation AJAX request received: ' . print_r($_POST, true));
|
||||
error_log('SEO Pro Stack: Theme activation AJAX request received: ' . print_r($_POST, true));
|
||||
|
||||
// Check nonce with the correct action name
|
||||
if (!check_ajax_referer('wp-allstars-nonce', '_wpnonce', false)) {
|
||||
error_log('Theme activation failed: Invalid nonce');
|
||||
if (!check_ajax_referer('wp-seoprostack-nonce', '_wpnonce', false)) {
|
||||
error_log('SEO Pro Stack: Theme activation failed: Invalid nonce');
|
||||
wp_send_json_error('Invalid security token sent.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current_user_can('switch_themes')) {
|
||||
error_log('Theme activation failed: Permission denied');
|
||||
error_log('SEO Pro Stack: Theme activation failed: Permission denied');
|
||||
wp_send_json_error('Permission denied');
|
||||
return;
|
||||
}
|
||||
|
||||
$theme = isset($_POST['theme']) ? sanitize_text_field($_POST['theme']) : '';
|
||||
if (empty($theme)) {
|
||||
error_log('Theme activation failed: No theme specified');
|
||||
error_log('SEO Pro Stack: Theme activation failed: No theme specified');
|
||||
wp_send_json_error('No theme specified');
|
||||
return;
|
||||
}
|
||||
@ -1322,13 +1338,13 @@ function wp_allstars_activate_theme() {
|
||||
// Get the theme object
|
||||
$theme_obj = wp_get_theme($theme);
|
||||
if (!$theme_obj->exists()) {
|
||||
error_log('Theme activation failed: Theme does not exist - ' . $theme);
|
||||
error_log('SEO Pro Stack: Theme activation failed: Theme does not exist - ' . $theme);
|
||||
wp_send_json_error('Theme does not exist');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($theme_obj->errors()) {
|
||||
error_log('Theme activation failed: Theme has errors - ' . print_r($theme_obj->errors(), true));
|
||||
error_log('SEO Pro Stack: Theme activation failed: Theme has errors - ' . print_r($theme_obj->errors(), true));
|
||||
wp_send_json_error('Theme has errors');
|
||||
return;
|
||||
}
|
||||
@ -1336,7 +1352,7 @@ function wp_allstars_activate_theme() {
|
||||
// Check if theme is already active
|
||||
$current_theme = wp_get_theme();
|
||||
if ($current_theme->get_stylesheet() === $theme) {
|
||||
error_log('Theme is already active: ' . $theme);
|
||||
error_log('SEO Pro Stack: Theme is already active: ' . $theme);
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Theme is already active',
|
||||
'customize_url' => admin_url('customize.php')
|
||||
@ -1345,26 +1361,26 @@ function wp_allstars_activate_theme() {
|
||||
}
|
||||
|
||||
// Switch the theme
|
||||
error_log('Switching to theme: ' . $theme);
|
||||
error_log('SEO Pro Stack: Switching to theme: ' . $theme);
|
||||
switch_theme($theme);
|
||||
|
||||
// Check if the switch was successful
|
||||
$active_theme = wp_get_theme();
|
||||
if ($active_theme->get_stylesheet() === $theme) {
|
||||
error_log('Theme activated successfully: ' . $theme);
|
||||
error_log('SEO Pro Stack: Theme activated successfully: ' . $theme);
|
||||
wp_send_json_success(array(
|
||||
'message' => 'Theme activated successfully',
|
||||
'customize_url' => admin_url('customize.php')
|
||||
));
|
||||
} else {
|
||||
error_log('Failed to activate theme: ' . $theme . ', active theme is: ' . $active_theme->get_stylesheet());
|
||||
error_log('SEO Pro Stack: Failed to activate theme: ' . $theme . ', active theme is: ' . $active_theme->get_stylesheet());
|
||||
wp_send_json_error('Failed to activate theme');
|
||||
}
|
||||
}
|
||||
add_action('wp_ajax_wp_allstars_activate_theme', 'wp_allstars_activate_theme');
|
||||
add_action('wp_ajax_wp_seoprostack_activate_theme', 'wp_seoprostack_activate_theme');
|
||||
|
||||
// Register settings page HTML
|
||||
function wp_allstars_settings_page() {
|
||||
function wp_seoprostack_settings_page() {
|
||||
global $tabs;
|
||||
|
||||
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general';
|
||||
@ -1372,7 +1388,7 @@ function wp_allstars_settings_page() {
|
||||
|
||||
// Clear cache and load required files
|
||||
if ($active_tab === 'recommended') {
|
||||
wp_allstars_clear_plugin_cache();
|
||||
wp_seoprostack_clear_plugin_cache();
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
wp_enqueue_script('plugin-install');
|
||||
wp_enqueue_script('updates');
|
||||
@ -1396,9 +1412,9 @@ function wp_allstars_settings_page() {
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: "wp_allstars_get_plugins",
|
||||
action: "wp_seoprostack_get_plugins",
|
||||
category: category,
|
||||
_wpnonce: wpAllstars.nonce
|
||||
_wpnonce: wpSeoProStack.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
$loadingOverlay.remove();
|
||||
@ -1424,7 +1440,7 @@ function wp_allstars_settings_page() {
|
||||
});
|
||||
');
|
||||
} elseif ($active_tab === 'theme') {
|
||||
wp_allstars_clear_theme_cache();
|
||||
wp_seoprostack_clear_theme_cache();
|
||||
require_once ABSPATH . 'wp-admin/includes/theme.php';
|
||||
wp_enqueue_script('theme-install');
|
||||
wp_enqueue_script('updates');
|
||||
@ -1447,8 +1463,8 @@ function wp_allstars_settings_page() {
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: "wp_allstars_get_themes",
|
||||
_wpnonce: wpAllstars.nonce
|
||||
action: "wp_seoprostack_get_themes",
|
||||
_wpnonce: wpSeoProStack.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
$loadingOverlay.remove();
|
||||
@ -1523,14 +1539,14 @@ function wp_allstars_settings_page() {
|
||||
<div class="wp-allstars-toggle-left">
|
||||
<div class="wp-toggle-switch">
|
||||
<input type="checkbox"
|
||||
id="wp_allstars_auto_upload_images"
|
||||
name="wp_allstars_auto_upload_images"
|
||||
id="wp_seoprostack_auto_upload_images"
|
||||
name="wp_seoprostack_auto_upload_images"
|
||||
value="1"
|
||||
<?php checked(get_option('wp_allstars_auto_upload_images', false)); ?>
|
||||
<?php checked(get_option('wp_seoprostack_auto_upload_images', get_option('wp_allstars_auto_upload_images', false))); ?>
|
||||
/>
|
||||
<span class="wp-toggle-slider"></span>
|
||||
</div>
|
||||
<label for="wp_allstars_auto_upload_images">
|
||||
<label for="wp_seoprostack_auto_upload_images">
|
||||
<?php esc_html_e('Enable Auto Upload Images', 'wp-allstars'); ?>
|
||||
</label>
|
||||
</div>
|
||||
@ -1541,40 +1557,40 @@ function wp_allstars_settings_page() {
|
||||
</div>
|
||||
<div class="wp-allstars-toggle-settings">
|
||||
<div class="wp-allstars-setting-row">
|
||||
<label for="wp_allstars_max_width"><?php esc_html_e('Max Width', 'wp-allstars'); ?></label>
|
||||
<label for="wp_seoprostack_max_width"><?php esc_html_e('Max Width', 'wp-allstars'); ?></label>
|
||||
<input type="number"
|
||||
id="wp_allstars_max_width"
|
||||
name="wp_allstars_max_width"
|
||||
value="<?php echo esc_attr(get_option('wp_allstars_max_width', 2560)); ?>"
|
||||
id="wp_seoprostack_max_width"
|
||||
name="wp_seoprostack_max_width"
|
||||
value="<?php echo esc_attr(get_option('wp_seoprostack_max_width', get_option('wp_allstars_max_width', 2560))); ?>"
|
||||
/>
|
||||
<p class="description"><?php esc_html_e('Maximum width for uploaded images in pixels.', 'wp-allstars'); ?></p>
|
||||
</div>
|
||||
<div class="wp-allstars-setting-row">
|
||||
<label for="wp_allstars_max_height"><?php esc_html_e('Max Height', 'wp-allstars'); ?></label>
|
||||
<label for="wp_seoprostack_max_height"><?php esc_html_e('Max Height', 'wp-allstars'); ?></label>
|
||||
<input type="number"
|
||||
id="wp_allstars_max_height"
|
||||
name="wp_allstars_max_height"
|
||||
value="<?php echo esc_attr(get_option('wp_allstars_max_height', 2560)); ?>"
|
||||
id="wp_seoprostack_max_height"
|
||||
name="wp_seoprostack_max_height"
|
||||
value="<?php echo esc_attr(get_option('wp_seoprostack_max_height', get_option('wp_allstars_max_height', 2560))); ?>"
|
||||
/>
|
||||
<p class="description"><?php esc_html_e('Maximum height for uploaded images in pixels.', 'wp-allstars'); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="wp-allstars-setting-row">
|
||||
<label for="wp_exclude_urls"><?php esc_html_e('Exclude URLs', 'wp-allstars'); ?></label>
|
||||
<textarea id="wp_exclude_urls"
|
||||
name="wp_exclude_urls"
|
||||
<label for="wp_seoprostack_exclude_urls"><?php esc_html_e('Exclude URLs', 'wp-allstars'); ?></label>
|
||||
<textarea id="wp_seoprostack_exclude_urls"
|
||||
name="wp_seoprostack_exclude_urls"
|
||||
rows="3"
|
||||
placeholder="example.com another-domain.com"
|
||||
><?php echo esc_textarea(get_option('wp_allstars_exclude_urls', '')); ?></textarea>
|
||||
><?php echo esc_textarea(get_option('wp_seoprostack_exclude_urls', get_option('wp_allstars_exclude_urls', ''))); ?></textarea>
|
||||
<p class="description"><?php esc_html_e('Enter domains to exclude (one per line). Images from these domains will not be imported.', 'wp-allstars'); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="wp-allstars-setting-row">
|
||||
<label for="wp_image_name"><?php esc_html_e('Image Name Pattern', 'wp-allstars'); ?></label>
|
||||
<label for="wp_seoprostack_image_name"><?php esc_html_e('Image Name Pattern', 'wp-allstars'); ?></label>
|
||||
<input type="text"
|
||||
id="wp_image_name"
|
||||
name="wp_image_name"
|
||||
value="<?php echo esc_attr(get_option('wp_allstars_image_name_pattern', '%filename%')); ?>"
|
||||
id="wp_seoprostack_image_name"
|
||||
name="wp_seoprostack_image_name"
|
||||
value="<?php echo esc_attr(get_option('wp_seoprostack_image_name_pattern', get_option('wp_allstars_image_name_pattern', '%filename%'))); ?>"
|
||||
/>
|
||||
<p class="description">
|
||||
<?php esc_html_e('Available patterns:', 'wp-allstars'); ?> %filename%, %post_id%, %postname%, %timestamp%, %date%, %year%, %month%, %day%
|
||||
@ -1582,11 +1598,11 @@ function wp_allstars_settings_page() {
|
||||
</div>
|
||||
|
||||
<div class="wp-allstars-setting-row">
|
||||
<label for="wp_image_alt"><?php esc_html_e('Image Alt Pattern', 'wp-allstars'); ?></label>
|
||||
<label for="wp_seoprostack_image_alt"><?php esc_html_e('Image Alt Pattern', 'wp-allstars'); ?></label>
|
||||
<input type="text"
|
||||
id="wp_image_alt"
|
||||
name="wp_image_alt"
|
||||
value="<?php echo esc_attr(get_option('wp_allstars_image_alt_pattern', '%filename%')); ?>"
|
||||
id="wp_seoprostack_image_alt"
|
||||
name="wp_seoprostack_image_alt"
|
||||
value="<?php echo esc_attr(get_option('wp_seoprostack_image_alt_pattern', get_option('wp_allstars_image_alt_pattern', '%filename%'))); ?>"
|
||||
/>
|
||||
<p class="description">
|
||||
<?php esc_html_e('Available patterns:', 'wp-allstars'); ?> %filename%, %post_title%, %post_id%, %postname%, %timestamp%
|
||||
@ -1659,9 +1675,34 @@ function wp_allstars_settings_page() {
|
||||
line-height: 34px;
|
||||
text-align: center;
|
||||
padding: 0 10px;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
border: 1px solid #0071a1 !important;
|
||||
border-radius: 3px !important;
|
||||
background: #f6f7f7;
|
||||
color: #0071a1;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
box-shadow: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
@media (max-width: 782px) {
|
||||
.theme-actions .button:hover {
|
||||
background: #f0f0f1;
|
||||
border-color: #0071a1;
|
||||
color: #0071a1;
|
||||
}
|
||||
.theme-actions .button-primary {
|
||||
background: #0071a1;
|
||||
border-color: #0071a1;
|
||||
color: #fff;
|
||||
}
|
||||
.theme-actions .button-primary:hover {
|
||||
background: #005d8c;
|
||||
border-color: #005d8c;
|
||||
color: #fff;
|
||||
}
|
||||
@media screen and (max-width: 782px) {
|
||||
.theme-actions {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
@ -1679,7 +1720,7 @@ function wp_allstars_settings_page() {
|
||||
<div class="tab-content" id="hosting">
|
||||
<div class="wpa-pro-plugins">
|
||||
<?php
|
||||
$hosting_providers = wp_allstars_get_hosting_providers();
|
||||
$hosting_providers = wp_seoprostack_get_hosting_providers();
|
||||
// Sort providers alphabetically by name
|
||||
uasort($hosting_providers, function($a, $b) {
|
||||
return strcasecmp($a['name'], $b['name']);
|
||||
@ -1767,7 +1808,7 @@ function wp_allstars_settings_page() {
|
||||
<div class="tab-content" id="pro">
|
||||
<div class="wpa-pro-plugins">
|
||||
<?php
|
||||
$pro_plugins = wp_allstars_get_pro_plugins_config();
|
||||
$pro_plugins = wp_seoprostack_get_pro_plugins_config();
|
||||
// Sort plugins alphabetically by name
|
||||
uasort($pro_plugins, function($a, $b) {
|
||||
return strcasecmp($a['name'], $b['name']);
|
||||
@ -1785,17 +1826,6 @@ function wp_allstars_settings_page() {
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="button-group">
|
||||
<?php if (!empty($plugin['demo_url'])): ?>
|
||||
<a href="<?php echo esc_url($plugin['demo_url']); ?>" class="button" target="_blank">
|
||||
<?php esc_html_e('View Demo', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo esc_url($plugin['url']); ?>" class="button button-primary" target="_blank">
|
||||
<?php esc_html_e('Learn More', 'wp-allstars'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
@ -1869,14 +1899,14 @@ function wp_allstars_settings_page() {
|
||||
border-color: #0071a1;
|
||||
color: #0071a1;
|
||||
}
|
||||
.wpa-pro-plugin .button-primary {
|
||||
background: #0071a1;
|
||||
border-color: #0071a1;
|
||||
.wpa-pro-plugin .button.button-primary {
|
||||
background: #2271b1;
|
||||
border-color: #2271b1 !important;
|
||||
color: #fff;
|
||||
}
|
||||
.wpa-pro-plugin .button-primary:hover {
|
||||
background: #005d8c;
|
||||
border-color: #005d8c;
|
||||
.wpa-pro-plugin .button.button-primary:hover {
|
||||
background: #135e96;
|
||||
border-color: #135e96 !important;
|
||||
color: #fff;
|
||||
}
|
||||
@media screen and (max-width: 960px) {
|
||||
@ -1915,14 +1945,14 @@ function wp_allstars_settings_page() {
|
||||
<div class="wp-setting-left">
|
||||
<div class="wp-toggle-switch">
|
||||
<input type="checkbox"
|
||||
id="wp_allstars_simple_setting"
|
||||
name="wp_allstars_simple_setting"
|
||||
id="wp_seoprostack_simple_setting"
|
||||
name="wp_seoprostack_simple_setting"
|
||||
value="1"
|
||||
<?php checked(get_option('wp_allstars_simple_setting', false)); ?>
|
||||
<?php checked(get_option('wp_seoprostack_simple_setting', get_option('wp_allstars_simple_setting', false))); ?>
|
||||
/>
|
||||
<span class="wp-toggle-slider"></span>
|
||||
</div>
|
||||
<label for="wp_allstars_simple_setting" class="wp-setting-label">
|
||||
<label for="wp_seoprostack_simple_setting" class="wp-setting-label">
|
||||
<?php esc_html_e('Example: Simple Toggle', 'wp-allstars'); ?>
|
||||
</label>
|
||||
</div>
|
||||
@ -1945,14 +1975,14 @@ function wp_allstars_settings_page() {
|
||||
<div class="wp-allstars-toggle-left">
|
||||
<div class="wp-toggle-switch">
|
||||
<input type="checkbox"
|
||||
id="wp_allstars_auto_upload_images"
|
||||
name="wp_allstars_auto_upload_images"
|
||||
id="wp_seoprostack_auto_upload_images"
|
||||
name="wp_seoprostack_auto_upload_images"
|
||||
value="1"
|
||||
<?php checked(get_option('wp_allstars_auto_upload_images', false)); ?>
|
||||
<?php checked(get_option('wp_seoprostack_auto_upload_images', get_option('wp_allstars_auto_upload_images', false))); ?>
|
||||
/>
|
||||
<span class="wp-toggle-slider"></span>
|
||||
</div>
|
||||
<label for="wp_allstars_auto_upload_images">
|
||||
<label for="wp_seoprostack_auto_upload_images">
|
||||
<?php esc_html_e('Example: Expandable Panel', 'wp-allstars'); ?>
|
||||
</label>
|
||||
</div>
|
||||
@ -2051,11 +2081,12 @@ function wp_allstars_settings_page() {
|
||||
.wpa-pro-plugin .button.button-primary:hover {
|
||||
background: #135e96;
|
||||
border-color: #135e96 !important;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<div class="wpa-pro-plugins">
|
||||
<?php
|
||||
$tools = wp_allstars_get_tools();
|
||||
$tools = wp_seoprostack_get_tools();
|
||||
// Sort tools alphabetically by name
|
||||
uasort($tools, function($a, $b) {
|
||||
return strcasecmp($a['name'], $b['name']);
|
||||
@ -2088,18 +2119,21 @@ function wp_allstars_settings_page() {
|
||||
}
|
||||
|
||||
// Enqueue admin scripts and styles
|
||||
function wp_allstars_admin_enqueue_scripts($hook) {
|
||||
if ('settings_page_wp-allstars' !== $hook) {
|
||||
function wp_seoprostack_admin_enqueue_scripts($hook) {
|
||||
if ($hook !== 'toplevel_page_seoprostack') {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style('wp-allstars-admin', plugins_url('css/wp-allstars-admin.css', __FILE__));
|
||||
wp_enqueue_script('wp-allstars-admin', plugins_url('js/wp-allstars-admin.js', __FILE__), array('jquery'), WP_ALLSTARS_VERSION, true);
|
||||
// Add admin CSS
|
||||
wp_enqueue_style('wp-seoprostack-admin', plugins_url('css/seoprostack-admin.css', __FILE__), array(), WP_ALLSTARS_VERSION);
|
||||
|
||||
// Add admin JavaScript
|
||||
wp_enqueue_script('seoprostack-admin', plugins_url('js/seoprostack-admin.js', __FILE__), array('jquery'), WP_ALLSTARS_VERSION, true);
|
||||
|
||||
// Localize the script with new data
|
||||
wp_localize_script('wp-allstars-admin', 'wpAllstars', array(
|
||||
'nonce' => wp_create_nonce('wp-allstars-nonce'),
|
||||
wp_localize_script('seoprostack-admin', 'wpSeoProStack', array(
|
||||
'nonce' => wp_create_nonce('wp-seoprostack-nonce'),
|
||||
'ajaxurl' => admin_url('admin-ajax.php')
|
||||
));
|
||||
}
|
||||
add_action('admin_enqueue_scripts', 'wp_allstars_admin_enqueue_scripts');
|
||||
add_action('admin_enqueue_scripts', 'wp_seoprostack_admin_enqueue_scripts');
|
Reference in New Issue
Block a user