Changeset 1696964
- Timestamp:
- 07/16/2017 09:04:28 AM (9 years ago)
- Location:
- wp-notification
- Files:
-
- 7 added
- 1 edited
-
tags/1.3 (added)
-
tags/1.3/lang (added)
-
tags/1.3/lang/wp-notification-hu_HU.mo (added)
-
tags/1.3/lang/wp-notification-hu_HU.po (added)
-
tags/1.3/readme.txt (added)
-
tags/1.3/screenshot-1.png (added)
-
tags/1.3/wp-notification.php (added)
-
trunk/wp-notification.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-notification/trunk/wp-notification.php
r1694489 r1696964 4 4 Plugin URI: http://wp-learning.net 5 5 Description: Show custom notifications on the dashboard 6 Version: 1. 36 Version: 1.4 7 7 Author: Tomek 8 8 Author URI: http://wp-learning-net … … 15 15 function wp_notification_menu() { 16 16 global $current_user, $wp_admin_bar; 17 if(get_option("custom_notices_login") != $current_user->user_login){ 18 if(current_user_can("administrator")){ 19 if(get_option("administrator_notices_text") == true ){ 20 if(get_option("administrator_notices_notification_type") == "error" ){ 21 $type = '#DC3232'; 22 } else if(get_option("administrator_notices_notification_type") == "warning" ){ 23 $type = '#FFB900'; 24 } else if(get_option("administrator_notices_notification_type") == "success" ){ 25 $type = '#46B450'; 26 } else if(get_option("administrator_notices_notification_type") == "info" ){ 27 $type = "#00A0D2"; 28 } 29 $wp_admin_bar->add_menu( array( 30 'parent' => 'top-secondary', 31 'id' => 'notification-menu', 32 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 33 'href' => false, 34 'meta' => array( 'class' => 'notification-admin-menu' ) 35 ) ); 36 $wp_admin_bar->add_menu( array( 37 'parent' => 'notification-menu', 38 'id' => 'notification-submenu', 39 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option("administrator_notices_text"))).'</span>', 40 'href' => false, 41 'meta' => array( 'class' => 'notification-admin-submenu' ) 42 ) ); 43 } 44 } else if(current_user_can("author")){ 45 if(get_option("author_notices_text") == true ){ 46 if(get_option("author_notices_notification_type") == "error" ){ 47 $type = '#DC3232'; 48 } else if(get_option("author_notices_notification_type") == "warning" ){ 49 $type = '#FFB900'; 50 } else if(get_option("author_notices_notification_type") == "success" ){ 51 $type = '#46B450'; 52 } else if(get_option("author_notices_notification_type") == "info" ){ 53 $type = "#00A0D2"; 54 } 55 $wp_admin_bar->add_menu( array( 56 'parent' => 'top-secondary', 57 'id' => 'notification-menu', 58 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 59 'href' => false, 60 'meta' => array( 'class' => 'notification-admin-menu' ) 61 ) ); 62 $wp_admin_bar->add_menu( array( 63 'parent' => 'notification-menu', 64 'id' => 'notification-submenu', 65 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option("author_notices_text"))).'</span>', 66 'href' => false, 67 'meta' => array( 'class' => 'notification-admin-submenu' ) 68 ) ); 69 } 70 } else if(current_user_can("editor")){ 71 if(get_option("editor_notices_text") == true ){ 72 if(get_option("editor_notices_notification_type") == "error" ){ 73 $type = '#DC3232'; 74 } else if(get_option("editor_notices_notification_type") == "warning" ){ 75 $type = '#FFB900'; 76 } else if(get_option("editor_notices_notification_type") == "success" ){ 77 $type = '#46B450'; 78 } else if(get_option("editor_notices_notification_type") == "info" ){ 79 $type = "#00A0D2"; 80 } 81 $wp_admin_bar->add_menu( array( 82 'parent' => 'top-secondary', 83 'id' => 'notification-menu', 84 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 85 'href' => false, 86 'meta' => array( 'class' => 'notification-admin-menu' ) 87 ) ); 88 $wp_admin_bar->add_menu( array( 89 'parent' => 'notification-menu', 90 'id' => 'notification-submenu', 91 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option("editor_notices_text"))).'</span>', 92 'href' => false, 93 'meta' => array( 'class' => 'notification-admin-submenu' ) 94 ) ); 95 } 96 } else if(current_user_can("contributor")){ 97 if(get_option("contributor_notices_text") == true ){ 98 if(get_option("contributor_notices_notification_type") == "error" ){ 99 $type = '#DC3232'; 100 } else if(get_option("contributor_notices_notification_type") == "warning" ){ 101 $type = '#FFB900'; 102 } else if(get_option("contributor_notices_notification_type") == "success" ){ 103 $type = '#46B450'; 104 } else if(get_option("contributor_notices_notification_type") == "info" ){ 105 $type = "#00A0D2"; 106 } 107 $wp_admin_bar->add_menu( array( 108 'parent' => 'top-secondary', 109 'id' => 'notification-menu', 110 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 111 'href' => false, 112 'meta' => array( 'class' => 'notification-admin-menu' ) 113 ) ); 114 $wp_admin_bar->add_menu( array( 115 'parent' => 'notification-menu', 116 'id' => 'notification-submenu', 117 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option("contributor_notices_text"))).'</span>', 118 'href' => false, 119 'meta' => array( 'class' => 'notification-admin-submenu' ) 120 ) ); 121 } 122 } else if(current_user_can("subscriber")){ 123 if(get_option("subscriber_notices_text") == true ){ 124 if(get_option("subscriber_notices_notification_type") == "error" ){ 125 $type = '#DC3232'; 126 } else if(get_option("subscriber_notices_notification_type") == "warning" ){ 127 $type = '#FFB900'; 128 } else if(get_option("subscriber_notices_notification_type") == "success" ){ 129 $type = '#46B450'; 130 } else if(get_option("subscriber_notices_notification_type") == "info" ){ 131 $type = "#00A0D2"; 132 } 133 $wp_admin_bar->add_menu( array( 134 'parent' => 'top-secondary', 135 'id' => 'notification-menu', 136 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 137 'href' => false, 138 'meta' => array( 'class' => 'notification-admin-menu' ) 139 ) ); 140 $wp_admin_bar->add_menu( array( 141 'parent' => 'notification-menu', 142 'id' => 'notification-submenu', 143 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option("subscriber_notices_text"))).'</span>', 144 'href' => false, 145 'meta' => array( 'class' => 'notification-admin-submenu' ) 146 ) ); 147 } 17 $user_info = get_userdata($current_user->ID); 18 $role = implode(', ', $user_info->roles); 19 if(get_option($role."_notices_login") != $current_user->user_login){ 20 if(get_option($role."_notices_text") == true ){ 21 if(get_option($role."_notices_notification_type") == "error" ){ 22 $type = '#DC3232'; 23 } else if(get_option($role."_notices_notification_type") == "warning" ){ 24 $type = '#FFB900'; 25 } else if(get_option($role."_notices_notification_type") == "success" ){ 26 $type = '#46B450'; 27 } else if(get_option($role."_notices_notification_type") == "info" ){ 28 $type = "#00A0D2"; 29 } 30 $wp_admin_bar->add_menu( array( 31 'parent' => 'top-secondary', 32 'id' => 'notification-menu', 33 'title' => '<span class="ab-icon dashicons dashicons-warning"></span>' . __('New notification','wp-notification'), 34 'href' => false, 35 'meta' => array( 'class' => 'notification-admin-menu' ) 36 ) ); 37 $wp_admin_bar->add_menu( array( 38 'parent' => 'notification-menu', 39 'id' => 'notification-submenu', 40 'title' => '<span class="notification-type" style="background:'.$type.';color:black;font-weight:bold;;padding:5px">!</span><span class="notification-content" style="padding-left:5px">'.strip_tags(stripslashes(get_option($role."_notices_text"))).'</span>', 41 'href' => false, 42 'meta' => array( 'class' => 'notification-admin-submenu' ) 43 ) ); 148 44 } 149 45 } else { … … 178 74 function wp_notification_core() { 179 75 global $current_screen, $current_user; 76 $user_info = get_userdata($current_user->ID); 77 $role = implode(', ', $user_info->roles); 180 78 if(get_option("custom_notices_login") != $current_user->user_login){ 181 if(current_user_can("administrator")){ 182 if(get_option("administrator_notices_text") == true ){ 183 if(get_option("administrator_notices_hide") == true ){ 184 $hide = ' is-dismissible'; 185 } 186 if(get_option("administrator_notices_notification_type") == "error" ){ 187 $type = 'notice notice-error'; 188 } else if(get_option("administrator_notices_notification_type") == "warning" ){ 189 $type = 'notice notice-warning'; 190 } else if(get_option("administrator_notices_notification_type") == "success" ){ 191 $type = 'notice notice-success'; 192 } else if(get_option("administrator_notices_notification_type") == "info" ){ 193 $type = 'notice notice-info'; 194 } 195 if( $current_screen->id == get_option("administrator_notices_location") ) { 196 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("administrator_notices_text")) ?></p></div><?php 197 } else if ( get_option("administrator_notices_location") == 'all' ) { 198 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("administrator_notices_text")) ?></p></div><?php 199 } 200 } 201 } else if(current_user_can("author")){ 202 if(get_option("author_notices_text") == true ){ 203 if(get_option("author_notices_hide") == true ){ 204 $hide = ' is-dismissible'; 205 } 206 if(get_option("author_notices_notification_type") == "error" ){ 207 $type = 'notice notice-error'; 208 } else if(get_option("author_notices_notification_type") == "warning" ){ 209 $type = 'notice notice-warning'; 210 } else if(get_option("author_notices_notification_type") == "success" ){ 211 $type = 'notice notice-success'; 212 } else if(get_option("author_notices_notification_type") == "info" ){ 213 $type = 'notice notice-info'; 214 } 215 if( $current_screen->id == get_option("author_notices_location") ) { 216 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("author_notices_text")) ?></p></div><?php 217 } else if ( get_option("author_notices_location") == 'all' ) { 218 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("author_notices_text")) ?></p></div><?php 219 } 220 } 221 } else if(current_user_can("editor")){ 222 if(get_option("editor_notices_text") == true ){ 223 if(get_option("editor_notices_hide") == true ){ 224 $hide = ' is-dismissible'; 225 } 226 if(get_option("editor_notices_notification_type") == "error" ){ 227 $type = 'notice notice-error'; 228 } else if(get_option("editor_notices_notification_type") == "warning" ){ 229 $type = 'notice notice-warning'; 230 } else if(get_option("editor_notices_notification_type") == "success" ){ 231 $type = 'notice notice-success'; 232 } else if(get_option("editor_notices_notification_type") == "info" ){ 233 $type = 'notice notice-info'; 234 } 235 if( $current_screen->id == get_option("editor_notices_location") ) { 236 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("editor_notices_text")) ?></p></div><?php 237 } else if ( get_option("editor_notices_location") == 'all' ) { 238 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("editor_notices_text")) ?></p></div><?php 239 } 240 } 241 } else if(current_user_can("contributor")){ 242 if(get_option("contributor_notices_text") == true ){ 243 if(get_option("contributor_notices_hide") == true ){ 244 $hide = ' is-dismissible'; 245 } 246 if(get_option("contributor_notices_notification_type") == "error" ){ 247 $type = 'notice notice-error'; 248 } else if(get_option("contributor_notices_notification_type") == "warning" ){ 249 $type = 'notice notice-warning'; 250 } else if(get_option("contributor_notices_notification_type") == "success" ){ 251 $type = 'notice notice-success'; 252 } else if(get_option("contributor_notices_notification_type") == "info" ){ 253 $type = 'notice notice-info'; 254 } 255 if( $current_screen->id == get_option("contributor_notices_location") ) { 256 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("contributor_notices_text")) ?></p></div><?php 257 } else if ( get_option("contributor_notices_location") == 'all' ) { 258 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("contributor_notices_text")) ?></p></div><?php 259 } 260 } 261 } else if(current_user_can("subscriber")){ 262 if(get_option("subscriber_notices_text") == true ){ 263 if(get_option("subscriber_notices_hide") == true ){ 264 $hide = ' is-dismissible'; 265 } 266 if(get_option("subscriber_notices_notification_type") == "error" ){ 267 $type = 'notice notice-error'; 268 } else if(get_option("subscriber_notices_notification_type") == "warning" ){ 269 $type = 'notice notice-warning'; 270 } else if(get_option("subscriber_notices_notification_type") == "success" ){ 271 $type = 'notice notice-success'; 272 } else if(get_option("subscriber_notices_notification_type") == "info" ){ 273 $type = 'notice notice-info'; 274 } 275 if( $current_screen->id == get_option("subscriber_notices_location") ) { 276 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("subscriber_notices_text")) ?></p></div><?php 277 } else if ( get_option("subscriber_notices_location") == 'all' ) { 278 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option("subscriber_notices_text")) ?></p></div><?php 279 } 79 if(get_option($role."_notices_text") == true ){ 80 if(get_option($role."_notices_hide") == true ){ 81 $hide = ' is-dismissible'; 82 } 83 if(get_option($role."_notices_notification_type") == "error" ){ 84 $type = 'notice notice-error'; 85 } else if(get_option($role."_notices_notification_type") == "warning" ){ 86 $type = 'notice notice-warning'; 87 } else if(get_option($role."_notices_notification_type") == "success" ){ 88 $type = 'notice notice-success'; 89 } else if(get_option($role."_notices_notification_type") == "info" ){ 90 $type = 'notice notice-info'; 91 } 92 if( $current_screen->id == get_option($role."_notices_location") ) { 93 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option($role."_notices_text")) ?></p></div><?php 94 } else if ( get_option($role."_notices_location") == 'all' ) { 95 ?><div class="<?php echo $type.$hide ?>"><p><?php echo stripslashes(get_option($role."_notices_text")) ?></p></div><?php 280 96 } 281 97 }
Note: See TracChangeset
for help on using the changeset viewer.