/**
  * Given a delegate name, notify all extensions that have registered to that
  * delegate to executing their callbacks with a `$context` array parameter
  * that contains information about the current Symphony state.
  *
  * @param string $delegate
  *  The delegate name
  * @param string $page
  *  The current page namespace that this delegate operates in
  * @param array $context
  *  The `$context` param is an associative array that at minimum will contain
  *  the current Administration class, the current page object and the delegate
  *  name. Other context information may be passed to this function when it is
  *  called. eg.
  *
  * array(
  *		'parent' =>& $this->Parent,
  *		'page' => $page,
  *		'delegate' => $delegate
  *	);
  *
  */
 public function notifyMembers($delegate, $page, array $context = array())
 {
     if ((int) Symphony::Configuration()->get('allow_page_subscription', 'symphony') != 1) {
         return;
     }
     if (is_null(self::$_subscriptions)) {
         self::$_subscriptions = Symphony::Database()->fetch("\n\t\t\t\t\tSELECT t1.name, t2.page, t2.delegate, t2.callback\n\t\t\t\t\tFROM `tbl_extensions` as t1 INNER JOIN `tbl_extensions_delegates` as t2 ON t1.id = t2.extension_id\n\t\t\t\t\tWHERE t1.status = 'enabled'");
     }
     // Make sure $page is an array
     if (!is_array($page)) {
         $page = array($page);
     }
     // Support for global delegate subscription
     if (!in_array('*', $page)) {
         $page[] = '*';
     }
     $services = array();
     foreach (self::$_subscriptions as $subscription) {
         if ($subscription['delegate'] != $delegate) {
             continue;
         }
         if (!in_array($subscription['page'], $page)) {
             continue;
         }
         $services[] = $subscription;
     }
     if (empty($services)) {
         return null;
     }
     $parent = Symphony::Engine();
     $context += array('parent' => &$parent, 'page' => $page, 'delegate' => $delegate);
     foreach ($services as $s) {
         $obj = $this->getInstance($s['name']);
         if (is_object($obj) && method_exists($obj, $s['callback'])) {
             $obj->{$s['callback']}($context);
         }
     }
 }
 public function notifyMembers($delegate, $page, $context = array())
 {
     if ((int) Symphony::Configuration()->get('allow_page_subscription', 'symphony') != 1) {
         return;
     }
     if (is_null(self::$_subscriptions)) {
         self::$_subscriptions = Symphony::Database()->fetch("\n\t\t\t\t\tSELECT t1.name, t2.page, t2.delegate, t2.callback\n\t\t\t\t\tFROM `tbl_extensions` as t1 INNER JOIN `tbl_extensions_delegates` as t2 ON t1.id = t2.extension_id\n\t\t\t\t\tWHERE t1.status = 'enabled'");
     }
     // Make sure $page is an array
     if (!is_array($page)) {
         // Support for pseudo-global delegates (including legacy support for /administration/)
         if (preg_match('/\\/?(administration|backend)\\/?/', $page)) {
             $page = array('backend', '/backend/', 'administration', '/administration/');
         } else {
             $page = array($page);
         }
     }
     // Support for global delegate subscription
     if (!in_array('*', $page)) {
         $page[] = '*';
     }
     $services = null;
     foreach (self::$_subscriptions as $subscription) {
         foreach ($page as $p) {
             if ($p == $subscription['page'] && $delegate == $subscription['delegate']) {
                 if (!is_array($services)) {
                     $services = array();
                 }
                 $services[] = $subscription;
             }
         }
     }
     if (!is_array($services) || empty($services)) {
         return NULL;
     }
     $context += array('parent' => &$this->_Parent, 'page' => $page, 'delegate' => $delegate);
     foreach ($services as $s) {
         $obj = $this->create($s['name']);
         if (is_object($obj) && in_array($s['callback'], get_class_methods($obj))) {
             $obj->{$s['callback']}($context);
             unset($obj);
         }
     }
 }