Ejemplo n.º 1
0
 /**
  * Check and execute hook handlers
  *
  * @param string $hook Hook name
  *
  * @return void
  */
 public static function invokeHook($hook)
 {
     // Get plugins "subscribed" for the hook
     foreach (static::getPlugins($hook) as $plugin => $instance) {
         if (!isset($instance)) {
             $class = '\\Includes\\Decorator\\Plugin\\' . str_replace('_', '\\', $plugin) . '\\Main';
             static::$plugins[$plugin] = $instance = new $class();
         }
         if ($instance->isBlockingPlugin()) {
             // Block software before run plugin
             \Includes\Decorator\Utils\CacheManager::setRebuildBlockMark(\Includes\Decorator\Utils\CacheManager::getStep(), array('hook' => $hook, 'class' => get_class($instance)));
         }
         // Show message
         $title = $instance->getTitle() ?: 'Run the "' . $plugin . '" plugin...';
         \Includes\Decorator\Utils\CacheManager::showStepMessage($title);
         // Execute plugin main method
         $instance->executeHookHandler();
         // Show memory usage
         \Includes\Decorator\Utils\CacheManager::showStepInfo();
     }
 }