/** * Display admin notices / action links. * * @return bool/string false or Admin notice. */ public function admin_notices() { if (!current_user_can('update_plugins')) { return false; } $message = null; foreach ($this->notices as $notice) { $status = empty($notice['status']) ? 'updated' : $notice['status']; if (!empty($notice['action'])) { $action = esc_attr($notice['action']); $message = esc_html($notice['text']); $message .= ' <a href="javascript:;" class="wpdi-button" data-action="' . $action . '" data-slug="' . $notice['slug'] . '">' . ucfirst($action) . ' Now »</a>'; } if (!empty($notice['status'])) { $message = esc_html($notice['message']); } $dismissible = 'dependency-installer-' . dirname($notice['slug']) . '-7'; if (class_exists('\\PAnd') && !\PAnD::is_admin_notice_active($dismissible)) { continue; } ?> <div data-dismissible="<?php echo $dismissible; ?> " class="<?php echo $status; ?> notice is-dismissible dependency-installer"> <p><?php echo '<strong>[' . __('Dependency') . ']</strong> ' . $message; ?> </p> </div> <?php } }
/** * Generate error message for WP_Error. */ public function show_wp_error() { if (!\PAnD::is_admin_notice_active('wp-error-1')) { return; } ?> <div data-dismissible="wp-error-1" class="error notice is-dismissible"> <p> <?php esc_html_e('GitHub Updater Error Code:', 'github-updater'); echo ' ' . self::$error_message; ?> </p> </div> <?php }