| Current File : /home/tekstore/public_html/wp-content/plugins/texty/includes/Dispatcher.php |
<?php
namespace Texty;
use Texty\Integrations\Dokan;
use Texty\Integrations\WooCommerce;
/**
* Dispatcher Class
*/
class Dispatcher {
/**
* Initialize
*/
public function __construct() {
// WordPress Events
add_action( 'user_register', [ $this, 'user_register' ] );
add_action( 'comment_post', [ $this, 'new_comment' ] );
// WooCommerce
new WooCommerce();
new Dokan();
}
/**
* Send message upon user registration
*
* @param int $user_id
*
* @return void
*/
public function user_register( $user_id ) {
$class = texty()->notifications()->get( 'registration' );
$notifier = new $class();
$notifier->set_user( $user_id );
$notifier->send();
}
/**
* Send message upon a new comment
*
* @param int $comment_id
*
* @return void
*/
public function new_comment( $comment_id ) {
$class = texty()->notifications()->get( 'comment' );
$notifier = new $class();
$notifier->set_comment( $comment_id );
$notifier->send();
}
}