当前位置: 首页>>代码示例>>PHP>>正文


PHP ExtensionManager::_subscriptions方法代码示例

本文整理汇总了PHP中ExtensionManager::_subscriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::_subscriptions方法的具体用法?PHP ExtensionManager::_subscriptions怎么用?PHP ExtensionManager::_subscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExtensionManager的用法示例。


在下文中一共展示了ExtensionManager::_subscriptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: notifyMembers

 /**
  * 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);
         }
     }
 }
开发者ID:benesch,项目名称:hilton-unar,代码行数:60,代码来源:class.extensionmanager.php

示例2: notifyMembers

 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);
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-calendar,代码行数:44,代码来源:class.extensionmanager.php


注:本文中的ExtensionManager::_subscriptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。