Skip to content

Commit

Permalink
Merge branch 'major' of github.com:BracketSpace/Notification into major
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmikita committed Sep 1, 2023
2 parents 7039924 + 136423f commit b2b3c40
Show file tree
Hide file tree
Showing 60 changed files with 458 additions and 167 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk


### macOS ###
*.DS_Store
.AppleDouble
Expand All @@ -39,7 +38,6 @@ $RECYCLE.BIN/
# Icon must end with two \r
Icon


# Thumbnails
._*

Expand All @@ -59,12 +57,10 @@ Network Trash Folder
Temporary Items
.apdisk


### Sass ###
.sass-cache/
*.css.map


### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
Expand Down Expand Up @@ -98,7 +94,6 @@ bh_unicode_properties.cache
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings


### Vim ###
# swap
[._]*.s[a-w][a-z]
Expand Down
175 changes: 173 additions & 2 deletions compat/src-deprecated/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
use BracketSpace\Notification\Store;
use BracketSpace\Notification\Dependencies\Micropackage\DocHooks\Helper as DocHooksHelper;
use BracketSpace\Notification\Queries\NotificationQueries;
use function BracketSpace\Notification\getSetting;
use function BracketSpace\Notification\adaptNotification;
use function BracketSpace\Notification\adaptNotificationFrom;
use function BracketSpace\Notification\swapNotificationAdapter;
use function BracketSpace\Notification\log;
use function BracketSpace\Notification\addNotification;
use function BracketSpace\Notification\convertNotificationData;
use function BracketSpace\Notification\registerSettings;
use function BracketSpace\Notification\getSettings;
use function BracketSpace\Notification\updateSetting;

/**
* Helper function.
Expand Down Expand Up @@ -62,7 +72,6 @@ function notification_cache() {
return null;
}


/**
* Checks if the Wizard should be displayed.
*
Expand Down Expand Up @@ -388,7 +397,6 @@ function notification_register_resolver( Interfaces\Resolvable $resolver ) {
Register::resolver( $resolver );
}


/**
* Resolves the value
*
Expand Down Expand Up @@ -669,3 +677,166 @@ function notification_update_setting($setting, $value) {

return notificationUpdateSetting($setting, $value);
}


/**
* Adapts Notification object
* Default adapters are: WordPress || JSON
*
* @param string $adapterName Adapter class name.
* @param \BracketSpace\Notification\Core\Notification $notification Notification object.
* @return \BracketSpace\Notification\Interfaces\Adaptable
* @throws \Exception If adapter wasn't found.
* @since 6.0.0
* @deprecated [Next]
*/
function notificationAdapt($adapterName, \BracketSpace\Notification\Core\Notification $notification) {
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\adaptNotification()');

return adaptNotification($adapterName, $notification);
}

/**
* Adapts Notification from input data
* Default adapters are: WordPress || JSON
*
* @param string $adapterName Adapter class name.
* @param mixed $data Input data needed by adapter.
* @return \BracketSpace\Notification\Interfaces\Adaptable
* @since 6.0.0
* @deprecated [Next]
*/
function notificationAdaptFrom($adapterName, $data)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\adaptNotificationFrom()');

return adaptNotificationFrom($adapterName, $data);
}

/**
* Changes one adapter to another
*
* @param string $newAdapterName Adapter class name.
* @param \BracketSpace\Notification\Interfaces\Adaptable $adapter Adapter.
* @return \BracketSpace\Notification\Interfaces\Adaptable
* @since 6.0.0
* @deprecated [Next]
*/
function notificationSwapAdapter($newAdapterName, Interfaces\Adaptable $adapter)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\swapNotificationAdapter()');

return swapNotificationAdapter($newAdapterName, $adapter);
}

/**
* Logs the message in database
*
* @param string $component Component nice name, like `Core` or `Any Plugin Name`.
* @param string $type Log type, values: notification|error|warning.
* @param string $message Log formatted message.
* @return bool|\WP_Error
* @since 6.0.0
* @deprecated [Next]
*/
function notificationLog($component, $type, $message)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\log()');

return log($component, $type, $message);
}

/**
* Adds Notification to Store
*
* @param \BracketSpace\Notification\Core\Notification $notification Notification object.
* @return void
* @since 6.0.0
* @deprecated [Next]
*/
function notificationAdd(\BracketSpace\Notification\Core\Notification $notification)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\addNotification()');

addNotification($notification);
}


/**
* Converts the static data to Trigger and Carrier objects
*
* If no `trigger` nor `carriers` keys are available it does nothing.
* If the data is already in form of objects it does nothing.
*
* @param array<mixed> $data Notification static data.
* @return array<mixed> Converted data.
* @since 6.0.0
* @deprecated [Next]
*/
function notificationConvertData($data = [])
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\convertNotificationData()');

return convertNotificationData($data);
}

/**
* Registers settings
*
* @param mixed $callback Callback for settings registration, array of string.
* @param int $priority Action priority.
* @return void
* @since 5.0.0
* @deprecated [Next]
*/
function notificationRegisterSettings($callback, $priority = 10)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\registerSettings()');

registerSettings($callback, $priority);
}

/**
* Gets setting values
*
* @return mixed
* @since 5.0.0
* @deprecated [Next]
*/
function notificationGetSettings()
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\getSettings()');

return getSettings();
}

/**
* Gets single setting value
*
* @param string $setting setting name in `a/b/c` format.
* @return mixed
* @since 5.0.0
* @since 7.0.0 The `notifications` section has been changed to `carriers`.
* @deprecated [Next]
*/
function notificationGetSetting($setting)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\getSetting()');

return getSetting($setting);
}

/**
* Updates single setting value.
*
* @param string $setting setting name in `a/b/c` format.
* @param mixed $value setting value.
* @return mixed
* @deprecated [Next]
*/
function notificationUpdateSetting($setting, $value)
{
_deprecated_function( __FUNCTION__, '[Next]', 'BracketSpace\\Notification\\updateSetting()');

return updateSetting($setting, $value);
}
13 changes: 13 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,31 @@ Yes! We're offering a [custom plugin development](https://bracketspace.com/custo

= [Next] =

* [Changed] Global functions moved to namespace and set as deprecated.
* [Changed] Removed v6 & v7 deprecated functions
* [Fixed] Shortcodes being uncorrectly stripped leaving closing "]" behind.
* [Fixed] PHP 8.2 deprecations.
* [Changed] Minimum required PHP version from 7.4.
* [Changed] WordPress Coding Standards to PSR-12 standards.
* [Added] New trigger after user confirms his new email address
* [Added] Option to disable notification about admin email address changed.

**Compatibility Breaking Changes**

* Class methods and properties has been changed from snake_case to camelCase.
* In Post Triggers, dynamic property `$trigger->{$post_type}` has been replaced with static prop `$trigger->post`.
* The same as above applies to Post Trigger datetime tags, namely: postCreationDatetime, postPublicationDatetime, and postModificationDatetime.
* Renamed functions:
notification_adapt() -> BracketSpace\Notification\adaptNotification()
notification_adapt_from() -> BracketSpace\Notification\adaptNotificationFrom()
notification_swap_adapter() -> BracketSpace\Notification\swapNotificationAdapter()
notification_log() -> BracketSpace\Notification\log()
notification_add() -> BracketSpace\Notification\addNotification()
notification_convert_data() -> BracketSpace\Notification\convertNotificationData()
notification_register_settings() -> BracketSpace\Notification\registerSettings()
notification_get_settings() -> BracketSpace\Notification\getSettings()
notification_get_setting() -> BracketSpace\Notification\getSetting()
notification_update_setting() -> BracketSpace\Notification\updateSetting()

== Upgrade Notice ==

Expand Down
1 change: 0 additions & 1 deletion resources/css/src/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

$mobile-width: 782px;

@mixin mobile {
Expand Down
1 change: 0 additions & 1 deletion resources/css/src/partials/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

}


/**
* On/Off switch
*/
Expand Down
1 change: 0 additions & 1 deletion resources/css/src/partials/_metabox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
}
}


.question-mark {
font-size: 14px;
position: absolute;
Expand Down
1 change: 0 additions & 1 deletion resources/templates/debug/error-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
</div>
<?php endforeach ?>


<?php else : ?>
<p><?php esc_html_e('The Error log is empty.'); ?></p>
<?php endif ?>
Expand Down
1 change: 0 additions & 1 deletion resources/templates/debug/notification-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@
</div>
<?php endforeach ?>


<?php else : ?>
<p>
<?php
Expand Down
2 changes: 1 addition & 1 deletion resources/wizard-data/comment_moderation.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"trigger": "comment/comment/added",
"carriers": {
"email": {
"activated": true,
"activated": true,
"enabled": true,
"subject": "{site_title} - Please moderate: \"{post_title}\"",
"body": "A new comment on the post \"{post_title}\" is waiting for your approval\r\n{post_permalink}\r\n\r\nAuthor: {comment_author_user_display_name} (IP address: {comment_author_IP})\r\nEmail: {comment_author_user_email}\r\nURL: {comment_author_url}\r\nComment: {comment_content}\r\n\r\nApprove it: {comment_approve_action_url}\r\nTrash it: {comment_trash_action_url}\r\nDelet it: {comment_delete_action_url}\r\nSpam it: {comment_spam_action_url}",
Expand Down
2 changes: 1 addition & 1 deletion resources/wizard-data/comment_published.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"trigger": "comment/comment/approved",
"carriers": {
"email": {
"activated": true,
"activated": true,
"enabled": true,
"subject": "{site_title} - Comment: \"{post_title}\"",
"body": "New comment on your post \"{post_title}\"\r\n\r\nAuthor: {comment_author_user_display_name} (IP address: {comment_author_IP})\r\n\r\nEmail: {comment_author_user_email}\r\n\r\nURL: {comment_author_url}\r\n\r\nComment: {comment_content}\r\n\r\nYou can see all comments on this post here:\r\n{post_permalink}#comments\r\n\r\nPermalink: {post_permalink}",
Expand Down
42 changes: 21 additions & 21 deletions resources/wizard-data/comment_reply.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"hash": "notification_5d3af50b188af",
"title": "Comment reply - comment author",
"trigger": "comment/comment/replied",
"carriers": {
"email": {
"activated": true,
"enabled": true,
"subject": "{site_title} - a new reply to your comment on \"{post_title}\"",
"body": "A new reply to your comment on the post \"{post_title}\" has been just added.\r\n{post_permalink}\r\n\r\nAuthor: {comment_author_user_display_name}\r\nURL: {comment_author_url}\r\nComment: {comment_content}",
"recipients": [
{
"type": "email",
"recipient": "{parent_comment_author_user_email}"
}
],
"headers": null
}
},
"enabled": true,
"extras": [],
"version": 1564144907
"hash": "notification_5d3af50b188af",
"title": "Comment reply - comment author",
"trigger": "comment/comment/replied",
"carriers": {
"email": {
"activated": true,
"enabled": true,
"subject": "{site_title} - a new reply to your comment on \"{post_title}\"",
"body": "A new reply to your comment on the post \"{post_title}\" has been just added.\r\n{post_permalink}\r\n\r\nAuthor: {comment_author_user_display_name}\r\nURL: {comment_author_url}\r\nComment: {comment_content}",
"recipients": [
{
"type": "email",
"recipient": "{parent_comment_author_user_email}"
}
],
"headers": null
}
},
"enabled": true,
"extras": [],
"version": 1564144907
}
2 changes: 1 addition & 1 deletion resources/wizard-data/new_user.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"trigger": "user/registered",
"carriers": {
"email": {
"activated": true,
"activated": true,
"enabled": true,
"subject": "{site_title} - New User Registration",
"body": "New user registration on your site {site_name}:\r\n\r\nUsername: {user_login}\r\n\r\nEmail: {user_email}",
Expand Down
2 changes: 1 addition & 1 deletion resources/wizard-data/password_forgotten.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"trigger": "user/password_reset_request",
"carriers": {
"email": {
"activated": true,
"activated": true,
"enabled": true,
"subject": "{site_title} - Password Reset",
"body": "Someone has requested a password reset for the following account:\r\n\r\nSite Name: {site_title}\r\n\r\nUsername: {user_nicename}\r\n\r\nIf this was a mistake, just ignore this email and nothing will happen.\r\n\r\nTo reset your password, visit the following address:\r\n\r\n{user_password_reset_link}",
Expand Down
2 changes: 1 addition & 1 deletion resources/wizard-data/password_reset.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"trigger": "user/password_changed",
"carriers": {
"email": {
"activated": true,
"activated": true,
"enabled": true,
"subject": "{site_title} - Password Reset",
"body": "Password changed for user: {user_login}",
Expand Down
Loading

0 comments on commit b2b3c40

Please sign in to comment.