bootstrap-4.1.3
7 years ago
font-awesome
6 years ago
term-color
6 years ago
vk-blocks
6 years ago
vk-components
6 years ago
admin-notices.php
6 years ago
font-awesome-config.php
7 years ago
vk-blocks-config.php
6 years ago
admin-notices.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The admin notice for VK blocks Pro. |
| 5 | */ |
| 6 | function vkblocks_admin_notice_pro() { |
| 7 | |
| 8 | $plugin_base_dir = dirname(__FILE__); |
| 9 | if(strpos($plugin_base_dir,'vk-blocks-pro') !== false) { |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | $meta = get_user_meta( get_current_user_id(), 'vkblocks_dismissed_notice_pro', true ); |
| 14 | if ( $meta ) { |
| 15 | return; |
| 16 | } |
| 17 | ?> |
| 18 | |
| 19 | <div id="notice-vkblocks-pro" class="notice notice-success is-dismissible"> |
| 20 | <p> |
| 21 | <strong> |
| 22 | <?php esc_html_e( 'We\'ve released VK Blocks Pro!', 'vk-blocks' ); ?> |
| 23 | </strong> |
| 24 | </p> |
| 25 | <p> |
| 26 | <?php |
| 27 | printf( |
| 28 | /* translators: 1: opening a tag, 2: closing a tag */ |
| 29 | esc_html__( |
| 30 | 'Thank you for using VK Blocks. We\'ve released VK Blocks Pro. It has more custom blocks to build web site more easily. If you are using Outer, Simple Table, or Table of Contents blocks with Lightning Pro, please switch to use VK Blocks Pro. Lightning Pro user can download it at Free. Please read %1$s this post %2$s for more details.', |
| 31 | 'vk-blocks' |
| 32 | ), |
| 33 | '<a href="' . esc_url( __( 'https://www.vektor-inc.co.jp/info/', 'vk-blocks' ) ) . '">', |
| 34 | '</a>' |
| 35 | ) |
| 36 | ?> |
| 37 | </p> |
| 38 | <p> |
| 39 | <a href="<?php echo esc_url( __( 'https://www.vektor-inc.co.jp/info/', 'vk-blocks' ) ); ?>"> |
| 40 | <?php esc_html_e( 'See more', 'vk-blocks' ); ?></a> |
| 41 | <span> | </span> |
| 42 | <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'vkblocks-dismiss-pro', 'dismiss_admin_notice' ), 'vkblocks-dismiss-pro-' . get_current_user_id() ) ); ?>" target="_parent"> |
| 43 | <?php esc_html_e( 'Dismiss this notice', 'vk-blocks' ); ?></a> |
| 44 | </p> |
| 45 | </div> |
| 46 | <?php |
| 47 | } |
| 48 | add_action( 'admin_notices', 'vkblocks_admin_notice_pro' ); |
| 49 | |
| 50 | |
| 51 | /** |
| 52 | * Dismiss admin notice for VK blocks Pro. |
| 53 | */ |
| 54 | function vkblocks_admin_notice_dismiss() { |
| 55 | if ( isset( $_GET['vkblocks-dismiss-pro'] ) && check_admin_referer( 'vkblocks-dismiss-pro-' . get_current_user_id() ) ) { |
| 56 | update_user_meta( get_current_user_id(), 'vkblocks_dismissed_notice_pro', 1 ); |
| 57 | } |
| 58 | } |
| 59 | add_action( 'admin_head', 'vkblocks_admin_notice_dismiss' ); |
| 60 |