PluginProbe
Phone Button / trunk
Phone Button vtrunk
trunk 1.0.0 1.0.1 1.0.3 1.1.0 1.1.1 2.0.0 2.1.0 2.1.1 2.1.2
← All changes | notices.php +42 -13 2.1.1trunk View file →
@@ -13,9 +13,9 @@
13 13 'plugin_donate_link' => "https://www.yydevelopment.com/coffee-break/?plugin=phone-button", // link to the plugin donate page
14 14 'company_plugins_page' => "https://www.yydevelopment.com/yydevelopment-wordpress-plugins/", // link to the main company plugins page
15 15 'icon_image_path' => plugins_url() . "/" . basename( dirname( __FILE__ ) ) . "/images/icon.png", // link to the plugin icon
16 16 'save_database_time_stamp_name' => "yydev_phone_btn_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)
17 + 'send_mail_in_days' => (30 * 60 * 60 * 24) + strtotime("now"), // the amount of time after we show the notice (4 months)
18 18 );
19 19
20 20 // ================================================
21 21 // creating time stamp if it doesn't exists
@@ -42,11 +42,21 @@
42 42
43 43 // when the visitor want to stop getting the messages
44 44 function yydev_phone_btn_stop_notice_forever() {
45 45
46 + // Verify nonce for security
47 + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) {
48 + wp_die('Security check failed');
49 + }
50 +
51 + // Check if user has proper capabilities
52 + if (!current_user_can('manage_options')) {
53 + wp_die('Insufficient permissions');
54 + }
55 +
46 56 global $yydev_phone_btn_notice_info_array;
47 57 update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], 'stop');
48 - die(); // we have to end ajax functions with die();
58 + wp_die(); // Use wp_die() instead of die() for WordPress AJAX
49 59
50 60 } // function yydev_phone_btn_stop_notice_forever() {
51 61
52 62 add_action( 'wp_ajax_yydev_phone_btn_stop_notice_forever', 'yydev_phone_btn_stop_notice_forever' );
@@ -54,11 +64,21 @@
54 64
55 65 // when the visitor ask to get the message in the future
56 66 function yydev_phone_btn_stop_notice_for_now() {
57 67
68 + // Verify nonce for security
69 + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) {
70 + wp_die('Security check failed');
71 + }
72 +
73 + // Check if user has proper capabilities
74 + if (!current_user_can('manage_options')) {
75 + wp_die('Insufficient permissions');
76 + }
77 +
58 78 global $yydev_phone_btn_notice_info_array;
59 79 update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], $yydev_phone_btn_notice_info_array['send_mail_in_days']);
60 - die(); // we have to end ajax functions with die();
80 + wp_die(); // Use wp_die() instead of die() for WordPress AJAX
61 81
62 82 } // function yydev_phone_btn_stop_notice_for_now() {
63 83
64 84 add_action( 'wp_ajax_yydev_phone_btn_stop_notice_for_now', 'yydev_phone_btn_stop_notice_for_now' );
@@ -93,9 +113,12 @@
93 113
94 114 $(this).css("display", "none");
95 115
96 116 // use the function and update value using ajax
97 - var data = {'action': 'yydev_phone_btn_stop_notice_forever'}; // var data = {
117 + var data = {
118 + 'action': 'yydev_phone_btn_stop_notice_forever',
119 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
120 + };
98 121 jQuery.post(ajaxurl, data, function(response) {});
99 122
100 123 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
101 124 return false;
@@ -107,9 +130,12 @@
107 130
108 131 $(this).css("display", "none");
109 132
110 133 // use the function and update value using ajax
111 - var data = {'action': 'yydev_phone_btn_stop_notice_for_now'}; // var data = {
134 + var data = {
135 + 'action': 'yydev_phone_btn_stop_notice_for_now',
136 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
137 + };
112 138 jQuery.post(ajaxurl, data, function(response) {});
113 139
114 140 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
115 141 return false;
@@ -122,9 +148,12 @@
122 148
123 149 $(this).css("display", "none");
124 150
125 151 // use the function and update value using ajax
126 - var data = {'action': 'yydev_phone_btn_stop_notice_forever'}; // var data = {
152 + var data = {
153 + 'action': 'yydev_phone_btn_stop_notice_forever',
154 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
155 + };
127 156 jQuery.post(ajaxurl, data, function(response) {});
128 157
129 158 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
130 159 }); // $(document).on('click', '.yydev_phone_btn_notice_style notice-dismiss', function() {
@@ -212,24 +241,24 @@
212 241
213 242 <div class="yydev_phone_btn_notice_style notice notice-info">
214 243
215 244 <div class="yy-plugin-icon">
216 - <img src="<?php echo $icon_image_path; ?>" alt="<?php echo $plugin_name; ?>" />
245 + <img src="<?php echo esc_url($icon_image_path); ?>" alt="<?php echo esc_attr($plugin_name); ?>" />
217 246 </div><!--yy-plugin-icon-->
218 247
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.
248 + We are happy to see that you are using our <b><?php echo esc_html($plugin_name); ?></b> plugin for some time now.
249 + We at <a href="<?php echo esc_url($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 esc_url($plugin_review_page); ?>" target="_blank">positive review</a> if you liked it.
221 250
222 251 <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>
252 + <a class="button button-primary yy-review-plugin" href="<?php echo esc_url($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 253 <a class="button yy-plugin-dismiss-for-now" href="#" target="_blank">I am busy dude ask me again later</a>
225 254 <a class="button button-secondary yy-plugin-dismiss-forever" href="#" target="_blank">Never show this message again :(</a>
226 255 </div><!--notice-buttons-->
227 256
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>.
257 + If you have problems with the plugin you can submit a ticket at our <a href="<?php echo esc_url($plugin_support_link); ?>" target="_blank">plugin support page</a> and we will be happy to help.
258 + You are also welcome to check our other <a href="<?php echo esc_url($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 esc_url($plugin_donate_link); ?>">buy us a coffee</a>.
230 259
231 - <div class="yy-bottom-plugin-name "><?php echo $plugin_name; ?> Plugin</div>
260 + <div class="yy-bottom-plugin-name "><?php echo esc_html($plugin_name); ?> Plugin</div>
232 261
233 262 </div><!--yydev_phone_btn_notice_style-->
234 263
235 264 <?php