PluginProbe
Media Cloud Sync / trunk
Media Cloud Sync vtrunk
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
← All changes | includes/admin.php +42 -2 1.3.10trunk View file →
@@ -35,8 +35,9 @@
35 35 // Admin Init
36 36 add_action('admin_init', [$this, 'adminInit']);
37 37
38 38 add_action('admin_menu', [$this, 'add_menu'], 10);
39 + add_action('admin_notices', [$this, 'storage_credentials_admin_notice']);
39 40
40 41 add_action('admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'], 10, 1);
41 42 add_action('admin_enqueue_scripts', [$this, 'admin_enqueue_styles'], 10, 1);
42 43 // Load media scripts
@@ -257,8 +258,12 @@
257 258 'getstarted' => '<a href="' . admin_url('admin.php?page=' . $this->token . '-admin-ui#/configure') . '">' . esc_html__('Get Started', 'media-cloud-sync') . '</a>',
258 259 'settings' => '<a href="' . admin_url('admin.php?page=' . $this->token . '-admin-ui/') . '">' . esc_html__('Settings', 'media-cloud-sync') . '</a>',
259 260 );
260 261
262 + if (!Utils::is_pro_licensed()) {
263 + $action_links['upgrade'] = '<a href="https://dudlewebs.com/product/media-cloud-sync/" target="_blank" style="color:#d54e21;font-weight:600;">' . esc_html__('Upgrade', 'media-cloud-sync') . '</a>';
264 + }
265 +
261 266 return array_merge($action_links, $links);
262 267 }
263 268
264 269
@@ -286,9 +291,9 @@
286 291 $this->token . '-admin-ui' ,
287 292 array($this, 'adminUi')
288 293 );
289 294
290 - if(Utils::is_service_enabled()) {
295 + if(Utils::get_service()) {
291 296 $this->hook_suffix[] = add_submenu_page(
292 297 $this->token . '-admin-ui',
293 298 esc_html__('Settings', 'media-cloud-sync'),
294 299 esc_html__('Settings', 'media-cloud-sync'),
@@ -308,8 +313,32 @@
308 313 }
309 314 }
310 315
311 316 /**
317 + * Admin notice when storage credentials are incomplete.
318 + * @since 1.3.11
319 + */
320 + public function storage_credentials_admin_notice() {
321 + if(!current_user_can('manage_options') || !Utils::get_service() || Utils::is_service_enabled()) {
322 + return;
323 + }
324 +
325 + $error = Utils::get_service_configuration_error();
326 + if(empty($error)) {
327 + return;
328 + }
329 +
330 + $settings_url = admin_url('admin.php?page=' . $this->token . '-admin-ui#/settings');
331 + $message = esc_html($error) . ' ' . sprintf(
332 + '<a href="%1$s">%2$s</a>',
333 + esc_url($settings_url),
334 + esc_html__('Open Media Cloud Sync settings', 'media-cloud-sync')
335 + );
336 +
337 + echo wp_kses_post(sprintf('<div class="notice notice-error is-dismissible"><p>%s</p></div>', $message));
338 + }
339 +
340 + /**
312 341 * Calling view function for admin page components
313 342 */
314 343 public function adminUi() {
315 344 echo wp_kses_post(sprintf(
@@ -331,8 +360,12 @@
331 360 /**
332 361 * Load the media assets
333 362 */
334 363 public function load_media_assets() {
364 + if(!Utils::is_service_enabled()) {
365 + return;
366 + }
367 +
335 368 /** CSS */
336 369 wp_enqueue_style($this->token . '-media', esc_url($this->assets_url) . 'css/media.css', array(), $this->version);
337 370
338 371 /** JS */
@@ -404,9 +437,16 @@
404 437 <textarea name="comments" placeholder="Please specify" rows="3"></textarea>
405 438 <p>Need help? <a href="https://dudlewebs.com/" target="_blank">Use live chat support</a></p>
406 439 </div>
407 440
408 - <p id="dw-wpmcs-error" class="dw-wpmcs-error"></p>
441 + <p id="dw-wpmcs-error" class="dw-wpmcs-error">
442 + <svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
443 + <path d="M8 2.2L14.6 13.3H1.4L8 2.2Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/>
444 + <path d="M8 6.7V9.7" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
445 + <circle cx="8" cy="11.4" r="0.85" fill="currentColor"/>
446 + </svg>
447 + <span id="dw-wpmcs-error-text"></span>
448 + </p>
409 449 <div class="dw-wpmcs-actions">
410 450 <button type="button" class="dw-button dw-skip" id="dw-wpmcs-skip">Skip & Deactivate</button>
411 451 <button type="button" class="dw-button dw-secondary" id="dw-wpmcs-cancel">Cancel</button>
412 452 <button type="submit" class="dw-button dw-primary" id="dw-wpmcs-deactivate">Submit & Deactivate</button>