| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/mail-manager-wpforms/includes/ |
Upload File : |
<?php
/**
* Registers all actions and filters for the plugin.
*
* @link https://mmw.diviaccessories.com/
* @since 1.0.0
*
* @package mail-manager-wpforms
* @subpackage mail-manager-wpforms/loader
*/
namespace MMWPF\Core;
/**
* Registers all actions and filters for the plugin.
*
* Keeps track of all hooks registered within the plugin,
* and registers them with the WordPress API. Calls the
* run function to execute the list of actions and filters.
*
* @since 1.0.0
* @author nishanmazumder<arosh019@gmail.com>
*/
class Loader {
use \MMWPF\TRT\Trait_Manager;
/**
* The list of actions registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $actions Actions registered with WordPress to execute when the plugin loads.
*/
protected $actions;
/**
* The list of filters registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $filters Filters registered with WordPress to trigger when the plugin loads.
*/
protected $filters;
/**
* Initializes the collections to manage actions and filters.
*
* @since 1.0.0
*/
public function __construct() {
$this->actions = array();
$this->filters = array();
}
/**
* Adds a new action to the collection for registration with WordPress.
*
* @since 1.0.0
* @param string $hook The name of the WordPress action being registered.
* @param object $component A reference to the instance of the object where the action is defined.
* @param string $callback The name of the function defined on the $component.
* @param int $priority Optional. The priority at which the function should be executed. Default is 10.
* @param int $accepted_args Optional. The number of arguments to pass to the $callback. Default is 1.
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Adds a new filter to the collection for registration with WordPress.
*
* @since 1.0.0
* @param string $hook The name of the WordPress filter being registered.
* @param object $component A reference to the instance of the object where the filter is defined.
* @param string $callback The name of the function defined on the $component.
* @param int $priority Optional. The priority at which the function should be executed. Default is 10.
* @param int $accepted_args Optional. The number of arguments to pass to the $callback. Default is 1.
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Utility function for registering actions and hooks into a single collection.
*
* @since 1.0.0
* @access private
* @param array $hooks Collection of hooks being registered (actions or filters).
* @param string $hook Name of the WordPress filter being registered.
* @param object $component Reference to the instance of the object defining the filter.
* @param string $callback Name of the function defined on the $component.
* @param int $priority Priority at which the function should be executed.
* @param int $accepted_args Number of arguments to pass to the $callback.
* @return array Collection of actions and filters registered with WordPress.
*/
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
$hooks[] = array(
'hook' => $hook,
'component' => $component,
'callback' => $callback,
'priority' => $priority,
'accepted_args' => $accepted_args,
);
return $hooks;
}
/**
* Registers the filters and actions with WordPress.
*
* @since 1.0.0
*/
public function mmwpf_loader() {
foreach ( $this->filters as $hook ) {
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
foreach ( $this->actions as $hook ) {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
}
}