term-color
6 days ago
tgm-plugin-activation
6 days ago
vk-blocks
6 days ago
vk-component
6 days ago
vk-css-optimize
6 days ago
vk-customize-helpers
6 days ago
vk-swiper
6 days ago
admin-notices.php
6 days ago
vk-blocks-config.php
6 days ago
admin-notices.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * VK Blocks Admin Notices |
| 4 | * |
| 5 | * @package vk-blocks |
| 6 | */ |
| 7 | |
| 8 | // Do not load directly. |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * The admin notice for VK blocks Pro. |
| 15 | */ |
| 16 | function vk_blocks_admin_notice_pro() { |
| 17 | $plugin_base_dir = __DIR__; |
| 18 | $lang = ( get_locale() === 'ja' ) ? 'ja' : 'en'; |
| 19 | if ( strpos( $plugin_base_dir, 'vk-blocks-pro' ) !== false ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | $meta = get_user_meta( get_current_user_id(), 'vkblocks_dismissed_notice_pro', true ); |
| 24 | if ( $meta ) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | if ( 'ja' === $lang ) { |
| 29 | ?> |
| 30 | <div id="notice-vkblocks-pro" class="notice notice-success is-dismissible"> |
| 31 | <p> |
| 32 | <strong> |
| 33 | <?php esc_html_e( 'We\'ve released VK Blocks Pro!', 'vk-blocks' ); ?> |
| 34 | </strong> |
| 35 | </p> |
| 36 | <p> |
| 37 | <?php |
| 38 | printf( |
| 39 | /* translators: 1: opening a tag, 2: closing a tag */ |
| 40 | esc_html__( '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 interested in VK Blocks Pro, Please read %1$s this post %2$s for more details.', 'vk-blocks' ), |
| 41 | '<a href="' . esc_url( __( 'https://www.vektor-inc.co.jp/service/wordpress-plugins/vk-blocks/', 'vk-blocks' ) ) . '">', |
| 42 | '</a>' |
| 43 | ) |
| 44 | ?> |
| 45 | </p> |
| 46 | <p> |
| 47 | <a href="<?php echo esc_url( __( 'https://www.vektor-inc.co.jp/service/wordpress-plugins/vk-blocks/', 'vk-blocks' ) ); ?>"> |
| 48 | <?php esc_html_e( 'See more', 'vk-blocks' ); ?></a> |
| 49 | <span> | </span> |
| 50 | <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"> |
| 51 | <?php esc_html_e( 'Dismiss this notice', 'vk-blocks' ); ?></a> |
| 52 | </p> |
| 53 | </div> |
| 54 | <?php |
| 55 | } |
| 56 | } |
| 57 | add_action( 'admin_notices', 'vk_blocks_admin_notice_pro' ); |
| 58 | |
| 59 | |
| 60 | /** |
| 61 | * Dismiss admin notice for VK blocks Pro. |
| 62 | */ |
| 63 | function vk_blocks_admin_notice_dismiss() { |
| 64 | if ( isset( $_GET['vkblocks-dismiss-pro'] ) && check_admin_referer( 'vkblocks-dismiss-pro-' . get_current_user_id() ) ) { |
| 65 | update_user_meta( get_current_user_id(), 'vkblocks_dismissed_notice_pro', 1 ); |
| 66 | } |
| 67 | } |
| 68 | add_action( 'admin_head', 'vk_blocks_admin_notice_dismiss' ); |
| 69 |