WP Notification Bars - Version 1.0

Version Description

  • Official plugin release.
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Notification Bars
Version 1.0
Comparing to
See all releases

Version 1.0

admin/class-wp-notification-bars-admin.php ADDED
@@ -0,0 +1,718 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The dashboard-specific functionality of the plugin.
5
+ *
6
+ * @link http://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/admin
11
+ */
12
+
13
+ /**
14
+ * The dashboard-specific functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the dashboard-specific stylesheet and JavaScript.
18
+ *
19
+ * @package MTSNBF
20
+ * @subpackage MTSNBF/admin
21
+ * @author MyThemeShop
22
+ */
23
+ class MTSNBF_Admin {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Slug of the plugin screen.
45
+ *
46
+ * @since 1.0
47
+ *
48
+ * @var string
49
+ */
50
+ private $plugin_screen_hook_suffix = null;
51
+
52
+ /**
53
+ * Initialize the class and set its properties.
54
+ *
55
+ * @since 1.0
56
+ * @param string $plugin_name The name of this plugin.
57
+ * @param string $version The version of this plugin.
58
+ */
59
+ public function __construct( $plugin_name, $version ) {
60
+
61
+ $this->plugin_name = $plugin_name;
62
+ $this->version = $version;
63
+
64
+ }
65
+
66
+ /**
67
+ * Register the stylesheets for the Dashboard.
68
+ *
69
+ * @since 1.0
70
+ */
71
+ public function enqueue_styles() {
72
+
73
+ $screen = get_current_screen();
74
+ $screen_id = $screen->id;
75
+
76
+ if ( 'mts_notification_bar' === $screen_id ) {
77
+
78
+ wp_enqueue_style( 'wp-color-picker' );
79
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wp-notification-bars-admin.css', array(), $this->version, 'all' );
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Register the JavaScript for the dashboard.
85
+ *
86
+ * @since 1.0
87
+ */
88
+ public function enqueue_scripts() {
89
+
90
+ $screen = get_current_screen();
91
+ $screen_id = $screen->id;
92
+
93
+ if ( 'mts_notification_bar' === $screen_id ) {
94
+
95
+ wp_enqueue_script( 'wp-color-picker' );
96
+
97
+ wp_enqueue_script(
98
+ $this->plugin_name,
99
+ plugin_dir_url( __FILE__ ) . 'js/wp-notification-bars-admin.js',
100
+ array(
101
+ 'jquery',
102
+ 'wp-color-picker',
103
+ ),
104
+ $this->version, false
105
+ );
106
+ }
107
+ }
108
+
109
+ //////////////////////
110
+ //////// CPT /////////
111
+ //////////////////////
112
+
113
+ /**
114
+ * Register MTS Notification Bar Post Type, attached to 'init'
115
+ *
116
+ * @since 1.0
117
+ */
118
+ public function mts_notification_cpt() {
119
+ $labels = array(
120
+ 'name' => _x( 'Notification Bars', 'post type general name', $this->plugin_name ),
121
+ 'singular_name' => _x( 'Notification Bar', 'post type singular name', $this->plugin_name ),
122
+ 'menu_name' => _x( 'Notification Bars', 'admin menu', $this->plugin_name ),
123
+ 'name_admin_bar' => _x( 'Notification Bar', 'add new on admin bar', $this->plugin_name ),
124
+ 'add_new' => _x( 'Add New', 'notification bar', $this->plugin_name ),
125
+ 'add_new_item' => __( 'Add New Notification Bar', $this->plugin_name ),
126
+ 'new_item' => __( 'New Notification Bar', $this->plugin_name ),
127
+ 'edit_item' => __( 'Edit Notification Bar', $this->plugin_name ),
128
+ 'view_item' => __( 'View Notification Bar', $this->plugin_name ),
129
+ 'all_items' => __( 'All Notification Bars', $this->plugin_name ),
130
+ 'search_items' => __( 'Search Notification Bars', $this->plugin_name ),
131
+ 'parent_item_colon' => __( 'Parent Notification Bars:', $this->plugin_name ),
132
+ 'not_found' => __( 'No notification bars found.', $this->plugin_name ),
133
+ 'not_found_in_trash' => __( 'No notification bars found in Trash.', $this->plugin_name )
134
+ );
135
+
136
+ $args = array(
137
+ 'labels' => $labels,
138
+ 'public' => false,
139
+ 'show_ui' => true,
140
+ 'capability_type' => 'post',
141
+ 'hierarchical' => false,
142
+ 'rewrite' => false,
143
+ 'publicly_queryable' => false,
144
+ 'menu_position' => 100,
145
+ 'menu_icon' => 'dashicons-info',
146
+ 'has_archive' => false,
147
+ 'supports' => array('title')
148
+ );
149
+
150
+ register_post_type( 'mts_notification_bar' , $args );
151
+ }
152
+
153
+ /**
154
+ * Add preview button to edit bar page.
155
+ *
156
+ * @since 1.0
157
+ */
158
+ public function add_preview_button() {
159
+ global $post;
160
+ if ( 'mts_notification_bar' === $post->post_type ) {
161
+ echo '<div class="misc-pub-section">';
162
+ echo '<a href="#" class="button" id="preview-bar"><i class="dashicons dashicons-visibility"></i> '.__( 'Preview Bar', $this->plugin_name ).'</a>';
163
+ echo '</div>';
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Add the Meta Box
169
+ *
170
+ * @since 1.0
171
+ */
172
+ public function add_custom_meta_box() {
173
+
174
+ add_meta_box(
175
+ 'custom_meta_box',
176
+ __( 'Settings', $this->plugin_name ),
177
+ array( $this, 'show_custom_meta_box' ),
178
+ 'mts_notification_bar',
179
+ 'normal',
180
+ 'high'
181
+ );
182
+ }
183
+
184
+ /**
185
+ * The Callback, Meta Box Content
186
+ *
187
+ * @since 1.0
188
+ */
189
+ public function show_custom_meta_box( $post ) {
190
+
191
+ $general_options = array(
192
+ array(
193
+ 'type' => 'select',
194
+ 'name' => 'button',
195
+ 'label' => __( 'Hide/Close Button', $this->plugin_name ),
196
+ 'default'=> 'no_button',
197
+ 'options' => array(
198
+ 'no_button' => __( 'No Button', $this->plugin_name ),
199
+ 'toggle_button' => __( 'Toggle Button', $this->plugin_name ),
200
+ 'close_button' => __( 'Close Button', $this->plugin_name ),
201
+ ),
202
+ 'class' => 'mtsnb-has-child-opt'
203
+ ),
204
+ array(
205
+ 'type' => 'number',
206
+ 'name' => 'content_width',
207
+ 'label' => __( 'Content Width (px)', $this->plugin_name ),
208
+ 'default'=> '960'
209
+ ),
210
+ array(
211
+ 'type' => 'select',
212
+ 'name' => 'css_position',
213
+ 'label' => __( 'Notification bar CSS position', $this->plugin_name ),
214
+ 'default'=> 'fixed',
215
+ 'options' => array(
216
+ 'fixed' => __( 'Fixed', $this->plugin_name ),
217
+ 'absolute' => __( 'Absolute', $this->plugin_name ),
218
+ )
219
+ ),
220
+ );
221
+
222
+ $style_options = array(
223
+ array(
224
+ 'type' => 'color',
225
+ 'name' => 'bg_color',
226
+ 'label' => __( 'Background Color', $this->plugin_name ),
227
+ 'default'=> '#d35151'
228
+ ),
229
+ array(
230
+ 'type' => 'color',
231
+ 'name' => 'txt_color',
232
+ 'label' => __( 'Text Color', $this->plugin_name ),
233
+ 'default'=> '#ffffff'
234
+ ),
235
+ array(
236
+ 'type' => 'color',
237
+ 'name' => 'link_color',
238
+ 'label' => __( 'Link Color/Button Color', $this->plugin_name ),
239
+ 'default'=> '#f4a700'
240
+ ),
241
+ array(
242
+ 'type' => 'number',
243
+ 'name' => 'font_size',
244
+ 'label' => __( 'Font size (px)', $this->plugin_name ),
245
+ 'default'=> '15'
246
+ ),
247
+ );
248
+
249
+ $button_content_type_options = array(
250
+ array(
251
+ 'type' => 'select',
252
+ 'name' => 'basic_link_style',
253
+ 'label' => __( 'Link Style', $this->plugin_name ),
254
+ 'default'=> 'link',
255
+ 'options' => array(
256
+ 'link' => __( 'Link', $this->plugin_name ),
257
+ 'button' => __( 'Button', $this->plugin_name ),
258
+ )
259
+ ),
260
+ array(
261
+ 'type' => 'text',
262
+ 'name' => 'basic_text',
263
+ 'label' => __( 'Text', $this->plugin_name ),
264
+ 'default'=> ''
265
+ ),
266
+ array(
267
+ 'type' => 'text',
268
+ 'name' => 'basic_link_text',
269
+ 'label' => __( 'Link/Button Text', $this->plugin_name ),
270
+ 'default'=> ''
271
+ ),
272
+ array(
273
+ 'type' => 'text',
274
+ 'name' => 'basic_link_url',
275
+ 'label' => __( 'Link/Button Url', $this->plugin_name ),
276
+ 'default'=> ''
277
+ ),
278
+ );
279
+
280
+ $custom_content_type_options = array(
281
+ array(
282
+ 'type' => 'textarea',
283
+ 'name' => 'custom_content',
284
+ 'label' => __( 'Add custom content, shortcodes allowed', $this->plugin_name ),
285
+ 'default'=> ''
286
+ ),
287
+ );
288
+
289
+ // Add an nonce field so we can check for it later.
290
+ wp_nonce_field('mtsnb_meta_box', 'mtsnb_meta_box_nonce');
291
+ // Use get_post_meta to retrieve an existing value from the database.
292
+ $value = get_post_meta( $post->ID, '_mtsnb_data', true );//var_dump($value);
293
+ ?>
294
+ <div class="mtsnb-tabs clearfix">
295
+ <div class="mtsnb-tabs-inner clearfix">
296
+ <?php $active_tab = ( isset( $value['active_tab'] ) && !empty( $value['active_tab'] ) ) ? $value['active_tab'] : 'general'; ?>
297
+ <input type="hidden" class="mtsnb-tab-option" name="mtsnb_fields[active_tab]" id="mtsnb_fields_active_tab" value="<?php echo $active_tab; ?>" />
298
+ <ul class="mtsnb-tabs-nav" id="main-tabs-nav">
299
+ <li>
300
+ <a href="#tab-general" <?php if ( $active_tab === 'general' ) echo 'class="active"'; ?>>
301
+ <span class="mtsnb-tab-title"><i class="dashicons dashicons-admin-generic"></i><?php _e( 'General', $this->plugin_name ); ?></span>
302
+ </a>
303
+ </li>
304
+ <li>
305
+ <a href="#tab-type" <?php if ( $active_tab === 'type' ) echo 'class="active"'; ?>>
306
+ <span class="mtsnb-tab-title"><i class="dashicons dashicons-edit"></i><?php _e( 'Content', $this->plugin_name ); ?></span>
307
+ </a>
308
+ </li>
309
+ <li>
310
+ <a href="#tab-style" <?php if ( $active_tab === 'style' ) echo 'class="active"'; ?>>
311
+ <span class="mtsnb-tab-title"><i class="dashicons dashicons-admin-appearance"></i><?php _e( 'Style', $this->plugin_name ); ?></span>
312
+ </a>
313
+ </li>
314
+ <li>
315
+ <a href="#tab-conditions" <?php if ( $active_tab === 'conditions' ) echo 'class="active"'; ?>>
316
+ <span class="mtsnb-tab-title"><i class="dashicons dashicons-admin-settings"></i><?php _e( 'Conditions', $this->plugin_name ); ?></span>
317
+ </a>
318
+ </li>
319
+ </ul>
320
+ <div class="mtsnb-tabs-wrap" id="main-tabs-wrap">
321
+ <div id="tab-general" class="mtsnb-tabs-content <?php if ( $active_tab === 'general' ) echo 'active'; ?>">
322
+ <div class="mtsnb-tab-desc"><?php _e( 'Select basic settings like close button type and CSS position of the bar.', $this->plugin_name ); ?></div>
323
+ <div class="mtsnb-tab-options clearfix">
324
+ <?php
325
+ foreach ( $general_options as $option_args ) {
326
+ $this->custom_meta_field( $option_args, $value );
327
+ }
328
+ ?>
329
+ </div>
330
+ </div>
331
+ <div id="tab-type" class="mtsnb-tabs-content <?php if ( $active_tab === 'type' ) echo 'active'; ?>">
332
+ <div class="mtsnb-tab-desc"><?php _e( 'Set up notification bar content. Select content type and fill in the fields.', $this->plugin_name ); ?></div>
333
+ <div class="mtsnb-tab-options clearfix">
334
+ <?php $content_type = ( isset( $value['content_type'] ) && !empty( $value['content_type'] ) ) ? $value['content_type'] : 'button'; ?>
335
+ <input type="hidden" class="mtsnb-tab-option" name="mtsnb_fields[content_type]" id="mtsnb_fields_content_type" value="<?php echo $content_type; ?>" />
336
+ <ul class="mtsnb-tabs-nav" id="sub-tabs-nav">
337
+ <li><a href="#tab-button" <?php if ( $content_type === 'button' ) echo 'class="active"'; ?>><?php _e( 'Text and Link/Button', $this->plugin_name ); ?></a></li>
338
+ <li><a href="#tab-custom" <?php if ( $content_type === 'custom' ) echo 'class="active"'; ?>><?php _e( 'Custom', $this->plugin_name ); ?></a></li>
339
+ </ul>
340
+ <div class="meta-tabs-wrap" id="sub-tabs-wrap">
341
+ <div id="tab-button" class="mtsnb-tabs-content <?php if ( $content_type === 'button' ) echo 'active'; ?>">
342
+ <?php
343
+ foreach ( $button_content_type_options as $option_args ) {
344
+ $this->custom_meta_field( $option_args, $value );
345
+ }
346
+ ?>
347
+ </div>
348
+ <div id="tab-custom" class="mtsnb-tabs-content <?php if ( $content_type === 'custom' ) echo 'active'; ?>">
349
+ <?php
350
+ foreach ( $custom_content_type_options as $option_args ) {
351
+ $this->custom_meta_field( $option_args, $value );
352
+ }
353
+ ?>
354
+ </div>
355
+ </div>
356
+ </div>
357
+ </div>
358
+ <div id="tab-style" class="mtsnb-tabs-content <?php if ( $active_tab === 'style' ) echo 'active'; ?>">
359
+ <div class="mtsnb-tab-desc"><?php _e( 'Change the appearance of the notification bar.', $this->plugin_name ); ?></div>
360
+ <div class="mtsnb-tab-options clearfix">
361
+ <?php
362
+ foreach ( $style_options as $option_args ) {
363
+ $this->custom_meta_field( $option_args, $value );
364
+ }
365
+ ?>
366
+ </div>
367
+ </div>
368
+ <div id="tab-conditions" class="mtsnb-tabs-content <?php if ( $active_tab === 'conditions' ) echo 'active'; ?>">
369
+ <div class="mtsnb-tab-desc"><?php _e( 'Choose when and where to display the notification bar.', $this->plugin_name ); ?></div>
370
+ <div id="conditions-selector-wrap" class="clearfix">
371
+ <div id="conditions-selector">
372
+ <ul>
373
+ <?php $condition_location_state = isset( $value['conditions'] ) && isset( $value['conditions']['location'] ) && ( isset( $value['conditions']['location']['state'] ) && !empty( $value['conditions']['location']['state'] ) ) ? $value['conditions']['location']['state'] : ''; ?>
374
+ <?php $condition_notlocation_state = isset( $value['conditions'] ) && isset( $value['conditions']['notlocation'] ) && ( isset( $value['conditions']['notlocation']['state'] ) && !empty( $value['conditions']['notlocation']['state'] ) ) ? $value['conditions']['notlocation']['state'] : ''; ?>
375
+ <?php $condition_location_disabled = empty( $condition_notlocation_state ) ? '' : ' disabled'; ?>
376
+ <?php $condition_notlocation_disabled = empty( $condition_location_state ) ? '' : ' disabled'; ?>
377
+ <li id="condition-location" data-disable="notlocation" class="condition-checkbox <?php echo $condition_location_state.$condition_location_disabled; ?>">
378
+ <?php _e( 'On specific locations', $this->plugin_name ); ?>
379
+ <div class="mtsnb-check"></div>
380
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_location_state" name="mtsnb_fields[conditions][location][state]" value="<?php echo $condition_location_state; ?>">
381
+ </li>
382
+ <li id="condition-notlocation" data-disable="location" class="condition-checkbox <?php echo $condition_notlocation_state.$condition_notlocation_disabled; ?>">
383
+ <?php _e( 'Not on specific locations', $this->plugin_name ); ?>
384
+ <div class="mtsnb-check"></div>
385
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_notlocation_state" name="mtsnb_fields[conditions][notlocation][state]" value="<?php echo $condition_notlocation_state; ?>">
386
+ </li>
387
+ <?php $condition_google_state = isset( $value['conditions'] ) && isset( $value['conditions']['google'] ) && ( isset( $value['conditions']['google']['state'] ) && !empty( $value['conditions']['google']['state'] ) ) ? $value['conditions']['google']['state'] : ''; ?>
388
+ <?php $condition_notgoogle_state = isset( $value['conditions'] ) && isset( $value['conditions']['notgoogle'] ) && ( isset( $value['conditions']['notgoogle']['state'] ) && !empty( $value['conditions']['notgoogle']['state'] ) ) ? $value['conditions']['notgoogle']['state'] : ''; ?>
389
+ <?php $condition_google_disabled = empty( $condition_notgoogle_state ) ? '' : ' disabled'; ?>
390
+ <?php $condition_notgoogle_disabled = empty( $condition_google_state ) ? '' : ' disabled'; ?>
391
+ <li id="condition-google" data-disable="notgoogle" class="condition-checkbox <?php echo $condition_google_state.$condition_google_disabled; ?>">
392
+ <?php _e( 'From Google', $this->plugin_name ); ?>
393
+ <div class="mtsnb-check"></div>
394
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_google_state" name="mtsnb_fields[conditions][google][state]" value="<?php echo $condition_google_state; ?>">
395
+ </li>
396
+ <li id="condition-notgoogle" data-disable="google" class="condition-checkbox <?php echo $condition_notgoogle_state.$condition_notgoogle_disabled; ?>">
397
+ <?php _e( 'Not from Google', $this->plugin_name ); ?>
398
+ <div class="mtsnb-check"></div>
399
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_notgoogle_state" name="mtsnb_fields[conditions][notgoogle][state]" value="<?php echo $condition_notgoogle_state; ?>">
400
+ </li>
401
+ <?php $condition_facebook_state = isset( $value['conditions'] ) && isset( $value['conditions']['facebook'] ) && ( isset( $value['conditions']['facebook']['state'] ) && !empty( $value['conditions']['facebook']['state'] ) ) ? $value['conditions']['facebook']['state'] : ''; ?>
402
+ <?php $condition_notfacebook_state = isset( $value['conditions'] ) && isset( $value['conditions']['notfacebook'] ) && ( isset( $value['conditions']['notfacebook']['state'] ) && !empty( $value['conditions']['notfacebook']['state'] ) ) ? $value['conditions']['notfacebook']['state'] : ''; ?>
403
+ <?php $condition_facebook_disabled = empty( $condition_notfacebook_state ) ? '' : ' disabled'; ?>
404
+ <?php $condition_notfacebook_disabled = empty( $condition_facebook_state ) ? '' : ' disabled'; ?>
405
+ <li id="condition-facebook" data-disable="notfacebook" class="condition-checkbox <?php echo $condition_facebook_state.$condition_facebook_disabled; ?>">
406
+ <?php _e( 'From Facebook', $this->plugin_name ); ?>
407
+ <div class="mtsnb-check"></div>
408
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_facebook_state" name="mtsnb_fields[conditions][facebook][state]" value="<?php echo $condition_facebook_state; ?>">
409
+ </li>
410
+ <li id="condition-notfacebook" data-disable="facebook" class="condition-checkbox <?php echo $condition_notfacebook_state.$condition_notfacebook_disabled; ?>">
411
+ <?php _e( 'Not from Facebook', $this->plugin_name ); ?>
412
+ <div class="mtsnb-check"></div>
413
+ <input type="hidden" class="mtsnb-condition-checkbox-input" id="mtsnb_fields_conditions_notfacebook_state" name="mtsnb_fields[conditions][notfacebook][state]" value="<?php echo $condition_notfacebook_state; ?>">
414
+ </li>
415
+ </ul>
416
+ </div>
417
+ <div id="conditions-panels">
418
+ <div id="condition-location-panel" class="mtsnb-conditions-panel <?php echo $condition_location_state; ?>">
419
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'On specific locations', $this->plugin_name ); ?></div>
420
+ <div class="mtsnb-conditions-panel-content">
421
+ <div class="mtsnb-conditions-panel-desc"><?php _e( 'Show Notification Bar on the following locations', $this->plugin_name ); ?></div>
422
+ <div class="mtsnb-conditions-panel-opt">
423
+ <?php $location_home = isset( $value['conditions'] ) && isset( $value['conditions']['location'] ) && ( isset( $value['conditions']['location']['home'] ) && !empty( $value['conditions']['location']['home'] ) ) ? $value['conditions']['location']['home'] : '0'; ?>
424
+ <?php $location_pages = isset( $value['conditions'] ) && isset( $value['conditions']['location'] ) && ( isset( $value['conditions']['location']['pages'] ) && !empty( $value['conditions']['location']['pages'] ) ) ? $value['conditions']['location']['pages'] : '0'; ?>
425
+ <?php $location_posts = isset( $value['conditions'] ) && isset( $value['conditions']['location'] ) && ( isset( $value['conditions']['location']['posts'] ) && !empty( $value['conditions']['location']['posts'] ) ) ? $value['conditions']['location']['posts'] : '0'; ?>
426
+ <p>
427
+ <label>
428
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][location][home]" id="mtsnb_fields_conditions_location_home" value="1" <?php checked( $location_home, '1', true ); ?> />
429
+ <?php _e( 'Homepage.', $this->plugin_name ); ?>
430
+ </label>
431
+ </p>
432
+ <p>
433
+ <label>
434
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][location][pages]" id="mtsnb_fields_conditions_location_pages" value="1" <?php checked( $location_pages, '1', true ); ?> />
435
+ <?php _e( 'Pages.', $this->plugin_name ); ?>
436
+ </label>
437
+ </p>
438
+ <p>
439
+ <label>
440
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][location][posts]" id="mtsnb_fields_conditions_location_posts" value="1" <?php checked( $location_posts, '1', true ); ?> />
441
+ <?php _e( 'Posts.', $this->plugin_name ); ?>
442
+ </label>
443
+ </p>
444
+ </div>
445
+ </div>
446
+ </div>
447
+ <div id="condition-notlocation-panel" class="mtsnb-conditions-panel <?php echo $condition_notlocation_state; ?>">
448
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'Not on specific locations', $this->plugin_name ); ?></div>
449
+ <div class="mtsnb-conditions-panel-content">
450
+ <div class="mtsnb-conditions-panel-desc"><?php _e( 'Hide Notification Bar on the following locations', $this->plugin_name ); ?></div>
451
+ <div class="mtsnb-conditions-panel-opt">
452
+ <?php $notlocation_home = isset( $value['conditions'] ) && isset( $value['conditions']['notlocation'] ) && ( isset( $value['conditions']['notlocation']['home'] ) && !empty( $value['conditions']['notlocation']['home'] ) ) ? $value['conditions']['notlocation']['home'] : '0'; ?>
453
+ <?php $notlocation_pages = isset( $value['conditions'] ) && isset( $value['conditions']['notlocation'] ) && ( isset( $value['conditions']['notlocation']['pages'] ) && !empty( $value['conditions']['notlocation']['pages'] ) ) ? $value['conditions']['notlocation']['pages'] : '0'; ?>
454
+ <?php $notlocation_posts = isset( $value['conditions'] ) && isset( $value['conditions']['notlocation'] ) && ( isset( $value['conditions']['notlocation']['posts'] ) && !empty( $value['conditions']['notlocation']['posts'] ) ) ? $value['conditions']['notlocation']['posts'] : '0'; ?>
455
+ <p>
456
+ <label>
457
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][notlocation][home]" id="mtsnb_fields_conditions_notlocation_home" value="1" <?php checked( $notlocation_home, '1', true ); ?> />
458
+ <?php _e( 'Homepage.', $this->plugin_name ); ?>
459
+ </label>
460
+ </p>
461
+ <p>
462
+ <label>
463
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][notlocation][pages]" id="mtsnb_fields_conditions_notlocation_pages" value="1" <?php checked( $notlocation_pages, '1', true ); ?> />
464
+ <?php _e( 'Pages.', $this->plugin_name ); ?>
465
+ </label>
466
+ </p>
467
+ <p>
468
+ <label>
469
+ <input type="checkbox" class="mtsnb-checkbox" name="mtsnb_fields[conditions][notlocation][posts]" id="mtsnb_fields_conditions_notlocation_posts" value="1" <?php checked( $notlocation_posts, '1', true ); ?> />
470
+ <?php _e( 'Posts.', $this->plugin_name ); ?>
471
+ </label>
472
+ </p>
473
+ </div>
474
+ </div>
475
+ </div>
476
+ <div id="condition-google-panel" class="mtsnb-conditions-panel <?php echo $condition_google_state; ?>">
477
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'From Google', $this->plugin_name ); ?></div>
478
+ <div class="mtsnb-conditions-panel-content">
479
+ <div class="mtsnb-conditions-panel-desc">
480
+ <p>
481
+ <label>
482
+ <?php _e( 'Show Notification Bar if visitor arrived via Google search engine.', $this->plugin_name ); ?>
483
+ </label>
484
+ </p>
485
+ </div>
486
+ </div>
487
+ </div>
488
+ <div id="condition-notgoogle-panel" class="mtsnb-conditions-panel <?php echo $condition_notgoogle_state; ?>">
489
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'Not from Google', $this->plugin_name ); ?></div>
490
+ <div class="mtsnb-conditions-panel-content">
491
+ <div class="mtsnb-conditions-panel-desc">
492
+ <p>
493
+ <label>
494
+ <?php _e( 'Hide Notification Bar if visitor arrived via Google search engine.', $this->plugin_name ); ?>
495
+ </label>
496
+ </p>
497
+ </div>
498
+ </div>
499
+ </div>
500
+ <div id="condition-facebook-panel" class="mtsnb-conditions-panel <?php echo $condition_facebook_state; ?>">
501
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'From Facebook', $this->plugin_name ); ?></div>
502
+ <div class="mtsnb-conditions-panel-content">
503
+ <div class="mtsnb-conditions-panel-desc">
504
+ <p>
505
+ <label>
506
+ <?php _e( 'Show Notification Bar if visitor arrived from Facebook.', $this->plugin_name ); ?>
507
+ </label>
508
+ </p>
509
+ </div>
510
+ </div>
511
+ </div>
512
+ <div id="condition-notfacebook-panel" class="mtsnb-conditions-panel <?php echo $condition_notfacebook_state; ?>">
513
+ <div class="mtsnb-conditions-panel-title"><?php _e( 'Not from Facebook', $this->plugin_name ); ?></div>
514
+ <div class="mtsnb-conditions-panel-content">
515
+ <div class="mtsnb-conditions-panel-desc">
516
+ <p>
517
+ <label>
518
+ <?php _e( 'Hide Notification Bar if visitor arrived from Facebook.', $this->plugin_name ); ?>
519
+ </label>
520
+ </p>
521
+ </div>
522
+ </div>
523
+ </div>
524
+ </div>
525
+ </div>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ </div>
530
+ <?php
531
+ }
532
+
533
+ /**
534
+ * Helper function for common fields
535
+ *
536
+ * @since 1.0
537
+ */
538
+ public function custom_meta_field( $args, $value, $b = false ) {
539
+
540
+ $type = isset( $args['type'] ) ? $args['type'] : '';
541
+ $name = isset( $args['name'] ) ? $args['name'] : '';
542
+ $name = $b ? 'b_'.$name : $name;
543
+ $label = isset( $args['label'] ) ? $args['label'] : '';
544
+ $options = isset( $args['options'] ) ? $args['options'] : array();
545
+ $default = isset( $args['default'] ) ? $args['default'] : '';
546
+ $min = isset( $args['min'] ) ? $args['min'] : '0';
547
+
548
+ $class = isset( $args['class'] ) ? $args['class'] : '';
549
+
550
+ // Option value
551
+ $opt_val = isset( $value[ $name ] ) ? $value[ $name ] : $default;
552
+
553
+ ?>
554
+ <div id="mtsnb_fields_<?php echo $name;?>_row" class="form-row">
555
+ <label class="form-label" for="mtsnb_fields_<?php echo $name;?>"><?php echo $label; ?></label>
556
+ <div class="form-option <?php echo $class; ?>">
557
+ <?php
558
+ switch ( $type ) {
559
+
560
+ case 'text':
561
+ ?>
562
+ <input type="text" name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>" value="<?php echo esc_attr( $opt_val );?>" />
563
+ <?php
564
+ break;
565
+ case 'select':
566
+ ?>
567
+ <select name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>">
568
+ <?php foreach ( $options as $val => $label ) { ?>
569
+ <option value="<?php echo $val; ?>" <?php selected( $opt_val, $val, true); ?>><?php echo $label ?></option>
570
+ <?php } ?>
571
+ </select>
572
+ <?php
573
+ break;
574
+ case 'number':
575
+ ?>
576
+ <input type="number" step="1" min="<?php echo $min;?>" name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>" value="<?php echo $opt_val;?>" class="small-text"/>
577
+ <?php
578
+ break;
579
+ case 'color':
580
+ ?>
581
+ <input type="text" name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>" value="<?php echo $opt_val;?>" class="mtsnb-color-picker" />
582
+ <?php
583
+ break;
584
+ case 'textarea':
585
+ ?>
586
+ <textarea name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>" class="mtsnb-textarea"><?php echo esc_textarea( $opt_val );?></textarea>
587
+ <?php
588
+ break;
589
+ case 'checkbox':
590
+ ?>
591
+ <input type="checkbox" name="mtsnb_fields[<?php echo $name;?>]" id="mtsnb_fields_<?php echo $name;?>" value="1" <?php checked( $opt_val, '1', true ); ?> />
592
+ <?php
593
+ break;
594
+ case 'info':
595
+ ?>
596
+ <small class="mtsnb-option-info">
597
+ <?php echo $default; ?>
598
+ </small>
599
+ <?php
600
+ break;
601
+ }
602
+ ?>
603
+ </div>
604
+ </div>
605
+ <?php
606
+ }
607
+
608
+ /**
609
+ * Save the Data
610
+ *
611
+ * @since 1.0
612
+ */
613
+ public function save_custom_meta( $post_id ) {
614
+ // Check if our nonce is set.
615
+ if ( ! isset( $_POST['mtsnb_meta_box_nonce'] ) ) {
616
+ return;
617
+ }
618
+ // Verify that the nonce is valid.
619
+ if ( ! wp_verify_nonce( $_POST['mtsnb_meta_box_nonce'], 'mtsnb_meta_box' ) ) {
620
+ return;
621
+ }
622
+ // If this is an autosave, our form has not been submitted, so we don't want to do anything.
623
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
624
+ return;
625
+ }
626
+ // Check the user's permissions.
627
+ if ( isset( $_POST['post_type'] ) && 'mts_notification_bar' == $_POST['post_type'] ) {
628
+
629
+ if ( ! current_user_can( 'edit_page', $post_id ) ) {
630
+ return;
631
+ }
632
+
633
+ } else {
634
+
635
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
636
+ return;
637
+ }
638
+ }
639
+
640
+ /* OK, it's safe for us to save the data now. */
641
+ if ( ! isset( $_POST['mtsnb_fields'] ) ) {
642
+ return;
643
+ }
644
+
645
+ $my_data = $_POST['mtsnb_fields'];
646
+
647
+ // Update the meta field in the database.
648
+ update_post_meta( $post_id, '_mtsnb_data', $my_data );
649
+ }
650
+
651
+ /**
652
+ * Deactivate plugin if pro is active
653
+ *
654
+ * @since 1.0
655
+ */
656
+ public function check_version() {
657
+
658
+ if ( defined( 'MTSNB_PLUGIN_BASE' ) ) {
659
+
660
+ if ( is_plugin_active( MTSNB_PLUGIN_BASE ) || class_exists('MTSNB') ) {
661
+
662
+ deactivate_plugins( MTSNBF_PLUGIN_BASE );
663
+ add_action( 'admin_notices', array( $this, 'disabled_notice' ) );
664
+ if ( isset( $_GET['activate'] ) ) {
665
+ unset( $_GET['activate'] );
666
+ }
667
+ }
668
+ }
669
+ }
670
+
671
+ /**
672
+ * Deactivation notice
673
+ *
674
+ * @since 1.0
675
+ */
676
+ public function disabled_notice() {
677
+ ?>
678
+ <div class="updated">
679
+ <p><?php _e( 'Free version of WP Notification Bars plugin disabled. Pro version is active!', $this->plugin_name ); ?></p>
680
+ </div>
681
+ <?php
682
+ }
683
+
684
+ /**
685
+ * Notification Bar update messages
686
+ *
687
+ * @since 1.0
688
+ *
689
+ * @param array $messages
690
+ * @return array $messages
691
+ */
692
+ public function mtsnb_update_messages( $messages ) {
693
+
694
+ global $post;
695
+
696
+ $post_ID = $post->ID;
697
+ $post_type = get_post_type( $post_ID );
698
+
699
+ if ('mts_notification_bar' == $post_type ) {
700
+
701
+ $messages['mts_notification_bar'] = array(
702
+ 0 => '', // Unused. Messages start at index 1.
703
+ 1 => __( 'Notification Bar updated.', $this->plugin_name ),
704
+ 2 => __( 'Custom field updated.', $this->plugin_name ),
705
+ 3 => __( 'Custom field deleted.', $this->plugin_name ),
706
+ 4 => __( 'Notification Bar updated.', $this->plugin_name ),
707
+ 5 => isset($_GET['revision']) ? sprintf( __('Notification Bar restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
708
+ 6 => __( 'Notification Bar published.', $this->plugin_name ),
709
+ 7 => __( 'Notification Bar saved.', $this->plugin_name ),
710
+ 8 => __( 'Notification Bar submitted.', $this->plugin_name),
711
+ 9 => sprintf( __('Notification Bar scheduled for: <strong>%1$s</strong>.', $this->plugin_name ), date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ) ),
712
+ 10 => __('Notification Bar draft updated.', $this->plugin_name ),
713
+ );
714
+ }
715
+
716
+ return $messages;
717
+ }
718
+ }
admin/css/wp-notification-bars-admin.css ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Plugin Name: WP Notification Bars by MyThemeShop
3
+ * Author URI: https://mythemeshop.com/
4
+ */
5
+ .mtsnb-tabs *, .mtsnb-tabs *:before, .mtsnb-tabs *:after { box-sizing: border-box }
6
+ .clearfix:before, .clearfix:after { content: " "; display: table; }
7
+ .clearfix:after { clear: both }
8
+ .clearfix { *zoom: 1 }
9
+ .mtsnb-tabs label, .mtsnb-tabs p { font-size: 15px }
10
+ .utm-text { min-width: 150px; float: left; }
11
+ .mtsnb-remove-utm-tag { position: absolute; right: 15px; top: 5px; }
12
+ .mtsnb-tabs p { color: #7f7f7f }
13
+ .mtsnb-tabs input[type="text"]:not(.wp-color-picker), .mtsnb-tabs input[type="number"], .mtsnb-tabs select, .mtsnb-tabs textarea { font-size: 15px; color: #aaaaaa; line-height: 22px; padding: 9px 20px; background: #ffffff; margin: 0; border: 1px solid #eaebec; outline: none!important; box-shadow: none!important; }
14
+ .mtsnb-tabs button, .mtsnb-tabs .button:not(.wp-picker-clear, .mtsnb-load-palette), .mtsnb-tabs input[type="submit"] { font-size: 15px!important; padding: 9px 20px!important; height: auto!important; line-height: 22px!important; outline: none!important; }
15
+ .mtsnb-tabs button:focus, .mtsnb-tabs .button:focus, .mtsnb-tabs input[type="submit"]:focus { outline: none!important; box-shadow: none!important; }
16
+ .mtsnb-tabs input[type="text"], .mtsnb-tabs input[type="number"], .mtsnb-tabs select, .mtsnb-tabs textarea { width: 100% }
17
+ .mtsnb-tabs select { height: auto }
18
+ .mtsnb-tabs textarea { width: 100%; max-width: 100%; height: 200px; }
19
+ .mtsnb-tabs input:focus, .mtsnb-tabs select:focus, .mtsnb-tabs textarea:focus, .select2-container--default.select2-container--focus .select2-selection--multiple { border-color: #a4e3fa; color: #666666; outline: none; }
20
+ /*Tabs*/
21
+ .mtsnb-tabs { padding: 20px; font-size: 16px; }
22
+ .mtsnb-tabs-inner { background: #fdfdfd }
23
+ .mtsnb-tabs-nav { float: left; margin: 0; }
24
+ #main-tabs-nav { width: 100%; padding-right: 0; }
25
+ #main-tabs-wrap { }
26
+ .mtsnb-tabs-nav li, #conditions-selector li { float: left; display: inline-block; width: 100%; clear: left; margin: 0; }
27
+ #main-tabs-nav li { width: 25%; display: block; clear: none; border-right: 1px solid #34aad5; }
28
+ #main-tabs-nav li:last-child { border-right: 0 }
29
+ .mtsnb-tabs-nav li a, #conditions-selector li { float: left; width: 100%; background: #45bbe6; color: #fff; padding: 15px; font-size: 15px; text-decoration: none; outline: none !important; position: relative; }
30
+ .mtsnb-tabs-nav li a:hover, .mtsnb-tabs-nav li a.active { background: #0074A2 }
31
+ .mtsnb-tabs-nav li a:focus { color: #fff; box-shadow: none; }
32
+ .mtsnb-tabs-nav li a.active { pointer-events: none }
33
+ #sub-tabs-nav li a, #conditions-selector li { padding-right: 60px; font-weight: bold; background: #ffffff; border: 1px solid #eaebec; margin: -1px 0 0 -1px; color: #aaaaaa; position: relative; cursor: pointer; }
34
+ #sub-tabs-nav li a.active, #sub-tabs-nav li a:hover, #conditions-selector li.active, #conditions-selector li:hover { background: #45BBE6; border-color: #45BBE6; border-left-color: #45bbe6; color: #fff; }
35
+ #sub-tabs-nav li a.active:after, #conditions-selector li.active:after { content: ''; position: absolute; border-style: solid; border-width: 9px 0 9px 9px; border-color: rgba(0, 0, 0, 0) #45BBE6; display: block; width: 0; z-index: 1; right: -9px; top: 50%; margin-top: -9px; }
36
+ #sub-tabs-nav li a.active:before, #conditions-selector li.active:before { content: ''; position: absolute; border-style: solid; border-width: 9px 0 9px 9px; border-color: rgba(0, 0, 0, 0) #45BBE6; display: block; width: 0; z-index: 0; right: -10px; top: 50%; margin-top: -9px; }
37
+ #conditions-selector li { padding-left: 50px; padding-right: 25px; }
38
+ .mtsnb-tab-title { display: block }
39
+ .mtsnb-tab-title { font-size: 16px; font-weight: bold; text-transform: uppercase; text-align: center; }
40
+ .mtsnb-tab-title .dashicons { margin-right: 8px }
41
+ /*tab content*/
42
+ .mtsnb-tabs-content { display: none; float: left; width: 100%; clear: both; }
43
+ .mtsnb-tabs-content.active { display: block }
44
+ .mtsnb-ab-slider-label { margin-bottom: 5px }
45
+ .mtsnb-tab-desc { border-width: 0 1px 0 1px; border-style: solid; border-color: #eaebec; background: #ffffff; line-height: 24px; color: #666666; padding: 30px 26px; }
46
+ .mtsnb-tab-options, #conditions-selector-wrap { padding: 30px; border: 1px solid #eaebec; }
47
+ .mtsnb-tab-options { padding-top: 10px; }
48
+ #tab-type .mtsnb-tab-options, #tab-conditions .mtsnb-tab-options, #conditions-selector-wrap { padding: 0 }
49
+ #tab-type .meta-tabs-wrap, #tab-conditions .meta-tabs-wrap { padding-top: 30px }
50
+ #sub-tabs-wrap { overflow: hidden }
51
+ .form-row { float: left; width: 100%; clear: both; margin: 15px 0; padding: 0; }
52
+ #tab-type .mtsnb-tab-options .form-row { padding: 0 30px }
53
+ .form-label { float: left; width: 25%; color: #7f7f7f; padding-right: 20px; padding-top: 12px; }
54
+ .form-label:hover { color: #666666 }
55
+ .form-option { float: left; width: 75%; }
56
+ .clear-image { margin: 0 10px; vertical-align: bottom; }
57
+ #preview-bar { width: 100%; padding: 10px; height: auto; text-align: center; }
58
+ .mtsnb-tabs .wp-color-result, .mtsnb-tabs .wp-picker-container .button { height: auto }
59
+ .mtsnb-tabs .wp-picker-container .button, .mtsnb-tabs .wp-color-result:after { line-height: 26px }
60
+ .mtsnb-tabs .wp-picker-container input[type=text].wp-color-picker { width: 70px }
61
+ .mtsnb-submit { pointer-events: none }
62
+ .mtsnb-tabs input[type=checkbox] { margin-top: 12px }
63
+ /*conditions*/
64
+ /*checkboxes*/
65
+ #conditions-selector { float: left }
66
+ #conditions-selector ul { margin: 0 }
67
+ #conditions-selector .mtsnb-check, #conditions-selector .mtsnb-check:after { position: absolute; border-radius: 50%; }
68
+ #conditions-selector .mtsnb-check { top: 15px; left: 15px; width: 17px; height: 17px; border: 1px solid #cccccc; }
69
+ #conditions-selector .mtsnb-check:after { content: ""; top: 3px; left: 3px; width: 9px; height: 9px; background: #cccccc; }
70
+ #conditions-selector .condition-checkbox.active .mtsnb-check, #conditions-selector .condition-checkbox:hover .mtsnb-check { border-color: #FFFFFF;}
71
+ #conditions-selector .condition-checkbox.active .mtsnb-check:after, #conditions-selector .condition-checkbox:hover .mtsnb-check:after { background: #FFFFFF;}
72
+ #conditions-selector ul li.disabled { color: #dcdcdc; pointer-events: none; }
73
+ #conditions-selector .condition-checkbox.disabled .mtsnb-check { border-color: #dcdcdc }
74
+ #conditions-selector .condition-checkbox.disabled .mtsnb-check:after { background: #dcdcdc }
75
+ /*panels*/
76
+ #conditions-panels { overflow: hidden }
77
+ .mtsnb-conditions-panel { padding: 15px; display: none; }
78
+ .mtsnb-conditions-panel.active { display: block }
79
+ .mtsnb-conditions-panel-title, .mtsnb-conditions-panel-content { padding: 15px }
80
+ .mtsnb-conditions-panel-title { color: #666666; font-size: 18px; font-weight: 700; }
81
+ .mtsnb-conditions-panel-desc input[type="number"] { width: 90px }
82
+ .mtsnb-conditions-panel-opt { margin-top: 15px; padding-left: 15px; padding-right: 15px; }
83
+ .text-center { text-align: center }
84
+ .mtsnb-colors-loader { margin-bottom: 12px }
85
+ .mtsnb-small-select { width: auto!important; padding: 5px!important; margin: -3px 5px 0 5px!important; }
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/js/wp-notification-bars-admin.js ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Plugin Name: WP Notification Bars by MyThemeShop
3
+ * Author URI: https://mythemeshop.com/
4
+ */
5
+ (function( $ ) {
6
+
7
+ 'use strict';
8
+
9
+ $(function() {
10
+
11
+ // Tabs
12
+ $(document).on('click', '.mtsnb-tabs-nav a', function(e){
13
+ e.preventDefault();
14
+ var $this = $(this),
15
+ target = $this.attr('href');
16
+ if ( !$this.hasClass('active') ) {
17
+ $this.parent().parent().find('a.active').removeClass('active');
18
+ $this.addClass('active');
19
+ $this.parent().parent().next().children().siblings().removeClass('active');
20
+ $this.parent().parent().next().find( target ).addClass('active');
21
+ $this.parent().parent().prev().val( target.replace('#tab-',''));
22
+ }
23
+ });
24
+
25
+ // Display conditions manager
26
+ $(document).on('click', '.condition-checkbox', function(e){
27
+ var $this = $(this),
28
+ panel = '#'+$this.attr('id')+'-panel',
29
+ disable = $this.data('disable');
30
+ if ( !$this.hasClass('disabled') ) {
31
+ if ( $this.hasClass('active') ) {
32
+ $this.removeClass('active');
33
+ $this.find('input').val('');
34
+ $(panel).removeClass('active');
35
+ if ( disable ) {
36
+ $('#condition-'+disable).removeClass('disabled');
37
+ }
38
+ } else {
39
+ $this.addClass('active');
40
+ $(panel).addClass('active');
41
+ $this.find('input').val('active');
42
+ if ( disable ) {
43
+ $('#condition-'+disable).addClass('disabled');
44
+ }
45
+ }
46
+ }
47
+ });
48
+
49
+ // Preview Bar Button
50
+ $(document).on('click', '#preview-bar', function(e){
51
+ e.preventDefault();
52
+ $('.mtsnb').remove();
53
+ $('body').css({ "padding-top": "0", "padding-bottom": "0" }).removeClass('has-mtsnb');
54
+ var form_data = $('form#post').serialize();
55
+ var data = {
56
+ action: 'preview_bar',
57
+ form_data: form_data,
58
+ };
59
+
60
+ $.post( ajaxurl, data, function(response) {
61
+
62
+ if ( response ) {
63
+ $('body').prepend( response );
64
+ }
65
+ }).done(function(result){
66
+ $( document ).trigger('mtsnbPreviewLoaded');
67
+ });
68
+
69
+ });
70
+
71
+ // Preview Bar
72
+ $( document ).on( 'mtsnbPreviewLoaded', function( event ) {
73
+
74
+ var barHeight;
75
+
76
+ if ( $('.mtsnb').length > 0 ) {
77
+ barHeight = $('.mtsnb').outerHeight();
78
+ $('body').css('padding-top', barHeight).addClass('has-mtsnb');
79
+ }
80
+
81
+ $(document).on('click', '.mtsnb-hide', function(e) {
82
+
83
+ e.preventDefault();
84
+
85
+ var $this = $(this);
86
+
87
+ if ( !$this.hasClass('active') ) {
88
+ $this.closest('.mtsnb').removeClass('mtsnb-shown').addClass('mtsnb-hidden');
89
+ $('body').css('padding-top', 0);
90
+ }
91
+ });
92
+
93
+ // Show Button
94
+ $(document).on('click', '.mtsnb-show', function(e) {
95
+
96
+ e.preventDefault();
97
+
98
+ var $this = $(this);
99
+ if ( !$this.hasClass('active') ) {
100
+ barHeight = $('.mtsnb').outerHeight();
101
+ $this.closest('.mtsnb').removeClass('mtsnb-hidden').addClass('mtsnb-shown');
102
+ $('body').css('padding-top', barHeight);
103
+ }
104
+ });
105
+ });
106
+
107
+ // Color option
108
+ $('.mtsnb-color-picker').wpColorPicker();
109
+ });
110
+
111
+ })( jQuery );
includes/class-wp-notification-bars-activator.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin activation
5
+ *
6
+ * @link http://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin activation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's activation.
17
+ *
18
+ * @since 1.0
19
+ * @package MTSNBF
20
+ * @subpackage MTSNBF/includes
21
+ * @author MyThemeShop
22
+ */
23
+ class MTSNBF_Activator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0
31
+ */
32
+ public static function activate() {
33
+
34
+ if ( false == get_option( 'mtsnb_stats' ) ) {
35
+
36
+ add_option( 'mtsnb_stats', array() );
37
+ }
38
+ }
39
+
40
+ }
includes/class-wp-notification-bars-deactivator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin deactivation
5
+ *
6
+ * @link http://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin deactivation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's deactivation.
17
+ *
18
+ * @since 1.0
19
+ * @package MTSNBF
20
+ * @subpackage MTSNBF/includes
21
+ * @author MyThemeShop
22
+ */
23
+ class MTSNBF_Deactivator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0
31
+ */
32
+ public static function deactivate() {
33
+
34
+ }
35
+
36
+ }
includes/class-wp-notification-bars-i18n.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Define the internationalization functionality
5
+ *
6
+ * Loads and defines the internationalization files for this plugin
7
+ * so that it is ready for translation.
8
+ *
9
+ * @link http://mythemeshop.com
10
+ * @since 1.0
11
+ *
12
+ * @package MTSNBF
13
+ * @subpackage MTSNBF/includes
14
+ */
15
+
16
+ /**
17
+ * Define the internationalization functionality.
18
+ *
19
+ * Loads and defines the internationalization files for this plugin
20
+ * so that it is ready for translation.
21
+ *
22
+ * @since 1.0
23
+ * @package MTSNBF
24
+ * @subpackage MTSNBF/includes
25
+ * @author MyThemeShop
26
+ */
27
+ class MTSNBF_i18n {
28
+
29
+ /**
30
+ * The domain specified for this plugin.
31
+ *
32
+ * @since 1.0
33
+ * @access private
34
+ * @var string $domain The domain identifier for this plugin.
35
+ */
36
+ private $domain;
37
+
38
+ /**
39
+ * Load the plugin text domain for translation.
40
+ *
41
+ * @since 1.0
42
+ */
43
+ public function load_plugin_textdomain() {
44
+
45
+ load_plugin_textdomain(
46
+ $this->domain,
47
+ false,
48
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
49
+ );
50
+
51
+ }
52
+
53
+ /**
54
+ * Set the domain equal to that of the specified domain.
55
+ *
56
+ * @since 1.0
57
+ * @param string $domain The domain that represents the locale of this plugin.
58
+ */
59
+ public function set_domain( $domain ) {
60
+ $this->domain = $domain;
61
+ }
62
+
63
+ }
includes/class-wp-notification-bars-loader.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin
5
+ *
6
+ * @link http://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/includes
11
+ */
12
+
13
+ /**
14
+ * Register all actions and filters for the plugin.
15
+ *
16
+ * Maintain a list of all hooks that are registered throughout
17
+ * the plugin, and register them with the WordPress API. Call the
18
+ * run function to execute the list of actions and filters.
19
+ *
20
+ * @package MTSNBF
21
+ * @subpackage MTSNBF/includes
22
+ * @author MyThemeShop
23
+ */
24
+ class MTSNBF_Loader {
25
+
26
+ /**
27
+ * The array of actions registered with WordPress.
28
+ *
29
+ * @since 1.0
30
+ * @access protected
31
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32
+ */
33
+ protected $actions;
34
+
35
+ /**
36
+ * The array of filters registered with WordPress.
37
+ *
38
+ * @since 1.0
39
+ * @access protected
40
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41
+ */
42
+ protected $filters;
43
+
44
+ /**
45
+ * Initialize the collections used to maintain the actions and filters.
46
+ *
47
+ * @since 1.0
48
+ */
49
+ public function __construct() {
50
+
51
+ $this->actions = array();
52
+ $this->filters = array();
53
+
54
+ }
55
+
56
+ /**
57
+ * Add a new action to the collection to be registered with WordPress.
58
+ *
59
+ * @since 1.0
60
+ * @param string $hook The name of the WordPress action that is being registered.
61
+ * @param object $component A reference to the instance of the object on which the action is defined.
62
+ * @param string $callback The name of the function definition on the $component.
63
+ * @param int Optional $priority The priority at which the function should be fired.
64
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
65
+ */
66
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
67
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
68
+ }
69
+
70
+ /**
71
+ * Add a new filter to the collection to be registered with WordPress.
72
+ *
73
+ * @since 1.0
74
+ * @param string $hook The name of the WordPress filter that is being registered.
75
+ * @param object $component A reference to the instance of the object on which the filter is defined.
76
+ * @param string $callback The name of the function definition on the $component.
77
+ * @param int Optional $priority The priority at which the function should be fired.
78
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
79
+ */
80
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
81
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
82
+ }
83
+
84
+ /**
85
+ * A utility function that is used to register the actions and hooks into a single
86
+ * collection.
87
+ *
88
+ * @since 1.0
89
+ * @access private
90
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
91
+ * @param string $hook The name of the WordPress filter that is being registered.
92
+ * @param object $component A reference to the instance of the object on which the filter is defined.
93
+ * @param string $callback The name of the function definition on the $component.
94
+ * @param int Optional $priority The priority at which the function should be fired.
95
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
96
+ * @return type The collection of actions and filters registered with WordPress.
97
+ */
98
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
99
+
100
+ $hooks[] = array(
101
+ 'hook' => $hook,
102
+ 'component' => $component,
103
+ 'callback' => $callback,
104
+ 'priority' => $priority,
105
+ 'accepted_args' => $accepted_args
106
+ );
107
+
108
+ return $hooks;
109
+
110
+ }
111
+
112
+ /**
113
+ * Register the filters and actions with WordPress.
114
+ *
115
+ * @since 1.0
116
+ */
117
+ public function run() {
118
+
119
+ foreach ( $this->filters as $hook ) {
120
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
121
+ }
122
+
123
+ foreach ( $this->actions as $hook ) {
124
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125
+ }
126
+
127
+ }
128
+
129
+ }
includes/class-wp-notification-bars-shared.php ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * @link http://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/public
11
+ */
12
+
13
+ /**
14
+ * The public-facing functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the dashboard-specific stylesheet and JavaScript.
18
+ *
19
+ * @package MTSNBF
20
+ * @subpackage MTSNBF/public
21
+ * @author MyThemeShop
22
+ */
23
+ class MTSNBF_Shared {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Notification bar id
45
+ *
46
+ * @since 1.0
47
+ *
48
+ * @var boolean
49
+ */
50
+ private $bar_id = false;
51
+
52
+ /**
53
+ * Bar settings.
54
+ *
55
+ * @since 1.0
56
+ *
57
+ * @var boolean
58
+ */
59
+ private $bar_data = false;
60
+
61
+ /**
62
+ * Initialize the class and set its properties.
63
+ *
64
+ * @since 1.0
65
+ * @param string $plugin_name The name of the plugin.
66
+ * @param string $version The version of this plugin.
67
+ */
68
+ public function __construct( $plugin_name, $version ) {
69
+
70
+ $this->plugin_name = $plugin_name;
71
+ $this->version = $version;
72
+
73
+ }
74
+
75
+ /**
76
+ * Check if Notification Bar should be displayed on front end
77
+ *
78
+ * @since 1.0
79
+ */
80
+ public function get_notification_bar_data() {
81
+
82
+ if ( is_admin() ) return;
83
+
84
+ $args = array(
85
+ 'post_type' => 'mts_notification_bar',
86
+ 'posts_per_page' => -1,
87
+ 'post_status' => 'publish',
88
+ );
89
+
90
+ $bar_id = false;
91
+ $bar_data = false;
92
+
93
+ $all_bars = get_posts( $args );
94
+ foreach( $all_bars as $post ) :
95
+ setup_postdata( $post );
96
+
97
+ $bar_id = $post->ID;
98
+ $meta_values = get_post_meta( $bar_id, '_mtsnb_data', true );
99
+
100
+ $passed_location_conditions = $this->test_location( $meta_values );
101
+ $passed_referrer_conditions = $this->test_referrer( $meta_values );
102
+
103
+ if ( $passed_location_conditions && $passed_referrer_conditions ) {
104
+
105
+ $this->bar_id = $bar_id;
106
+ $this->bar_data = $meta_values;
107
+
108
+ break;
109
+ }
110
+
111
+ endforeach; wp_reset_postdata();
112
+ }
113
+
114
+ /**
115
+ * Register the stylesheets for the public-facing side of the site.
116
+ *
117
+ * @since 1.0
118
+ */
119
+ public function enqueue_styles() {
120
+
121
+ if ( is_admin() ) {// Needed for Notification Bar preview on admin side
122
+
123
+ $screen = get_current_screen();
124
+ $screen_id = $screen->id;
125
+
126
+ if ( 'mts_notification_bar' === $screen_id ) {
127
+
128
+ wp_enqueue_style( $this->plugin_name.'admin', MTSNBF_PLUGIN_URL . 'public/css/wp-notification-bars-public.css', array(), $this->version, 'all' );
129
+ }
130
+
131
+ } else {
132
+
133
+ if ( $this->bar_id && $this->bar_data ) {
134
+
135
+ wp_enqueue_style( $this->plugin_name, MTSNBF_PLUGIN_URL . 'public/css/wp-notification-bars-public.css', array(), $this->version, 'all' );
136
+ }
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Register the stylesheets for the public-facing side of the site.
142
+ *
143
+ * @since 1.0
144
+ */
145
+ public function enqueue_scripts() {
146
+
147
+ if ( !is_admin() && $this->bar_id && $this->bar_data ) {
148
+
149
+ wp_enqueue_script( $this->plugin_name, MTSNBF_PLUGIN_URL . 'public/js/wp-notification-bars-public.js', array( 'jquery' ), $this->version, false );
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Display Notification Bar on front end
155
+ *
156
+ * @since 1.0
157
+ */
158
+ public function display_bar() {
159
+
160
+ if ( $this->bar_id && $this->bar_data ) {
161
+
162
+ $this->bar_output( $this->bar_id, $this->bar_data );
163
+ }
164
+ }
165
+
166
+ /**
167
+ * Notification bar output.
168
+ *
169
+ * @since 1.0
170
+ */
171
+ public function bar_output( $bar_id, $meta_values ) {
172
+
173
+ $button_type = $meta_values['button'];
174
+ $button_close_icon = '<span>+</span>';
175
+ $button_open_icon = '<span>+</span>';
176
+
177
+ $style = 'background-color:'.$meta_values['bg_color'].';color:'.$meta_values['txt_color'].';';
178
+ $btn_style = 'background-color:'.$meta_values['bg_color'].';color:'.$meta_values['txt_color'].';';
179
+
180
+ $shadow = '-webkit-box-shadow: 0 3px 4px rgba(0, 0, 0, 0.05);box-shadow: 0 3px 4px rgba(0, 0, 0, 0.05);';
181
+
182
+ $width = ( isset( $meta_values['content_width'] ) && !empty( $meta_values['content_width'] ) ) ? $meta_values['content_width'] : '960';
183
+ $width = (int)$width+120;
184
+
185
+ $screen_position_class = 'mtsnb-top';
186
+ $css_position_class = isset( $meta_values['css_position'] ) ? ' mtsnb-'.$meta_values['css_position'] : ' mtsnb-fixed';
187
+ ?>
188
+ <div class="mtsnb mtsnb-shown <?php echo $screen_position_class.$css_position_class; ?>" id="mtsnb-<?php echo $bar_id; ?>" data-mtsnb-id="<?php echo $bar_id; ?>" style="<?php echo $style;?>">
189
+ <style type="text/css">
190
+ .mtsnb { position: <?php echo $meta_values['css_position'];?>; <?php echo $shadow;?>}
191
+ .mtsnb .mtsnb-container { width: <?php echo $width;?>px; font-size: <?php echo $meta_values['font_size'];?>px;}
192
+ .mtsnb a { color: <?php echo $meta_values['link_color'];?>;}
193
+ .mtsnb .mtsnb-button { background-color: <?php echo $meta_values['link_color'];?>;}
194
+ </style>
195
+ <div class="mtsnb-container-outer">
196
+ <div class="mtsnb-container mtsnb-clearfix">
197
+ <?php do_action('before_mtsnb_content'); ?>
198
+ <?php $this->bar_content( $meta_values ); ?>
199
+ <?php do_action('after_mtsnb_content'); ?>
200
+ </div>
201
+ <?php if ( 'no_button' !== $button_type ) { ?>
202
+ <?php if ( 'toggle_button' === $button_type ) {?><a href="#" class="mtsnb-show" style="<?php echo $btn_style; ?>"><?php echo $button_open_icon; ?></a><?php } ?>
203
+ <a href="#" class="mtsnb-hide" style="<?php echo $style; ?>"><?php echo $button_close_icon; ?></a>
204
+ <?php } ?>
205
+ </div>
206
+ </div>
207
+ <?php
208
+ }
209
+
210
+ /**
211
+ * Notification bar content.
212
+ *
213
+ * @since 1.0
214
+ */
215
+ public function bar_content( $options ) {
216
+
217
+ // Output
218
+ echo '<div class="mtsnb-'.$options['content_type'].'-type mtsnb-content">';
219
+
220
+ switch ( $options['content_type'] ) {
221
+
222
+ case 'button':
223
+
224
+ $text = esc_html( $options['basic_text'] );
225
+ $link_text = esc_html( $options['basic_link_text'] );
226
+ $link_url = esc_url( $options['basic_link_url'] );
227
+ $link_style = $options['basic_link_style'];
228
+
229
+ echo '<span class="mtsnb-text">'.$text.'</span><a href="'.$link_url.'" class="mtsnb-'.$link_style.'">'.$link_text.'</a>';
230
+
231
+ break;
232
+ case 'custom':
233
+
234
+ echo '<div class="mtsnb-custom-content">';
235
+ echo do_shortcode( html_entity_decode( $options['custom_content'] ) );
236
+ echo '</div>';
237
+
238
+ break;
239
+ }
240
+
241
+ echo '</div>';
242
+ }
243
+
244
+ /**
245
+ * Notification bar admin preview.
246
+ *
247
+ * @since 1.0
248
+ */
249
+ public function preview_bar() {
250
+
251
+ $data = $_POST['form_data'];
252
+
253
+ parse_str( $data, $options );
254
+
255
+ $id = $options['post_ID'];
256
+ $meta_values = $options['mtsnb_fields'];
257
+
258
+ // fix slashes
259
+ foreach ( $meta_values as $key => $value ) {
260
+
261
+ if ( is_string( $value ) ) {
262
+
263
+ $meta_values[ $key ] = stripslashes( $value );
264
+ }
265
+ }
266
+
267
+ $this->bar_output( $id, $meta_values );
268
+
269
+ die();
270
+ }
271
+
272
+
273
+ /**
274
+ * Tests if bar can be displayed based on referrer settings
275
+ *
276
+ * @since 1.0
277
+ */
278
+ public function test_referrer( $meta_values ) {
279
+
280
+ $no_condition = (bool) ( empty( $meta_values['conditions']['google']['state'] ) && empty( $meta_values['conditions']['notgoogle']['state'] ) && empty( $meta_values['conditions']['facebook']['state'] ) && empty( $meta_values['conditions']['notfacebook']['state'] ) );
281
+
282
+ if ( $no_condition ) return true; // not set, can be displayed
283
+
284
+ $referer = $this->get_referrer();
285
+
286
+ // Show for google
287
+ if ( !empty( $meta_values['conditions']['google']['state'] ) ) {
288
+
289
+ if ( !$referer || empty( $referer ) ) return false; // not set, don't display
290
+ $is_search_engine = $this->test_searchengine( $referer );
291
+
292
+ if ( $is_search_engine ) {
293
+
294
+ return true;// referrer is google search engine, display
295
+ }
296
+
297
+ return false;
298
+ }
299
+
300
+ // Don't show for google
301
+ if ( !empty( $meta_values['conditions']['notgoogle']['state'] ) ) {
302
+
303
+ if ( !$referer || empty( $referer ) ) return true; // not set, display
304
+ $is_search_engine = $this->test_searchengine( $referer );
305
+
306
+ if ( $is_search_engine ) {
307
+
308
+ return false;// referrer is google search engine, don't display
309
+ }
310
+
311
+ return true;
312
+ }
313
+
314
+ // Show for facebook
315
+ if ( !empty( $meta_values['conditions']['facebook']['state'] ) ) {
316
+
317
+ if ( !$referer || empty( $referer ) ) return false; // not set, don't display
318
+
319
+ if ( false !== strpos( $referer, 'facebook.' ) ) {
320
+
321
+ return true;// refetrer is facebook, display
322
+ }
323
+
324
+ return false;
325
+ }
326
+
327
+ // Don't show for facebook
328
+ if ( !empty( $meta_values['conditions']['notfacebook']['state'] ) ) {
329
+
330
+ if ( !$referer || empty( $referer ) ) return true; // not set, display
331
+
332
+ if ( false !== strpos( $referer, 'facebook.' ) ) {
333
+
334
+ return false;// refetrer is facebook, don't display
335
+ }
336
+
337
+ return true;
338
+ }
339
+ }
340
+
341
+ /**
342
+ * Tests if bar can be displayed based on location settings
343
+ *
344
+ * @since 1.0
345
+ */
346
+ public function test_location( $meta_values ) {
347
+
348
+ $no_condition = (bool) ( empty( $meta_values['conditions']['location']['state'] ) && empty( $meta_values['conditions']['notlocation']['state'] ) );
349
+
350
+ if ( $no_condition ) return true; // not set, can be displayed
351
+
352
+ // Enable on locations
353
+ if ( !empty( $meta_values['conditions']['location']['state'] ) ) {
354
+
355
+ if ( is_home() && isset( $meta_values['conditions']['location']['home'] ) ) {
356
+
357
+ return true;
358
+
359
+ } else if ( is_single() && isset( $meta_values['conditions']['location']['posts'] ) ) {
360
+
361
+ return true;
362
+
363
+ } else if ( is_page() && isset( $meta_values['conditions']['location']['pages'] ) ) {
364
+
365
+ return true;
366
+ }
367
+
368
+ return false;
369
+ }
370
+
371
+ // Disable on locations
372
+ if ( !empty( $meta_values['conditions']['notlocation']['state'] ) ) {
373
+
374
+ if ( is_home() && isset( $meta_values['conditions']['notlocation']['home'] ) ) {
375
+
376
+ return false;
377
+
378
+ } else if ( is_single() && isset( $meta_values['conditions']['notlocation']['posts'] ) ) {
379
+
380
+ return false;
381
+
382
+ } else if ( is_page() && isset( $meta_values['conditions']['notlocation']['pages'] ) ) {
383
+
384
+ return false;
385
+ }
386
+
387
+ return true;
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Tests if the current referrer is a search engine.
393
+ *
394
+ * @since 1.0
395
+ */
396
+ public function test_searchengine( $referrer ) {
397
+ $response = false;
398
+
399
+ $patterns = array(
400
+ '.google.',
401
+ );
402
+
403
+ foreach ( $patterns as $url ) {
404
+ if ( false !== stripos( $referrer, $url ) ) {
405
+ if ( $url == '.google.' ) {
406
+ if ( $this->is_googlesearch( $referrer ) ) {
407
+ $response = true;
408
+ } else {
409
+ $response = false;
410
+ }
411
+ } else {
412
+ $response = true;
413
+ }
414
+ break;
415
+ }
416
+ }
417
+ return $response;
418
+ }
419
+
420
+ /**
421
+ * Checks if the referrer is a google web-source.
422
+ *
423
+ * @since 1.0
424
+ */
425
+ public function is_googlesearch( $referrer = '' ) {
426
+ $response = true;
427
+
428
+ // Get the query strings and check its a web source.
429
+ $qs = parse_url( $referrer, PHP_URL_QUERY );
430
+ $qget = array();
431
+
432
+ foreach ( explode( '&', $qs ) as $keyval ) {
433
+ $kv = explode( '=', $keyval );
434
+ if ( count( $kv ) == 2 ) {
435
+ $qget[ trim( $kv[0] ) ] = trim( $kv[1] );
436
+ }
437
+ }
438
+
439
+ if ( isset( $qget['source'] ) ) {
440
+ $response = $qget['source'] == 'web';
441
+ }
442
+
443
+ return $response;
444
+ }
445
+
446
+ /**
447
+ * Get referrer
448
+ *
449
+ * @since 1.0
450
+ */
451
+ public function get_referrer() {
452
+
453
+ $referer = '';
454
+
455
+ if ( !isset( $_COOKIE['mtsnb_referrer'] ) ) {
456
+
457
+ $referer = wp_get_referer();
458
+
459
+ // Set cookie only if referrer url actually exists
460
+ if ( $referer || !empty( $referer ) ) {
461
+
462
+ $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );// maybe not needed
463
+ setcookie( 'mtsnb_referrer', esc_url( $referer ), time() + ( 86400 * 365 ), COOKIEPATH, COOKIE_DOMAIN, $secure ); // 86400 = 1 day
464
+ }
465
+
466
+ } else {
467
+
468
+ // Stored referrer url
469
+ $referer = $_COOKIE['mtsnb_referrer'];
470
+ }
471
+
472
+ return $referer;
473
+ }
474
+ }
includes/class-wp-notification-bars.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The file that defines the core plugin class
5
+ *
6
+ * A class definition that includes attributes and functions used across both the
7
+ * public-facing side of the site and the dashboard.
8
+ *
9
+ * @link http://mythemeshop.com
10
+ * @since 1.0
11
+ *
12
+ * @package MTSNBF
13
+ * @subpackage MTSNBF/includes
14
+ */
15
+
16
+ /**
17
+ * The core plugin class.
18
+ *
19
+ * This is used to define internationalization, dashboard-specific hooks, and
20
+ * public-facing site hooks.
21
+ *
22
+ * Also maintains the unique identifier of this plugin as well as the current
23
+ * version of the plugin.
24
+ *
25
+ * @since 1.0
26
+ * @package MTSNBF
27
+ * @subpackage MTSNBF/includes
28
+ * @author MyThemeShop
29
+ */
30
+ class MTSNBF {
31
+
32
+ /**
33
+ * The loader that's responsible for maintaining and registering all hooks that power
34
+ * the plugin.
35
+ *
36
+ * @since 1.0
37
+ * @access protected
38
+ * @var MTSNBF_Loader $loader Maintains and registers all hooks for the plugin.
39
+ */
40
+ protected $loader;
41
+
42
+ /**
43
+ * The unique identifier of this plugin.
44
+ *
45
+ * @since 1.0
46
+ * @access protected
47
+ * @var string $plugin_name The string used to uniquely identify this plugin.
48
+ */
49
+ protected $plugin_name;
50
+
51
+ /**
52
+ * The current version of the plugin.
53
+ *
54
+ * @since 1.0
55
+ * @access protected
56
+ * @var string $version The current version of the plugin.
57
+ */
58
+ protected $version;
59
+
60
+ /**
61
+ * Define the core functionality of the plugin.
62
+ *
63
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
64
+ * Load the dependencies, define the locale, and set the hooks for the Dashboard and
65
+ * the public-facing side of the site.
66
+ *
67
+ * @since 1.0
68
+ */
69
+ public function __construct() {
70
+
71
+ $this->plugin_name = 'wp-notification-bars';
72
+ $this->version = '1.0';
73
+
74
+ $this->load_dependencies();
75
+ $this->set_locale();
76
+ $this->define_admin_hooks();
77
+ $this->define_public_hooks();
78
+ $this->define_shared_hooks();
79
+ }
80
+
81
+ /**
82
+ * Load the required dependencies for this plugin.
83
+ *
84
+ * Include the following files that make up the plugin:
85
+ *
86
+ * - MTSNBF_Loader. Orchestrates the hooks of the plugin.
87
+ * - MTSNBF_i18n. Defines internationalization functionality.
88
+ * - MTSNBF_Admin. Defines all hooks for the dashboard.
89
+ * - MTSNBF_Public. Defines all hooks for the public side of the site.
90
+ *
91
+ * Create an instance of the loader which will be used to register the hooks
92
+ * with WordPress.
93
+ *
94
+ * @since 1.0
95
+ * @access private
96
+ */
97
+ private function load_dependencies() {
98
+
99
+ /**
100
+ * The class responsible for orchestrating the actions and filters of the
101
+ * core plugin.
102
+ */
103
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-notification-bars-loader.php';
104
+
105
+ /**
106
+ * The class responsible for defining internationalization functionality
107
+ * of the plugin.
108
+ */
109
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-notification-bars-i18n.php';
110
+
111
+ /**
112
+ * The class responsible for defining all actions that occur in the Dashboard.
113
+ */
114
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wp-notification-bars-admin.php';
115
+
116
+ /**
117
+ * The class responsible for defining all actions that occur in the public-facing
118
+ * side of the site.
119
+ */
120
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wp-notification-bars-public.php';
121
+
122
+ /**
123
+ * The class responsible for defining all actions that occur in both sides of the site.
124
+ */
125
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-notification-bars-shared.php';
126
+
127
+ $this->loader = new MTSNBF_Loader();
128
+ }
129
+
130
+ /**
131
+ * Define the locale for this plugin for internationalization.
132
+ *
133
+ * Uses the MTSNBF_i18n class in order to set the domain and to register the hook
134
+ * with WordPress.
135
+ *
136
+ * @since 1.0
137
+ * @access private
138
+ */
139
+ private function set_locale() {
140
+
141
+ $plugin_i18n = new MTSNBF_i18n();
142
+ $plugin_i18n->set_domain( $this->get_plugin_name() );
143
+
144
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
145
+ }
146
+
147
+ /**
148
+ * Register all of the hooks related to the dashboard functionality
149
+ * of the plugin.
150
+ *
151
+ * @since 1.0
152
+ * @access private
153
+ */
154
+ private function define_admin_hooks() {
155
+
156
+ $plugin_admin = new MTSNBF_Admin( $this->get_plugin_name(), $this->get_version() );
157
+
158
+ $this->loader->add_action( 'admin_init', $plugin_admin, 'check_version' );
159
+
160
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
161
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
162
+
163
+ // Register our post type
164
+ $this->loader->add_action( 'init', $plugin_admin, 'mts_notification_cpt' );
165
+
166
+ // Metaboxes
167
+ $this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'add_custom_meta_box' );
168
+ $this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta' );
169
+
170
+ // Add preview button to poblish metabox
171
+ $this->loader->add_action( 'post_submitbox_misc_actions', $plugin_admin, 'add_preview_button' );
172
+
173
+ $this->loader->add_filter( 'post_updated_messages', $plugin_admin, 'mtsnb_update_messages' );
174
+ }
175
+
176
+ /**
177
+ * Register all of the hooks related to the public-facing functionality
178
+ * of the plugin.
179
+ *
180
+ * @since 1.0
181
+ * @access private
182
+ */
183
+ private function define_public_hooks() {
184
+
185
+ $plugin_public = new MTSNBF_Public( $this->get_plugin_name(), $this->get_version() );
186
+ }
187
+
188
+ /**
189
+ * Register all of the hooks related to both public and dashboard functionality
190
+ * of the plugin.
191
+ *
192
+ * @since 1.0
193
+ * @access private
194
+ */
195
+ private function define_shared_hooks() {
196
+
197
+ $plugin_shared = new MTSNBF_Shared( $this->get_plugin_name(), $this->get_version() );
198
+
199
+ // get/set bar settings
200
+ $this->loader->add_action( 'wp', $plugin_shared, 'get_notification_bar_data' );
201
+ // Display bar on front end
202
+ $this->loader->add_action( 'wp_footer', $plugin_shared, 'display_bar' );
203
+ // Ajax Preview on backend
204
+ $this->loader->add_action( 'wp_ajax_preview_bar', $plugin_shared, 'preview_bar' );
205
+
206
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_shared, 'enqueue_styles', -1 );
207
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_shared, 'enqueue_scripts' );
208
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_shared, 'enqueue_styles' );
209
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_shared, 'enqueue_scripts' );
210
+ }
211
+
212
+ /**
213
+ * Run the loader to execute all of the hooks with WordPress.
214
+ *
215
+ * @since 1.0
216
+ */
217
+ public function run() {
218
+ $this->loader->run();
219
+ }
220
+
221
+ /**
222
+ * The name of the plugin used to uniquely identify it within the context of
223
+ * WordPress and to define internationalization functionality.
224
+ *
225
+ * @since 1.0
226
+ * @return string The name of the plugin.
227
+ */
228
+ public function get_plugin_name() {
229
+ return $this->plugin_name;
230
+ }
231
+
232
+ /**
233
+ * The reference to the class that orchestrates the hooks with the plugin.
234
+ *
235
+ * @since 1.0
236
+ * @return MTSNBF_Loader Orchestrates the hooks of the plugin.
237
+ */
238
+ public function get_loader() {
239
+ return $this->loader;
240
+ }
241
+
242
+ /**
243
+ * Retrieve the version number of the plugin.
244
+ *
245
+ * @since 1.0
246
+ * @return string The version number of the plugin.
247
+ */
248
+ public function get_version() {
249
+ return $this->version;
250
+ }
251
+
252
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/wp-notification-bars.mo ADDED
Binary file
languages/wp-notification-bars.pot ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2015 WP Backup
2
+ # This file is distributed under the same license as the WP Backup package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WP Notification Bars\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/my-wp-backup\n"
7
+ "POT-Creation-Date: 2015-09-15 13:28+0530\n"
8
+ "PO-Revision-Date: 2015-09-15 13:28+0530\n"
9
+ "Last-Translator: MyThemeShop <support-team@mythemeshop.com>\n"
10
+ "Language-Team: MyThemeShop <support-team@mythemeshop.com>\n"
11
+ "Language: en\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.6.2\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
+ "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
18
+ "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
19
+ "X-Poedit-Basepath: ..\n"
20
+ "X-Poedit-SearchPathExcluded-0: vendor\n"
21
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
22
+ "X-Poedit-SearchPath-0: .\n"
23
+
24
+ #: admin/class-wp-notification-bars-admin.php:120
25
+ msgctxt "post type general name"
26
+ msgid "Notification Bars"
27
+ msgstr ""
28
+
29
+ #: admin/class-wp-notification-bars-admin.php:121
30
+ msgctxt "post type singular name"
31
+ msgid "Notification Bar"
32
+ msgstr ""
33
+
34
+ #: admin/class-wp-notification-bars-admin.php:122
35
+ msgctxt "admin menu"
36
+ msgid "Notification Bars"
37
+ msgstr ""
38
+
39
+ #: admin/class-wp-notification-bars-admin.php:123
40
+ msgctxt "add new on admin bar"
41
+ msgid "Notification Bar"
42
+ msgstr ""
43
+
44
+ #: admin/class-wp-notification-bars-admin.php:124
45
+ msgctxt "notification bar"
46
+ msgid "Add New"
47
+ msgstr ""
48
+
49
+ #: admin/class-wp-notification-bars-admin.php:125
50
+ msgid "Add New Notification Bar"
51
+ msgstr ""
52
+
53
+ #: admin/class-wp-notification-bars-admin.php:126
54
+ msgid "New Notification Bar"
55
+ msgstr ""
56
+
57
+ #: admin/class-wp-notification-bars-admin.php:127
58
+ msgid "Edit Notification Bar"
59
+ msgstr ""
60
+
61
+ #: admin/class-wp-notification-bars-admin.php:128
62
+ msgid "View Notification Bar"
63
+ msgstr ""
64
+
65
+ #: admin/class-wp-notification-bars-admin.php:129
66
+ msgid "All Notification Bars"
67
+ msgstr ""
68
+
69
+ #: admin/class-wp-notification-bars-admin.php:130
70
+ msgid "Search Notification Bars"
71
+ msgstr ""
72
+
73
+ #: admin/class-wp-notification-bars-admin.php:131
74
+ msgid "Parent Notification Bars:"
75
+ msgstr ""
76
+
77
+ #: admin/class-wp-notification-bars-admin.php:132
78
+ msgid "No notification bars found."
79
+ msgstr ""
80
+
81
+ #: admin/class-wp-notification-bars-admin.php:133
82
+ msgid "No notification bars found in Trash."
83
+ msgstr ""
84
+
85
+ #: admin/class-wp-notification-bars-admin.php:162
86
+ msgid "Preview Bar"
87
+ msgstr ""
88
+
89
+ #: admin/class-wp-notification-bars-admin.php:176
90
+ msgid "Settings"
91
+ msgstr ""
92
+
93
+ #: admin/class-wp-notification-bars-admin.php:195
94
+ msgid "Hide/Close Button"
95
+ msgstr ""
96
+
97
+ #: admin/class-wp-notification-bars-admin.php:198
98
+ msgid "No Button"
99
+ msgstr ""
100
+
101
+ #: admin/class-wp-notification-bars-admin.php:199
102
+ msgid "Toggle Button"
103
+ msgstr ""
104
+
105
+ #: admin/class-wp-notification-bars-admin.php:200
106
+ msgid "Close Button"
107
+ msgstr ""
108
+
109
+ #: admin/class-wp-notification-bars-admin.php:207
110
+ msgid "Content Width (px)"
111
+ msgstr ""
112
+
113
+ #: admin/class-wp-notification-bars-admin.php:213
114
+ msgid "Notification bar CSS position"
115
+ msgstr ""
116
+
117
+ #: admin/class-wp-notification-bars-admin.php:216
118
+ msgid "Fixed"
119
+ msgstr ""
120
+
121
+ #: admin/class-wp-notification-bars-admin.php:217
122
+ msgid "Absolute"
123
+ msgstr ""
124
+
125
+ #: admin/class-wp-notification-bars-admin.php:226
126
+ msgid "Background Color"
127
+ msgstr ""
128
+
129
+ #: admin/class-wp-notification-bars-admin.php:232
130
+ msgid "Text Color"
131
+ msgstr ""
132
+
133
+ #: admin/class-wp-notification-bars-admin.php:238
134
+ msgid "Link Color/Button Color"
135
+ msgstr ""
136
+
137
+ #: admin/class-wp-notification-bars-admin.php:244
138
+ msgid "Font size (px)"
139
+ msgstr ""
140
+
141
+ #: admin/class-wp-notification-bars-admin.php:253
142
+ msgid "Link Style"
143
+ msgstr ""
144
+
145
+ #: admin/class-wp-notification-bars-admin.php:256
146
+ msgid "Link"
147
+ msgstr ""
148
+
149
+ #: admin/class-wp-notification-bars-admin.php:257
150
+ msgid "Button"
151
+ msgstr ""
152
+
153
+ #: admin/class-wp-notification-bars-admin.php:263
154
+ msgid "Text"
155
+ msgstr ""
156
+
157
+ #: admin/class-wp-notification-bars-admin.php:269
158
+ msgid "Link/Button Text"
159
+ msgstr ""
160
+
161
+ #: admin/class-wp-notification-bars-admin.php:275
162
+ msgid "Link/Button Url"
163
+ msgstr ""
164
+
165
+ #: admin/class-wp-notification-bars-admin.php:284
166
+ msgid "Add custom content, shortcodes allowed"
167
+ msgstr ""
168
+
169
+ #: admin/class-wp-notification-bars-admin.php:301
170
+ msgid "General"
171
+ msgstr ""
172
+
173
+ #: admin/class-wp-notification-bars-admin.php:306
174
+ msgid "Content"
175
+ msgstr ""
176
+
177
+ #: admin/class-wp-notification-bars-admin.php:311
178
+ msgid "Style"
179
+ msgstr ""
180
+
181
+ #: admin/class-wp-notification-bars-admin.php:316
182
+ msgid "Conditions"
183
+ msgstr ""
184
+
185
+ #: admin/class-wp-notification-bars-admin.php:322
186
+ msgid ""
187
+ "Select basic settings like close button type and CSS position of the bar."
188
+ msgstr ""
189
+
190
+ #: admin/class-wp-notification-bars-admin.php:332
191
+ msgid ""
192
+ "Set up notification bar content. Select content type and fill in the fields."
193
+ msgstr ""
194
+
195
+ #: admin/class-wp-notification-bars-admin.php:337
196
+ msgid "Text and Link/Button"
197
+ msgstr ""
198
+
199
+ #: admin/class-wp-notification-bars-admin.php:338
200
+ msgid "Custom"
201
+ msgstr ""
202
+
203
+ #: admin/class-wp-notification-bars-admin.php:359
204
+ msgid "Change the appearance of the notification bar."
205
+ msgstr ""
206
+
207
+ #: admin/class-wp-notification-bars-admin.php:369
208
+ msgid "Choose when and where to display the notification bar."
209
+ msgstr ""
210
+
211
+ #: admin/class-wp-notification-bars-admin.php:378
212
+ #: admin/class-wp-notification-bars-admin.php:419
213
+ msgid "On specific locations"
214
+ msgstr ""
215
+
216
+ #: admin/class-wp-notification-bars-admin.php:383
217
+ #: admin/class-wp-notification-bars-admin.php:448
218
+ msgid "Not on specific locations"
219
+ msgstr ""
220
+
221
+ #: admin/class-wp-notification-bars-admin.php:392
222
+ #: admin/class-wp-notification-bars-admin.php:477
223
+ msgid "From Google"
224
+ msgstr ""
225
+
226
+ #: admin/class-wp-notification-bars-admin.php:397
227
+ #: admin/class-wp-notification-bars-admin.php:489
228
+ msgid "Not from Google"
229
+ msgstr ""
230
+
231
+ #: admin/class-wp-notification-bars-admin.php:406
232
+ #: admin/class-wp-notification-bars-admin.php:501
233
+ msgid "From Facebook"
234
+ msgstr ""
235
+
236
+ #: admin/class-wp-notification-bars-admin.php:411
237
+ #: admin/class-wp-notification-bars-admin.php:513
238
+ msgid "Not from Facebook"
239
+ msgstr ""
240
+
241
+ #: admin/class-wp-notification-bars-admin.php:421
242
+ msgid "Show Notification Bar on the following locations"
243
+ msgstr ""
244
+
245
+ #: admin/class-wp-notification-bars-admin.php:429
246
+ #: admin/class-wp-notification-bars-admin.php:458
247
+ msgid "Homepage."
248
+ msgstr ""
249
+
250
+ #: admin/class-wp-notification-bars-admin.php:435
251
+ #: admin/class-wp-notification-bars-admin.php:464
252
+ msgid "Pages."
253
+ msgstr ""
254
+
255
+ #: admin/class-wp-notification-bars-admin.php:441
256
+ #: admin/class-wp-notification-bars-admin.php:470
257
+ msgid "Posts."
258
+ msgstr ""
259
+
260
+ #: admin/class-wp-notification-bars-admin.php:450
261
+ msgid "Hide Notification Bar on the following locations"
262
+ msgstr ""
263
+
264
+ #: admin/class-wp-notification-bars-admin.php:482
265
+ msgid "Show Notification Bar if visitor arrived via Google search engine."
266
+ msgstr ""
267
+
268
+ #: admin/class-wp-notification-bars-admin.php:494
269
+ msgid "Hide Notification Bar if visitor arrived via Google search engine."
270
+ msgstr ""
271
+
272
+ #: admin/class-wp-notification-bars-admin.php:506
273
+ msgid "Show Notification Bar if visitor arrived from Facebook."
274
+ msgstr ""
275
+
276
+ #: admin/class-wp-notification-bars-admin.php:518
277
+ msgid "Hide Notification Bar if visitor arrived from Facebook."
278
+ msgstr ""
279
+
280
+ #: admin/class-wp-notification-bars-admin.php:679
281
+ msgid ""
282
+ "Free version of WP Notification Bars plugin disabled. Pro version is active!"
283
+ msgstr ""
284
+
285
+ #: admin/class-wp-notification-bars-admin.php:703
286
+ #: admin/class-wp-notification-bars-admin.php:706
287
+ msgid "Notification Bar updated."
288
+ msgstr ""
289
+
290
+ #: admin/class-wp-notification-bars-admin.php:704
291
+ msgid "Custom field updated."
292
+ msgstr ""
293
+
294
+ #: admin/class-wp-notification-bars-admin.php:705
295
+ msgid "Custom field deleted."
296
+ msgstr ""
297
+
298
+ #: admin/class-wp-notification-bars-admin.php:707
299
+ #, php-format
300
+ msgid "Notification Bar restored to revision from %s"
301
+ msgstr ""
302
+
303
+ #: admin/class-wp-notification-bars-admin.php:708
304
+ msgid "Notification Bar published."
305
+ msgstr ""
306
+
307
+ #: admin/class-wp-notification-bars-admin.php:709
308
+ msgid "Notification Bar saved."
309
+ msgstr ""
310
+
311
+ #: admin/class-wp-notification-bars-admin.php:710
312
+ msgid "Notification Bar submitted."
313
+ msgstr ""
314
+
315
+ #: admin/class-wp-notification-bars-admin.php:711
316
+ #, php-format
317
+ msgid "Notification Bar scheduled for: <strong>%1$s</strong>."
318
+ msgstr ""
319
+
320
+ #: admin/class-wp-notification-bars-admin.php:711
321
+ msgid "M j, Y @ H:i"
322
+ msgstr ""
323
+
324
+ #: admin/class-wp-notification-bars-admin.php:712
325
+ msgid "Notification Bar draft updated."
326
+ msgstr ""
public/class-wp-notification-bars-public.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * @link https://mythemeshop.com
7
+ * @since 1.0
8
+ *
9
+ * @package MTSNBF
10
+ * @subpackage MTSNBF/public
11
+ */
12
+
13
+ /**
14
+ * The public-facing functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the dashboard-specific stylesheet and JavaScript.
18
+ *
19
+ * @package MTSNBF
20
+ * @subpackage MTSNBF/public
21
+ * @author MyThemeShop
22
+ */
23
+ class MTSNBF_Public {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 1.0
47
+ * @param string $plugin_name The name of the plugin.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $plugin_name, $version ) {
51
+
52
+ $this->plugin_name = $plugin_name;
53
+ $this->version = $version;
54
+ }
55
+ }
public/css/wp-notification-bars-public.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Plugin Name: WP Notification Bars by MyThemeShop
3
+ * Author URI: https://mythemeshop.com/
4
+ */
5
+ .mtsnb div, .mtsnb span, .mtsnb h1, .mtsnb h2, .mtsnb h3, .mtsnb h4, .mtsnb h5, .mtsnb h6, .mtsnb p, .mtsnb blockquote, .mtsnb pre, .mtsnb a, .mtsnb img, .mtsnb dl, .mtsnb dt, .mtsnb dd, .mtsnb ol, .mtsnb ul, .mtsnb li, .mtsnb fieldset, .mtsnb form, .mtsnb label, .mtsnb legend, .mtsnb table, .mtsnb caption, .mtsnb tbody, .mtsnb tfoot, .mtsnb thead, .mtsnb tr, .mtsnb th, .mtsnb td, .mtsnb article, .mtsnb aside, .mtsnb details, .mtsnb footer, .mtsnb header, .mtsnb menu, .mtsnb meter, .mtsnb nav, .mtsnb output, .mtsnb progress, .mtsnb section, .mtsnb summary { border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; margin: 0; padding: 0; }
6
+ .mtsnb { line-height: 1 }
7
+ .mtsnb article, .mtsnb aside, .mtsnb dialog, .mtsnb figure, .mtsnb footer, .mtsnb header, .mtsnb nav, .mtsnb section, .mtsnb blockquote { display: block }
8
+ .mtsnb nav ul { list-style: none }
9
+ .mtsnb ol { list-style: decimal }
10
+ .mtsnb ul { list-style: disc }
11
+ .mtsnb ul ul { list-style: circle }
12
+ .mtsnb blockquote, .mtsnb q { quotes: none }
13
+ .mtsnb blockquote:before, .mtsnb blockquote:after, .mtsnb q:before, .mtsnb q:after { content: none }
14
+ .mtsnb table { border-collapse: collapse; border-spacing: 0; }
15
+ .mtsnb input, .mtsnb select, .mtsnb a img { vertical-align: middle }
16
+ .mtsnb, .mtsnb *, .mtsnb *:before, .mtsnb *:after { box-sizing: border-box; }
17
+ .mtsnb .screen-reader-text { clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); overflow: hidden; position: absolute; max-height: 1px; }
18
+ .mtsnb { text-align: center; position: fixed; top: 0; width: 100%; z-index: 9999; transition: all 0.25s linear; -webkit-backface-visibility: hidden; min-height: 30px; }
19
+ .mtsnb .mtsnb-container { position: relative; margin-right: auto; margin-left: auto; max-width: 100%; width: 1000px; padding: 10px 60px; line-height: 1.4 }
20
+ .admin-bar .mtsnb.mtsnb-fixed.mtsnb-top, #wp-toolbar .mtsnb.mtsnb-fixed.mtsnb-top { top: 32px }
21
+ .mtsnb-container-outer { position: relative }
22
+ .mtsnb-clearfix:before, .mtsnb-clearfix:after { content: " "; display: table; }
23
+ .mtsnb-clearfix:after { clear: both }
24
+ .mtsnb-clearfix { *zoom: 1 }
25
+ .mtsnb .mtsnb-show { padding: 10px }
26
+ .mtsnb-hide, .mtsnb-show { position: absolute; right: 20px; background-color: inherit; color: #fff; font-size: 18px!important; line-height: 50px; text-align: center; box-sizing: initial; line-height: 1;}
27
+ .mtsnb-top .mtsnb-show { bottom: 1px;}
28
+ .mtsnb-hide { top: 50%; background: transparent; margin-top: -9px!important;}
29
+ .mtsnb-hide span { display: inline-block; -webkit-transform: rotate(45deg) translate3d(0,0,0); transform: rotate(45deg) translate3d(0,0,0); }
30
+ .mtsnb-hidden { transition: -webkit-transform ease 0.3s; transition: transform ease 0.3s; }
31
+ .mtsnb-hidden.mtsnb-top { -webkit-transform: translateY(-100%) translate3d(0,0,0); transform: translateY(-100%) translate3d(0,0,0); }
32
+ .mtsnb-hidden .mtsnb-show { transition: -webkit-transform ease 0.3s; transition: transform ease 0.3s; }
33
+ .mtsnb-hidden.mtsnb-top .mtsnb-show { -webkit-transform: translateY(100%) translate3d(0,0,0); transform: translateY(100%) translate3d(0,0,0); }
34
+ .mtsnb-shown { transition: -webkit-transform ease 0.3s; transition: transform ease 0.3s; -webkit-transform: translateY(0%) translate3d(0,0,0); transform: translateY(0%) translate3d(0,0,0); }
35
+ .mtsnb-hidden .mtsnb-hide, .mtsnb-shown .mtsnb-show { display: none }
36
+ body.has-mtsnb { transition: padding-top ease 0.3s, padding-bottom ease 0.3s; width: 100%; height: 100%; float: left; position: relative; box-sizing: border-box; /*overflow: hidden;*/}
37
+ .mtsnb a { text-decoration: none; color: inherit; }
38
+ .mtsnb .mtsnb-text, .mtsnb .mtsnb-button, .mtsnb .mtsnb-text, .mtsnb input { margin: .2em .5em }
39
+ .mtsnb input { padding: 6px 10px; font-size: 12px; border-radius: 3px; color: #666; border: 0; font-family: inherit; }
40
+ .mtsnb .mtsnb-button { display: inline-block; padding: 6px 10px; font-size: 12px; border-radius: 3px; color: #fff!important; outline: 0; border: 0; cursor: pointer; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);}
41
+ .mtsnb .mtsnb-message { display: block }
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/js/wp-notification-bars-public.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Plugin Name: WP Notification Bars by MyThemeShop
3
+ * Author URI: https://mythemeshop.com/
4
+ */
5
+ (function( $ ) {
6
+
7
+ 'use strict';
8
+
9
+ $(function() {
10
+
11
+ var barHeight;
12
+
13
+ // Show notification bar
14
+ if ( $('.mtsnb').length > 0 ) {
15
+ barHeight = $('.mtsnb').outerHeight();
16
+ $('body').css('padding-top', barHeight).addClass('has-mtsnb');
17
+ }
18
+
19
+ // Hide Button
20
+ $(document).on('click', '.mtsnb-hide', function(e) {
21
+
22
+ e.preventDefault();
23
+
24
+ var $this = $(this);
25
+
26
+ if ( !$this.hasClass('active') ) {
27
+ $this.closest('.mtsnb').removeClass('mtsnb-shown').addClass('mtsnb-hidden');
28
+ $('body').css('padding-top', 0);
29
+ }
30
+ });
31
+
32
+ // Show Button
33
+ $(document).on('click', '.mtsnb-show', function(e) {
34
+
35
+ e.preventDefault();
36
+
37
+ var $this = $(this);
38
+
39
+ if ( !$this.hasClass('active') ) {
40
+ barHeight = $('.mtsnb').outerHeight();
41
+ $this.closest('.mtsnb').removeClass('mtsnb-hidden').addClass('mtsnb-shown');
42
+ $('body').css('padding-top', barHeight);
43
+ }
44
+ });
45
+ });
46
+
47
+ })( jQuery );
readme.txt ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Notification Bars ===
2
+ Contributors: mythemeshop
3
+ Creator's website link: http://mythemeshop.com/plugins/wp-notification-bars/
4
+ Tags: notification, alert, notification bar, welcome google visitor, welcome facebook visitor, attention bar, floating bar, message, notice, sticky header, offer bar, hello bar
5
+ Requires at least: 3.0.1
6
+ Tested up to: 4.3
7
+ Stable tag: 1.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Create custom notification and alert bar for marketing promotions, alerts, increasing click throughs to other pages and so much more.
12
+
13
+ == Description ==
14
+
15
+ WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
16
+
17
+ = Why WP Notification Bars from <a href="http://mythemeshop.com">MyThemeShop</a>: =
18
+
19
+ * Easy to Use
20
+ * Lightweight
21
+ * Create Unlimited Notification Bars
22
+ * Responsive
23
+ * Unlimited Colors
24
+ * Fixed or Absolute Position
25
+ * Add CTA Button
26
+ * Add Custom Code
27
+ * Control Font Size
28
+ * Show on HomePage / Posts / Pages
29
+ * Show only to Google Visitors
30
+ * Show only to Facebook Visitors
31
+ * Translation Ready
32
+ * 24/7/365 Support
33
+
34
+ = Support =
35
+
36
+ We will do our best to provide support through the WordPress forums. However, all plugin support is provided in our forum. If you have not registered yet, you can do so here: <a href="https://mythemeshop.com/go/signup/index/c/free">https://mythemeshop.com/go/signup/index/c/free</a>. After searching the knowledge base and forum if you are still stuck, feel free to open a new thread, and a member of our support team will be happy to help. Cheers!<br>
37
+ Support link: <a href="http://community.mythemeshop.com/forum/free/plugin-support">http://community.mythemeshop.com/forum/free/plugin-support</a>
38
+
39
+ = Feedback =
40
+ If you like this plugin, then please leave us a good rating and review.<br> Consider following us on <a rel="author" href="https://plus.google.com/+Mythemeshop/">Google+</a>, <a href="https://twitter.com/MyThemeShopTeam">Twitter</a>, and <a href="https://www.facebook.com/MyThemeShop">Facebook</a>
41
+
42
+ == Installation ==
43
+
44
+ This section describes how to install the plugin and get it working.
45
+
46
+ 1. Upload the `wp-notification-bar` folder to the to the `/wp-content/plugins/` directory
47
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
48
+ 3. ‘Notification Bars’ Option will be available in Backend
49
+ 4. Create new Notification and relax!
50
+
51
+ == Frequently Asked Questions ==
52
+
53
+ = Plugin is not working =
54
+
55
+ Please disable all plugins and check if backup is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Rating plugin.
56
+
57
+ == Screenshots ==
58
+
59
+ 1. General Settings
60
+ 2. Content Settings
61
+ 3. Style Settings
62
+ 4. Conditions Settings
63
+ 5. All Notifications
64
+
65
+ == Changelog ==
66
+
67
+ = 1.0 =
68
+ * Official plugin release.
uninstall.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired when the plugin is uninstalled.
5
+ *
6
+ * When populating this file, consider the following flow
7
+ * of control:
8
+ *
9
+ * - This method should be static
10
+ * - Check if the $_REQUEST content actually is the plugin name
11
+ * - Run an admin referrer check to make sure it goes through authentication
12
+ * - Verify the output of $_GET makes sense
13
+ * - Repeat with other user roles. Best directly by using the links/query string parameters.
14
+ * - Repeat things for multisite. Once for a single site in the network, once sitewide.
15
+ *
16
+ * This file may be updated more in future version of the Boilerplate; however, this is the
17
+ * general skeleton and outline for how the file should work.
18
+ *
19
+ * For more information, see the following discussion:
20
+ * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
+ *
22
+ * @link https://mythemeshop.com
23
+ * @since 1.0
24
+ *
25
+ * @package MTSNBF
26
+ */
27
+
28
+ // If uninstall not called from WordPress, then exit.
29
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30
+ exit;
31
+ }
wp-notification-bars.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @wordpress-plugin
5
+ * Plugin Name: WP Notification Bars
6
+ * Plugin URI: https://mythemeshop.com/plugins/wp-notification-bars/
7
+ * Description: WP Notification Bars is a custom notification and alert bar plugin for WordPress which is perfect for marketing promotions, alerts, increasing click throughs to other pages and so much more.
8
+ * Version: 1.0
9
+ * Author: MyThemeShop
10
+ * Author URI: https://mythemeshop.com/
11
+ * Text Domain: wp-notification-bars
12
+ * Domain Path: /languages
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ // Plugin directory
21
+ if ( !defined( 'MTSNBF_PLUGIN_DIR') )
22
+ define( 'MTSNBF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
23
+
24
+ if ( !defined( 'MTSNBF_PLUGIN_URL') )
25
+ define( 'MTSNBF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
26
+
27
+ if ( !defined( 'MTSNBF_PLUGIN_BASE') )
28
+ define( 'MTSNBF_PLUGIN_BASE', plugin_basename(__FILE__) );
29
+
30
+ /**
31
+ * The code that runs during plugin activation.
32
+ * This action is documented in includes/class-wp-notification-bars-activator.php
33
+ */
34
+ function activate_mts_notification_bar_f() {
35
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-notification-bars-activator.php';
36
+ MTSNBF_Activator::activate();
37
+ }
38
+
39
+ /**
40
+ * The code that runs during plugin deactivation.
41
+ * This action is documented in includes/class-wp-notification-bars-deactivator.php
42
+ */
43
+ function deactivate_mts_notification_bar_f() {
44
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-notification-bars-deactivator.php';
45
+ MTSNBF_Deactivator::deactivate();
46
+ }
47
+
48
+ register_activation_hook( __FILE__, 'activate_mts_notification_bar_f' );
49
+ register_deactivation_hook( __FILE__, 'deactivate_mts_notification_bar_f' );
50
+
51
+ /**
52
+ * The core plugin class that is used to define internationalization,
53
+ * dashboard-specific hooks, and public-facing site hooks.
54
+ */
55
+ require plugin_dir_path( __FILE__ ) . 'includes/class-wp-notification-bars.php';
56
+
57
+ /**
58
+ * Begins execution of the plugin.
59
+ *
60
+ * Since everything within the plugin is registered via hooks,
61
+ * then kicking off the plugin from this point in the file does
62
+ * not affect the page life cycle.
63
+ *
64
+ * @since 1.0
65
+ */
66
+ function run_mts_notification_bar_f() {
67
+
68
+ $plugin = new MTSNBF();
69
+ $plugin->run();
70
+
71
+ }
72
+ run_mts_notification_bar_f();