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


PHP Zend_Registry::getInstance方法代码示例

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


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

示例1: getFlash

 /**
  *	Concatenates the messages to flash the user in a string format.
  *	@return		String		The messages in the flash queue
  */
 public static function getFlash()
 {
     $session = Zend_Registry::getInstance()->get('session');
     $result = join(chr(10), (array) $session->flash);
     $session->flash = (array) null;
     return nl2br($result);
 }
开发者ID:aldimol,项目名称:zf-sample,代码行数:11,代码来源:Misc.php

示例2: _initDoctrine

 /**
  * Initialize Doctrine
  * @return Doctrine_Manager
  */
 public function _initDoctrine()
 {
     // include and register Doctrine's class loader
     require_once 'Doctrine/Common/ClassLoader.php';
     $classLoader = new \Doctrine\Common\ClassLoader('Doctrine', APPLICATION_PATH . '/../library/');
     $classLoader->register();
     // create the Doctrine configuration
     $config = new \Doctrine\ORM\Configuration();
     // setting the cache ( to ArrayCache. Take a look at
     // the Doctrine manual for different options ! )
     $cache = new \Doctrine\Common\Cache\ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     // choosing the driver for our database schema
     // we'll use annotations
     $driver = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/models');
     $config->setMetadataDriverImpl($driver);
     // set the proxy dir and set some options
     $config->setProxyDir(APPLICATION_PATH . '/models/Proxies');
     $config->setAutoGenerateProxyClasses(true);
     $config->setProxyNamespace('App\\Proxies');
     // now create the entity manager and use the connection
     // settings we defined in our application.ini
     $connectionSettings = $this->getOption('doctrine');
     $conn = array('driver' => $connectionSettings['conn']['driv'], 'user' => $connectionSettings['conn']['user'], 'password' => $connectionSettings['conn']['pass'], 'dbname' => $connectionSettings['conn']['dbname'], 'host' => $connectionSettings['conn']['host']);
     $entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
     // push the entity manager into our registry for later use
     $registry = Zend_Registry::getInstance();
     $registry->entitymanager = $entityManager;
     return $entityManager;
 }
开发者ID:manish436,项目名称:zform,代码行数:35,代码来源:Bootstrap.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: getRemoteImageUrl

 public function getRemoteImageUrl()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     return $cdn['static']['url']['images'];
 }
开发者ID:hukumonline,项目名称:quart80,代码行数:7,代码来源:GetRemoteImageUrl.php

示例5: indexAction

 public function indexAction()
 {
     $url = $this->getRequest()->getParam('url');
     $xmlString = '<?xml version="1.0" standalone="yes"?><response></response>';
     $xml = new SimpleXMLElement($xmlString);
     if (strlen($url) < 1) {
         $xml->addChild('status', 'failed no url passed');
     } else {
         $shortid = $this->db->fetchCol("select * from urls where url = ?", $url);
         $config = Zend_Registry::getInstance();
         $sh = $config->get('configuration');
         if ($shortid[0]) {
             $hex = dechex($shortid[0]);
             $short = $sh->siteroot . $hex;
         } else {
             //if not insert then return the id
             $data = array('url' => $url, 'createdate' => date("Y-m-d h:i:s"), 'remoteip' => Pandamp_Lib_Formater::getRealIpAddr());
             $insert = $this->db->insert('urls', $data);
             $id = $this->db->lastInsertId('urls', 'id');
             $hex = dechex($id);
             $short = $sh->siteroot . $hex;
         }
         $xml->addChild('holurl', $short);
         $xml->addChild('status', 'success');
     }
     $out = $xml->asXML();
     //This returns the XML xmlreponse should be key value pairs
     $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($out);
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
 }
开发者ID:hukumonline,项目名称:zfurl,代码行数:31,代码来源:ApiController.php

示例6: isValid

 public function isValid($value)
 {
     $this->_setValue($value);
     $valueString = (string) $value;
     $people = Ml_Model_People::getInstance();
     if (mb_strstr($value, "@")) {
         $getUserByEmail = $people->getByEmail($value);
         if (empty($getUserByEmail)) {
             $this->_error(self::MSG_EMAIL_NOT_FOUND);
             return false;
         }
         Zend_Registry::getInstance()->set("loginUserInfo", $getUserByEmail);
         return true;
     }
     if (mb_strlen($value) == 0) {
         return false;
     }
     if (mb_strlen($value) > 20) {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     if (preg_match('#([^a-z0-9_-]+)#is', $value) || $value == '0') {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     $getUserByUsername = $people->getByUsername($value);
     if (empty($getUserByUsername)) {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     Zend_Registry::getInstance()->set("loginUserInfo", $getUserByUsername);
     return true;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:33,代码来源:Username.php

示例7: init

 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $registry = Zend_Registry::getInstance();
     $authedUserInfo = $registry->get('authedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Files:');
     $file->setRequired(true);
     $file->addValidator('Count', false, array('min' => 1, 'max' => 1));
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     // hack for not showing 'the file exceeds the defined form size'
     $file->setMaxFileSize($maxFileSize * 2);
     /*$file->setMultiFile(1);*/
     $this->addElement($file, 'file');
     $title = $this->addElement('text', 'title', array('label' => 'Title:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 100)))));
     $short = $this->addElement('text', 'short', array('label' => 'Short description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 120)))));
     $description = $this->addElement('textarea', 'description', array('label' => 'Description:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 4096)))));
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:28,代码来源:Upload.php

示例8: __construct

 function __construct()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get('config');
     //		switch ($config->acl->config->db->adapter)
     //		{
     //			case subs
     //		}
     $host = $config->acl->config->db->param->host;
     $username = $config->acl->config->db->param->username;
     $password = $config->acl->config->db->param->password;
     $dbname = $config->acl->config->db->param->dbname;
     $gacl_options['debug'] = '';
     $gacl_options['db_type'] = 'mysql';
     $gacl_options['db_host'] = $host;
     $gacl_options['db_user'] = $username;
     $gacl_options['db_password'] = $password;
     $gacl_options['db_name'] = $dbname;
     $gacl_options['db_table_prefix'] = 'gacl_';
     $gacl_options['caching'] = '';
     $gacl_options['force_cache_expire'] = 1;
     $gacl_options['cache_dir'] = "/tmp/phpgacl_cache";
     $gacl_options['cache_expire_time'] = 600;
     $gacl_options['items_per_page'] = 100;
     $gacl_options['max_select_box_items'] = 100;
     $gacl_options['max_search_return_items'] = 200;
     $gacl_options['smarty_dir'] = "smarty/libs";
     $gacl_options['smarty_template_dir'] = "templates";
     $gacl_options['smarty_compile_dir'] = "templates_c";
     $this->_aclEngine = new Kutu_Acl_Vendor_PhpGaclApi($gacl_options);
     $this->_acl = new Kutu_Acl_Vendor_PhpGacl($gacl_options);
 }
开发者ID:psykomo,项目名称:kutump-enhanced,代码行数:32,代码来源:PhpGacl.php

示例9: init

 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $this->addElementPrefixPath('Ml_Validate', 'Ml/Validate/', Zend_Form_Element::VALIDATE);
     $this->addElementPrefixPath('Ml_Filter', 'Ml/Filter/', Zend_Form_Element::FILTER);
     $signedUserInfo = $registry->get('signedUserInfo');
     $uploadStatus = $registry->get("uploadStatus");
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->setMethod('post');
     $file = new Zend_Form_Element_File('file');
     $file->setRequired(false);
     $file->setLabel('What do you want to share today?');
     if ($uploadStatus['bandwidth']['remainingbytes'] > 0) {
         $maxFileSize = $uploadStatus['filesize']['maxbytes'];
     } else {
         $maxFileSize = 0;
     }
     $file->addValidator('Size', false, $maxFileSize);
     $file->setMaxFileSize($maxFileSize);
     $file->setMultiFile(4);
     $file->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $this->addElement($file, 'file');
     $this->addElement(Ml_Model_MagicCookies::formElement());
     $this->addElement('submit', 'submitupload', array('label' => 'Upload!', 'class' => 'btn primary'));
     $this->setAttrib('class', 'form-stacked');
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:26,代码来源:Upload.php

示例10: _initAcl

 function _initAcl()
 {
     $registry = Zend_Registry::getInstance();
     $acl = $registry->get('acl');
     $acl->addResource($this->_name . ':stores');
     $acl->addResource($this->_name . ':categories');
     $acl->addResource($this->_name . ':products');
     $acl->addResource($this->_name . ':carts');
     $acl->addResource($this->_name . ':accounts');
     /*
      * Divide role for users and guests on contoller stores
      */
     $acl->allow(Core_Role::ROLE_USER, $this->_name . ':stores', array('index', 'create', 'edit', 'delete', 'publish', 'unpublish'));
     /*
      * Divide role for users and guests on contoller categories
      */
     $acl->allow(Core_Role::ROLE_GUEST, $this->_name . ':categories', array());
     $acl->allow(Core_Role::ROLE_USER, $this->_name . ':categories', array('index', 'create', 'edit', 'delete'));
     /*
      * Divide role for users and guests on contoller products
      */
     $acl->allow(Core_Role::ROLE_GUEST, $this->_name . ':products', array());
     $acl->allow(Core_Role::ROLE_USER, $this->_name . ':products', array('index', 'create', 'edit', 'delete'));
     /*
      * Divide role for users and guests on contoller carts
      */
     $acl->allow(Core_Role::ROLE_GUEST, $this->_name . ':carts', array());
     $acl->allow(Core_Role::ROLE_USER, $this->_name . ':carts', array('index'));
     /*
      * Divide role for users and guests on contoller stores
      */
     $acl->allow(Core_Role::ROLE_GUEST, $this->_name . ':accounts', array());
     $acl->allow(Core_Role::ROLE_USER, $this->_name . ':accounts', array('index', 'edit'));
     $registry->set('acl', $acl);
 }
开发者ID:BGCX067,项目名称:facebook-store-svn-to-git,代码行数:35,代码来源:Bootstrap.php

示例11: preDispatch

 function preDispatch()
 {
     $this->_helper->layout()->setLayout('layout-final-inside');
     $saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
     $saveHandlerManager->setSaveHandler();
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $sReturn = urlencode($sReturn);
     $this->view->returnTo = $sReturn;
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect(KUTU_ROOT_URL . '/helper/sso/login' . '?returnTo=' . $sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $userId = $auth->getIdentity()->guid;
     $tblUserFinance = new Kutu_Core_Orm_Table_UserFinance();
     $this->_userInfo = $tblUserFinance->find($userId)->current();
     //$config = new Zend_Config_Ini(CONFIG_PATH.'/store.ini', APPLICATION_ENV);
     $registry = Zend_Registry::getInstance();
     $reg = $registry->get(ZEND_APP_REG_ID);
     $storeConfig = $reg->getOption('store');
     $this->_configStore = $storeConfig;
 }
开发者ID:psykomo,项目名称:kutump,代码行数:26,代码来源:Store3Controller.php

示例12: getDirPhotoUrl

 public function getDirPhotoUrl()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     return $cdn['static']['dir']['photo'];
 }
开发者ID:hukumonline,项目名称:pmg,代码行数:7,代码来源:GetDirPhotoUrl.php

示例13: getT

 protected function getT()
 {
     if (!$this->translate) {
         $this->translate = Zend_Registry::getInstance()->translate;
     }
     return $this->translate;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:7,代码来源:LoompAction.php

示例14: authAction

 public function authAction()
 {
     $request = $this->getRequest();
     $registry = Zend_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     $DB = $registry['DB'];
     $authAdapter = new Zend_Auth_Adapter_DbTable($DB);
     $authAdapter->setTableName('fitness_admin_accounts')->setIdentityColumn('admin_username')->setCredentialColumn('admin_password');
     // Set the input credential values
     $uname = $request->getParam('user_username');
     $paswd = $request->getParam('user_password');
     $authAdapter->setIdentity($uname);
     $authAdapter->setCredential(md5($paswd));
     // Perform the authentication query, saving the result
     $result = $auth->authenticate($authAdapter);
     if ($result->isValid()) {
         $data = $authAdapter->getResultRowObject(null, 'password');
         $auth->getStorage()->write($data);
         $sess = new Zend_Session_Namespace('AdminSession');
         if ($sess->isLocked()) {
             $sess->unlock();
         }
         $sess->username = $uname;
         $this->_redirect('/admin/homeuser');
     } else {
         $this->_redirect('/admin/index');
     }
 }
开发者ID:keyanmca,项目名称:yoga,代码行数:28,代码来源:AdminController.php

示例15: init

    public function init() {
        $authNamespace = new Zend_Session_Namespace('Zend_Auth');
        $this->view->headLink()->appendStylesheet($this->view->BaseUrl() . '/themes/base/jquery.ui.all.css');
        $this->view->headLink()->appendStylesheet($this->view->BaseUrl() . '/css/dashboard.css');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/jquery.ui.core.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/jquery.ui.widget.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/jquery.ui.datepicker.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/i18n/jquery.ui.datepicker-es.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/jquery.validate.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/jquery.ui.mouse.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/ui/jquery.ui.draggable.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/jquery.number_format.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/highcharts.js');
        $this->view->headScript()->appendFile($this->view->BaseUrl() . '/js/dashboard.js');

        $this->me = Zend_Registry::get("me");
        if (!isset($this->me["id_usuario"])) {
            $data = new Application_Model_Usuario();
            $MP = new Application_Model_UsuarioMP();
            $MP->fetchByFb($this->me["id"], $data);
            $this->me["id_usuario"] = $data->getIdUsuario();
            $authNamespace->id_usuario = $this->me["id_usuario"];
        }
        Zend_Registry::getInstance()->set('me', $this->me);
        $request = $this->getRequest();
        $this->view->controlador = $request->getControllerName();
        $this->regMP = new Application_Model_RegistroMP();
        $this->proMP = new Application_Model_ProyectoMP();
        $pro = new Application_Model_Proyecto();
        $this->proMP->find($this->me['id_usuario'], $pro);
        $pro->setIngresos($this->regMP->fetchSumTipo(1, $pro->getIdProyecto()));
        $pro->setEgresos($this->regMP->fetchSumTipo(2, $pro->getIdProyecto()));
        $pro->setBalance($pro->getIngresos() - $pro->getEgresos());
        $this->view->proyecto = $pro;
    }
开发者ID:neeph,项目名称:NoTengoNiUno,代码行数:35,代码来源:IndexController.php


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