Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: mvp #259

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions includes/channels.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
/**
* Functions related to registering channels.
*
* @package wordpress/wp-feature-notifications
*/

namespace WP\Notifications;

use WP\Notification\Model;

/**
* Register a notification channel.
*
* @param string|Model\Channel $name Channel name including namespace, or
* alternatively a complete Channel instance.
* Incase a Channel is provided, the $args
* parameter will be ignored.
* @param array $args Optional. Array of channel arguments. Accepts
* any public property of `Channel`. See
* Channel::__construct() for information on
* accepted arguments. Default empty array.
* @return Model\Channel|false The registered channel on success, or false on failure.
*/
function register_channel( $name, $args = array() ) {
return Channel_Registry::get_instance()->register( $name, $args );
}

/**
* Unregister a channel.
*
* @param string|Model\Channel $name Channel name including namespace, or
* alternatively a complete Channel instance.
* @return Model\Channel|false The unregistered channel on success, or false on failure.
*/
function unregister_channel( $name ) {
return Channel_Registry::get_instance()->unregister( $name );
}

// Register core notification channels.

add_action(
'init',
function () {
register_channel(
'core/updates',
array(
'title' => __( 'WordPress Updates', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'WordPress core update events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/plugin-install',
array(
'title' => __( 'Plugin Install', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Plugin install events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/plugin-uninstall',
array(
'title' => __( 'Plugin Uninstall', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Plugin uninstall events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/plugin-activate',
array(
'title' => __( 'Plugin Activate', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Plugin activation events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/plugin-deactivate',
array(
'title' => __( 'Plugin Deactivate', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Plugin deactivation events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/plugin-updates',
array(
'title' => __( 'Plugin Update', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Plugin update events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/post-new',
array(
'title' => __( 'New Post', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Post creation events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/post-edit',
array(
'title' => __( 'Edit Post', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Post edit events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/post-delete',
array(
'title' => __( 'Delete Post', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Post delete events.', 'wp-feature-notifications' ),
)
);

register_channel(
'core/comment-new',
array(
'title' => __( 'New Comment', 'wp-feature-notifications' ),
'icon' => 'wordpress',
'description' => __( 'Comment creation events.', 'wp-feature-notifications' ),
)
);
}
);
89 changes: 0 additions & 89 deletions includes/class-aggregate-factory.php

This file was deleted.

Loading