Changeset 2021763
- Timestamp:
- 01/30/2019 08:58:35 AM (7 years ago)
- Location:
- dw-notifications
- Files:
-
- 50 added
- 11 edited
-
tags/1.0.3 (added)
-
tags/1.0.3/assets (added)
-
tags/1.0.3/assets/._webfonts (added)
-
tags/1.0.3/assets/css (added)
-
tags/1.0.3/assets/css/dw-notifications.css (added)
-
tags/1.0.3/assets/css/multi-select.css (added)
-
tags/1.0.3/assets/images (added)
-
tags/1.0.3/assets/images/image_default.png (added)
-
tags/1.0.3/assets/images/switch.png (added)
-
tags/1.0.3/assets/js (added)
-
tags/1.0.3/assets/js/admin-script.js (added)
-
tags/1.0.3/assets/js/dw-notifications.js (added)
-
tags/1.0.3/assets/js/jquery.multi-select.js (added)
-
tags/1.0.3/dw-notifications.php (added)
-
tags/1.0.3/inc (added)
-
tags/1.0.3/inc/Ajax.php (added)
-
tags/1.0.3/inc/Integrations.php (added)
-
tags/1.0.3/inc/Notification.php (added)
-
tags/1.0.3/inc/Script.php (added)
-
tags/1.0.3/inc/Settings.php (added)
-
tags/1.0.3/inc/Shortcode.php (added)
-
tags/1.0.3/inc/Template.php (added)
-
tags/1.0.3/inc/autoload.php (added)
-
tags/1.0.3/inc/functions.php (added)
-
tags/1.0.3/inc/integrations (added)
-
tags/1.0.3/inc/integrations/dwqa (added)
-
tags/1.0.3/inc/integrations/dwqa/index.php (added)
-
tags/1.0.3/inc/integrations/dwqa/loader.php (added)
-
tags/1.0.3/inc/integrations/index.php (added)
-
tags/1.0.3/inc/integrations/wordpress-post (added)
-
tags/1.0.3/inc/integrations/wordpress-post/index.php (added)
-
tags/1.0.3/inc/integrations/wordpress-post/loader.php (added)
-
tags/1.0.3/languages (added)
-
tags/1.0.3/languages/dw-notifications-ar.mo (added)
-
tags/1.0.3/languages/dw-notifications-ar.po (added)
-
tags/1.0.3/languages/dw-notifications-vi.mo (added)
-
tags/1.0.3/languages/dw-notifications-vi.po (added)
-
tags/1.0.3/languages/dw-notifications.pot (added)
-
tags/1.0.3/libs (added)
-
tags/1.0.3/libs/custom-list-table.php (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/templates (added)
-
tags/1.0.3/templates/default (added)
-
tags/1.0.3/templates/default/notification-alert.php (added)
-
tags/1.0.3/templates/default/notification-item.php (added)
-
tags/1.0.3/templates/default/notification-list-all.php (added)
-
tags/1.0.3/templates/default/notification-list.php (added)
-
tags/1.0.3/templates/default/notification-popup-item.php (added)
-
tags/1.0.3/templates/default/notification-popup.php (added)
-
trunk/assets/css/dw-notifications.css (modified) (4 diffs)
-
trunk/assets/js/dw-notifications.js (modified) (8 diffs)
-
trunk/dw-notifications.php (modified) (2 diffs)
-
trunk/inc/Ajax.php (modified) (1 diff)
-
trunk/inc/Notification.php (modified) (6 diffs)
-
trunk/inc/Script.php (modified) (3 diffs)
-
trunk/inc/Shortcode.php (modified) (2 diffs)
-
trunk/inc/integrations/wordpress-post/loader.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/templates/default/notification-alert.php (modified) (1 diff)
-
trunk/templates/default/notification-item.php (modified) (1 diff)
-
trunk/templates/default/notification-list-all.php (added)
Legend:
- Unmodified
- Added
- Removed
-
dw-notifications/trunk/assets/css/dw-notifications.css
r2012557 r2021763 142 142 border-right: 0; 143 143 position: relative; 144 padding-right: 15px;145 144 width: 100%; 146 145 word-wrap: break-word; … … 168 167 font-size: 13px; 169 168 font-weight: 400; 170 padding: 20px 020px 70px;169 padding: 20px 15px 20px 70px; 171 170 width: 100%; 172 171 word-wrap: break-word; … … 230 229 content: "\f058"; 231 230 color: #84c31e; 231 } 232 .dw-notifications .list-notification li.dw-notif-show-older-wrap { 233 text-align: center; 234 } 235 .dw-notifications .list-notification li.dw-notif-show-older-wrap a { 236 padding: 20px 20px 20px 20px; 232 237 } 233 238 .notif-count-unchecked { … … 327 332 -moz-transform: rotate(45deg); 328 333 } 334 335 /** 336 ---- List All ----*/ 337 .dw-notifications-list-all { 338 width: 100%; 339 } 340 .dw-notifications-list-all .notification-group { 341 width: 100%; 342 position: static; 343 opacity: 1; 344 visibility: visible; 345 z-index: auto; 346 } 347 348 .dw-notifications-list-all .notification-group ul.list-notification { 349 max-height: unset; 350 } 351 329 352 /** 330 353 ---- Use php shortcode ----*/ -
dw-notifications/trunk/assets/js/dw-notifications.js
r2012557 r2021763 3 3 var time = dwnotif.dwnotif_current_time; 4 4 var old_time = time; 5 6 if(!$('#dw-notifications').length){ 7 return; 8 } 5 var document_title = document.title; 6 var count_unchecked = 0; 7 9 8 10 9 var change_numer = 0; … … 17 16 minTimeRequest = dwnotif.dwnotif_min_time_request * 1000; 18 17 } 18 19 if($('#dw-notifications').length){ 20 setCountUnchecked(count_unchecked); 21 autoCheck(); 22 } 19 23 20 21 autoCheck(); 24 22 25 23 26 function changeTimeRequest(changed = false){ … … 49 52 changeTimeItem(time); 50 53 changeReadItem(); 54 changeCountTitle(); 51 55 setTimeout(checkNotifications, currentTimeRequest); 56 } 57 58 function setCountUnchecked(count){ 59 setCookie('dw_count_user_unchecked', count, 3600); 60 } 61 62 function changeCountTitle() { 63 var count = parseInt(getCookie('dw_count_user_unchecked')); 64 var newTitle = document_title; 65 if(count){ 66 var newTitle = '(' + count + ') ' + document_title; 67 } 68 document.title = newTitle; 52 69 } 53 70 … … 72 89 $('#dw-notifications').find('.dw-notification-btn').addClass('has-notification'); 73 90 $('#dw-notifications').find('.notif-count-unchecked').text(data.result.count_unchecked); 91 setCountUnchecked(data.result.count_unchecked); 74 92 } 75 93 … … 81 99 } 82 100 83 /*if(data.result.length>0){84 for(var i=0;i<data.result.length;i++){85 $('.dw-notifications._' + data.result[i].id).find('.list-notification').html(data.result[i].html);86 if(data.result[i].new){87 addPopup(data.result[i].id, data.result[i].new);88 changed = true;89 }90 if(data.result[i].count_unchecked){91 addHasNotifications(data.result[i].id, data.result[i].count_unchecked);92 }93 }94 }*/95 101 time = data.time; 96 102 } … … 163 169 164 170 $(this).removeClass('has-notification'); 171 setCountUnchecked(0); 172 changeCountTitle(); 165 173 166 174 var notifications = $(this).closest('.dw-notifications'); … … 198 206 }); 199 207 208 //show older 209 210 $('.dw-notif-show-older').on('click', function(event){ 211 event.preventDefault(); 212 var older_button = $(this); 213 var older_wrap = $(this).closest('.dw-notif-show-older-wrap'); 214 var data_time = parseInt($(this).attr('data-time')); 215 var data_page = parseInt($(this).attr('data-page')); 216 $.ajax({ 217 url: dwnotif.dwnotif_ajax_url, 218 type: 'POST', 219 dataType: 'json', 220 data: { 221 action: 'dwnotif_get_older_notifications', 222 nonce: dwnotif.dwnotif_nonce, 223 time: data_time, 224 page: data_page, 225 }, 226 success: function( data ) { 227 if (data.success) { 228 if(data.result.older_notifications){ 229 older_wrap.before(data.result.older_notifications); 230 data_page++; 231 older_button.attr('data-page', data_page); 232 }else{ 233 older_wrap.text(dwnotif.dwnotif_text.older_not_found); 234 } 235 } 236 return false; 237 }, 238 error: function (request, status, error) { 239 240 } 241 }); 242 }); 243 200 244 //mark item read 201 245 $(document).on('click', '.list-notification .unread', function (e) { … … 234 278 $(document).on('click', '.dw-notifications', function (e) { 235 279 e.stopPropagation(); 280 }); 281 282 $('#dw-notifications .noti-body').bind('mousewheel DOMMouseScroll', function(e) { 283 var scrollTo = null; 284 285 if (e.type == 'mousewheel') { 286 scrollTo = (e.originalEvent.wheelDelta * -1); 287 } 288 else if (e.type == 'DOMMouseScroll') { 289 scrollTo = 40 * e.originalEvent.detail; 290 } 291 292 if (scrollTo) { 293 e.preventDefault(); 294 $(this).scrollTop(scrollTo + $(this).scrollTop()); 295 } 236 296 }); 237 297 }); -
dw-notifications/trunk/dw-notifications.php
r2012557 r2021763 5 5 * Author: DesignWall 6 6 * Author URI: http://www.designwall.com 7 * Version: 1.0. 27 * Version: 1.0.3 8 8 * Text Domain: dw-notifications 9 9 */ … … 16 16 class DW_Notifications{ 17 17 public function __construct() { 18 $this->version = '1.0. 2';18 $this->version = '1.0.3'; 19 19 $this->define_constants(); 20 20 $this->includes(); -
dw-notifications/trunk/inc/Ajax.php
r2012557 r2021763 10 10 add_action( 'wp_ajax_nopriv_dwnotif_check_notifications', array($this, 'check_notifications') ); 11 11 12 add_action( 'wp_ajax_dwnotif_get_older_notifications', array($this, 'get_older_notifications') ); 13 add_action( 'wp_ajax_nopriv_dwnotif_get_older_notifications', array($this, 'get_older_notifications') ); 14 12 15 add_action( 'wp_ajax_dwnotif_mark_all_as_read', array($this, 'mark_all_as_read') ); 13 16 add_action( 'wp_ajax_dwnotif_mark_user_checked', array($this, 'mark_user_checked') ); 17 } 18 19 public function get_older_notifications(){ 20 check_ajax_referer( 'dwnotif_nonce', 'nonce' ); 21 $result = array(); 22 $time = $_POST['time']?$_POST['time']:current_time('timestamp'); 23 $page = $_POST['page']?$_POST['page']:2; 24 25 $notification = new DWNOTIF_Notification(); 26 27 $args = array( 28 'paged' => $page, 29 'date_query' => array( 30 array( 31 'before' => array( 32 'year' => date("Y", $time), 33 'month' => date("m", $time), 34 'day' => date("d", $time), 35 'hour' => date("H", $time), 36 'minute' => date("i", $time), 37 'second' => date("s", $time), 38 ), 39 'column ' => 'post_date', 40 'inclusive' => false 41 ) 42 ), 43 ); 44 45 $older_notifications = $notification->get_notifications($args); 46 47 if($older_notifications){ 48 $result['older_notifications'] = $notification->get_item_template($older_notifications); 49 }else{ 50 $result['older_notifications'] = false; 51 } 52 53 echo json_encode(array('success'=>true, 'result'=>$result)); 54 die(); 55 14 56 } 15 57 -
dw-notifications/trunk/inc/Notification.php
r2012557 r2021763 223 223 'post_title' => $notification['title'], 224 224 'post_content' => $notification['content'], 225 'post_status' => 'publish' 225 'post_parent' => $notification['parent'], 226 'post_status' => 'publish', 226 227 ); 227 228 … … 255 256 'image' => dwnotif_default_image(), 256 257 'auto' => true, // add this to check auto genrate 258 'parent' => 0, // if source is post_type 257 259 )); 258 260 } … … 348 350 extract($data); 349 351 352 $current_time = current_time('timestamp'); 350 353 $notifications = $this->get_notifications($data); 351 354 $count_unchecked = $this->count_user_unchecked(); … … 360 363 } 361 364 365 public function get_list_all_template($data = array()){ 366 367 $default_data = array( 368 'id' => $this->id, 369 'paged' => 1, 370 ); 371 $data = (array)$data; 372 $data = wp_parse_args( $data, $default_data); 373 $data = apply_filters('dwnotif_list_all_data', $data); 374 extract($data); 375 376 $current_time = current_time('timestamp'); 377 $notifications = $this->get_notifications($data); 378 379 $file_dir = dwnotif_load_template('notification-list-all', false); 380 381 //get list item 382 ob_start(); 383 include($file_dir); 384 $html = ob_get_contents(); 385 ob_end_clean(); 386 387 return $html; 388 } 362 389 363 390 public function get_list_template($data = array()){ … … 445 472 446 473 $user_checked_time = get_user_meta($user_id, 'dwnotif_user_checked', true); 474 if(!$user_checked_time){ 475 $user_checked_time = current_time('timestamp'); 476 } 447 477 448 478 $dw_notification_to = array('all'); … … 479 509 $notifications = get_posts($args); 480 510 481 return $notifications?count($notifications):0; 511 $count = $notifications?count($notifications):0; 512 513 return $count; 482 514 } 483 515 -
dw-notifications/trunk/inc/Script.php
r2012557 r2021763 12 12 13 13 function enqueue_style() { 14 global $dw_notif_options ;14 global $dw_notif_options, $dwnotif; 15 15 16 16 $min_time_request = isset( $dw_notif_options['min-time-request'] ) ? $dw_notif_options['min-time-request'] : 0; … … 29 29 'YEAR_IN_SECONDS' => YEAR_IN_SECONDS, 30 30 ), 31 'dwnotif_text' => array( 32 'older_not_found' => __('That\'s all', 'dw-notifications') 33 ), 31 34 32 35 'dwnotif_min_time_request' => $min_time_request … … 34 37 35 38 wp_enqueue_style( 'dwnotif-fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'); 36 wp_enqueue_style( 'dwnotif-default-style', DWNOTIF_URI . 'assets/css/dw-notifications.css' );37 wp_enqueue_script( 'dwnotif-default', DWNOTIF_URI . 'assets/js/dw-notifications.js', array( 'jquery') );39 wp_enqueue_style( 'dwnotif-default-style', DWNOTIF_URI . 'assets/css/dw-notifications.css', array(), $dwnotif->version); 40 wp_enqueue_script( 'dwnotif-default', DWNOTIF_URI . 'assets/js/dw-notifications.js', array( 'jquery'), $dwnotif->version); 38 41 wp_localize_script( 'dwnotif-default', 'dwnotif', $dw_notifications_script_vars ); 39 42 } -
dw-notifications/trunk/inc/Shortcode.php
r2012557 r2021763 13 13 14 14 add_shortcode( 'dw_notif', array( $this, 'show_notifications') ); 15 add_shortcode( 'dw_notif_list_all', array( $this, 'show_list_all_notifications') ); 15 16 16 17 //add filter to use shortcode in wp menu setup … … 64 65 } 65 66 67 public function show_list_all_notifications( $atts ){ 68 global $dwnotif; 69 $notification = $dwnotif->notification; 70 71 $html = $notification->get_list_all_template(); 72 $html = $this->sanitize_output( $html ); 73 return apply_filters( 'dwnotif_shortcode_list_all', $html ); 74 } 75 66 76 } 67 77 -
dw-notifications/trunk/inc/integrations/wordpress-post/loader.php
r2012557 r2021763 17 17 $image = dwnotif_default_image(); 18 18 if(has_post_thumbnail($post_ID)){ 19 $image = get_the_post_thumbnail ($post_ID, 'post-thumbnail') ;19 $image = get_the_post_thumbnail_url($post_ID, 'post-thumbnail') ; 20 20 } 21 21 22 $notif = array('title'=>$title, 'link' => $link, 'image' => $image); 23 dwnotif_add_notification('all', $notif); 22 $notif = array('title'=>$title, 'link' => $link, 'image' => $image, 'parent'=>$post_ID); 23 $notif = apply_filters('dwnotif_insert_wp_post_data', $notif, $post_ID, $post); 24 25 $to = apply_filters('dwnotif_insert_wp_post_to', 'all', $post_ID, $post); 26 dwnotif_add_notification( $to, $notif ); 24 27 } 25 28 -
dw-notifications/trunk/readme.txt
r2012558 r2021763 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.0.3 6 Stable tag: 1.0. 26 Stable tag: 1.0.3 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 32 32 * Select css type. 33 33 * Add Shortcode in Menu 34 * Load more. 35 * All notification shortcode 34 36 35 = Upcoming features = 36 * Load more. 37 * All notification page 37 ShortCode 38 [dw_notif], [dw_notif_list_all] 38 39 39 40 … … 41 42 You can find [Documents](https://www.designwall.com/guide/dw-notifications/) and more detailed information about DW GDPR plugin on [DesignWall.com](http://www.designwall.com/). 42 43 We provide support both on support forum on WordPress.org and our [support page](http://www.designwall.com/question/) on DesignWall. 43 44 = Source =45 [Free for commercial use](https://www.iconfinder.com/icons/728992/configuration_control_dashboard_setting_speed_system_tool_icon#size=128)46 44 47 45 = Languages supported: = … … 60 58 == Changelog == 61 59 60 = 1.0.3 = 61 62 * Add load more/show older button 63 * Add shortcode [dw_notif_list_all] 64 * Add notification counter on the tab page title 65 62 66 = 1.0.2 = 63 67 -
dw-notifications/trunk/templates/default/notification-alert.php
r2012557 r2021763 16 16 <ul class="list-notification noti-body"> 17 17 <?php include dwnotif_load_template( 'notification-list', false );?> 18 <li class="dw-notif-show-older-wrap"><a href="#" class="dw-notif-show-older" data-time="<?php echo $current_time;?>" data-page="2"><?php _e( 'Show older', 'dw-notifications' );?></a></li> 18 19 </ul> 20 <div class="clearfix noti-headerbotom"> 21 22 </div> 19 23 </div> 20 24 -
dw-notifications/trunk/templates/default/notification-item.php
r2012557 r2021763 19 19 </div> 20 20 <div><?php echo $notification->post_title; ?></div> 21 <date class="notif-time"><?php echo human_time_diff( $notification_time, current_time('timestamp') ) . __( ' ago', 'dw-notifications' ); ?></date>21 <date class="notif-time"><?php echo human_time_diff( $notification_time, current_time('timestamp') ); ?></date> 22 22 </a> 23 23 </li>
Note: See TracChangeset
for help on using the changeset viewer.