| @@ -286,12 +286,8 @@ | ||
| 286 | 286 | if (empty($whitelabel_settings['hide_indexation_control'])) { |
| 287 | 287 | $menu_items['seo_controls'] = ['title' => 'Indexation Control', 'slug_suffix' => '-seo-controls']; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if ($general_options['enable_googleinstantindex'] ?? false) { | |
| 291 | - $menu_items['instant_index'] = ['title' => 'Instant Indexing', 'slug_suffix' => '-instant-index']; | |
| 292 | - } | |
| 293 | - | |
| 294 | 290 | if ($general_options['enable_google_console'] ?? false) { |
| 295 | 291 | $menu_items['google_console'] = ['title' => 'Google Console', 'slug_suffix' => '-google-console']; |
| 296 | 292 | } |
| 297 | 293 | |
| @@ -506,20 +502,8 @@ | ||
| 506 | 502 | 'group' => 'seo' |
| 507 | 503 | ]; |
| 508 | 504 | } |
| 509 | 505 | |
| 510 | - // Instant Indexing - setting now stored in seo_controls (moved from Settings to Indexation Control) | |
| 511 | - $seo_controls = Metasync::get_option('seo_controls'); | |
| 512 | - if ($seo_controls['enable_googleinstantindex'] ?? false) { | |
| 513 | - $menu_items['instant_index'] = [ | |
| 514 | - 'title' => 'Instant Indexing', | |
| 515 | - 'slug_suffix' => '-instant-index', | |
| 516 | - 'callback' => 'create_admin_google_instant_index_page', | |
| 517 | - 'internal_nav' => 'Instant Indexing', | |
| 518 | - 'group' => 'seo' | |
| 519 | - ]; | |
| 520 | - } | |
| 521 | - | |
| 522 | 506 | if ($general_options['enable_google_console'] ?? false) { |
| 523 | 507 | $menu_items['google_console'] = [ |
| 524 | 508 | 'title' => 'Google Console', |
| 525 | 509 | 'slug_suffix' => '-google-console', |
| @@ -833,13 +817,8 @@ | ||
| 833 | 817 | |
| 834 | 818 | // Site Verification (in-page sidebar only in short mode) |
| 835 | 819 | $register_submenu('site_verification', 'Site Verification', 'Site Verification', $menu_capability, $menu_slug . '-search-engine-verify', array($admin, 'create_admin_search_engine_verification_page')); |
| 836 | 820 | |
| 837 | - // Instant Indexing (conditional) | |
| 838 | - if ($seo_controls['enable_googleinstantindex'] ?? false) { | |
| 839 | - $register_submenu('instant_index', 'Instant Indexing', 'Instant Indexing', $menu_capability, $menu_slug . '-instant-index', array($admin, 'create_admin_google_instant_index_page')); | |
| 840 | - } | |
| 841 | - | |
| 842 | 821 | // Google Console (conditional) |
| 843 | 822 | if ($general_options['enable_google_console'] ?? false) { |
| 844 | 823 | $register_submenu('google_console', 'Google Console', 'Google Console', $menu_capability, $menu_slug . '-google-console', array($admin, 'create_admin_google_console_page')); |
| 845 | 824 | } |
| @@ -920,10 +899,10 @@ | ||
| 920 | 899 | // WordPress cannot resolve titles for pages registered under an empty |
| 921 | 900 | // parent, even though those pages remain reachable by URL. Restore the |
| 922 | 901 | // standard admin title format for our registered pages only. |
| 923 | 902 | add_filter('admin_title', function($admin_title, $title) use (&$admin_page_titles) { |
| 924 | - $current_page = isset($_GET['page']) && is_string($_GET['page']) | |
| 925 | - ? sanitize_text_field(wp_unslash($_GET['page'])) | |
| 903 | + $current_page = isset($_GET['page']) && is_string($_GET['page']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only page slug for the admin title | |
| 904 | + ? sanitize_text_field(wp_unslash($_GET['page'])) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only page slug for the admin title | |
| 926 | 905 | : ''; |
| 927 | 906 | |
| 928 | 907 | if (empty($title) && isset($admin_page_titles[$current_page])) { |
| 929 | 908 | $site_title = is_network_admin() || is_user_admin() |
| @@ -931,9 +910,9 @@ | ||
| 931 | 910 | : get_bloginfo('name'); |
| 932 | 911 | |
| 933 | 912 | $admin_title = sprintf( |
| 934 | 913 | /* translators: 1: Admin page title, 2: Site or network title. */ |
| 935 | - __('%1$s ‹ %2$s — WordPress'), | |
| 914 | + __('%1$s ‹ %2$s — WordPress', 'metasync'), | |
| 936 | 915 | $admin_page_titles[$current_page], |
| 937 | 916 | $site_title |
| 938 | 917 | ); |
| 939 | 918 | } |
| @@ -1478,10 +1457,10 @@ | ||
| 1478 | 1457 | |
| 1479 | 1458 | <?php |
| 1480 | 1459 | $page_slug = Metasync_Admin::$page_slug; |
| 1481 | 1460 | $is_plugin_page = ( |
| 1482 | - (isset($_GET['page']) && strpos($_GET['page'], $page_slug) !== false) || | |
| 1483 | - (isset($_GET['page']) && strpos($_GET['page'], 'searchatlas') !== false) | |
| 1461 | + (isset($_GET['page']) && strpos($_GET['page'], $page_slug) !== false) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only page check for an inline config script | |
| 1462 | + (isset($_GET['page']) && strpos($_GET['page'], 'searchatlas') !== false) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only page check for an inline config script | |
| 1484 | 1463 | ); |
| 1485 | 1464 | if ($is_plugin_page): |
| 1486 | 1465 | ?> |
| 1487 | 1466 | <script type="text/javascript"> |
| @@ -1777,15 +1756,19 @@ | ||
| 1777 | 1756 | { |
| 1778 | 1757 | ?> |
| 1779 | 1758 | </main><!-- /.metasync-layout-main --> |
| 1780 | 1759 | |
| 1781 | - <?php if ($show_promo): | |
| 1782 | - $general = Metasync::get_option('general') ?? []; | |
| 1783 | - $is_connected = Metasync_Heartbeat_Manager::instance()->is_heartbeat_connected($general); | |
| 1760 | + <?php | |
| 1761 | + // The sidebar exists to get an unconnected site connected. Once the | |
| 1762 | + // site is linked it has nothing further to offer, so the whole | |
| 1763 | + // column is dropped and the grid reflows to two columns. | |
| 1764 | + $show_promo = $show_promo && ! Metasync_Heartbeat_Manager::instance() | |
| 1765 | + ->is_heartbeat_connected(Metasync::get_option('general') ?? []); | |
| 1766 | + if ($show_promo): | |
| 1784 | 1767 | ?> |
| 1785 | 1768 | <!-- Right promo sidebar --> |
| 1786 | 1769 | <aside class="metasync-layout-promo"> |
| 1787 | - <?php $this->render_promo_sidebar($is_connected); ?> | |
| 1770 | + <?php $this->render_promo_sidebar(); ?> | |
| 1788 | 1771 | </aside> |
| 1789 | 1772 | <?php endif; ?> |
| 1790 | 1773 | |
| 1791 | 1774 | </div><!-- /.metasync-layout --> |
| @@ -1840,11 +1823,19 @@ | ||
| 1840 | 1823 | $plugin_items[$key] = $item; |
| 1841 | 1824 | } |
| 1842 | 1825 | } |
| 1843 | 1826 | |
| 1827 | + $total_items = count($seo_items) + count($plugin_items); | |
| 1828 | + | |
| 1844 | 1829 | ?> |
| 1845 | 1830 | <nav class="metasync-sidenav"> |
| 1846 | 1831 | |
| 1832 | + <?php if ($total_items === 0): ?> | |
| 1833 | + <div class="metasync-sidenav-empty"> | |
| 1834 | + <?php esc_html_e('No pages are available.', 'metasync'); ?> | |
| 1835 | + </div> | |
| 1836 | + <?php else: ?> | |
| 1837 | + | |
| 1847 | 1838 | <!-- SEO Features group --> |
| 1848 | 1839 | <div class="metasync-sidenav-group"> |
| 1849 | 1840 | <div class="metasync-sidenav-group-title">SEO Features</div> |
| 1850 | 1841 | <ul> |
| @@ -1910,8 +1901,10 @@ | ||
| 1910 | 1901 | </ul> |
| 1911 | 1902 | </div> |
| 1912 | 1903 | <?php endif; ?> |
| 1913 | 1904 | |
| 1905 | + <?php endif; ?> | |
| 1906 | + | |
| 1914 | 1907 | </nav> |
| 1915 | 1908 | <?php |
| 1916 | 1909 | } |
| 1917 | 1910 | |
| @@ -1917,17 +1910,22 @@ | ||
| 1917 | 1910 | |
| 1918 | 1911 | /** |
| 1919 | 1912 | * Render the right promotional sidebar. |
| 1920 | 1913 | * |
| 1921 | - * @param bool $is_connected Whether the plugin is authenticated. | |
| 1914 | + * Only reached while the site is unconnected; the caller drops the | |
| 1915 | + * whole column once the plugin is linked. | |
| 1922 | 1916 | */ |
| 1923 | - public function render_promo_sidebar($is_connected = false) | |
| 1917 | + public function render_promo_sidebar() | |
| 1924 | 1918 | { |
| 1925 | 1919 | $plugin_name = Metasync::get_effective_plugin_name(); |
| 1926 | 1920 | $otto_name = Metasync::get_whitelabel_otto_name(); |
| 1927 | 1921 | $settings_url = esc_url(admin_url('admin.php?page=' . Metasync_Admin::$page_slug)); |
| 1928 | 1922 | $homepage = Metasync::HOMEPAGE_DOMAIN; |
| 1929 | - $is_default_brand = ( $plugin_name === 'Search Atlas' ); | |
| 1923 | + $docs_url = Metasync::DOCUMENTATION_DOMAIN; | |
| 1924 | + // These links point at Search Atlas properties, so they only belong | |
| 1925 | + // here while the plugin runs under its own name AND branding — a | |
| 1926 | + // reseller can leave the name untouched and still be whitelabeled. | |
| 1927 | + $is_default_brand = ( $plugin_name === 'Search Atlas' ) && ! Metasync::is_whitelabel_enabled(); | |
| 1930 | 1928 | $whitelabel = Metasync::get_whitelabel_settings(); |
| 1931 | 1929 | $custom_links = isset($whitelabel['quick_links']) && is_array($whitelabel['quick_links']) |
| 1932 | 1930 | ? array_filter($whitelabel['quick_links'], function($l) { return !empty($l['url']); }) |
| 1933 | 1931 | : []; |
| @@ -1932,9 +1930,8 @@ | ||
| 1932 | 1930 | ? array_filter($whitelabel['quick_links'], function($l) { return !empty($l['url']); }) |
| 1933 | 1931 | : []; |
| 1934 | 1932 | ?> |
| 1935 | 1933 | |
| 1936 | - <?php if (!$is_connected): ?> | |
| 1937 | 1934 | <!-- Connect CTA card --> |
| 1938 | 1935 | <div class="metasync-promo-card metasync-promo-card--connect"> |
| 1939 | 1936 | <div class="metasync-promo-card-header"> |
| 1940 | 1937 | <div class="metasync-promo-card-icon"> |
| @@ -1954,36 +1951,8 @@ | ||
| 1954 | 1951 | <a href="<?php echo $settings_url; ?>" class="metasync-promo-btn metasync-promo-btn--primary"> |
| 1955 | 1952 | Connect Now |
| 1956 | 1953 | </a> |
| 1957 | 1954 | </div> |
| 1958 | - <?php else: ?> | |
| 1959 | - <!-- Connected — feature highlights --> | |
| 1960 | - <div class="metasync-promo-card metasync-promo-card--accent"> | |
| 1961 | - <div class="metasync-promo-card-header"> | |
| 1962 | - <div class="metasync-promo-card-icon"> | |
| 1963 | - <span class="dashicons dashicons-performance"></span> | |
| 1964 | - </div> | |
| 1965 | - <div> | |
| 1966 | - <h3><?php echo esc_html($otto_name); ?> Active</h3> | |
| 1967 | - </div> | |
| 1968 | - </div> | |
| 1969 | - <p class="metasync-promo-tagline">Your site is connected and <?php echo esc_html($otto_name); ?> is optimizing pages automatically.</p> | |
| 1970 | - <ul class="metasync-promo-benefits"> | |
| 1971 | - <li><span class="promo-check">✓</span> Schema markup auto-applied</li> | |
| 1972 | - <li><span class="promo-check">✓</span> Meta titles & descriptions optimized</li> | |
| 1973 | - <li><span class="promo-check">✓</span> Internal linking suggestions active</li> | |
| 1974 | - </ul> | |
| 1975 | - <?php if ($is_default_brand): ?> | |
| 1976 | - <a href="<?php echo esc_url($homepage); ?>" target="_blank" rel="noopener" class="metasync-promo-btn metasync-promo-btn--outline"> | |
| 1977 | - View <?php echo esc_html($plugin_name); ?> Dashboard | |
| 1978 | - </a> | |
| 1979 | - <?php elseif (!empty($whitelabel['domain'])): ?> | |
| 1980 | - <a href="<?php echo esc_url($whitelabel['domain']); ?>" target="_blank" rel="noopener" class="metasync-promo-btn metasync-promo-btn--outline"> | |
| 1981 | - View <?php echo esc_html($plugin_name); ?> Dashboard | |
| 1982 | - </a> | |
| 1983 | - <?php endif; ?> | |
| 1984 | - </div> | |
| 1985 | - <?php endif; ?> | |
| 1986 | 1955 | |
| 1987 | 1956 | <?php |
| 1988 | 1957 | // Quick Links: show default links for default brand, custom links if whitelabeled + provided, hide if whitelabeled + none |
| 1989 | 1958 | $show_quick_links = $is_default_brand || !empty($custom_links); |
| @@ -1993,12 +1962,20 @@ | ||
| 1993 | 1962 | <div class="metasync-promo-card"> |
| 1994 | 1963 | <h3 style="margin:0 0 12px;font-size:13px;font-weight:700;color:var(--dashboard-text-primary);">Quick Links</h3> |
| 1995 | 1964 | <ul class="metasync-promo-links"> |
| 1996 | 1965 | <?php if ($is_default_brand): ?> |
| 1966 | + <li><a href="<?php echo esc_url($docs_url); ?>" target="_blank" rel="noopener"><span class="dashicons dashicons-book-alt"></span> Documentation</a></li> | |
| 1997 | 1967 | <li><a href="<?php echo esc_url($homepage . '/blog/'); ?>" target="_blank" rel="noopener"><span class="dashicons dashicons-rss"></span> SEO Blog</a></li> |
| 1998 | - <li><a href="<?php echo esc_url($homepage . '/academy/'); ?>" target="_blank" rel="noopener"><span class="dashicons dashicons-welcome-learn-more"></span> SEO Academy</a></li> | |
| 1968 | + <li><a href="<?php echo esc_url($homepage . '/contact/'); ?>" target="_blank" rel="noopener"><span class="dashicons dashicons-email-alt"></span> Contact Support</a></li> | |
| 1999 | 1969 | <li><a href="<?php echo esc_url(admin_url('admin.php?page=' . Metasync_Admin::$page_slug . '-setup-wizard')); ?>"><span class="dashicons dashicons-admin-customizer"></span> Setup Wizard</a></li> |
| 1970 | + <?php | |
| 1971 | + // Mirrors the gate that decides whether the page is registered | |
| 1972 | + // at all. Without it the link outlives the page for any user | |
| 1973 | + // the access rules hide it from, and leads nowhere. | |
| 1974 | + if (Metasync_Access_Control::user_can_access('hide_report_issue')): | |
| 1975 | + ?> | |
| 2000 | 1976 | <li><a href="<?php echo esc_url(admin_url('admin.php?page=' . Metasync_Admin::$page_slug . '-report-issue')); ?>"><span class="dashicons dashicons-sos"></span> Report Issue</a></li> |
| 1977 | + <?php endif; ?> | |
| 2001 | 1978 | <?php else: ?> |
| 2002 | 1979 | <?php foreach ($custom_links as $link): ?> |
| 2003 | 1980 | <li><a href="<?php echo esc_url($link['url']); ?>" <?php echo !empty($link['external']) ? 'target="_blank" rel="noopener"' : ''; ?>><span class="dashicons dashicons-admin-links"></span> <?php echo esc_html($link['label'] ?: $link['url']); ?></a></li> |
| 2004 | 1981 | <?php endforeach; ?> |