コード例 #1
0
ファイル: CommonTestCase.php プロジェクト: pnaq57/zf2demo
 public function testInjectingEncodingProxiesToEscapeHelper()
 {
     if (!extension_loaded('intl')) {
         $this->markTestSkipped('ext/intl not enabled');
     }
     $escape = $this->renderer->plugin('escapehtml');
     $this->helper->setEncoding('iso-8859-1');
     $this->assertEquals('iso-8859-1', $escape->getEncoding());
 }
コード例 #2
0
ファイル: Export.php プロジェクト: no-reply/cbpl-vufind
 /**
  * Get the URL for bulk export.
  *
  * @param \Zend\View\Renderer\RendererInterface $view   View object (needed for
  * URL generation)
  * @param string                                $format Export format being used
  * @param array                                 $ids    Array of IDs to export
  * (in source|id format)
  *
  * @return string
  */
 public static function getBulkUrl($view, $format, $ids)
 {
     $params = array();
     $params[] = 'f=' . urlencode($format);
     foreach ($ids as $id) {
         $params[] = urlencode('i[]') . '=' . urlencode($id);
     }
     $serverUrlHelper = $view->plugin('serverurl');
     $urlHelper = $view->plugin('url');
     $url = $serverUrlHelper($urlHelper('cart-doexport')) . '?' . implode('&', $params);
     return self::needsRedirect($format) ? self::getRedirectUrl($format, $url) : $url;
 }
コード例 #3
0
    /**
     * Retrieve view object
     *
     * @return \Zend\View\View
     */
    public function getView()
    {
        if (null === $this->_view) {
            $options = $this->getOptions();
            $this->_view = new \Zend\View\PhpRenderer($options);

            if(isset($options['doctype'])) {
                $this->_view->plugin('doctype')->setDoctype(strtoupper($options['doctype']));
            }
        }
        return $this->_view;
    }
コード例 #4
0
ファイル: Container.php プロジェクト: necrogami/zf2
    /**
     * Render dojo module paths and requires
     *
     * @return string
     */
    protected function _renderExtras()
    {
        $js          = array();
        $modulePaths = $this->getModulePaths();
        $escape      = $this->view->plugin('escape');
        if (!empty($modulePaths)) {
            foreach ($modulePaths as $module => $path) {
                $js[] =  'dojo.registerModulePath("' . $escape($module) . '", "' . $escape($path) . '");';
            }
        }

        $modules = $this->getModules();
        if (!empty($modules)) {
            foreach ($modules as $module) {
                $js[] = 'dojo.require("' . $escape($module) . '");';
            }
        }

        $onLoadActions = array();
        // Get Zend specific onLoad actions; these will always be first to
        // ensure that dijits are created in the correct order
        foreach ($this->_getZendLoadActions() as $callback) {
            $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
        }

        // Get all other onLoad actions
        foreach ($this->getOnLoadActions() as $callback) {
            $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
        }

        $javascript = implode("\n    ", $this->getJavascript());

        $content = '';
        if (!empty($js)) {
            $content .= implode("\n    ", $js) . "\n";
        }

        if (!empty($onLoadActions)) {
            $content .= implode("\n    ", $onLoadActions) . "\n";
        }

        if (!empty($javascript)) {
            $content .= $javascript . "\n";
        }

        if (preg_match('/^\s*$/s', $content)) {
            return '';
        }

        $html = '<script type="text/javascript">' . PHP_EOL
              . (($this->_isXhtml) ? '//<![CDATA[' : '//<!--') . PHP_EOL
              . $content
              . (($this->_isXhtml) ? '//]]>' : '//-->') . PHP_EOL
              . PHP_EOL . '</script>';
        return $html;
    }
コード例 #5
0
ファイル: Image.php プロジェクト: brikou/zend_captcha
 /**
  * Display the captcha
  *
  * @param Renderer $view
  * @param mixed $element
  * @return string
  */
 public function render(Renderer $view = null, $element = null)
 {
     $endTag = ' />';
     if ($view instanceof Pluggable) {
         $doctype = $view->plugin('doctype');
         if ($doctype && !$doctype->isXhtml()) {
             $endTag = '>';
         }
     }
     return '<img width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . $this->getImgAlt() . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '"' . $endTag;
 }