PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / libraries / cartflows-plugin-update-notifications / class-cartflows-plugin-update-notifications.php

class-cartflows-plugin-update-notifications.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.3.0, at libraries/cartflows-plugin-update-notifications/class-cartflows-plugin-update-notifications.php

108 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Update Notices
4 *
5 *
6 * @package CartFlows Notices
7 * @since 1.11.8
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14
15 /**
16 * CartFlows_Plugin_Update_Notifications
17 *
18 * @since 1.11.8
19 */
20 class Cartflows_Plugin_Update_Notifications {
21
22 /**
23 * Instance
24 *
25 * @access private
26 * @var object Class object.
27 * @since 1.11.8
28 */
29 private static $instance;
30
31 /**
32 * Initiator
33 *
34 * @since 1.11.8
35 * @return object initialized object of class.
36 */
37 public static function get_instance() {
38 if ( ! isset( self::$instance ) ) {
39 self::$instance = new self();
40 }
41 return self::$instance;
42 }
43
44 /**
45 * Constructor
46 *
47 * @since 1.11.8
48 */
49 public function __construct() {
50
51 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
52 add_action( 'in_plugin_update_message-' . CARTFLOWS_BASE, array( $this, 'dynamic_plugin_update_notification' ), 10, 2 );
53 }
54
55 /**
56 * Show customized plugin update notification message.
57 *
58 * @since 1.11.8
59 *
60 * @param array $data plugin data.
61 * @param array $response response.
62 *
63 * @return void
64 */
65 public function dynamic_plugin_update_notification( $data, $response ) {
66
67 if( isset( $data['upgrade_notice'] ) && ! empty( $data['upgrade_notice'] ) ) { ?>
68 <hr class="wcf-plugin-update-notification__separator" />
69 <div class="wcf-plugin-update-notification">
70 <div class="wcf-plugin-update-notification__icon">
71 <span class="dashicons dashicons-info"></span>
72 </div>
73 <div>
74 <div class="wcf-plugin-update-notification__title">
75 <?php echo esc_html__( 'Heads up!', 'cartflows' ); ?>
76 </div>
77 <div class="wcf-plugin-update-notification__message">
78 <?php
79 printf(
80 // translators: %s upgrade notice message.
81 __( '%s', 'cartflows' ),
82 esc_html( $data['upgrade_notice'] )
83 );
84 ?>
85 </div>
86 </div>
87 </div> <?php
88 }
89 }
90
91 /**
92 * Enqueue Scripts.
93 *
94 * @since 1.11.8
95 * @return void
96 */
97 public function enqueue_styles(){
98 wp_enqueue_style( 'wcf-notifications', CARTFLOWS_URL . 'libraries/cartflows-plugin-update-notifications/update-notifications.css', array(), CARTFLOWS_VER );
99 }
100 }
101
102 /**
103 * Kicking this off by calling 'get_instance()' method
104 */
105 Cartflows_Plugin_Update_Notifications::get_instance();
106
107
108