• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: autoload

 public static function autoload($class)
 {
     try {
         if (self::$withLoader) {
             Zend_Loader::loadClass($class);
         } else {
             Zend::loadClass($class);
         }
     } catch (Zend_Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:13,代码来源:sfZendFrameworkBridge.class.php


示例17: setUp

 public function setUp()
 {
     if (!class_exists('Zend_Log') || !class_exists('Zend_Log_Adapter_Null')) {
         Zend::loadClass('Zend_Log');
         Zend::loadClass('Zend_Log_Adapter_Null');
     }
     if (!Zend_Log::hasLogger('LOG')) {
         Zend_Log::registerLogger(new Zend_Log_Adapter_Null(), 'LOG');
     }
     $this->_instance->setDirectives(array('logging' => true));
     $this->_instance->save('bar : data to cache', 'bar', array('tag3', 'tag4'));
     $this->_instance->save('bar2 : data to cache', 'bar2', array('tag3', 'tag1'));
     $this->_instance->save('bar3 : data to cache', 'bar3', array('tag2', 'tag3'));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:CommonBackendTest.php


示例18: _query

 /**
  * Writes/receives data to/from the timeserver
  * 
  * @return int unix timestamp
  */
 protected function _query()
 {
     $this->_connect();
     $begin = time();
     fputs($this->_socket, "\n");
     $result = fread($this->_socket, 49);
     $end = time();
     $this->_disconnect();
     if (!$result) {
         throw Zend::exception('Zend_TimeSync_ProtocolException', 'invalid result returned from server');
     } else {
         $time = abs(hexdec('7fffffff') - hexdec(bin2hex($result)) - hexdec('7fffffff'));
         $time -= 2208988800;
         // socket delay
         $time -= ($end - $begin) / 2;
         return $time;
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:23,代码来源:Sntp.php


示例19: Primitus_View_Plugin_Render

/**
 * The Primitus View plugin is a procedural function which implements the logic of
 * the template-level {render} function. It is responsible for either calling the
 * requested controller's render() method to get the template, or simply processing
 * the template in the views/ directory if the controller didn't exist.
 * 
 * You can set template-level variables in the module being rendered by simply setting
 * them in the smarty {render} function. i.e.
 * 
 * {render module="blog" action="view" entry=$entry}
 * 
 * will expose the {$entry} template variable to the blog::view template in /blog/view.tpl
 * 
 * @category   Primitus
 * @package    Primitus
 * @subpackage View
 * @copyright  Copyright (c) 2006 John Coggeshall
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
function Primitus_View_Plugin_Render($params, &$smarty)
{
    if (!isset($params['module'])) {
        throw new Primitus_View_Exception("No module name was provided to render");
    }
    $module = $params['module'];
    if (strtolower(substr($module, strlen($module) - 10)) != "controller") {
        $module .= "Controller";
    }
    $action = isset($params['action']) ? $params['action'] : "indexAction";
    $dispatcher = Primitus::registry('Dispatcher');
    $controllerFile = $dispatcher->formatControllerFile($module);
    if (file_exists($controllerFile)) {
        // Load the Class
        Zend::loadClass($module, $dispatcher->getControllerDirectory());
        $controller = new $module();
        if ($controller instanceof Primitus_Controller_Action_Base) {
            unset($params['module']);
            unset($params['action']);
            if (!empty($params)) {
                $view = Primitus_View::getInstance($module);
                foreach ($params as $key => $value) {
                    $view->assign($key, $value);
                }
            }
            return $controller->render($action);
        } else {
            throw new Primitus_View_Exception("Bad Request");
        }
    } else {
        $view = Primitus_View::getInstance($module);
        unset($params['module']);
        unset($params['action']);
        if (!empty($params)) {
            $view = Primitus_View::getInstance($module);
            foreach ($params as $key => $value) {
                $view->assign($key, $value);
            }
        }
        return $view->render($action);
    }
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:61,代码来源:Render.php


示例20: __autoload

 /**
  * load class
  * @param string $className : the class to load
  * @throws Exception
  */
 function __autoload($className)
 {
     if (class_exists('Zend', false)) {
         if (is_int(strrpos($className, '_Interface'))) {
             Zend::loadClass($className);
         } else {
             Zend::loadInterface($className);
         }
     } else {
         if (!defined('__CLASS_PATH__')) {
             define('__CLASS_PATH__', realpath(dirname(__FILE__)));
         }
         $file = __CLASS_PATH__ . '/' . str_replace('_', '/', $className) . '.php';
         if (!file_exists($file)) {
             throw new Exception('Cannot load class file ' . $className);
         } else {
             require_once $file;
         }
     }
 }
开发者ID:ViniciusFelix,项目名称:ProjetoPadrao,代码行数:25,代码来源:Autoload.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ZendT_Lib类代码示例发布时间:2022-05-23
下一篇:
PHP Zebra_Form_Control类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap