PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.0
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.0
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
metasync / views / metasync-google-index-api-settings.php

metasync-google-index-api-settings.php in Search Atlas SEO – OTTO AI SEO Automation for WordPress 2.7.0, at views/metasync-google-index-api-settings.php

214 lines 9.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * MetaSync - Google Index API Settings
5 *
6 * This view integrates Google Index API settings into MetaSync's general settings
7 *
8 * @package MetaSync
9 * @subpackage GoogleIndexDirect
10 * @version 1.0.0
11 */
12
13 // Prevent direct access
14 if (!defined('ABSPATH')) {
15 exit;
16 }
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
33 ?>
34
35 <div style="padding: 20px;">
36 <!-- Requirements (Collapsible) -->
37 <details style="margin-top: 20px; padding-top: 15px;">
38 <summary style="cursor: pointer; font-weight: 600; margin-bottom: 10px;">Requirements</summary>
39 <div style="margin-top: 10px;">
40 <ul style="margin-left: 20px;">
41 <li>Google Cloud Project with Indexing API enabled</li>
42 <li>Service Account with appropriate permissions</li>
43 <li>Domain verified in Google Search Console</li>
44 <li>Service account added as user in Search Console</li>
45 </ul>
46 </div>
47 </details>
48
49 <!-- Configuration Status -->
50 <div style="margin-bottom: 20px;">
51 <?php if ($is_configured): ?>
52 <div class="notice notice-success inline" style="margin: 0 0 15px 0; padding: 10px;">
53 <p style="margin: 0;">
54 <strong>Service Account Configured: </strong><br>
55 <strong>Email:</strong> <?php echo esc_html($service_info['client_email']); ?><br>
56 <strong>Project ID:</strong> <?php echo esc_html($service_info['project_id']); ?>
57 </p>
58 </div>
59 <?php else: ?>
60 <div class="notice notice-warning inline" style="margin: 0 0 15px 0; padding: 10px;">
61 <p style="margin: 0;">
62 <strong>Service Account Not Configured</strong><br>
63 Please provide your Google service account JSON below.
64 </p>
65 </div>
66 <?php endif; ?>
67 </div>
68
69 <!-- Settings Fields -->
70 <table class="form-table" style="margin-top: 0;">
71 <tr>
72 <th scope="row" style="width: 200px;">
73 <label for="google_index_service_account_json">Service Account JSON</label>
74 <?php Metasync::render_tooltip_icon('google_index_service_account_json', 'Paste the private key file from a Google Cloud service account added to your Search Console property. This lets the plugin ask Google to crawl your pages. Treat it like a password. It is stored on your server and never shared.'); ?>
75 </th>
76 <td>
77 <textarea name="google_index_service_account_json"
78 id="google_index_service_account_json"
79 class="large-text code"
80 rows="8"
81 placeholder="Paste your Google service account JSON here..."><?php
82 if ($is_configured && !empty($saved_json_display)) {
83 echo esc_textarea($saved_json_display);
84 }
85 ?></textarea>
86 <p class="description">
87 <strong>How to get this:</strong><br>
88 1. Go to <a href="https://console.cloud.google.com/apis/credentials" target="_blank">Google Cloud Console → Credentials</a><br>
89 2. Create or select a Service Account → Generate JSON key<br>
90 3. Paste the JSON content above or upload the file below
91 </p>
92 </td>
93 </tr>
94
95 <tr>
96 <th scope="row">
97 <label for="google_index_service_account_file">Upload JSON File</label>
98 <?php Metasync::render_tooltip_icon('google_index_service_account_file', 'Upload the service account JSON key file you downloaded from Google Cloud instead of pasting it. The file fills in the Service Account JSON box above. It is only stored once you save.'); ?>
99 </th>
100 <td>
101 <input type="file"
102 name="google_index_service_account_file"
103 id="google_index_service_account_file"
104 accept=".json,application/json"
105 class="regular-text" />
106
107 <!--
108 Selected-file row. Hidden until a file is chosen; the admin
109 JS fills in the name and reveals it. "Remove" clears the
110 input and restores the textarea to whatever it held before
111 the file was read, so a mis-click does not destroy a saved
112 (redacted) configuration the user never meant to replace.
113 -->
114 <p id="google-index-selected-file" style="display:none;margin:8px 0 0;">
115 <span class="dashicons dashicons-media-code" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span>
116 <strong id="google-index-selected-file-name"></strong>
117 <button type="button"
118 id="google-index-remove-file"
119 class="button-link"
120 style="margin-left:8px;color:var(--dashboard-error, #b32d2e);text-decoration:none;"
121 aria-label="Remove the selected JSON file">&times; Remove</button>
122 </p>
123
124 <!-- Inline validation feedback; replaces the old alert(). -->
125 <div id="google-index-file-messages" style="margin-top:8px;"></div>
126
127 <p class="description">
128 Upload your service account JSON file. This will auto-populate the textarea above.
129 </p>
130 </td>
131 </tr>
132 </table>
133
134 <!-- Action Buttons and Test Results -->
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): ?>
169 <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid #ddd;">
170 <button type="button"
171 id="google-index-test-connection"
172 class="button button-secondary">
173 <span class="dashicons dashicons-yes" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span> Test Connection
174 </button>
175
176 <button type="button"
177 id="google-index-clear-config"
178 class="button button-link-delete"
179 style="margin-left: 10px;">
180 <span class="dashicons dashicons-trash" style="margin-top:3px;font-size:15px;width:15px;height:15px;"></span> Clear Configuration
181 </button>
182
183 <div id="google-index-test-results" style="margin-top: 15px;"></div>
184 </div>
185 <?php endif; ?>
186
187 </div>
188
189 <style>
190 /* Additional styles for Google Index API section */
191 #google-index-test-results .notice {
192 margin-top: 10px;
193 }
194
195 #google-index-test-results ul {
196 margin-left: 20px;
197 }
198
199 .metasync-accordion-section details[open] summary {
200 margin-bottom: 15px;
201 }
202
203 .metasync-accordion-section pre {
204 font-size: 12px;
205 line-height: 1.4;
206 }
207
208 .metasync-accordion-section .notice.inline {
209 display: block;
210 }
211 </style>
212
213 <!-- File upload handling and unsaved changes integration is now handled by the admin JavaScript -->
214