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


PHP PageUtil::getVar方法代码示例

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


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

示例1: filter

 /**
  * Inject header assets into the head of the raw source of a page (before </head>)
  * Inject footer assets into the foot of the raw source of a page (before </body>)
  *
  * @param string $source
  * @param array $js
  * @param array $css
  * @return string
  */
 public function filter($source, $js = array(), $css = array())
 {
     if (!empty($css)) {
         $this->cssResolver->getBag()->add($css);
     }
     if (!empty($js)) {
         $this->jsResolver->getBag()->add($js);
     }
     // compile and replace head
     $header = $this->cssResolver->compile();
     $header .= \JCSSUtil::getJSConfig();
     // must be included before other scripts because it defines `Zikula` JS namespace
     $header .= $this->scriptPosition == 'head' ? $this->jsResolver->compile() : '';
     $header .= implode("\n", $this->headers->all()) . "\n";
     $header .= trim(implode("\n", \PageUtil::getVar('header')) . "\n");
     // @todo legacy - remove at Core-2.0
     if (strripos($source, '</head>')) {
         $source = str_replace('</head>', $header . "\n</head>", $source);
     }
     // compile and replace foot
     $footer = $this->scriptPosition == 'foot' ? $this->jsResolver->compile() : '';
     $footer .= trim(implode("\n", $this->footers->all()) . "\n");
     $footer .= trim(implode("\n", \PageUtil::getVar('footer')) . "\n");
     // @todo legacy - remove at Core-2.0
     if (false === empty($footer)) {
         $source = str_replace('</body>', $footer . "\n</body>", $source);
     }
     return $source;
 }
开发者ID:Silwereth,项目名称:core,代码行数:38,代码来源:Filter.php

示例2: smarty_function_title

/**
 * Zikula_View function to generate the title for the page
 *
 * Available parameters:
 *  - assign     if set, the title will be assigned to this variable
 *
 * Example
 * {title}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.title.php::smarty_function_title()
 *
 * @return string The title.
 */
function smarty_function_title($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('title', "pagegetvar name='title'")), E_USER_DEPRECATED);
    $title = PageUtil::getVar('title');
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $title);
    } else {
        return $title;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:26,代码来源:function.title.php

示例3: smarty_function_pagegetvar

/**
 * Zikula_View function to get page variable
 *
 * This function obtains a page-specific variable from the Zikula system.
 *
 * Available parameters:
 *   - name:     The name of the page variable to obtain
 *   - html:     If true then result will be treated as html content.
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Zikula doesn't impose any restriction on the page variable's name except for duplicate
 * and reserved names. As of this writing, the list of reserved names consists of
 * <ul>
 * <li>title</li>
 * <li>stylesheet</li>
 * <li>javascript</li>
 * <li>body</li>
 * <li>header</li>
 * <li>footer</li>
 * </ul>
 *
 * In addition, if your system is operating in legacy compatibility mode, then
 * the variable 'rawtext' is reserved, and maps to 'header'. (When not operating in
 * legacy compatibility mode, 'rawtext' is not reserved and will not be rendered
 * to the page output by the page variable output filter.)
 *
 * Example
 *   {pagegetvar name='title'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The module variable.
 */
function smarty_function_pagegetvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $html = isset($params['html']) ? (bool) $params['html'] : false;
    $name = isset($params['name']) ? $params['name'] : null;
    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pagegetvar', 'name')));
        return false;
    }
    $result = PageUtil::getVar($name);
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if ($html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:54,代码来源:function.pagegetvar.php

示例4: filter

 /**
  * Filter the Response to add page assets and vars and return.
  * @param Response $response
  * @return Response
  */
 private function filter(Response $response)
 {
     // @todo START legacy block - remove at Core-2.0
     $baseUri = \System::getBaseUri();
     $jsAssets = [];
     $javascripts = \JCSSUtil::prepareJavascripts(\PageUtil::getVar('javascript'));
     $i = 60;
     $legacyAjaxScripts = 0;
     foreach ($javascripts as $javascript) {
         $javascript = !empty($baseUri) && false === strpos($javascript, $baseUri) ? "{$baseUri}/{$javascript}" : "{$javascript}";
         $javascript = $javascript[0] == '/' ? $javascript : "/{$javascript}";
         // add slash to start if not present.
         // Add legacy ajax scripts (like prototype/scriptaculous) at the lightest weight (0) and in order from there.
         // Add others after core default assets (like jQuery) but before pageAddAsset default weight (100) and in order from there.
         $jsAssets[$javascript] = false !== strpos($javascript, 'javascript/ajax/') ? $legacyAjaxScripts++ : $i++;
     }
     $cssAssets = [];
     $stylesheets = \PageUtil::getVar('stylesheet');
     $i = 60;
     foreach ($stylesheets as $stylesheet) {
         $stylesheet = $baseUri . '/' . $stylesheet;
         $cssAssets[$stylesheet] = $i++;
         // add before pageAddAsset default weight (100)
     }
     // @todo END legacy block - remove at Core-2.0
     $filteredContent = $this->filterService->filter($response->getContent(), $jsAssets, $cssAssets);
     $response->setContent($filteredContent);
     return $response;
 }
开发者ID:Silwereth,项目名称:core,代码行数:34,代码来源:Engine.php

示例5: processPdf

 /**
  * Processes a template file using dompdf (LGPL).
  *
  * @param Zikula_View $view     Reference to view object.
  * @param string      $template Name of template to use.
  *
  * @return mixed Output.
  */
 protected function processPdf(Zikula_View $view, $template)
 {
     // first the content, to set page vars
     $output = $view->fetch($template);
     // make local images absolute
     $output = str_replace('img src="/', 'img src="' . System::serverGetVar('DOCUMENT_ROOT') . '/', $output);
     // see http://codeigniter.com/forums/viewthread/69388/P15/#561214
     //$output = utf8_decode($output);
     // then the surrounding
     $output = $view->fetch('include_pdfheader.tpl') . $output . '</body></html>';
     $controllerHelper = new MUVideo_Util_Controller($this->serviceManager);
     // create name of the pdf output file
     $fileTitle = $controllerHelper->formatPermalink(System::getVar('sitename')) . '-' . $controllerHelper->formatPermalink(PageUtil::getVar('title')) . '-' . date('Ymd') . '.pdf';
     // if ($_GET['dbg'] == 1) die($output);
     // instantiate pdf object
     $pdf = new \DOMPDF();
     // define page properties
     $pdf->set_paper('A4');
     // load html input data
     $pdf->load_html($output);
     // create the actual pdf file
     $pdf->render();
     // stream output to browser
     $pdf->stream($fileTitle);
     // prevent additional output by shutting down the system
     System::shutDown();
     return true;
 }
开发者ID:robbrandt,项目名称:MUVideo,代码行数:36,代码来源:View.php

示例6: getJSGettext

 /**
  * Gets from PageUtil requests for gettext and generates url for file with translations.
  *
  * @return string Url to file with translations
  */
 public static function getJSGettext()
 {
     $jsgettext = PageUtil::getVar('jsgettext');
     if (!empty($jsgettext)) {
         $params = array('lang' => ZLanguage::getLanguageCode());
         foreach ($jsgettext as $entry) {
             $vars = explode(':', $entry);
             if (isset($vars[0])) {
                 $domain = $vars[0];
             }
             if (isset($vars[1])) {
                 $module = $vars[1];
             }
             if (isset($domain) && !empty($domain)) {
                 $params[$domain] = isset($module) && !empty($module) ? $module : $domain;
             }
         }
         $params = http_build_query($params, '', '&');
         return System::getBaseUri() . '/mo2json.php?' . $params;
     }
     return false;
 }
开发者ID:Silwereth,项目名称:core,代码行数:27,代码来源:JCSSUtil.php

示例7: smarty_outputfilter_pagevars

/**
 * Zikula_View outputfilter to add page variables and additional header global into page header
 *
 * By default this output filter places page variable output immediately prior to the closing
 * head tag (</head>). The output can, optionally, be placed anywhere in the template by adding
 * the HTML comment <!-- pagevars --> to the page template. Note that this must always be in
 * the header for the output to function correctly.
 *
 * @param string      $source Output source.
 * @param Zikula_View $view   Reference to Zikula_View instance.
 *
 * @return string
 */
function smarty_outputfilter_pagevars($source, $view)
{
    $return = '';
    $themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
    $cssjscombine = ModUtil::getVar('ZikulaThemeModule', 'cssjscombine', false);
    $type = $view->getRequest()->get('type');
    $zkType = $view->getRequest()->attributes->get('_zkType');
    $isAdminController = $type == 'admin' || $zkType == 'admin';
    // get list of stylesheets and scripts from JCSSUtil
    $jcss = JCSSUtil::prepareJCSS($cssjscombine, $view->cache_dir, $themeinfo, $isAdminController);
    if (is_array($jcss['stylesheets']) && !empty($jcss['stylesheets'])) {
        foreach ($jcss['stylesheets'] as $stylesheet) {
            if (empty($stylesheet)) {
                continue;
            }
            // check if the stylesheets is in the additional_header array
            if ($themeinfo['xhtml']) {
                $return .= '<link rel="stylesheet" href="' . DataUtil::formatForDisplay($stylesheet) . '" type="text/css" />' . "\n";
            } else {
                $return .= '<link rel="stylesheet" href="' . DataUtil::formatForDisplay($stylesheet) . '" type="text/css">' . "\n";
            }
        }
    }
    // get inline js config and print it just before any script tag
    $jsConfig = JCSSUtil::getJSConfig();
    if (!empty($jsConfig)) {
        $return .= $jsConfig;
    }
    if (is_array($jcss['javascripts']) && !empty($jcss['javascripts'])) {
        foreach ($jcss['javascripts'] as $j => $javascript) {
            if (empty($javascript)) {
                unset($jcss['javascripts'][$j]);
                continue;
            }
            // check if the javascript is in the additional_header array
            $return .= '<script type="text/javascript" src="' . DataUtil::formatForDisplay($javascript) . '"></script>' . "\n";
        }
    }
    $headerContent = PageUtil::getVar('header');
    if (is_array($headerContent) && !empty($headerContent)) {
        $return .= implode("\n", $headerContent) . "\n";
    }
    // if we've got some page vars to add the header wrap the output in
    // suitable identifying comments when in development mode
    $return = trim($return);
    if (!empty($return) && System::getVar('development') != 0) {
        $return = "<!-- zikula pagevars -->\n" . $return . "\n<!-- /zikula pagevars -->";
    }
    // get any body page vars
    $bodyvars = PageUtil::getVar('body');
    if (!empty($bodyvars)) {
        $bodyattribs = '<body ' . @implode(' ', $bodyvars) . '>';
        $source = str_replace('<body>', $bodyattribs, $source);
    }
    // get any footer page vars
    $footervars = PageUtil::getVar('footer');
    if (!empty($footervars)) {
        $footersource = @implode("\n", $footervars) . "\n</body>";
        $source = str_replace('</body>', $footersource, $source);
    }
    // replace the string in the template source
    if (stripos($source, '<!-- pagevars -->')) {
        $source = str_replace('<!-- pagevars -->', $return, $source);
    } else {
        $headPos = stripos($source, '</head>');
        if ($headPos !== false) {
            if ($headPos == strripos($source, '</head>')) {
                // Position of the first </head> matches the last </head> so str_replace is safe
                $source = str_replace('</head>', $return . "\n</head>", $source);
            } else {
                // Position of the first </head> does not match the last </head> so str_replace is NOT safe
                // There was probably a {zdebug} tag opening a _dbgconsole.
                // Need to use preg_replace so we can limit to the first.
                preg_replace('#</head>#i', $return . "\n</head>", $source, 1);
            }
        }
    }
    // return the modified source
    return $source;
}
开发者ID:Silwereth,项目名称:core,代码行数:93,代码来源:outputfilter.pagevars.php

示例8: processPdf

 /**
  * Processes a template file using dompdf (LGPL).
  *
  * @param Zikula_View $view     Reference to view object.
  * @param string      $template Name of template to use.
  *
  * @return mixed Output.
  */
 protected static function processPdf(Zikula_View $view, $template)
 {
     // first the content, to set page vars
     $output = $view->fetch($template);
     // see http://codeigniter.com/forums/viewthread/69388/P15/#561214
     //$output = utf8_decode($output);
     // then the surrounding
     $output = $view->fetch('include_pdfheader.tpl') . $output . '</body></html>';
     // create name of the pdf output file
     $fileTitle = MUBoard_Util_Controller::formatPermalink(System::getVar('sitename')) . '-' . MUBoard_Util_Controller::formatPermalink(PageUtil::getVar('title')) . '-' . date('Ymd') . '.pdf';
     //if ($_GET['dbg'] == 1) die($output);
     // instantiate pdf object
     $pdf = new DOMPDF();
     // define page properties
     $pdf->set_paper('A4');
     // load html input data
     $pdf->load_html($output);
     // create the actual pdf file
     $pdf->render();
     // stream output to browser
     $pdf->stream($fileTitle);
     // prevent additional output by shutting down the system
     System::shutDown();
     return true;
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:33,代码来源:View.php

示例9: pageGetVar

 public function pageGetVar($name, $default = null)
 {
     return \PageUtil::getVar($name, $default);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:4,代码来源:CoreExtension.php


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