| @@ -14,8 +14,23 @@ | ||
| 14 | 14 | if (!defined('ABSPATH')) { |
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | +/** | |
| 19 | + * Whether this section is rendered outside any settings form. | |
| 20 | + * | |
| 21 | + * On General Settings and Indexation Control the section sits inside | |
| 22 | + * #metaSyncGeneralSetting / #metaSyncSeoControlsForm, whose own save button | |
| 23 | + * posts these fields along with everything else. The standalone Instant | |
| 24 | + * Indexing page has no such form — its only button ("Save Post Types") posts | |
| 25 | + * metasync_post_types and ignores the credentials entirely — so a service | |
| 26 | + * account pasted or uploaded there could never be saved. In that context we | |
| 27 | + * render a dedicated Save button wired to its own AJAX endpoint. | |
| 28 | + * | |
| 29 | + * Callers opt in by setting $google_index_standalone before the include. | |
| 30 | + */ | |
| 31 | +$google_index_standalone = !empty($google_index_standalone); | |
| 32 | + | |
| 18 | 33 | ?> |
| 19 | 34 | |
| 20 | 35 | <div style="padding: 20px;"> |
| 21 | 36 | <!-- Requirements (Collapsible) --> |
| @@ -116,9 +131,42 @@ | ||
| 116 | 131 | </tr> |
| 117 | 132 | </table> |
| 118 | 133 | |
| 119 | 134 | <!-- Action Buttons and Test Results --> |
| 120 | - <?php if ($is_configured): ?> | |
| 135 | + <?php if ($google_index_standalone): ?> | |
| 136 | + <!-- | |
| 137 | + Standalone Instant Indexing page only. The embedded contexts are | |
| 138 | + saved by their own form's save button, so adding a second one there | |
| 139 | + would give the page two competing save paths. | |
| 140 | + --> | |
| 141 | + <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid #ddd;"> | |
| 142 | + <?php wp_nonce_field('metasync_google_index_account', 'metasync_google_index_account_nonce'); ?> | |
| 143 | + <button type="button" | |
| 144 | + id="google-index-save-config" | |
| 145 | + class="button button-primary"> | |
| 146 | + <span class="dashicons dashicons-yes" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span> Save Configuration | |
| 147 | + </button> | |
| 148 | + | |
| 149 | + <?php if ($is_configured): ?> | |
| 150 | + <button type="button" | |
| 151 | + id="google-index-test-connection" | |
| 152 | + class="button button-secondary" | |
| 153 | + style="margin-left: 10px;"> | |
| 154 | + <span class="dashicons dashicons-yes" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span> Test Connection | |
| 155 | + </button> | |
| 156 | + | |
| 157 | + <button type="button" | |
| 158 | + id="google-index-clear-config" | |
| 159 | + class="button button-link-delete" | |
| 160 | + style="margin-left: 10px;"> | |
| 161 | + <span class="dashicons dashicons-trash" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span> Clear Configuration | |
| 162 | + </button> | |
| 163 | + <?php endif; ?> | |
| 164 | + | |
| 165 | + <div id="google-index-save-messages" style="margin-top: 15px;"></div> | |
| 166 | + <div id="google-index-test-results" style="margin-top: 15px;"></div> | |
| 167 | + </div> | |
| 168 | + <?php elseif ($is_configured): ?> | |
| 121 | 169 | <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid #ddd;"> |
| 122 | 170 | <button type="button" |
| 123 | 171 | id="google-index-test-connection" |
| 124 | 172 | class="button button-secondary"> |