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


PHP Zend_View_Exception类代码示例

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


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

示例1: htmlList

 /**
  * Generates a 'List' element.
  *
  * @param array   $items   Array with the elements of the list
  * @param boolean $ordered Specifies ordered/unordered list; default unordered
  * @param array   $attribs Attributes for the ol/ul tag.
  * @return string The list XHTML.
  */
 public function htmlList(array $items, $ordered = false, $attribs = false, $escape = true)
 {
     if (!is_array($items)) {
         #require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('First param must be an array');
         $e->setView($this->view);
         throw $e;
     }
     $list = '';
     foreach ($items as $item) {
         if (!is_array($item)) {
             if ($escape) {
                 $item = $this->view->escape($item);
             }
             $list .= '<li>' . $item . '</li>' . self::EOL;
         } else {
             if (6 < strlen($list)) {
                 $list = substr($list, 0, strlen($list) - 6) . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             } else {
                 $list .= '<li>' . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             }
         }
     }
     if ($attribs) {
         $attribs = $this->_htmlAttribs($attribs);
     } else {
         $attribs = '';
     }
     $tag = 'ul';
     if ($ordered) {
         $tag = 'ol';
     }
     return '<' . $tag . $attribs . '>' . self::EOL . $list . '</' . $tag . '>' . self::EOL;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:42,代码来源:HtmlList.php

示例2: __construct

    /**
     * Constructor
     *
     * Grab local copies of various MVC objects
     *
     * @return void
     */
    public function __construct()
    {
        $front   = Zend_Controller_Front::getInstance();
        $modules = $front->getControllerDirectory();
        if (empty($modules)) {
            // require_once 'Zend/View/Exception.php';
            $e = new Zend_View_Exception('Action helper depends on valid front controller instance');
            $e->setView($this->view);
            throw $e;
        }

        $request  = $front->getRequest();
        $response = $front->getResponse();

        if (empty($request) || empty($response)) {
            // require_once 'Zend/View/Exception.php';
            $e = new Zend_View_Exception('Action view helper requires both a registered request and response object in the front controller instance');
            $e->setView($this->view);
            throw $e;
        }

        $this->request       = clone $request;
        $this->response      = clone $response;
        $this->dispatcher    = clone $front->getDispatcher();
        $this->defaultModule = $front->getDefaultModule();
    }
开发者ID:padraic,项目名称:framework-benchs,代码行数:33,代码来源:Action.php

示例3: findHelper

 public function findHelper($proxy, $strict = true)
 {
     if (isset($this->_helpers[$proxy])) {
         return $this->_helpers[$proxy];
     }
     if (!$this->view->getPluginLoader('helper')->getPaths(self::NS)) {
         $this->view->addHelperPath(str_replace('_', '/', self::NS), self::NS);
     }
     if ($strict) {
         $helper = $this->view->getHelper($proxy);
     } else {
         try {
             $helper = $this->view->getHelper($proxy);
         } catch (Zend_Loader_PluginLoader_Exception $e) {
             return null;
         }
     }
     if (!$helper instanceof Zend_View_Helper_Navigation_Helper) {
         if ($strict) {
             require_once 'Zend/View/Exception.php';
             $e = new Zend_View_Exception(sprintf('Proxy helper "%s" is not an instance of ' . 'Zend_View_Helper_Navigation_Helper', get_class($helper)));
             $e->setView($this->view);
             throw $e;
         }
         return null;
     }
     $this->_inject($helper);
     $this->_helpers[$proxy] = $helper;
     return $helper;
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:30,代码来源:Navigation.php

示例4: __set

 public function __set($key, $val)
 {
     if ('_' != substr($key, 0, 1)) {
         $this->_proxyData->{$key} = $val;
         return;
     }
     require_once 'Zend/View/Exception.php';
     $e = new Zend_View_Exception('Setting private or protected class members is not allowed');
     $e->setView($this);
     throw $e;
 }
开发者ID:padraic,项目名称:ZFPlanet,代码行数:11,代码来源:View.php

示例5: setTranslator

 /**
  * Set translator
  *
  * @param  Zend_Translate|Zend_Translate_Adapter|null $translator
  * @return Zend_View_Helper_FormElement
  */
 public function setTranslator($translator = null)
 {
     if (null === $translator) {
         $this->_translator = null;
     } elseif ($translator instanceof Zend_Translate_Adapter) {
         $this->_translator = $translator;
     } elseif ($translator instanceof Zend_Translate) {
         $this->_translator = $translator->getAdapter();
     } else {
         $e = new Zend_View_Exception('Invalid translator specified');
         $e->setView($this->view);
         throw $e;
     }
     return $this;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:21,代码来源:FormElement.php

示例6: doctype

    /**
     * Set or retrieve doctype
     *
     * @param  string $doctype
     * @return Zend_View_Helper_Doctype
     */
    public function doctype($doctype = null)
    {
        if (null !== $doctype) {
            switch ($doctype) {
                case self::XHTML11:
                case self::XHTML1_STRICT:
                case self::XHTML1_TRANSITIONAL:
                case self::XHTML1_FRAMESET:
                case self::XHTML_BASIC1:
                case self::XHTML1_RDFA:
                case self::XHTML5:
                case self::HTML4_STRICT:
                case self::HTML4_LOOSE:
                case self::HTML4_FRAMESET:
                case self::HTML5:
                    $this->setDoctype($doctype);
                    break;
                default:
                    if (substr($doctype, 0, 9) != '<!DOCTYPE') {
                        require_once 'Zend/View/Exception.php';
                        $e = new Zend_View_Exception('The specified doctype is malformed');
                        $e->setView($this->view);
                        throw $e;
                    }
                    if (stristr($doctype, 'xhtml')) {
                        $type = self::CUSTOM_XHTML;
                    } else {
                        $type = self::CUSTOM;
                    }
                    $this->setDoctype($type);
                    $this->_registry['doctypes'][$type] = $doctype;
                    break;
            }
        }

        return $this;
    }
开发者ID:realfluid,项目名称:umbaugh,代码行数:43,代码来源:Doctype.php

示例7: offsetSet

 /**
  * Override offsetSet
  *
  * @param  string|int $index
  * @param  mixed $value
  * @return void
  */
 public function offsetSet($index, $value)
 {
     if (!$this->_isValid($value)) {
         //require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()');
         $e->setView($this->view);
         throw $e;
     }
     return $this->getContainer()->offsetSet($index, $value);
 }
开发者ID:schlypel,项目名称:YiiBackboneBoilerplate,代码行数:17,代码来源:HeadScript.php

示例8: createDataAlternate

 /**
  * Create item for alternate link item
  *
  * @param  array $args
  * @return stdClass
  */
 public function createDataAlternate(array $args)
 {
     if (3 > count($args)) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception(sprintf('Alternate tags require 3 arguments; %s provided', count($args)));
         $e->setView($this->view);
         throw $e;
     }
     $rel = 'alternate';
     $href = array_shift($args);
     $type = array_shift($args);
     $title = array_shift($args);
     if (0 < count($args) && is_array($args[0])) {
         $extras = array_shift($args);
         $extras = (array) $extras;
         if (isset($extras['media']) && is_array($extras['media'])) {
             $extras['media'] = implode(',', $extras['media']);
         }
     }
     $href = (string) $href;
     $type = (string) $type;
     $title = (string) $title;
     $attributes = compact('rel', 'href', 'type', 'title', 'extras');
     return $this->createData($attributes);
 }
开发者ID:madberry,项目名称:WhiteLabelTransfer,代码行数:31,代码来源:HeadLink.php

示例9: getLocale

 /**
  * Returns the set locale for translations
  *
  * @throws Zend_View_Exception When no Zend_Translate instance was set
  * @return string|Zend_Locale
  */
 public function getLocale()
 {
     $translate = $this->getTranslator();
     if ($translate === null) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter');
         $e->setView($this->view);
         throw $e;
     }
     return $translate->getLocale();
 }
开发者ID:fredcido,项目名称:cenbrap,代码行数:17,代码来源:Translate.php

示例10: paginationControl

 /**
  * Render the provided pages.  This checks if $view->paginator is set and,
  * if so, uses that.  Also, if no scrolling style or partial are specified,
  * the defaults will be used (if set).
  *
  * @param  Zend_Paginator (Optional) $paginator
  * @param  string $scrollingStyle (Optional) Scrolling style
  * @param  string $partial (Optional) View partial
  * @param  array|string $params (Optional) params to pass to the partial
  * @return string
  * @throws Zend_View_Exception
  */
 public function paginationControl(Zend_Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)
 {
     if ($paginator === null) {
         if (isset($this->view->paginator) and $this->view->paginator !== null and $this->view->paginator instanceof Zend_Paginator) {
             $paginator = $this->view->paginator;
         } else {
             /**
              * @see Zend_View_Exception
              */
             require_once 'Zend/View/Exception.php';
             $e = new Zend_View_Exception('No paginator instance provided or incorrect type');
             $e->setView($this->view);
             throw $e;
         }
     }
     if ($partial === null) {
         if (self::$_defaultViewPartial === null) {
             /**
              * @see Zend_View_Exception
              */
             require_once 'Zend/View/Exception.php';
             $e = new Zend_View_Exception('No view partial provided and no default set');
             $e->setView($this->view);
             throw $e;
         }
         $partial = self::$_defaultViewPartial;
     }
     $pages = get_object_vars($paginator->getPages($scrollingStyle));
     if ($params !== null) {
         $pages = array_merge($pages, (array) $params);
     }
     if (is_array($partial)) {
         if (count($partial) != 2) {
             /**
              * @see Zend_View_Exception
              */
             require_once 'Zend/View/Exception.php';
             $e = new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module');
             $e->setView($this->view);
             throw $e;
         }
         if ($partial[1] !== null) {
             return $this->view->partial($partial[0], $partial[1], $pages);
         }
         $partial = $partial[0];
     }
     return $this->view->partial($partial, $pages);
 }
开发者ID:null-1,项目名称:fangtaitong,代码行数:60,代码来源:PaginationControl.php

示例11: set

 /**
  * Override set to enforce style creation
  *
  * @param  mixed $value
  * @return void
  */
 public function set($value)
 {
     if (!$this->_isValid($value)) {
         // require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('Invalid value passed to set; please use setStyle()');
         $e->setView($this->view);
         throw $e;
     }
     return $this->getContainer()->set($value);
 }
开发者ID:sadikeser,项目名称:tickets,代码行数:16,代码来源:HeadStyle.php

示例12: renderPartial

 /**
  * Renders the given $container by invoking the partial view helper
  *
  * The container will simply be passed on as a model to the view script
  * as-is, and will be available in the partial script as 'container', e.g.
  * <code>echo 'Number of pages: ', count($this->container);</code>.
  *
  * @param  Zend_Navigation_Container $container  [optional] container to
  *                                               pass to view script. Default
  *                                               is to use the container
  *                                               registered in the helper.
  * @param  string|array             $partial     [optional] partial view
  *                                               script to use. Default is to
  *                                               use the partial registered
  *                                               in the helper. If an array
  *                                               is given, it is expected to
  *                                               contain two values; the
  *                                               partial view script to use,
  *                                               and the module where the
  *                                               script can be found.
  * @return string                                helper output
  */
 public function renderPartial(Zend_Navigation_Container $container = null, $partial = null)
 {
     if (null === $container) {
         $container = $this->getContainer();
     }
     if (null === $partial) {
         $partial = $this->getPartial();
     }
     if (empty($partial)) {
         $e = new Zend_View_Exception('Unable to render menu: No partial view script provided');
         $e->setView($this->view);
         throw $e;
     }
     $model = array('container' => $container);
     if (is_array($partial)) {
         if (count($partial) != 2) {
             $e = new Zend_View_Exception('Unable to render menu: A view partial supplied as ' . 'an array must contain two values: partial view ' . 'script and module where script can be found');
             $e->setView($this->view);
             throw $e;
         }
         return $this->view->partial($partial[0], $partial[1], $model);
     }
     return $this->view->partial($partial, null, $model);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:46,代码来源:Menu.php

示例13: getPluginLoader

 /**
  * Retrieve plugin loader for a specific plugin type
  *
  * @param  string $type
  * @return Zend_Loader_PluginLoader
  */
 public function getPluginLoader($type)
 {
     $type = strtolower($type);
     if (!in_array($type, $this->_loaderTypes)) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"; cannot retrieve', $type));
         $e->setView($this);
         throw $e;
     }
     if (!array_key_exists($type, $this->_loaders)) {
         $prefix = 'Zend_View_';
         $pathPrefix = 'Zend/View/';
         $pType = ucfirst($type);
         switch ($type) {
             case 'filter':
             case 'helper':
             default:
                 $prefix .= $pType;
                 $pathPrefix .= $pType;
                 $loader = new Centurion_Loader_PluginLoader(array($prefix => $pathPrefix), $type);
                 $this->_loaders[$type] = $loader;
                 break;
         }
     }
     return $this->_loaders[$type];
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:32,代码来源:View.php

示例14: _script

 /**
  * Finds a view script from the available directories.
  *
  * @param string $name The base name of the script.
  * @return void
  */
 protected function _script($name)
 {
     if ($this->isLfiProtectionOn() && preg_match('#\\.\\.[\\\\/]#', $name)) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)');
         $e->setView($this);
         throw $e;
     }
     if (0 == count($this->_path['script'])) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('no view script directory set; unable to determine location for view script');
         $e->setView($this);
         throw $e;
     }
     /* original
        foreach ($this->_path['script'] as $dir) {
            if (is_readable($dir . $name)) {
                return $dir . $name;
            }
        }
        */
     // alcalbg: layout conflict detector
     $count = 0;
     $ret = $ret_log = false;
     foreach ($this->_path['script'] as $dir) {
         if (is_readable($dir . $name)) {
             if ($ret === false) {
                 $ret = $dir . $name;
             }
             $ret_log = $dir . $name;
             ++$count;
         }
     }
     if ($count > 2) {
         foreach ($this->_path['script'] as $dir) {
             if ($dir . $name != $ret_log && is_readable($dir . $name)) {
                 $message = 'Possible layout conflict: ' . $dir . $name;
                 Application_Plugin_Common::log($message);
             }
         }
     }
     if ($ret) {
         return $ret;
     }
     // alcalbg: end
     require_once 'Zend/View/Exception.php';
     $message = "script '{$name}' not found in path (" . implode(PATH_SEPARATOR, $this->_path['script']) . ")";
     $e = new Zend_View_Exception($message);
     $e->setView($this);
     throw $e;
 }
开发者ID:georgepaul,项目名称:socialstrap,代码行数:57,代码来源:Abstract.php

示例15: offsetSet

 /**
  * Override offsetSet
  *
  * @param  string|int $index
  * @param  mixed $value
  * @return void
  */
 public function offsetSet($index, $value)
 {
     if (!$this->_isValid($value)) {
         require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()');
         $e->setView($this->view);
         throw $e;
     }
     // we don't need to overwrite existing files - will shift them by one
     if ($this->getContainer()->offsetExists($index)) {
         $values = $this->getContainer()->getArrayCopy();
         $keys = $this->getContainer()->getKeys();
         // insert value to required position. Keys will be restored later
         $offset = array_search($index, $keys);
         array_splice($values, $offset, 0, array($value));
         // rebuild array keys
         $arrKeys = array_fill_keys($keys, null);
         $result = array();
         foreach ($arrKeys as $key => $dummy) {
             if ($key === $index) {
                 do {
                     $result[$key] = $dummy;
                     $key++;
                 } while (isset($keys[$key]));
             }
             $result[$key] = $dummy;
         }
         // restore keys in result array
         $i = 0;
         foreach ($result as $key => $dummy) {
             $result[$key] = $values[$i++];
         }
         return $this->getContainer()->exchangeArray($result);
     }
     return $this->getContainer()->offsetSet($index, $value);
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:43,代码来源:HeadScript.php


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