PluginProbe
FileBird – WordPress Media Library Folders & File Manager / 5.6
FileBird – WordPress Media Library Folders & File Manager v5.6
6.5.8 6.5.7 6.5.5 6.5.4 trunk 4.3.1 5.1.6 5.3 5.3.2 5.4.3 5.4.4 5.4.5 5.5 5.5.3 5.5.5 5.5.8 5.5.8.1 5.6 5.6.1 5.6.2 5.6.3 5.6.4 6.2.3 6.2.5 6.3 All 36 releases
filebird / includes / YC.php

YC.php in FileBird – WordPress Media Library Folders & File Manager 5.6, at includes/YC.php

86 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 if ( ! class_exists( 'YayCommerce' ) ) {
6 class YayCommerce {
7 private $autoInstallUrl = '';
8 private $nonce = '';
9 public function __construct() {
10 if ( ! function_exists( 'WC' ) || defined( 'YAYMAIL_VERSION' ) ) {
11 return;
12 }
13
14 $noti_sale = get_option( 'yaymail_noti_sale' );
15 if ( ! empty( $noti_sale ) ) {
16 return;
17 }
18
19 if ( function_exists( 'current_user_can' ) && current_user_can( 'install_plugins' ) ) {
20 $this->nonce = wp_create_nonce( 'install-plugin_yaymail' );
21 $this->autoInstallUrl = self_admin_url( 'update.php?action=install-plugin&plugin=yaymail&_wpnonce=' . $this->nonce );
22 } else {
23 $this->autoInstallUrl = admin_url( 'plugin-install.php?s=yaymail&tab=search&type=term' );
24 }
25
26 add_action( 'admin_init', array( $this, 'init' ) );
27 }
28
29 public function init() {
30 add_action( 'admin_notices', array( $this, 'notification' ) );
31 add_action( 'wp_ajax_njt_yaycommerce_dismiss', array( $this, 'ajax_dismiss_plugin' ) );
32 }
33
34 public function ajax_dismiss_plugin() {
35 check_ajax_referer( 'install-plugin_yaymail', 'nonce', true );
36 update_option( 'yaymail_noti_sale', 1 );
37 wp_send_json_success();
38 }
39
40 public function notification() {
41 if ( function_exists( 'get_current_screen' ) ) {
42 $screen = get_current_screen();
43 if ( ! in_array( $screen->id, array( 'woocommerce_page_wc-settings', 'woocommerce_page_wc-addons' ) ) ) {
44 return;
45 }
46 } else {
47 return;
48 }
49
50 wp_enqueue_script( 'yaycommerce', NJFB_PLUGIN_URL . 'assets/js/yc.js', array(), NJFB_VERSION, true );
51 wp_localize_script(
52 'yaycommerce',
53 'yaycommerce',
54 array(
55 'nonce' => $this->nonce,
56 )
57 );
58
59 ?>
60 <div class="notice notice-info is-dismissible" id="njt-yc">
61 <div class="njt-yc-wrapper">
62 <h3><?php esc_html_e( 'Email Customizer for WooCommerce', 'filebird' ); ?></h3>
63 <p style="margin: 17px 0"><?php esc_html_e( 'YayMail helps you easily customize your WooCommerce emails with email builder. Try it today!', 'filebird' ); ?></p>
64 <p>
65 <a href="<?php echo esc_url( $this->autoInstallUrl ); ?>" aria-label="More information about YayMail" data-title="YayMail" class="button button-primary"><?php esc_html_e( 'Install for Free', 'filebird' ); ?></a>
66 <a href="javascript:;" id="njt-yc-noti-dismiss"><?php esc_html_e( 'No, Thanks', 'filebird' ); ?></a>
67 </p>
68 </div>
69 </div>
70 <style>
71 #njt-yc-noti-dismiss{
72 margin-left: 10px;
73 text-decoration: none;
74 }
75
76 .njt-yc-wrapper{
77 padding: 5px 0 10px;
78 }
79 </style>
80 <?php
81 }
82 }
83
84 new YayCommerce();
85 }
86