Changeset 2994668
- Timestamp:
- 11/12/2023 11:15:04 AM (2 years ago)
- Location:
- wp-admin-notification-center
- Files:
-
- 24 added
- 8 edited
- 10 copied
-
tags/3.0.0 (copied) (copied from wp-admin-notification-center/trunk)
-
tags/3.0.0/assets/css/global.css (added)
-
tags/3.0.0/assets/css/notification_center.css (copied) (copied from wp-admin-notification-center/trunk/assets/css/notification_center.css)
-
tags/3.0.0/assets/images (copied) (copied from wp-admin-notification-center/trunk/assets/images)
-
tags/3.0.0/assets/js/notice.js (copied) (copied from wp-admin-notification-center/trunk/assets/js/notice.js) (6 diffs)
-
tags/3.0.0/assets/js/notice_not_allowed.js (modified) (1 diff)
-
tags/3.0.0/index.php (copied) (copied from wp-admin-notification-center/trunk/index.php) (1 diff)
-
tags/3.0.0/lib/Database.php (added)
-
tags/3.0.0/lib/Debug.php (modified) (1 diff)
-
tags/3.0.0/lib/Repository.php (added)
-
tags/3.0.0/readme.txt (copied) (copied from wp-admin-notification-center/trunk/readme.txt) (2 diffs)
-
tags/3.0.0/src/Controllers/Notices.php (added)
-
tags/3.0.0/src/Controllers/NotificationCenter.php (copied) (copied from wp-admin-notification-center/trunk/src/Controllers/NotificationCenter.php)
-
tags/3.0.0/src/Controllers/Settings.php (copied) (copied from wp-admin-notification-center/trunk/src/Controllers/Settings.php)
-
tags/3.0.0/src/Entities (added)
-
tags/3.0.0/src/Entities/Notice.php (added)
-
tags/3.0.0/src/Init.php (copied) (copied from wp-admin-notification-center/trunk/src/Init.php) (3 diffs)
-
tags/3.0.0/src/Repositories (added)
-
tags/3.0.0/src/Repositories/NoticeRepository.php (added)
-
tags/3.0.0/src/Services/NoticeListingService.php (added)
-
tags/3.0.0/src/Services/UpdateService.php (added)
-
tags/3.0.0/src/Views/notice (added)
-
tags/3.0.0/src/Views/notice/listing.php (added)
-
tags/3.0.0/src/Views/settings.php (copied) (copied from wp-admin-notification-center/trunk/src/Views/settings.php)
-
trunk/assets/css/global.css (added)
-
trunk/assets/js/notice.js (modified) (6 diffs)
-
trunk/assets/js/notice_not_allowed.js (modified) (1 diff)
-
trunk/index.php (modified) (1 diff)
-
trunk/lib/Database.php (added)
-
trunk/lib/Debug.php (modified) (1 diff)
-
trunk/lib/Repository.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Controllers/Notices.php (added)
-
trunk/src/Entities (added)
-
trunk/src/Entities/Notice.php (added)
-
trunk/src/Init.php (modified) (3 diffs)
-
trunk/src/Repositories (added)
-
trunk/src/Repositories/NoticeRepository.php (added)
-
trunk/src/Services/NoticeListingService.php (added)
-
trunk/src/Services/UpdateService.php (added)
-
trunk/src/Views/notice (added)
-
trunk/src/Views/notice/listing.php (added)
Legend:
- Unmodified
- Added
- Removed
-
wp-admin-notification-center/tags/3.0.0/assets/js/notice.js
r2900860 r2994668 3 3 preAdminNotifications: '', 4 4 adminNotifications: [], 5 notificationsDisplayed: [], 5 6 buttonNotification: '', 6 7 closeButton: '', … … 42 43 setTimeout(() => { 43 44 this.moveNotifications(); 45 this.saveNotices(); 44 46 }, 500); 45 47 }, 46 48 initNotificationCenterStyle: function () { 47 49 //We get the top and left to place it 48 let top = this.buttonNotification.offsetTop + this.buttonNotification.offsetHeight;50 const top = this.buttonNotification.offsetTop + this.buttonNotification.offsetHeight; 49 51 50 let paddingTopContainer = document.defaultView.getComputedStyle(this.wancContainer, '').getPropertyValue('padding-top').replace(/[^-\d\.]/g, '');52 const paddingTopContainer = document.defaultView.getComputedStyle(this.wancContainer, '').getPropertyValue('padding-top').replace(/[^-\d\.]/g, ''); 51 53 52 54 //We place it … … 82 84 //We display it if this is a not a crucial notification 83 85 this.wancContainer.appendChild(this.adminNotifications[i]); 86 this.notificationsDisplayed.push(this.adminNotifications[i]); 84 87 85 88 if (this.wancContainer.lastChild.offsetHeight > 0) numberOfNotification++; … … 111 114 }, 112 115 needToBeDisplayed: function (notification) { 113 //let's run the settings and check if there something to display116 //let's run the settings and check if there is something to display 114 117 for (let [noticeClass, displayNotice] of Object.entries(this.notificationSettings)) { 115 118 if (displayNotice !== 1 && notification.classList.contains(noticeClass)) return true; … … 130 133 131 134 // we set a nice array by removing all white space at the start and the end of each word 132 let formattedWords = [];135 const formattedWords = []; 133 136 this[option].map(word => { 134 137 formattedWords.push(word.trim()); … … 151 154 if (notWhiteListed) this.adminNotifications.push(this.preAdminNotifications[i]); 152 155 } 156 }, 157 saveNotices: function () { 158 const formData = new FormData(); 159 160 formData.set('action', 'save_notices'); 161 this.notificationsDisplayed.forEach((notice, index) => { 162 formData.set(`notices[${index}]`, JSON.stringify(notice.outerHTML)); 163 }); 164 165 fetch(ajaxurl, {method: 'POST', body: formData}).then(response => { 166 return response.text(); 167 }); 153 168 } 154 169 }; -
wp-admin-notification-center/tags/3.0.0/assets/js/notice_not_allowed.js
r2375266 r2994668 1 1 const wanc_notification_not_allowed = { 2 2 init: function () { 3 let adminNotifications = document.querySelectorAll('.notice, #message');3 const adminNotifications = document.querySelectorAll('.notice, #message'); 4 4 for (let i = 0 ; i < adminNotifications.length ; i++) { 5 5 adminNotifications[i].remove(); -
wp-admin-notification-center/tags/3.0.0/index.php
r2966106 r2994668 6 6 Author URI: https://github.com/roumilb 7 7 License: GPLv3 8 Version: 2.3.38 Version: 3.0.0 9 9 Text Domain: wanc 10 10 Domain Path: /languages -
wp-admin-notification-center/tags/3.0.0/lib/Debug.php
r2771298 r2994668 1 1 <?php 2 2 3 4 namespace WANC\lib; 5 3 namespace WANC; 6 4 7 5 class Debug -
wp-admin-notification-center/tags/3.0.0/readme.txt
r2966106 r2994668 3 3 Tags: notification, notice, notices, notifications, admin 4 4 Requires at least: 5.0 5 Tested up to: 6. 25 Tested up to: 6.4 6 6 Requires PHP: 7.0 7 Stable tag: 2.3.37 Stable tag: 3.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 == Changelog == 36 36 37 = 2.3.3 = 38 * Fix CSRF Vulnerability 37 = 3.0.0 = 38 * Store notice displayed in the admin 39 * Listing of all notices stored 40 * Change admin menu icon -
wp-admin-notification-center/tags/3.0.0/src/Init.php
r2900859 r2994668 4 4 namespace WANC; 5 5 6 use \WANC\Controllers\Settings; 7 use \WANC\Controllers\NotificationCenter; 8 use WANC\Services\SurveyService; 6 use WANC\Controllers\Notices; 7 use WANC\Controllers\Settings; 8 use WANC\Controllers\NotificationCenter; 9 use WANC\Services\UpdateService; 9 10 10 11 class Init … … 14 15 public function __construct() 15 16 { 17 if (is_admin()) { 18 (new UpdateService())->update(); 19 } 20 16 21 add_action('admin_menu', [$this, 'registerWancOptionsPage']); 22 add_action('admin_enqueue_scripts', [$this, 'addScript']); 23 new Notices(); 17 24 new Settings(); 18 25 new NotificationCenter(); 19 new SurveyService();20 26 } 21 27 … … 27 33 'manage_options', 28 34 self::WANC_SLUG_MENU, 29 [new Settings(), 'optionsPage'] 35 [new Settings(), 'optionsPage'], 36 plugins_url('wp-admin-notification-center/assets/images/logo.svg') 37 ); 38 39 add_submenu_page( 40 self::WANC_SLUG_MENU, 41 'Notice Listing', 42 'Notice Listing', 43 'manage_options', 44 'notice-listing', 45 [new Notices(), 'listing'] 30 46 ); 31 47 } 48 49 public function addScript() { 50 wp_enqueue_style('wanc_style', plugins_url('wp-admin-notification-center/assets/css/global.css?time='.time())); 51 } 32 52 } -
wp-admin-notification-center/trunk/assets/js/notice.js
r2900860 r2994668 3 3 preAdminNotifications: '', 4 4 adminNotifications: [], 5 notificationsDisplayed: [], 5 6 buttonNotification: '', 6 7 closeButton: '', … … 42 43 setTimeout(() => { 43 44 this.moveNotifications(); 45 this.saveNotices(); 44 46 }, 500); 45 47 }, 46 48 initNotificationCenterStyle: function () { 47 49 //We get the top and left to place it 48 let top = this.buttonNotification.offsetTop + this.buttonNotification.offsetHeight;50 const top = this.buttonNotification.offsetTop + this.buttonNotification.offsetHeight; 49 51 50 let paddingTopContainer = document.defaultView.getComputedStyle(this.wancContainer, '').getPropertyValue('padding-top').replace(/[^-\d\.]/g, '');52 const paddingTopContainer = document.defaultView.getComputedStyle(this.wancContainer, '').getPropertyValue('padding-top').replace(/[^-\d\.]/g, ''); 51 53 52 54 //We place it … … 82 84 //We display it if this is a not a crucial notification 83 85 this.wancContainer.appendChild(this.adminNotifications[i]); 86 this.notificationsDisplayed.push(this.adminNotifications[i]); 84 87 85 88 if (this.wancContainer.lastChild.offsetHeight > 0) numberOfNotification++; … … 111 114 }, 112 115 needToBeDisplayed: function (notification) { 113 //let's run the settings and check if there something to display116 //let's run the settings and check if there is something to display 114 117 for (let [noticeClass, displayNotice] of Object.entries(this.notificationSettings)) { 115 118 if (displayNotice !== 1 && notification.classList.contains(noticeClass)) return true; … … 130 133 131 134 // we set a nice array by removing all white space at the start and the end of each word 132 let formattedWords = [];135 const formattedWords = []; 133 136 this[option].map(word => { 134 137 formattedWords.push(word.trim()); … … 151 154 if (notWhiteListed) this.adminNotifications.push(this.preAdminNotifications[i]); 152 155 } 156 }, 157 saveNotices: function () { 158 const formData = new FormData(); 159 160 formData.set('action', 'save_notices'); 161 this.notificationsDisplayed.forEach((notice, index) => { 162 formData.set(`notices[${index}]`, JSON.stringify(notice.outerHTML)); 163 }); 164 165 fetch(ajaxurl, {method: 'POST', body: formData}).then(response => { 166 return response.text(); 167 }); 153 168 } 154 169 }; -
wp-admin-notification-center/trunk/assets/js/notice_not_allowed.js
r2375266 r2994668 1 1 const wanc_notification_not_allowed = { 2 2 init: function () { 3 let adminNotifications = document.querySelectorAll('.notice, #message');3 const adminNotifications = document.querySelectorAll('.notice, #message'); 4 4 for (let i = 0 ; i < adminNotifications.length ; i++) { 5 5 adminNotifications[i].remove(); -
wp-admin-notification-center/trunk/index.php
r2966106 r2994668 6 6 Author URI: https://github.com/roumilb 7 7 License: GPLv3 8 Version: 2.3.38 Version: 3.0.0 9 9 Text Domain: wanc 10 10 Domain Path: /languages -
wp-admin-notification-center/trunk/lib/Debug.php
r2771298 r2994668 1 1 <?php 2 2 3 4 namespace WANC\lib; 5 3 namespace WANC; 6 4 7 5 class Debug -
wp-admin-notification-center/trunk/readme.txt
r2966106 r2994668 3 3 Tags: notification, notice, notices, notifications, admin 4 4 Requires at least: 5.0 5 Tested up to: 6. 25 Tested up to: 6.4 6 6 Requires PHP: 7.0 7 Stable tag: 2.3.37 Stable tag: 3.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 == Changelog == 36 36 37 = 2.3.3 = 38 * Fix CSRF Vulnerability 37 = 3.0.0 = 38 * Store notice displayed in the admin 39 * Listing of all notices stored 40 * Change admin menu icon -
wp-admin-notification-center/trunk/src/Init.php
r2900859 r2994668 4 4 namespace WANC; 5 5 6 use \WANC\Controllers\Settings; 7 use \WANC\Controllers\NotificationCenter; 8 use WANC\Services\SurveyService; 6 use WANC\Controllers\Notices; 7 use WANC\Controllers\Settings; 8 use WANC\Controllers\NotificationCenter; 9 use WANC\Services\UpdateService; 9 10 10 11 class Init … … 14 15 public function __construct() 15 16 { 17 if (is_admin()) { 18 (new UpdateService())->update(); 19 } 20 16 21 add_action('admin_menu', [$this, 'registerWancOptionsPage']); 22 add_action('admin_enqueue_scripts', [$this, 'addScript']); 23 new Notices(); 17 24 new Settings(); 18 25 new NotificationCenter(); 19 new SurveyService();20 26 } 21 27 … … 27 33 'manage_options', 28 34 self::WANC_SLUG_MENU, 29 [new Settings(), 'optionsPage'] 35 [new Settings(), 'optionsPage'], 36 plugins_url('wp-admin-notification-center/assets/images/logo.svg') 37 ); 38 39 add_submenu_page( 40 self::WANC_SLUG_MENU, 41 'Notice Listing', 42 'Notice Listing', 43 'manage_options', 44 'notice-listing', 45 [new Notices(), 'listing'] 30 46 ); 31 47 } 48 49 public function addScript() { 50 wp_enqueue_style('wanc_style', plugins_url('wp-admin-notification-center/assets/css/global.css?time='.time())); 51 } 32 52 }
Note: See TracChangeset
for help on using the changeset viewer.