src/Pupcake/Pupcake.php
public function loadAllPlugins()
    {
        if (count($this->plugins) > 0) {
            foreach ($this->plugins as $plugin_name => $plugin) {
                $event_helpers = $plugin->getEventHelperCallbacks();
                if (count($event_helpers) > 0) {
                    foreach ($event_helpers as $event_name => $callback) {
                        if (!isset($this->events_helpers[$event_name])) {
                            $this->events_helpers[$event_name] = array();
                        }
                        $this->events_helpers[$event_name][] = $plugin; //add the plugin object to the map
                    }
                }
            }

            //register all event helpers
            if (count($this->events_helpers) > 0) {
                foreach ($this->events_helpers as $event_name => $plugin_objs) {
                    if (count($plugin_objs) > 0) {
                        $this->plugin_loading = true;
                        $this->on($event_name, function($event) use ($plugin_objs) {
                            return call_user_func_array(array($event, "register"), $plugin_objs)->start();
                        });
                        $this->plugin_loading = false;
                    }
                }
            }
        }
    }
public function loadAllPlugins()
    {
        if (count($this->plugins) > 0) {
            foreach ($this->plugins as $plugin_name => $plugin) {
                $event_helpers = $plugin->getEventHelperCallbacks();
                if (count($event_helpers) > 0) {
                    foreach ($event_helpers as $event_name => $callback) {
                        if (!isset($this->events_helpers[$event_name])) {
                            $this->events_helpers[$event_name] = array();
                        }
                        $this->events_helpers[$event_name][] = $plugin; //add the plugin object to the map
                    }
                }
            }

            //register all event helpers
            if (count($this->events_helpers) > 0) {
                foreach ($this->events_helpers as $event_name => $plugin_objs) {
                    if (count($plugin_objs) > 0) {
                        $this->plugin_loading = true;
                        $this->on($event_name, function($event) use ($plugin_objs) {
                            return call_user_func_array(array($event, "register"), $plugin_objs)->start();
                        });
                        $this->plugin_loading = false;
                    }
                }
            }
        }
    }
public function loadAllPlugins ( ) { if ( count ( $ this -> plugins ) > 0 ) { foreach ( $ this -> plugins as $ plugin_name => $ plugin ) { $ event_helpers = $ plugin -> getEventHelperCallbacks ( ) ; if ( count ( $ event_helpers ) > 0 ) { foreach ( $ event_helpers as $ event_name => $ callback ) { if ( ! isset ( $ this -> events_helpers [ $ event_name ] ) ) { $ this -> events_helpers [ $ event_name ] = array ( ) ; } $ this -> events_helpers [ $ event_name ] [ ] = $ plugin ; //add the plugin object to the map } } } //register all event helpers if ( count ( $ this -> events_helpers ) > 0 ) { foreach ( $ this -> events_helpers as $ event_name => $ plugin_objs ) { if ( count ( $ plugin_objs ) > 0 ) { $ this -> plugin_loading = true ; $ this -> on ( $ event_name , function ( $ event ) use ( $ plugin_objs ) { return call_user_func_array ( array ( $ event , "register" ) , $ plugin_objs ) -> start ( ) ; } ) ; $ this -> plugin_loading = false ; } } } } }
load all plugins
load all plugins