PluginProbe
Simple Accessibility Button / 2.1.6
Simple Accessibility Button v2.1.6
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.8 1.0.9 1.1.0 1.1.2 1.1.4 1.1.5 1.1.6 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 All 31 releases
yydevelopment-accessibility / notices.php

notices.php in Simple Accessibility Button 2.1.6, at notices.php

249 lines 10.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2 <?php
3
4 // ============================================================
5 // replace the prefix when adding to new plugin "yydev_accessibility_"
6 // ============================================================
7
8 $yydev_accessibility_notice_info_array = array(
9 'plugin_name' => "YYDevelopment Accessibility", // the name of the plugin
10 'developer_website' => "https://www.yydevelopment.com", // link to the developer website page
11 'plugin_review_page' => "https://wordpress.org/plugins/yydevelopment-accessibility/#reviews", // link to the plugin support page
12 'plugin_support_link' => "https://wordpress.org/support/plugin/yydevelopment-accessibility/", // link to the plugin review page
13 'plugin_donate_link' => "https://www.yydevelopment.com/coffee-break/?plugin=yydevelopment-accessibility", // link to the plugin donate page
14 'company_plugins_page' => "https://www.yydevelopment.com/yydevelopment-wordpress-plugins/", // link to the main company plugins page
15 'icon_image_path' => plugins_url() . "/" . basename( dirname( __FILE__ ) ) . "/images/icon.png", // link to the plugin icon
16 'save_database_time_stamp_name' => "yydev_accessibility_timestamp", // database input name to save data
17 'send_mail_in_days' => (4 * 30 * 60 * 60 * 24) + strtotime("now"), // the amount of time after we show the notice (4 months)
18 );
19
20 // ================================================
21 // creating time stamp if it doesn't exists
22 // ================================================
23
24 // loading the plugin version from the database
25 $plugin_db_timestamp = get_option($yydev_accessibility_notice_info_array['save_database_time_stamp_name']);
26
27 // checking if the plugin version exists on the dabase
28 // and checking if the database version equal to the plugin version $plugin_version
29 if( empty($plugin_db_timestamp) ) {
30
31 // update the plugin version in the database
32 update_option($yydev_accessibility_notice_info_array['save_database_time_stamp_name'], $yydev_accessibility_notice_info_array['send_mail_in_days']);
33 $plugin_db_timestamp = get_option($yydev_accessibility_notice_info_array['save_database_time_stamp_name']);
34
35 } // if( empty($plugin_db_timestamp) ) {
36
37 // add_action('plugins_loaded', 'my_awesome_plugin_check_version');
38
39 // ================================================
40 // ajax function for when the visitor click on the buttons
41 // ================================================
42
43 // when the visitor want to stop getting the messages
44 function yydev_accessibility_stop_notice_forever() {
45
46 global $yydev_accessibility_notice_info_array;
47 update_option($yydev_accessibility_notice_info_array['save_database_time_stamp_name'], 'stop');
48 die(); // we have to end ajax functions with die();
49
50 } // function yydev_accessibility_stop_notice_forever() {
51
52 add_action( 'wp_ajax_yydev_accessibility_stop_notice_forever', 'yydev_accessibility_stop_notice_forever' );
53
54
55 // when the visitor ask to get the message in the future
56 function yydev_accessibility_stop_notice_for_now() {
57
58 global $yydev_accessibility_notice_info_array;
59 update_option($yydev_accessibility_notice_info_array['save_database_time_stamp_name'], $yydev_accessibility_notice_info_array['send_mail_in_days']);
60 die(); // we have to end ajax functions with die();
61
62 } // function yydev_accessibility_stop_notice_for_now() {
63
64 add_action( 'wp_ajax_yydev_accessibility_stop_notice_for_now', 'yydev_accessibility_stop_notice_for_now' );
65
66 // ================================================
67 // update the time stamp if the user click on one of the button
68 // ================================================
69
70 // creating a function with admin notice output
71 function yydev_accessibility_admin_notice($notice_info_array) {
72
73 global $yydev_accessibility_notice_info_array;
74
75 $plugin_name = $yydev_accessibility_notice_info_array['plugin_name'];
76 $developer_website = $yydev_accessibility_notice_info_array['developer_website'];
77 $plugin_review_page = $yydev_accessibility_notice_info_array['plugin_review_page'];
78 $plugin_support_link = $yydev_accessibility_notice_info_array['plugin_support_link'];
79 $plugin_donate_link = $yydev_accessibility_notice_info_array['plugin_donate_link'];
80 $company_plugins_page = $yydev_accessibility_notice_info_array['company_plugins_page'];
81 $icon_image_path = $yydev_accessibility_notice_info_array['icon_image_path'];
82 $save_database_time_stamp_name = $yydev_accessibility_notice_info_array['save_database_time_stamp_name'];
83
84 ?>
85
86 <script>
87
88 jQuery(document).ready(function($){
89
90 // if the user click on the right close button or ask to stop showing message
91 $(document).on('click', '.yydev_accessibility_notice_style .yy-plugin-dismiss-forever', function() {
92 $(this).parent().parent().animate({opacity: "0"}, 200, function() {
93
94 $(this).css("display", "none");
95
96 // use the function and update value using ajax
97 var data = {'action': 'yydev_accessibility_stop_notice_forever'}; // var data = {
98 jQuery.post(ajaxurl, data, function(response) {});
99
100 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
101 return false;
102 }); // $(document).on('click', '.yydev_accessibility_notice_style notice-dismiss', function() {
103
104 // if the user click on ask me later
105 $(document).on('click', '.yydev_accessibility_notice_style .yy-plugin-dismiss-for-now', function() {
106 $(this).parent().parent().animate({opacity: "0"}, 200, function() {
107
108 $(this).css("display", "none");
109
110 // use the function and update value using ajax
111 var data = {'action': 'yydev_accessibility_stop_notice_for_now'}; // var data = {
112 jQuery.post(ajaxurl, data, function(response) {});
113
114 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
115 return false;
116 }); // $(document).on('click', '.yydev_accessibility_notice_style notice-dismiss', function() {
117
118
119 // if the user click on the right close button or ask to stop showing message
120 $(document).on('click', '.yydev_accessibility_notice_style .yy-review-plugin', function() {
121 $(this).parent().parent().animate({opacity: "0"}, 200, function() {
122
123 $(this).css("display", "none");
124
125 // use the function and update value using ajax
126 var data = {'action': 'yydev_accessibility_stop_notice_forever'}; // var data = {
127 jQuery.post(ajaxurl, data, function(response) {});
128
129 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
130 }); // $(document).on('click', '.yydev_accessibility_notice_style notice-dismiss', function() {
131
132 }); // jQuery(document).ready(function($){
133
134 </script>
135
136 <style>
137
138 .yydev_accessibility_notice_style {
139 direction: ltr;
140 text-align: left;
141 position: relative;
142 background: #fff;
143 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
144 margin: 5px 0px 35px 0px !important;
145 padding: 1px 12px;
146 padding: 15px 30px 15px 35px;
147 opacity: 1;
148 }
149
150 .yydev_accessibility_notice_style .yy-bottom-plugin-name {
151 color: #fff;
152 padding: 3px 10px;
153 position: absolute;
154 bottom: -20px;
155 right: 10px;
156 z-index: 999;
157 -moz-border-radius: 0 0 3px 3px;
158 -webkit-border-radius: 0 0 3px 3px;
159 border-radius: 0 0 3px 3px;
160 font-size: 12px;
161 font-weight: bold;
162 cursor: auto;
163 background: #8f8f8f;
164 text-decoration: none;
165 box-shadow: 0 1px 0 #006799;
166 }
167
168 .yydev_accessibility_notice_style .notice-buttons {
169 margin: 10px 0px 10px 0px;
170 }
171
172 .yydev_accessibility_notice_style .notice-buttons a {
173 max-width: 100%;
174 white-space: normal;
175 margin: 4px 0px 4px 2px;
176 }
177
178 .yydev_accessibility_notice_style .yy-notice-dismiss {
179 position: absolute;
180 top: 0;
181 left: auto;
182 right: 1px;
183 border: none;
184 margin: 0;
185 padding: 9px;
186 background: 0 0;
187 color: #72777c;
188 cursor: pointer;
189 }
190
191 .yydev_accessibility_notice_style .yy-notice-dismiss::before {
192 background: 0 0;
193 color: #72777c;
194 content: "\f153";
195 display: block;
196 font: normal 16px/20px dashicons;
197 speak: none;
198 height: 20px;
199 text-align: center;
200 width: 20px;
201 -webkit-font-smoothing: antialiased;
202 -moz-osx-font-smoothing: grayscale;
203 }
204
205 .yydev_accessibility_notice_style .yy-plugin-icon {
206 max-width: 85px;
207 float: left;
208 margin: 4px 15px 0px -20px;
209 }
210
211 </style>
212
213 <div class="yydev_accessibility_notice_style notice notice-info">
214
215 <div class="yy-plugin-icon">
216 <img src="<?php echo $icon_image_path; ?>" alt="<?php echo $plugin_name; ?>" />
217 </div><!--yy-plugin-icon-->
218
219 We are happy to see that you are using our <b><?php echo $plugin_name; ?></b> plugin for some time now.
220 We at <a href="<?php echo $developer_website; ?>" target="_blank">YYDevelopment</a> share our plugin for free under GPLv2 license and the only thing we ask in return is that you give a <a href="<?php echo $plugin_review_page; ?>" target="_blank">positive review</a> if you liked it.
221
222 <div class="notice-buttons">
223 <a class="button button-primary yy-review-plugin" href="<?php echo $plugin_review_page; ?>" target="_blank">Yes!!! This plugin saved my life I love it and I will be happy to give it 5 stars review :)</a>
224 <a class="button yy-plugin-dismiss-for-now" href="#" target="_blank">I am busy dude ask me again later</a>
225 <a class="button button-secondary yy-plugin-dismiss-forever" href="#" target="_blank">Never show this message again :(</a>
226 </div><!--notice-buttons-->
227
228 If you have problems with the plugin you can submit a ticket at our <a href="<?php echo $plugin_support_link; ?>" target="_blank">plugin support page</a> and we will be happy to help.
229 You are also welcome to check our other <a href="<?php echo $company_plugins_page; ?>" target="_blank">free wordpress plugins</a>. And if you want to help support this FREE plugins <a target="_blank" href="<?php echo $plugin_donate_link; ?>">buy us a coffee</a>.
230
231 <div class="yy-bottom-plugin-name "><?php echo $plugin_name; ?> Plugin</div>
232
233 </div><!--yydev_accessibility_notice_style-->
234
235 <?php
236
237 } // function yydev_accessibility_admin_notice() {
238
239 // checking for global value that stop all plugins notices
240 $yydev_stop_plugins_notice = get_option('yydev_stop_plugins_notice');
241
242 if( !empty($plugin_db_timestamp) && ($plugin_db_timestamp != "stop") && ($plugin_db_timestamp < strtotime("now")) && ($yydev_stop_plugins_notice != 1) ) {
243
244 // output the admin notice on the wordpress pages
245 add_action( 'admin_notices', 'yydev_accessibility_admin_notice' );
246
247 } // if( !empty($plugin_db_timestamp) && ($plugin_db_timestamp != "stop") && ($plugin_db_timestamp < strtotime("now")) && ($yydev_stop_plugins_notice != 1) ) {
248
249 ?>