admin-bar
3 years ago
client-migration
2 years ago
compatibility
1 year ago
customizer
1 year ago
freemius
1 year ago
menu-icons
1 year ago
metabox
2 years ago
panel
1 year ago
post-settings
1 year ago
preloader
1 year ago
shortcodes
2 years ago
themepanel
1 year ago
widgets
1 year ago
wizard
3 years ago
adobe-font.php
1 year ago
custom-code.php
1 year ago
dashboard.php
6 years ago
image-resizer.php
1 year ago
jshrink.php
3 years ago
ocean-extra-strings.php
3 years ago
plugins-tab.php
1 year ago
update-message.php
1 year ago
walker.php
4 years ago
update-message.php
152 lines
| 1 | <?php |
| 2 | /** |
| 3 | * OceanWP plugin update message |
| 4 | * |
| 5 | * @package OceanWP WordPress theme |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | if ( ! class_exists( 'OE_Plugin_Update_Message' ) ) : |
| 13 | |
| 14 | class OE_Plugin_Update_Message { |
| 15 | |
| 16 | /** |
| 17 | * Setup class. |
| 18 | * |
| 19 | * @since 2.3.0 |
| 20 | */ |
| 21 | public function __construct() { |
| 22 | |
| 23 | add_action( 'in_plugin_update_message-ocean-extra/ocean-extra.php', array( $this, 'plugin_update_message' ), 10, 2 ); |
| 24 | add_action( 'admin_enqueue_scripts', array( $this, 'plugin_update_asset' ) ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Message content |
| 29 | */ |
| 30 | public function plugin_update_content() { |
| 31 | ?> |
| 32 | <hr class="owp-update-warning__separator"> |
| 33 | <div class="owp-update-warning"> |
| 34 | <div class="warning-info-icon"> |
| 35 | <span class="dashicons dashicons-info"></span> |
| 36 | </div> |
| 37 | <div> |
| 38 | <div class="warning__title"> |
| 39 | <?php echo esc_html__( 'Backup recommended before plugin update.', 'ocean-extra' ); ?> |
| 40 | </div> |
| 41 | <div class="warning__message"> |
| 42 | <?php |
| 43 | printf( |
| 44 | /* translators: %1$s Link open tag, %2$s: Link close tag. */ |
| 45 | esc_html__( 'The latest update introduces significant improvements and changes to various plugin features. For a smooth update process, it\'s crucial to %1$s backup your website beforehand %2$s and test the update in a staging or test environment if available.', 'ocean-extra' ), |
| 46 | '<a href="https://docs.oceanwp.org/article/875-how-to-safely-update-wordpress-website" target="_blank">', |
| 47 | '</a>' |
| 48 | ); |
| 49 | ?> |
| 50 | </div> |
| 51 | </div> |
| 52 | </div> |
| 53 | |
| 54 | <hr class="owp-update-warning__separator"> |
| 55 | <div class="owp-update-warning"> |
| 56 | <div class="warning-info-icon green"> |
| 57 | <span class="dashicons dashicons-yes-alt"></span> |
| 58 | </div> |
| 59 | <div> |
| 60 | <div class="warning__title"> |
| 61 | <?php echo esc_html__( 'What\'s new?', 'ocean-extra' ); ?> |
| 62 | </div> |
| 63 | <div class="warning__message"> |
| 64 | <?php |
| 65 | printf( |
| 66 | /* translators: %1$s Link open tag, %2$s: Link close tag. */ |
| 67 | esc_html__( 'Revamped Customizer for enhanced experience! This update delivers a completely redesigned Customizer with a focus on improved user interface (UI), user experience (UX), and performance. Enjoy a faster and more intuitive way to personalize your website with a wider range of options at your fingertips. Learn %1$s how to properly update your websites and transition to OceanWP 4 %4$s, view %2$s OceanWP 4 New Customizer details %4$s or check out the %3$s OceanWP 4 Customizer documentation %4$s.', 'ocean-extra' ), |
| 68 | '<a href="https://oceanwp.org/blog/oceanwp-4-release-announcement/" target="_blank">', |
| 69 | '<a href="https://oceanwp.org/blog/customize-wordpress-new-core-update/" target="_blank">', |
| 70 | '<a href="https://docs.oceanwp.org/category/894-oceanwp-customizer" target="_blank">', |
| 71 | '</a>' |
| 72 | ); |
| 73 | ?> |
| 74 | </div> |
| 75 | <div class="owp-required-products"> |
| 76 | <table class="owp-required-version-table"> |
| 77 | <tbody> |
| 78 | <tr> |
| 79 | <th><?php echo esc_html__( 'Items', 'ocean-extra' ); ?></th> |
| 80 | <th><?php echo esc_html__( 'Required Version', 'ocean-extra' ); ?></th> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <td><?php echo esc_html__( 'OceanWP', 'ocean-extra' ); ?></td> |
| 84 | <td><?php echo esc_html__( '4.0.0', 'ocean-extra' ); ?></td> |
| 85 | </tr> |
| 86 | </tbody> |
| 87 | </table> |
| 88 | </div> |
| 89 | </div> |
| 90 | </div> |
| 91 | <?php |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Enqueue scripts |
| 96 | * |
| 97 | * @since 2.2.9 |
| 98 | */ |
| 99 | public function plugin_update_message( $plugin_data, $new_data ) { |
| 100 | |
| 101 | if ( isset( $plugin_data['update'] ) && $plugin_data['update'] ) { |
| 102 | |
| 103 | $this->plugin_update_content(); |
| 104 | |
| 105 | } |
| 106 | |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Enqueue scripts |
| 111 | * |
| 112 | * @since 2.2.9 |
| 113 | */ |
| 114 | public function ms_plugin_update_message( $file, $plugin ) { |
| 115 | |
| 116 | if ( is_multisite() && version_compare( $plugin['Version'], $plugin['new_version'], '<') ) { |
| 117 | |
| 118 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
| 119 | |
| 120 | printf( |
| 121 | '<tr class="plugin-update-tr"> |
| 122 | <td colspan="%s" class="plugin-update update-message notice inline notice-warning notice-alt">%s</td> |
| 123 | </tr>', |
| 124 | $wp_list_table->get_column_count(), |
| 125 | $this->plugin_update_content() |
| 126 | ); |
| 127 | } |
| 128 | |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Script |
| 133 | */ |
| 134 | public function plugin_update_asset() { |
| 135 | $screen = get_current_screen(); |
| 136 | |
| 137 | if ( 'plugins' === $screen->id || 'plugins-network' === $screen->id ) { |
| 138 | wp_enqueue_style( |
| 139 | 'oe-plugin-update', |
| 140 | plugins_url( '/assets/css/pluginUpdateMessage.min.css', __DIR__ ), |
| 141 | array(), |
| 142 | false |
| 143 | ); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | } |
| 148 | |
| 149 | endif; |
| 150 | |
| 151 | new OE_Plugin_Update_Message(); |
| 152 |