/** * If it should be shown, display an individual notice * * @param array $notice * @param array $dismissed_notices * @param string|bool $tab */ protected function maybe_show_notice($notice, $dismissed_notices, $tab) { $screen = get_current_screen(); if ($notice['only_show_in_settings'] && false === strpos($screen->id, $this->as3cf->hook_suffix)) { return; } if (!$notice['only_show_to_user'] && in_array($notice['id'], $dismissed_notices)) { return; } if (!isset($notice['only_show_on_tab']) && false !== $tab) { return; } if (isset($notice['only_show_on_tab']) && $tab !== $notice['only_show_on_tab']) { return; } if (!$this->check_capability_for_notice($notice)) { return; } if ('info' === $notice['type']) { $notice['type'] = 'notice-info'; } $this->as3cf->render_view('notice', $notice); if ($notice['flash']) { $this->remove_notice($notice); } }
/** * Adds notices about issues with upgrades allowing user to restart them */ function maybe_display_notices() { $action_url = $this->as3cf->get_plugin_page_url(array('action' => 'restart_update', 'update' => $this->upgrade_name), 'self'); $msg_type = 'notice-info'; switch ($this->get_upgrade_status()) { case self::STATUS_RUNNING: $msg = sprintf(__('<strong>Running %s Update</strong> — We’re going through all the Media Library items uploaded to S3 %s This will be done quietly in the background, processing a small batch of Media Library items every %d minutes. There should be no noticeable impact on your server’s performance.', 'as3cf'), ucfirst($this->upgrade_type), $this->running_update_text, $this->cron_interval_in_minutes); $action_text = __('Pause Update', 'as3cf'); $action_url = $this->as3cf->get_plugin_page_url(array('action' => 'pause_update', 'update' => $this->upgrade_name), 'self'); break; case self::STATUS_PAUSED: $msg = sprintf(__('<strong>%s Update Paused</strong> — Updating Media Library %s has been paused.', 'as3cf'), ucfirst($this->upgrade_type), $this->upgrade_type); $action_text = __('Restart Update', 'as3cf'); break; case self::STATUS_ERROR: $msg = sprintf(__('<strong>Error Updating %s</strong> — We ran into some errors attempting to update the %s for all your Media Library items that have been uploaded to S3. Please check your error log for details.', 'as3cf'), ucfirst($this->upgrade_type), $this->upgrade_type); $action_text = __('Try Run It Again', 'as3cf'); $msg_type = 'error'; break; default: return; } $msg .= ' <strong><a href="' . $action_url . '">' . $action_text . '</a></strong>'; $args = array('message' => $msg, 'type' => $msg_type); $this->as3cf->render_view('notice', $args); }
/** * Adds notices about issues with upgrades allowing user to restart them */ public function maybe_display_notices() { $action_url = $this->as3cf->get_plugin_page_url(array('action' => 'restart_update', 'update' => $this->upgrade_name), 'self'); $msg_type = 'notice-info'; switch ($this->get_upgrade_status()) { case self::STATUS_RUNNING: $msg = $this->get_running_message(); $action_text = __('Pause Update', 'amazon-s3-and-cloudfront'); $action_url = $this->as3cf->get_plugin_page_url(array('action' => 'pause_update', 'update' => $this->upgrade_name), 'self'); break; case self::STATUS_PAUSED: $msg = $this->get_paused_message(); $action_text = __('Restart Update', 'amazon-s3-and-cloudfront'); break; case self::STATUS_ERROR: $msg = $this->get_error_message(); $action_text = __('Try Run It Again', 'amazon-s3-and-cloudfront'); $msg_type = 'error'; break; default: return; } $msg .= ' <strong><a href="' . $action_url . '">' . $action_text . '</a></strong>'; $args = array('message' => $msg, 'type' => $msg_type); $this->as3cf->render_view('notice', $args); }
/** * If it should be shown, display an individual notice * * @param array $notice * @param array $dismissed_notices * @param string|bool $tab */ protected function maybe_show_notice($notice, $dismissed_notices, $tab) { $screen = get_current_screen(); if ($notice['only_show_in_settings'] && false === strpos($screen->id, $this->as3cf->hook_suffix)) { return; } if (!$notice['only_show_to_user'] && in_array($notice['id'], $dismissed_notices)) { return; } if (!isset($notice['only_show_on_tab']) && false !== $tab) { return; } if (isset($notice['only_show_on_tab']) && $tab !== $notice['only_show_on_tab']) { return; } if (!$this->check_capability_for_notice($notice)) { return; } if (!empty($notice['lock_key']) && class_exists('AS3CF_Tool') && AS3CF_Tool::lock_key_exists($notice['lock_key'])) { return; } if ('info' === $notice['type']) { $notice['type'] = 'notice-info'; } if (!empty($notice['pre_render_callback']) && is_callable($notice['pre_render_callback'])) { call_user_func($notice['pre_render_callback']); } $this->as3cf->render_view('notice', $notice); if ($notice['flash']) { $this->remove_notice($notice); } }