tab_id; } /** * Get the tab title * * @return string The tab title */ public function get_title() { return __('Tools', 'seoprostack'); } /** * Get the tab description * * @return string The tab description */ public function get_description() { return __('Useful tools and resources to help improve your website\'s SEO and performance.', 'seoprostack'); } /** * Get the tools data * This internalizes the data previously retrieved from wp_seoprostack_get_tools() * * @return array Array of tools with their details */ public function get_tools() { return array( 'advise' => array( 'name' => 'Advise.so', 'description' => 'Accelerate website growth with AI-powered content optimization and topic recommendations.', 'button_group' => array( array( 'text' => 'Home Page', 'url' => 'https://advise.so/', 'primary' => true ), array( 'text' => 'App', 'url' => 'https://app.advise.so/' ) ) ), 'seoutils' => array( 'name' => 'SEO Utils', 'description' => 'Rich collection of online SEO tools for keyword research, SERP analysis, and content optimization.', 'button_group' => array( array( 'text' => 'Home Page', 'url' => 'https://seoutils.com/', 'primary' => true ) ) ), 'dataforseo' => array( 'name' => 'DataForSEO', 'description' => 'Comprehensive SEO APIs for rank tracking, SERP analysis, and keyword research.', 'button_group' => array( array( 'text' => 'Home Page', 'url' => 'https://dataforseo.com/', 'primary' => true ), array( 'text' => 'Dashboard', 'url' => 'https://app.dataforseo.com/' ) ) ), // For brevity, I'm including only a few tools here // In production, you would include all tools or dynamically load them 'ahrefs' => array( 'name' => 'Ahrefs', 'description' => 'Comprehensive SEO toolset for backlink analysis, keyword research, and competitor analysis.', 'button_group' => array( array( 'text' => 'Home Page', 'url' => 'https://ahrefs.com/', 'primary' => true ), array( 'text' => 'Dashboard', 'url' => 'https://app.ahrefs.com/' ) ) ), 'localrank' => array( 'name' => 'LocalRank', 'description' => 'Track keyword rankings for multiple locations to better understand local SEO performance.', 'button_group' => array( array( 'text' => 'Home Page', 'url' => 'https://app.localrank.io/', 'primary' => true ) ) ), // Additional tools would be listed here... ); } /** * Render the tab content. */ public function render() { // Get tools from the internal method $tools = $this->get_tools(); // For backward compatibility, make tools available through the global function if (function_exists('wp_seoprostack_get_tools') && empty($GLOBALS['_wp_seoprostack_tools_loaded'])) { // Optional: merge with any tools from the external function to ensure none are lost $external_tools = wp_seoprostack_get_tools(); $tools = array_merge($external_tools, $tools); $GLOBALS['_wp_seoprostack_tools_loaded'] = true; } ?>
__('You do not have permission to perform this action.', 'seoprostack'))); } global $wpdb; // Optimize database tables $tables = $wpdb->get_results('SHOW TABLES', ARRAY_N); $optimized = 0; foreach ($tables as $table) { if (0 === strpos($table[0], $wpdb->prefix)) { $wpdb->query("OPTIMIZE TABLE {$table[0]}"); $optimized++; } } // Clean up post revisions $deleted_revisions = $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'"); // Clean up auto drafts $deleted_drafts = $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'"); // Clean up orphaned postmeta $deleted_postmeta = $wpdb->query(" DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts p ON p.ID = pm.post_id WHERE p.ID IS NULL "); // Send success response wp_send_json_success(array( 'message' => sprintf( __('Database optimization complete. Optimized %d tables, deleted %d revisions, %d auto-drafts, and %d orphaned postmeta entries.', 'seoprostack'), $optimized, $deleted_revisions, $deleted_drafts, $deleted_postmeta ) )); } }