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


PHP Zend_Registry::isRegistered方法代码示例

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


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

示例1: getDatabase

 /**
  * Gets an instance of the Sahara_Database.
  *
  * @return Zend_Db instance
  * @throws Exception - 100 - Database not configured
  */
 public static function getDatabase()
 {
     if (!Zend_Registry::isRegistered('db')) {
         if (!($dbconfig = Zend_Registry::get('config')->database)) {
             throw new Exception('Database not configured.', 100);
         }
         if (isset($dbconfig->failover) && $dbconfig->failover->enabled) {
             if (!($file = $dbconfig->failover->file)) {
                 throw new Exception('Database fail over configuration file not configured.', 100);
             }
             /* If the database failover file does not exist, a fail over
              * operation is triggered to choose a database server to
              * connect to. */
             if (!is_file($dbconfig->failover->file)) {
                 if (!self::performFailover($dbconfig)) {
                     throw new Exception('Failed database fail over, could not find an online server to use.', 100);
                 }
             } else {
                 if (!($dbconfig = new Zend_Config_Ini($dbconfig->failover->file))) {
                     throw new Exception('Failed to load server from fail over configuration file.', 100);
                 }
                 self::_registerDatabase(Zend_Db::factory($dbconfig));
             }
         } else {
             self::_registerDatabase(Zend_Db::factory($dbconfig));
         }
     }
     return Zend_Registry::get('db');
 }
开发者ID:jeking3,项目名称:web-interface,代码行数:35,代码来源:Database.php

示例2: indexAction

 /**
  * List of subscriptions
  */
 public function indexAction()
 {
     $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table();
     $this->view->subscriptionPlan = $subscriptionPlansTable->fetchAll();
     //Get user
     $identity = Zend_Auth::getInstance()->getIdentity();
     if ($identity) {
         $userId = $identity->id;
         //Get current subscription
         $subscriptionManager = new Subscriptions_Model_Subscription_Manager();
         $currentSubscription = $subscriptionManager->getCurrentSubscription($userId);
         if ($currentSubscription) {
             $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table();
             $currentSubscriptionPlan = $subscriptionPlansTable->getById($currentSubscription->subscriptionPlanId);
             $paypalHost = false;
             if (Zend_Registry::isRegistered('payments')) {
                 $payments = Zend_Registry::get('payments');
                 if (isset($payments['gateways']) && $payments['gateways'] && isset($payments['gateways']['paypal']) && $payments['gateways']['paypal']) {
                     $paypalHost = $payments['gateways']['paypal']['paypalHost'];
                 }
             }
             if (!$paypalHost) {
                 if (Zend_Registry::isRegistered('Log')) {
                     $log = Zend_Registry::get('Log');
                     $log->log("PayPal is not configured.", Zend_Log::CRIT);
                 }
                 throw new Exception($this->__("Paypal is not configured."));
             }
             $this->view->paypalHost = $paypalHost;
             $this->view->currentSubscription = $currentSubscription;
             $this->view->currentSubscriptionPlan = $currentSubscriptionPlan;
         }
     }
 }
开发者ID:shahmaulik,项目名称:zfcore,代码行数:37,代码来源:IndexController.php

示例3: clearRegistry

 public function clearRegistry()
 {
     if (Zend_Registry::isRegistered('Zend_Translate')) {
         $registry = Zend_Registry::getInstance();
         unset($registry['Zend_Translate']);
     }
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:7,代码来源:AbstractTest.php

示例4: __construct

 /**
  * Creates a new Base Model
  * 
  * @param mixed|string,object $DbTableModel
  */
 public function __construct($DbTableModel)
 {
     $this->setDbTable($DbTableModel);
     $page_size = Zend_Registry::isRegistered('default_page_size') ? Zend_Registry::get('default_page_size') : 20;
     $this->_defaultPageSize = $page_size;
     $this->_pageSize = $page_size;
 }
开发者ID:gatorv,项目名称:gecko_fw1,代码行数:12,代码来源:Base.php

示例5: __construct

 /**
  * Zend_Measure_Abstract is an abstract class for the different measurement types
  *
  * @param  $value  mixed  - Value as string, integer, real or float
  * @param  $type   type   - OPTIONAL a Zend_Measure_Area Type
  * @param  $locale locale - OPTIONAL a Zend_Locale Type
  * @throws Zend_Measure_Exception
  */
 public function __construct($value, $type = null, $locale = null)
 {
     if ($type !== null and Zend_Locale::isLocale($type, null, false)) {
         $locale = $type;
         $type = null;
     }
     if (empty($locale)) {
         require_once 'Zend/Registry.php';
         if (Zend_Registry::isRegistered('Zend_Locale') === true) {
             $locale = Zend_Registry::get('Zend_Locale');
         }
     }
     if ($locale === null) {
         $locale = new Zend_Locale();
     }
     if (!Zend_Locale::isLocale($locale, true, false)) {
         if (!Zend_Locale::isLocale($locale, false, false)) {
             require_once 'Zend/Measure/Exception.php';
             throw new Zend_Measure_Exception("Language (" . (string) $locale . ") is unknown");
         }
         $locale = new Zend_Locale($locale);
     }
     $this->_locale = (string) $locale;
     if ($type === null) {
         $type = $this->_units['STANDARD'];
     }
     if (isset($this->_units[$type]) === false) {
         require_once 'Zend/Measure/Exception.php';
         throw new Zend_Measure_Exception("Type ({$type}) is unknown");
     }
     $this->setValue($value, $type, $this->_locale);
 }
开发者ID:H38uS,项目名称:Impulsion,代码行数:40,代码来源:Abstract.php

示例6: getAcl

 /**
  * Returns the Zend_Acl object or null.
  * @return Zend_Acl
  */
 protected function getAcl()
 {
     if (is_null($this->_acl)) {
         $this->_acl = Zend_Registry::isRegistered('Opus_Acl') ? Zend_Registry::get('Opus_Acl') : null;
     }
     return $this->_acl;
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:11,代码来源:AccessControl.php

示例7: checkRequire

 public function checkRequire()
 {
     try {
         $subject = Engine_Api::_()->core()->getSubject();
     } catch (Exception $e) {
         $subject = null;
     }
     $actionName = $this->getFrontController()->getRequest()->getActionName();
     $ret = true;
     if (!$subject instanceof Core_Model_Item_Abstract || !$subject->getIdentity()) {
         $ret = false;
     } else {
         if (null !== $this->_requiredType && $subject->getType() != $this->_requiredType) {
             $ret = false;
         } else {
             if (null !== ($requireType = $this->getActionRequireType($actionName)) && $subject->getType() != $requireType) {
                 $ret = false;
             }
         }
     }
     if (!$ret && APPLICATION_ENV == 'development' && Zend_Registry::isRegistered('Zend_Log') && ($log = Zend_Registry::get('Zend_Log')) instanceof Zend_Log) {
         $target = $this->getRequest()->getModuleName() . '.' . $this->getRequest()->getControllerName() . '.' . $this->getRequest()->getActionName();
         $log->log('Require class ' . get_class($this) . ' failed check for: ' . $target, Zend_Log::DEBUG);
     }
     return $ret;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:26,代码来源:RequireSubject.php

示例8: datePicker

 /**
  * Create a jQuery UI Widget Date Picker
  *
  * @link   http://docs.jquery.com/UI/Datepicker
  * @param  string $id
  * @param  string $value
  * @param  array  $params jQuery Widget Parameters
  * @param  array  $attribs HTML Element Attributes
  * @return string
  */
 public function datePicker($id, $value = null, array $params = array(), array $attribs = array())
 {
     $attribs = $this->_prepareAttributes($id, $value, $attribs);
     if (Zend_Registry::isRegistered('Zend_Locale')) {
         if (!isset($params['dateFormat'])) {
             $params['dateFormat'] = self::resolveZendLocaleToDatePickerFormat();
         }
         $days = Zend_Locale::getTranslationList('Days');
         if (!isset($params['dayNames'])) {
             $params['dayNames'] = array_values($days['format']['wide']);
         }
         if (!isset($params['dayNamesShort'])) {
             $params['dayNamesShort'] = array_values($days['format']['abbreviated']);
         }
         if (!isset($params['dayNamesMin'])) {
             $params['dayNamesMin'] = array_values($days['stand-alone']['narrow']);
         }
         $months = Zend_Locale::getTranslationList('Months');
         if (!isset($params['monthNames'])) {
             $params['monthNames'] = array_values($months['stand-alone']['wide']);
         }
         if (!isset($params['monthNamesShort'])) {
             $params['monthNamesShort'] = array_values($months['stand-alone']['narrow']);
         }
     }
     // TODO: Allow translation of DatePicker Text Values to get this action from client to server
     $params = ZendX_JQuery::encodeJson($params);
     $js = sprintf('%s("#%s").datepicker(%s);', ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(), $attribs['id'], $params);
     $this->jquery->addOnLoad($js);
     return $this->view->formText($id, $value, $attribs);
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:41,代码来源:DatePicker.php

示例9: __construct

 /**
  * Creates a currency instance. Every supressed parameter is used from the actual or the given locale.
  *
  * @param  string             $currency OPTIONAL currency short name
  * @param  string|Zend_Locale $locale   OPTIONAL locale name
  * @throws Zend_Currency_Exception When currency is invalid
  */
 public function __construct($currency = null, $locale = null)
 {
     if (Zend_Locale::isLocale($currency, true, false)) {
         $temp = $locale;
         $locale = $currency;
         $currency = $temp;
     }
     if (empty($locale)) {
         require_once 'Zend/Registry.php';
         if (Zend_Registry::isRegistered('Zend_Locale') === true) {
             $locale = Zend_Registry::get('Zend_Locale');
         }
     }
     $this->setLocale($locale);
     // Get currency details
     $this->_options['currency'] = self::getShortName($currency, $this->_locale);
     $this->_options['name'] = self::getName($currency, $this->_locale);
     $this->_options['symbol'] = self::getSymbol($currency, $this->_locale);
     if ($this->_options['currency'] === null and $this->_options['name'] === null) {
         require_once 'Zend/Currency/Exception.php';
         throw new Zend_Currency_Exception("Currency '{$currency}' not found");
     }
     // Get the format
     $this->_options['position'] = $this->_updateFormat();
     $this->_options['display'] = self::NO_SYMBOL;
     if (empty($this->_options['symbol']) === false) {
         $this->_options['display'] = self::USE_SYMBOL;
     } else {
         if (empty($this->_options['currency']) === false) {
             $this->_options['display'] = self::USE_SHORTNAME;
         }
     }
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:40,代码来源:Currency.php

示例10: getClientmessages

 /**
  * Wird beim Abholen der Clientnachrichten aufgerufen
  * @param integer $lastResponse
  * @param integer $actualResponse
  * @return RecordList
  */
 public function getClientmessages($lastResponse, $actualResponse)
 {
     if (!Zend_Registry::isRegistered('DragonX_Storage_Engine')) {
         return new DragonX_Storage_RecordList();
     }
     return Zend_Registry::get('DragonX_Storage_Engine')->loadBySqlStatement(new DragonX_Clientmessage_Record_All(), "SELECT * FROM `dragonx_clientmessage_record_all` " . "WHERE " . "    `created` BETWEEN :lastResponse AND :actualResponse", array('lastResponse' => $lastResponse, 'actualResponse' => $actualResponse - 1));
 }
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:13,代码来源:All.php

示例11: __construct

 public function __construct()
 {
     $emptyRegistry = array('css' => array('prepend' => array(), 'append' => array()), 'js' => array('prepend' => array(), 'append' => array()));
     if (!Zend_Registry::isRegistered(self::REGISTRY_KEY)) {
         Zend_Registry::set(self::REGISTRY_KEY, $emptyRegistry);
     }
 }
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:7,代码来源:HeadRegister.php

示例12: setupView

 /**
  * Configures view class
  *
  */
 protected function setupView()
 {
     if (Zend_Registry::isRegistered('config')) {
         $config = Zend_Registry::get('config');
         $renderClass = $config->output->viewrenderer;
         $viewRenderer = new $renderClass();
         $viewClass = $config->output->view->name;
         $viewRenderer->setView(new $viewClass($config->output->view->options->toArray()));
     } else {
         // Config file not detected, use defaults
         $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
         $viewRenderer->setView(new Zoo_View_Php());
     }
     $viewRenderer->setViewSuffix('phtml');
     //make it search for .phtml files
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     //add it to the action helper broker
     // Set the encoding
     $viewRenderer->view->setEncoding("UTF-8");
     $doctypeHelper = new Zend_View_Helper_Doctype();
     $doctypeHelper->doctype('XHTML1_STRICT');
     // Add core module's view helper path
     $viewRenderer->view->addHelperPath(ZfApplication::$_base_path . "/app/Zoo/views/helpers");
     // Add JQuery support
     $viewRenderer->view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:30,代码来源:Http.php

示例13: __construct

 public function __construct($type = null)
 {
     if (Zend_Registry::isRegistered('config')) {
         $_setting = Zend_Registry::get('config');
         if ($_setting instanceof Zend_Config) {
             $_setting = $_setting->toArray();
         }
         if (isset($_setting['log']['active'])) {
             $this->_isActive = $_setting['log']['active'] == 1;
         }
         if (isset($_setting['log']['type'])) {
             $this->_writerType = (string) $_setting['log']['type'];
         }
         if (self::LOG_STREAM == $this->_writerType && isset($_setting['log']['path'])) {
             $this->_logPath = (string) $_setting['log']['path'];
             if (!realpath($this->_logPath)) {
                 mkdir($this->_logPath, 0755, TRUE);
             }
         } else {
             $this->_logPath = realpath(APPLICATION_PATH . "/../log");
         }
     }
     if (isset($type) && !is_null($type) && is_string($type) && $this->__isAvalideType($type)) {
         $this->_writerType = $type;
     }
 }
开发者ID:kangza,项目名称:hagtag,代码行数:26,代码来源:Logger.php

示例14: isAllowed

 static function isAllowed($resource, $module = "default", $username = null)
 {
     $users_roles_table = new UsersRoles();
     $user_roles = array();
     $roles_table = new Roles();
     if (!is_null($username)) {
         $users_roles_db = $users_roles_table->fetchAll($users_roles_table->select()->where("username = ?", $username));
         $user_roles = array();
         if (count($users_roles_db) > 0) {
             foreach ($users_roles_db as $role) {
                 $user_roles[] = $role->role_id;
             }
         }
     } else {
         $user_roles = array($roles_table->getIdByShortname("guest"));
     }
     $resource_name = $module . "-@@EXTRA-" . $resource;
     $out = false;
     if (Zend_Registry::isRegistered('acl')) {
         $acl = Zend_Registry::get('acl');
         if ($acl->has($resource_name)) {
             foreach ($user_roles as $role) {
                 if ($acl->isAllowed($role, $resource_name)) {
                     $out = true;
                 }
             }
         }
     }
     return $out;
 }
开发者ID:jaybill,项目名称:Bolts,代码行数:30,代码来源:ExtraResourceCheck.php

示例15: commentsCounter

 /**
  * Fetch the amount of comments for the items related to the $alias with keys
  * 
  * @param mixed $key
  * @param string $alias
  * @param array $items
  * @param string $fieldName
  * @return integer
  * @throws Zend_Controller_Action_Exception 
  */
 public function commentsCounter($key, $alias, $items, $fieldName = 'id')
 {
     $aliasManager = new Comments_Model_CommentAlias_Manager();
     $aliasRow = $aliasManager->getByAlias($alias);
     // check if alias registered
     if (!Zend_Registry::isRegistered($alias . '.' . $fieldName)) {
         $userId = $this->view->user() ? $this->view->user()->id : 0;
         $commentsManager = new Comments_Model_Comment_Manager();
         $values = array();
         // collect items
         foreach ($items as $item) {
             $value = (int) $item[$fieldName];
             if ($value > 0) {
                 array_push($values, $value);
             }
         }
         // fetch gropped comments amount
         $commentsAmount = $commentsManager->getGrouppedCommentsAmount($aliasRow, $fieldName, $values, $userId);
         Zend_Registry::set($alias . '.' . $fieldName, $commentsAmount);
     }
     // fetch the data from registry
     $commentsAmount = Zend_Registry::get($alias . '.' . $fieldName);
     if (isset($commentsAmount[$key])) {
         return $commentsAmount[$key];
     } else {
         return 0;
     }
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:38,代码来源:CommentsCounter.php


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