| @@ -269,18 +269,8 @@ | ||
| 269 | 269 | $this->admin->render_layout_open('Settings', $settings_current_page, 'Manage all plugin settings and configuration.'); |
| 270 | 270 | ?> |
| 271 | 271 | <?php |
| 272 | 272 | /* |
| 273 | - * options.php redirects back here after the native (no-JavaScript) | |
| 274 | - * settings submit. Scoped to metasync_messages so field-level | |
| 275 | - * rejections (e.g. invalid white-label branding) print without the | |
| 276 | - * generic "Settings saved." notice that would otherwise accompany | |
| 277 | - * a rejected save. | |
| 278 | - */ | |
| 279 | - settings_errors('metasync_messages'); | |
| 280 | - ?> | |
| 281 | - <?php | |
| 282 | - /* | |
| 283 | 273 | # Temporarily commented out: Clear Cache notice and button (can be re-enabled later) |
| 284 | 274 | |
| 285 | 275 | * <div class="notice notice-success"> |
| 286 | 276 | * <p> |
| @@ -793,21 +783,21 @@ | ||
| 793 | 783 | } |
| 794 | 784 | }); |
| 795 | 785 | |
| 796 | 786 | function hasPassword() { |
| 797 | - var passwordField = $('input[name="<?php echo esc_attr(Metasync_Admin::option_key); ?>[whitelabel][settings_password]"]'); | |
| 787 | + var passwordField = $('input[name="<?php echo Metasync_Admin::option_key; ?>[whitelabel][settings_password]"]'); | |
| 798 | 788 | var passwordValue = passwordField.val(); |
| 799 | 789 | return passwordValue && passwordValue.length > 0; |
| 800 | 790 | } |
| 801 | 791 | |
| 802 | 792 | function hasRecoveryEmail() { |
| 803 | - var recoveryEmailField = $('input[name="<?php echo esc_attr(Metasync_Admin::option_key); ?>[whitelabel][recovery_email]"]'); | |
| 793 | + var recoveryEmailField = $('input[name="<?php echo Metasync_Admin::option_key; ?>[whitelabel][recovery_email]"]'); | |
| 804 | 794 | var emailValue = recoveryEmailField.val(); |
| 805 | 795 | return emailValue && emailValue.length > 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue); |
| 806 | 796 | } |
| 807 | 797 | |
| 808 | - var passwordField = $('input[name="<?php echo esc_attr(Metasync_Admin::option_key); ?>[whitelabel][settings_password]"]'); | |
| 809 | - var recoveryEmailField = $('input[name="<?php echo esc_attr(Metasync_Admin::option_key); ?>[whitelabel][recovery_email]"]'); | |
| 798 | + var passwordField = $('input[name="<?php echo Metasync_Admin::option_key; ?>[whitelabel][settings_password]"]'); | |
| 799 | + var recoveryEmailField = $('input[name="<?php echo Metasync_Admin::option_key; ?>[whitelabel][recovery_email]"]'); | |
| 810 | 800 | |
| 811 | 801 | passwordField.on('blur', function() { |
| 812 | 802 | if (hasPassword() && !hasRecoveryEmail()) { |
| 813 | 803 | showModal( |
| @@ -845,9 +835,9 @@ | ||
| 845 | 835 | 'You must set a <strong>Settings Password</strong> before enabling "Hide Settings".<br><br>Please scroll up to the <strong>Branding</strong> section and set a password first.' |
| 846 | 836 | ); |
| 847 | 837 | |
| 848 | 838 | setTimeout(function() { |
| 849 | - $('input[name="<?php echo esc_attr(Metasync_Admin::option_key); ?>[whitelabel][settings_password]"]').focus(); | |
| 839 | + $('input[name="<?php echo Metasync_Admin::option_key; ?>[whitelabel][settings_password]"]').focus(); | |
| 850 | 840 | }, 300); |
| 851 | 841 | |
| 852 | 842 | return false; |
| 853 | 843 | } |
| @@ -983,9 +973,9 @@ | ||
| 983 | 973 | 'method': 'post', |
| 984 | 974 | 'action': '' |
| 985 | 975 | }); |
| 986 | 976 | |
| 987 | - logoutForm.append('<?php echo wp_nonce_field("whitelabel_logout_nonce", "whitelabel_logout_nonce", true, false); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- nonce markup from wp_nonce_field() is safe by construction; kses-based escaping strips the <input> and breaks the logout nonce ?>'); | |
| 977 | + logoutForm.append('<?php echo wp_nonce_field("whitelabel_logout_nonce", "whitelabel_logout_nonce", true, false); ?>'); | |
| 988 | 978 | |
| 989 | 979 | logoutForm.append($('<input>', { |
| 990 | 980 | 'type': 'hidden', |
| 991 | 981 | 'name': 'whitelabel_logout', |
| @@ -1057,9 +1047,9 @@ | ||
| 1057 | 1047 | $.ajax({ |
| 1058 | 1048 | url: ajaxUrl, |
| 1059 | 1049 | type: 'POST', |
| 1060 | 1050 | dataType: 'json', |
| 1061 | - data: { action: action, nonce: '<?php echo esc_attr(wp_create_nonce('metasync_nonce')); ?>' }, | |
| 1051 | + data: { action: action, nonce: '<?php echo wp_create_nonce('metasync_nonce'); ?>' }, | |
| 1062 | 1052 | timeout: 35000, |
| 1063 | 1053 | success: function(response, textStatus, xhr) { |
| 1064 | 1054 | try { |
| 1065 | 1055 | if (response && response.success && response.data) { |
| @@ -1375,9 +1365,9 @@ | ||
| 1375 | 1365 | <p style="color: var(--dashboard-text-secondary); margin-bottom: 20px;">Access your <?php echo esc_html(Metasync::get_effective_plugin_name()); ?> dashboard to view analytics, manage SEO settings, and monitor your site performance.</p> |
| 1376 | 1366 | <?php |
| 1377 | 1367 | if (!isset(Metasync::get_option('general')['linkgraph_token']) || Metasync::get_option('general')['linkgraph_token'] == '') { |
| 1378 | 1368 | echo '<p style="color: #d54e21; margin-bottom: 15px;">Authentication required: Please authenticate with your ' . esc_html(Metasync::get_effective_plugin_name()) . ' account and save your auth token in general settings.</p>'; |
| 1379 | - echo '<a href="' . esc_url(admin_url('admin.php?page=' . Metasync_Admin::$page_slug)) . '" class="button button-secondary">Go to Settings</a>'; | |
| 1369 | + echo '<a href="' . admin_url('admin.php?page=' . Metasync_Admin::$page_slug) . '" class="button button-secondary">Go to Settings</a>'; | |
| 1380 | 1370 | } else { |
| 1381 | 1371 | echo '<a href="' . esc_url($this->admin->get_dashboard_url()) . '" target="_blank" class="button button-primary">Open Dashboard</a>'; |
| 1382 | 1372 | } |
| 1383 | 1373 | ?> |
| @@ -1416,11 +1406,8 @@ | ||
| 1416 | 1406 | |
| 1417 | 1407 | if (is_wp_error($result)) { |
| 1418 | 1408 | echo '<div class="notice notice-error"><p>' . esc_html($result->get_error_message()) . '</p></div>'; |
| 1419 | 1409 | } else { |
| 1420 | - Metasync_PostHog::feature('robots_txt_saved', array( | |
| 1421 | - 'warning_count' => count($validation['warnings']), | |
| 1422 | - )); | |
| 1423 | 1410 | echo '<div class="notice notice-success"><p>' . esc_html__('robots.txt file saved successfully!', 'metasync') . '</p></div>'; |
| 1424 | 1411 | |
| 1425 | 1412 | if (!empty($validation['warnings'])) { |
| 1426 | 1413 | foreach ($validation['warnings'] as $warning) { |