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


PHP Zend类代码示例

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


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

示例1: regformAction

 public function regformAction()
 {
     // show reg form
     $view = Zend::registry("view");
     $view->title = "User Registration";
     print $view->render('user/regform.php');
 }
开发者ID:BackupTheBerlios,项目名称:agileweb,代码行数:7,代码来源:UserController.php

示例2: addAdvancedRoute

 public function addAdvancedRoute($name, $map, $params = array(), $reqs = array())
 {
     if (!class_exists('Custom_Controller_Router_AdvancedRoute')) {
         Zend::loadClass('Custom_Controller_Router_AdvancedRoute');
     }
     $this->_routes[$name] = new Custom_Controller_Router_AdvancedRoute($map, $params, $reqs);
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:7,代码来源:RewriteRouter.php

示例3: staticAuthenticate

 /**
  * Authenticates against the given parameters
  *
  * $options requires the following key-value pairs:
  *
  *      'filename' => path to digest authentication file
  *      'realm'    => digest authentication realm
  *      'username' => digest authentication user
  *      'password' => password for the user of the realm
  *
  * @param  array $options
  * @throws Zend_Auth_Digest_Exception
  * @return Zend_Auth_Digest_Token
  */
 public static function staticAuthenticate(array $options)
 {
     $optionsRequired = array('filename', 'realm', 'username', 'password');
     foreach ($optionsRequired as $optionRequired) {
         if (!isset($options[$optionRequired]) || !is_string($options[$optionRequired])) {
             throw Zend::exception('Zend_Auth_Digest_Exception', "Option '{$optionRequired}' is required to be " . 'provided as a string');
         }
     }
     if (false === ($fileHandle = @fopen($options['filename'], 'r'))) {
         throw Zend::exception('Zend_Auth_Digest_Exception', "Cannot open '{$options['filename']}' for reading");
     }
     require_once 'Zend/Auth/Digest/Token.php';
     $id = "{$options['username']}:{$options['realm']}";
     $idLength = strlen($id);
     $tokenValid = false;
     $tokenIdentity = array('realm' => $options['realm'], 'username' => $options['username']);
     while ($line = trim(fgets($fileHandle))) {
         if (substr($line, 0, $idLength) === $id) {
             if (substr($line, -32) === md5("{$options['username']}:{$options['realm']}:{$options['password']}")) {
                 $tokenValid = true;
                 $tokenMessage = null;
             } else {
                 $tokenMessage = 'Password incorrect';
             }
             return new Zend_Auth_Digest_Token($tokenValid, $tokenIdentity, $tokenMessage);
         }
     }
     $tokenMessage = "Username '{$options['username']}' and realm '{$options['realm']}' combination not found";
     return new Zend_Auth_Digest_Token($tokenValid, $tokenIdentity, $tokenMessage);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:44,代码来源:Adapter.php

示例4: loadTests

 /**
  * recurses through the Test subdir and includes classes in each test group subdir,
  * then builds an array of classnames for the tests that will be run
  *
  */
 public function loadTests($test_path = NULL)
 {
     $this->resetStats();
     if ($test_path === NULL) {
         // this seems hackey.  is it?  dunno.
         $test_path = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Security' . DIRECTORY_SEPARATOR . 'Test';
     }
     $test_root = dir($test_path);
     while (false !== ($entry = $test_root->read())) {
         if (is_dir($test_root->path . DIRECTORY_SEPARATOR . $entry) && !preg_match('|^\\.(.*)$|', $entry)) {
             $test_dirs[] = $entry;
         }
     }
     // include_once all files in each test dir
     foreach ($test_dirs as $test_dir) {
         $this_dir = dir($test_root->path . DIRECTORY_SEPARATOR . $test_dir);
         while (false !== ($entry = $this_dir->read())) {
             if (!is_dir($this_dir->path . DIRECTORY_SEPARATOR . $entry) && preg_match('/[A-Za-z]+\\.php/i', $entry)) {
                 $className = "Zend_Environment_Security_Test_" . $test_dir . "_" . basename($entry, '.php');
                 Zend::loadClass($className);
                 $classNames[] = $className;
             }
         }
     }
     $this->_tests_to_run = $classNames;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:Security.php

示例5: _disconnect

 /**
  * Disconnects from the peer, closes the socket.
  * 
  * @return void
  */
 protected function _disconnect()
 {
     if (!is_resource($this->_socket)) {
         throw Zend::exception('Zend_TimeSync_ProtocolException', "could not close server connection from '{$this->_timeserver}' on port '{$this->_port}'");
     }
     @fclose($this->_socket);
     $this->_socket = null;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:Protocol.php

示例6: autoload

 public static function autoload($class)
 {
     try {
         Zend::loadClass($class);
     } catch (Zend_Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:9,代码来源:sfZendFrameworkBridge.class.php

示例7: testException

 public function testException()
 {
     $this->assertTrue(Zend::exception('Zend_Exception') instanceof Exception);
     try {
         $e = Zend::exception('Zend_FooBar_Baz', 'should fail');
         $this->fail('invalid exception class should throw exception');
     } catch (Exception $e) {
         // success...
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:ZendTest.php

示例8: __set

 /**
  * @param string $var
  * @param string $value
  */
 protected function __set($var, $value)
 {
     switch ($var) {
         case 'updatedMin':
         case 'updatedMax':
             throw Zend::exception('Zend_Gdata_Exception', "Parameter '{$var}' is not currently supported in Spreadsheets.");
             break;
     }
     parent::__set($var, $value);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:Spreadsheets.php

示例9: routeShutdown

 public function routeShutdown($action)
 {
     $user = Zend::registry('user');
     if ($user->getPermission($action->getControllerName(), $action->getActionName())) {
         return $action;
     } else {
         $action->setControllerName('index');
         $action->setActionName('unauthorized');
         return $action;
     }
 }
开发者ID:BackupTheBerlios,项目名称:umlrecord,代码行数:11,代码来源:First.php

示例10: __construct

 function __construct($config = array())
 {
     // set a Zend_Db_Adapter connection
     if (!empty($config['db'])) {
         // convenience variable
         $db = $config['db'];
         // use an object from the registry?
         if (is_string($db)) {
             $db = Zend::registry($db);
         }
         // make sure it's a Zend_Db_Adapter
         if (!$db instanceof Zend_Db_Adapter_Abstract) {
             throw new Varien_Db_Tree_Exception('db object does not implement Zend_Db_Adapter_Abstract');
         }
         // save the connection
         $this->_db = $db;
         $conn = $this->_db->getConnection();
         if ($conn instanceof PDO) {
             $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
         } elseif ($conn instanceof mysqli) {
             //TODO: ???
         }
     } else {
         throw new Varien_Db_Tree_Exception('db object is not set in config');
     }
     if (!empty($config['table'])) {
         $this->setTable($config['table']);
     }
     if (!empty($config['id'])) {
         $this->setIdField($config['id']);
     } else {
         $this->setIdField('id');
     }
     if (!empty($config['left'])) {
         $this->setLeftField($config['left']);
     } else {
         $this->setLeftField('left_key');
     }
     if (!empty($config['right'])) {
         $this->setRightField($config['right']);
     } else {
         $this->setRightField('right_key');
     }
     if (!empty($config['level'])) {
         $this->setLevelField($config['level']);
     } else {
         $this->setLevelField('level');
     }
     if (!empty($config['pid'])) {
         $this->setPidField($config['pid']);
     } else {
         $this->setPidField('parent_id');
     }
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:54,代码来源:Tree.php

示例11: getDriver

 public function getDriver()
 {
     // @todo: when the Mysqli adapter moves out of the incubator,
     // the following trick to allow it to be loaded should be removed.
     $incubator = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR . 'incubator' . DIRECTORY_SEPARATOR . 'library';
     Zend::loadClass('Zend_Db_Adapter_Mysqli', $incubator);
     // @todo: also load any auxiliary classes if necessary, e.g.:
     // Zend_Db_Adapter_Mysqli_Exception
     // Zend_Db_Statement_Mysqli
     // Zend_Db_Statement_Mysqli_Exception
     return 'Mysqli';
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:12,代码来源:MysqliTest.php

示例12: __construct

 /**
  * @param array $config
  * @throws LocalizedException
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function __construct($config = [])
 {
     // set a \Zend_Db_Adapter connection
     if (!empty($config['db'])) {
         // convenience variable
         $connection = $config['db'];
         // use an object from the registry?
         if (is_string($connection)) {
             $connection = \Zend::registry($connection);
         }
         // make sure it's a \Zend_Db_Adapter
         if (!$connection instanceof \Zend_Db_Adapter_Abstract) {
             throw new LocalizedException(new \Magento\Framework\Phrase('db object does not implement \\Zend_Db_Adapter_Abstract'));
         }
         // save the connection
         $this->_db = $connection;
         $conn = $this->_db->getConnection();
         if ($conn instanceof \PDO) {
             $conn->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
         }
     } else {
         throw new LocalizedException(new \Magento\Framework\Phrase('db object is not set in config'));
     }
     if (!empty($config['table'])) {
         $this->setTable($config['table']);
     }
     if (!empty($config['id'])) {
         $this->setIdField($config['id']);
     } else {
         $this->setIdField('id');
     }
     if (!empty($config['left'])) {
         $this->setLeftField($config['left']);
     } else {
         $this->setLeftField('left_key');
     }
     if (!empty($config['right'])) {
         $this->setRightField($config['right']);
     } else {
         $this->setRightField('right_key');
     }
     if (!empty($config['level'])) {
         $this->setLevelField($config['level']);
     } else {
         $this->setLevelField('level');
     }
     if (!empty($config['pid'])) {
         $this->setPidField($config['pid']);
     } else {
         $this->setPidField('parent_id');
     }
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:58,代码来源:Tree.php

示例13: setTimestamp

 /**
  * Sets a new timestamp
  *
  * @param $date mixed - OPTIONAL timestamp otherwise actual timestamp is used
  * @return boolean
  * @throws Zend_Date_Exception
  */
 public function setTimestamp($date = false)
 {
     // no date value, take actual time
     if ($date === false) {
         $this->_unixtimestamp = time();
         return true;
     }
     if (is_numeric($date)) {
         $this->_unixtimestamp = $date;
         return true;
     }
     throw Zend::exception('Zend_Date_Exception', '\'' . $date . '\' is no valid date');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:20,代码来源:DateObject.php

示例14: autoload

 public static function autoload($class)
 {
     try {
         if (class_exists('Zend_Version')) {
             Zend_Loader::loadClass($class);
         } else {
             Zend::loadClass($class);
         }
     } catch (Zend_Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:taryono,项目名称:school,代码行数:13,代码来源:sfZendFrameworkBridge.class.php

示例15: nowaAction

 /**
  * Tworzy now� ankiet� i przekierowuje do akcji edytujAction
  */
 public function nowaAction()
 {
     $post = new Zend_Filter_Input($_POST);
     $user = Zend::registry('user');
     $poll = new Ankiety();
     $data = array('nazwa' => $post->getRaw('ankieta_nazwa'), 'opis' => $post->getRaw('ankieta_opis'), 'id_uzytkownik' => 1);
     try {
         $id = $poll->insert($data);
         $this->_forward('ankieter', 'edytuj', array('ankieta' => $id));
     } catch (Hamster_Validation_Exception $e) {
         $this->_forward('ankieter', 'index', array('validationError' => $e->getMessage()));
     }
 }
开发者ID:BackupTheBerlios,项目名称:phppool,代码行数:16,代码来源:AnkieterController.php


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