HEX
Server: Apache/2.4.25
System: Linux ion14 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64
User: (10087)
PHP: 7.4.30
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,system, exec, shell_exec, passthru, popen, proc_open
Upload Files
File: /home/www/web115/wordpress/wp-content/plugins/digimember/system/model/logic/event_subscriber.php
<?php

class ncore_EventSubscriberLogic extends ncore_BaseLogic
{
    public function call( $event )
    {
        $subscribers = $this->getSubscribers( $event );

        $given_args = func_get_args();
        array_shift($given_args);


        foreach ($subscribers as $info)
        {
            list(  $model, $method, $no_of_accepted_args ) = $info;

            $callable = array( $model, $method );

            $args = array_slice( $given_args, 0, $no_of_accepted_args);

            call_user_func_array( $callable, $args  );
        }
    }



    private $config = false;

    private function getSubscribers( $event )
    {
        if ($this->config === false)
        {
            $model = $this->api->load->config('event_subscriber');
            $this->config = $model->get('event_subscriber');
        }

        $subscribers =& $this->config[ $event ];

        if (empty($subscribers)) {
            return array();
        }

        if (is_string($subscribers)) {

            $lines = explode( "\n", str_replace( array( ',', ';' ), "\n", $subscribers ) );
            $subscribers = array();
            foreach ($lines as $line)
            {
                $line = trim($line);
                if (!$line) {
                    continue;
                }

                list( $path, $model_name, $method, $no_of_accepted_args ) = ncore_retrieveList( '/', $line );

                switch ($path)
                {
                    case 'library':
                        $model = $this->api->load->library( $model_name );
                    break;
                    default:
                        $model = $this->api->load->model( "$path/$model_name" );
                }

                $subscribers[] = array( $model, $method, $no_of_accepted_args );
            }
        }

        return $subscribers;
    }

}