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


PHP Zikula_View::getRequest方法代码示例

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


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

示例1: smarty_function_admincategorymenu

/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategorymenu()
 * @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 results of the module function
 */
function smarty_function_admincategorymenu($params, \Zikula_View $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('ZikulaAdminModule'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    $path = array('_controller' => 'ZikulaAdminModule:Admin:categorymenu', 'acid' => $acid);
    $subRequest = $view->getRequest()->duplicate(array(), null, $path);
    return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
开发者ID:Silwereth,项目名称:core,代码行数:21,代码来源:function.admincategorymenu.php

示例2: smarty_function_adminfooter

/**
 * Smarty function to close the admin container.
 *
 * Admin
 * {adminfooter}
 *
 * @see          function.adminfooter.php::smarty_function_adminfooter()
 * @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 results of the module function
 */
function smarty_function_adminfooter($params, \Zikula_View $view)
{
    // check to make sure adminmodule is available and route is available
    $router = $view->getContainer()->get('router');
    try {
        $router->generate('zikulaadminmodule_admin_adminfooter');
    } catch (\Symfony\Component\Routing\Exception\RouteNotFoundException $e) {
        return '';
    }
    $path = array('_controller' => 'ZikulaAdminModule:Admin:adminfooter');
    $subRequest = $view->getRequest()->duplicate(array(), null, $path);
    return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
开发者ID:Silwereth,项目名称:core,代码行数:24,代码来源:function.adminfooter.php

示例3: smarty_function_adminfooter

/**
 * Smarty function to close the admin container.
 *
 * Admin
 * {adminfooter}
 *
 * @see          function.adminfooter.php::smarty_function_adminfooter()
 * @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 results of the module function
 */
function smarty_function_adminfooter($params, \Zikula_View $view)
{
    // check to make sure adminmodule is available and route is available
    $router = $view->getContainer()->get('router');
    $routeCollection = $router instanceof \JMS\I18nRoutingBundle\Router\I18nRouter ? $router->getOriginalRouteCollection() : $router->getRouteCollection();
    $route = $routeCollection->get('zikulaadminmodule_admin_adminfooter');
    if (isset($route)) {
        $path = array('_controller' => 'ZikulaAdminModule:Admin:adminfooter');
        $subRequest = $view->getRequest()->duplicate(array(), null, $path);
        return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
    }
    return '';
}
开发者ID:rmaiwald,项目名称:core,代码行数:24,代码来源:function.adminfooter.php

示例4: smarty_function_adminheader

/**
 * Smarty function to open the admin container.
 *
 * Admin
 * {adminheader}
 *
 * @see          function.adminheader.php::smarty_function_adminheader()
 * @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 results of the module function
 */
function smarty_function_adminheader($params, $view)
{
    // check to make sure adminmodule is available and route is available
    $router = $view->getContainer()->get('router');
    try {
        $router->generate('zikulaadminmodule_admin_adminheader');
    } catch (\Symfony\Component\Routing\Exception\RouteNotFoundException $e) {
        $url = $view->getContainer()->get('router')->generate('zikularoutesmodule_route_reload', array('lct' => 'admin', 'confirm' => 1));
        return '<div class="alert alert-danger"><i class="fa fa-exclamation-triangle fa-2x"></i> ' . __f('Routes must be reloaded. Click %s to reload all routes.', "<a href='{$url}'>" . __('here') . '</a>') . '</div>';
    }
    $path = array('_controller' => 'ZikulaAdminModule:Admin:adminheader');
    $subRequest = $view->getRequest()->duplicate(array(), null, $path);
    return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
开发者ID:rojblake,项目名称:core,代码行数:25,代码来源:function.adminheader.php

示例5: smarty_function_sessiondelvar

/**
 * Smarty function to delete a session variable
 *
 * This function deletes a session-specific variable from the Zikula system.
 *
 *
 * Available parameters:
 *   - name:    The name of the session variable to delete
 *   - path:    The namespace.
 *   - assign:  If set, the result is assigned to the corresponding variable instead of printed out
 *
 * Example
 *   {sessiondelvar name='foobar'}
 *
 * @param  array       $params All attributes passed to this function from the template
 * @param  Zikula_View $view   Reference to the Smarty object
 * @param  string      $name   The name of the session variable to delete
 *
 * @return mixed
 */
function smarty_function_sessiondelvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $name = isset($params['name']) ? $params['name'] : null;
    $path = isset($params['path']) ? $params['path'] : '/';
    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('sessiondelvar', 'name')));
        return false;
    }
    $result = $view->getRequest()->getSession()->del($name, $path);
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:planetenkiller,项目名称:core,代码行数:36,代码来源:function.sessiondelvar.php

示例6: smarty_block_checkgroup

/**
 * Zikula_View block to implement group checks in a template.
 *
 * Available attributes:
 *  - gid (numeric) The ID number of the group to be tested.
 *
 * Example:
 * <pre>
 * {checkgroup gid='1'}
 *   do some stuff now we have permission
 * {/checkgroup}
 * </pre>.
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The content between the block tags.
 * @param Zikula_View $view    Reference to the {@link Zikula_View} object.
 *
 * @return string|boolean|void The content of the matching case.
 *                             If the user is a member of the group specified by the gid,
 *                             then the content contained in the block, otherwise null,
 *                             false on error.
 */
function smarty_block_checkgroup($params, $content, Zikula_View $view)
{
    // check if there is something between the tags
    if (is_null($content)) {
        return;
    }
    // check our input
    if (!isset($params['gid'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_block_checkgroup', 'component')));
        return false;
    }
    $uid = $view->getRequest()->getSession()->get('uid');
    if (empty($uid)) {
        return;
    }
    if (!ModUtil::apiFunc('GroupsModule', 'user', 'isgroupmember', array('uid' => $uid, 'gid' => $params['gid']))) {
        return;
    }
    return $content;
}
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:42,代码来源:block.checkgroup.php

示例7: smarty_function_formutil_getpassedvalue

/**
 * FormUtil::getPassedValue().
 *
 * Available parameters:
 *   assign    The smarty variable to assign the retrieved value to.
 *   html      Wether or not to DataUtil::formatForDisplayHTML'ize the ML value.
 *   key       The key to retrieve from the input vector.
 *   name      Alias for key.
 *   default   The default value to return if the key is not set.
 *   source    The input source to retrieve the key from .
 *   noprocess If set, no processing is applied to the constant value.
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string
 *
 */
function smarty_function_formutil_getpassedvalue($params, Zikula_View $view)
{
    if ((!isset($params['key']) || !$params['key']) && (!isset($params['name']) || !$params['name'])) {
        // use name as an alias for key for programmer convenience
        $view->trigger_error('formutil_getpassedvalue: attribute key (or name) required');
        return false;
    }
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $key = isset($params['key']) ? $params['key'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $html = isset($params['html']) ? $params['html'] : null;
    $source = isset($params['source']) ? $params['source'] : null;
    $noprocess = isset($params['noprocess']) ? $params['noprocess'] : null;
    if (!$key) {
        $key = isset($params['name']) ? $params['name'] : null;
    }
    $source = isset($source) ? $source : null;
    switch ($source) {
        case 'GET':
            $val = $view->getRequest()->query->get($key, $default);
            break;
        case 'POST':
            $val = $view->getRequest()->request->get($key, $default);
            break;
        case 'SERVER':
            $val = $view->getRequest()->server->get($key, $default);
            break;
        case 'FILES':
            $val = $view->getRequest()->files->get($key, $default);
            break;
        default:
            $val = $view->getRequest()->query->get($key, $view->getRequest()->request->get($key, $default));
            break;
    }
    if ($noprocess) {
        $val = $val;
    } elseif ($html) {
        $val = DataUtil::formatForDisplayHTML($val);
    } else {
        $val = DataUtil::formatForDisplay($val);
    }
    if ($assign) {
        $view->assign($assign, $val);
    } else {
        return $val;
    }
}
开发者ID:planetenkiller,项目名称:core,代码行数:65,代码来源:function.formutil_getpassedvalue.php

示例8: smarty_function_pager

/**
 * Zikula_View pager plugin
 *
 * Examples (see also the demo page)
 *   {pager rowcount="400" limit="50"}
 *   {pager rowcount="400" limit="35" template="pageritems.tpl"}
 *   {pager rowcount="480" limit="90" template="pagerintervals.tpl" posvar="myposvar"}
 *   {pager rowcount="500" limit="47" template="pagerimage.tpl"}
 *   {pager rowcount="432" limit="25" template="pagercss.tpl"}
 *   {pager rowcount="1200" limit="40" maxpages="10"}
 *   {pager rowcount="1200" limit="40" template="pagercss.tpl" maxpages="7"}
 *   {pager rowcount="1200" limit="40" template="pagerjs.tpl" maxpages="10"}
 *   {pager rowcount="1200" limit="40" template="pagercss2.tpl" maxpages="20"}
 *   {pager rowcount="1200" limit="40" template="pagercss2.tpl" maxpages="20" optimize=true}
 *
 * Available parameters:
 *  modname            Fixed name of the module to page (optional)
 *  type               Fixed value of the type url parameter (optional)
 *  func               Fixed value of the function url parameter (optional)
 *  route              Name of a fixed route to use (optional, replaces modname / type / func)
 *  rowcount           Total number of items to page in between
 *                       (if an array is assigned, it's count will be used)
 *  limit              Number of items on a page (if <0 unlimited)
 *  posvar             Name of the variable that contains the position data, eg "offset"
 *  owner              If set uses it as the module owner of the Zikula_View instance. Default owner is the Theme module
 *  template           Optional name of a template file
 *  includeStylesheet  Use predefined stylesheet file? Default is yes.
 *  anchorText         Optional text for hyperlink anchor (e.g. 'comments' for the anchor #comments) (default: '')
 *  maxpages           Optional maximum number of displayed pages, others will be hidden / suppressed
 *                       (default: 15 = show only 15 pages)
 *  display            Optional choice between 'page' or 'startnum'. Show links using page number or starting item number (default is startnum)
 *  class              Optional class to apply to the pager container (default : z-pager)
 *  processDetailLinks Should the single page links be processed? (default: false if using pagerimage.tpl, otherwise true)
 *  processUrls        Should urls be processed or assign the arguments? (default: true)
 *  optimize           Only deliver page links which are actually displayed to the template (default: true)
 *  includePostVars    Whether or not to include the POST variables as GET variables in the pager URLs (default: true)
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string
 */
function smarty_function_pager($params, Zikula_View $view)
{
    if (!isset($params['rowcount'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pager', 'rowcount')));
    }
    if (!isset($params['limit'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pager', 'limit')));
    }
    if (is_array($params['rowcount'])) {
        $params['rowcount'] = count($params['rowcount']);
    } elseif ($params['rowcount'] == 0) {
        return '';
    }
    if ($params['limit'] == 0) {
        $params['limit'] = 5;
    }
    if (!isset($params['display'])) {
        $params['display'] = 'startnum';
    }
    if (!isset($params['class'])) {
        $params['class'] = 'z-pager';
    }
    if (!isset($params['optimize'])) {
        $params['optimize'] = true;
    }
    if (!isset($params['owner'])) {
        $params['owner'] = false;
    }
    if (!isset($params['includePostVars'])) {
        $params['includePostVars'] = true;
    }
    if (!isset($params['route'])) {
        $params['route'] = false;
    }
    $pager = array();
    $pager['total'] = $params['rowcount'];
    $pager['perpage'] = $params['limit'];
    $pager['class'] = $params['class'];
    $pager['optimize'] = $params['optimize'];
    unset($params['rowcount']);
    unset($params['limit']);
    unset($params['class']);
    unset($params['optimize']);
    // current position
    $pager['posvar'] = isset($params['posvar']) ? $params['posvar'] : 'pos';
    $routeParams = array();
    if ($view->getRequest()->attributes->has('_route_params')) {
        $routeParams = $view->getRequest()->attributes->get('_route_params');
        if (isset($routeParams[$pager['posvar']])) {
            $pager['pos'] = (int) $routeParams[$pager['posvar']];
        } else {
            $pager['pos'] = (int) $view->getRequest()->query->get($pager['posvar'], '');
        }
    } else {
        $pager['pos'] = (int) $view->getRequest()->query->get($pager['posvar'], '');
    }
    if ($params['display'] == 'page') {
        $pager['pos'] = $pager['pos'] * $pager['perpage'];
//.........这里部分代码省略.........
开发者ID:Silwereth,项目名称:core,代码行数:101,代码来源:function.pager.php

示例9: smarty_function_adminpanelmenu

/**
 * Inserts a hidden admin panel controlled by permissions.
 *
 * Inserts required javascript and css files for a hidden admin panel that is triggered by a rendered link.
 * Builds and renders an unordered list of admin-capable modules and their adminLinks using the
 * jQuery.mmenu library <@see http://mmenu.frebsite.nl>
 *
 * This plugin currently has NO configuration options.
 *
 * Examples:
 *
 * <samp>{adminpanelmenu}</samp>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the {@link Zikula_View} object.
 *
 * @return string
 */
function smarty_function_adminpanelmenu($params, Zikula_View $view)
{
    if (!SecurityUtil::checkPermission('ZikulaAdminModule::', "::", ACCESS_EDIT)) {
        return '';
        // Since no permission, return empty
    }
    // add required scritps and stylesheets to page
    PageUtil::addVar('javascript', '@ZikulaAdminModule/Resources/public/js/jQuery.mmenu-5.5.1/dist/core/js/jquery.mmenu.min.all.js');
    PageUtil::addVar('stylesheet', '@ZikulaAdminModule/Resources/public/js/jQuery.mmenu-5.5.1/dist/core/css/jquery.mmenu.all.css');
    // add override for panel width created from .scss file
    PageUtil::addVar('stylesheet', '@ZikulaAdminModule/Resources/public/css/mmenu-hiddenpanel-customwidth.css');
    $router = $view->getContainer()->get('router');
    $modules = ModUtil::getModulesCapableOf('admin');
    // sort modules by displayname
    $moduleNames = array();
    foreach ($modules as $key => $module) {
        $moduleNames[$key] = $module['displayname'];
    }
    array_multisort($moduleNames, SORT_ASC, $modules);
    // create unordered list of admin-capable module links
    $htmlContent = '<nav id="zikula-admin-hiddenpanel-menu">';
    $htmlContent .= '<div class="text-left">';
    $htmlContent .= '<h1><img src="images/logo.gif" alt="Logo" style="height: 32px"> ' . __('Administration') . '</h1>';
    $htmlContent .= '<ul>';
    foreach ($modules as $module) {
        if (SecurityUtil::checkPermission("module[name]::", '::', ACCESS_EDIT)) {
            // first-level list - list modules with general 'index' link
            $img = ModUtil::getModuleImagePath($module['name']);
            $url = isset($module['capabilities']['admin']['url']) ? $module['capabilities']['admin']['url'] : $router->generate($module['capabilities']['admin']['route']);
            $moduleSelected = empty($moduleSelected) && strpos($view->getRequest()->getUri(), $module['url']) ? " class='Selected'" : "";
            $htmlContent .= "<li{$moduleSelected}><a href=\"" . DataUtil::formatForDisplay($url) . "\"><img src=\"{$img}\" alt=\"\" style=\"height: 18px\" /> " . $module['displayname'] . "</a>";
            $links = $view->getContainer()->get('zikula.link_container_collector')->getLinks($module['name'], 'admin');
            if (empty($links)) {
                $links = (array) ModUtil::apiFunc($module['name'], 'admin', 'getLinks');
            }
            if (count($links) > 0 && $links[0] != false) {
                // create second-level list from module adminLinks
                $htmlContent .= '<ul class="text-left">';
                foreach ($links as $link) {
                    if (isset($link['icon'])) {
                        $img = '<i class="fa fa-' . $link['icon'] . '"></i>';
                    } elseif (isset($link['class'])) {
                        $img = '<span class="' . $link['class'] . '"></span>';
                    } else {
                        $img = '';
                    }
                    $linkSelected = empty($linkSelected) && strpos($view->getRequest()->getUri(), $link['url']) ? " class='Selected'" : "";
                    $htmlContent .= "<li{$linkSelected}><a href=\"" . DataUtil::formatForDisplay($link['url']) . "\">{$img} " . $link['text'] . '</a>';
                    // create third-level list from adminLinks subLinks
                    if (isset($link['links']) && count($link['links']) > 0) {
                        $htmlContent .= '<ul class="text-left">';
                        foreach ($link['links'] as $sublink) {
                            $htmlContent .= '<li><a href="' . DataUtil::formatForDisplay($sublink['url']) . '">' . $sublink['text'] . '</a></li>';
                        }
                        $htmlContent .= '</ul>';
                    }
                    $htmlContent .= '</li>';
                }
                $htmlContent .= '</ul>';
            }
            $htmlContent .= '</li>';
        }
    }
    $htmlContent .= '</ul>';
    $htmlContent .= '</div>';
    $htmlContent .= '</nav>';
    $htmlContent .= '
            <script type="text/javascript">
                jQuery(document).ready(function( $ ){
                    $("#zikula-admin-hiddenpanel-menu").mmenu({
                        extensions: ["hiddenpanel-customwidth"],
                        "header": {
                           "title": "' . __('Zikula Administration') . '",
                           "add": true,
                           "update": true
                        },
                        "searchfield": true
                    });
                });
            </script>';
    // the the html content before </body>
    PageUtil::addVar('footer', $htmlContent);
//.........这里部分代码省略.........
开发者ID:Silwereth,项目名称:core,代码行数:101,代码来源:function.adminpanelmenu.php

示例10: smarty_function_pagerabc


//.........这里部分代码省略.........
            // Hungarian
            $pager['names'] = $pager['values'] = array('A', '?', 'B', 'C', 'D', 'E', '?', 'F', 'G', 'H', 'I', '?', 'J', 'K', 'L', 'M', 'N', 'O', '?', '?', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', '?', '?', 'U', 'V', 'W', 'X', 'Y', 'Z');
            //$params['names']  = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U'    ,'V','W','X','Y','Z');
            //$params['values'] = array('A,?','B','C','D','E,?','F','G','H','I,?','J','K','L','M','N','O,?,?,O','P','Q','R','S','T','U,?,?,U','V','W','X','Y','Z');
        } else {
            $alphabet = defined('_ALPHABET') ? constant('_ALPHABET') : 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z';
            $pager['names'] = $pager['values'] = explode(',', $alphabet);
        }
    }
    $pager['posvar'] = $params['posvar'];
    unset($params['posvar']);
    unset($params['names']);
    unset($params['values']);
    if (!isset($params['route'])) {
        if (isset($params['modname'])) {
            $pager['module'] = $params['modname'];
        } else {
            $module = FormUtil::getPassedValue('module', null, 'GETPOST', FILTER_SANITIZE_STRING);
            $name = FormUtil::getPassedValue('name', null, 'GETPOST', FILTER_SANITIZE_STRING);
            $pager['module'] = !empty($module) ? $module : $name;
        }
        $pager['func'] = isset($params['func']) ? $params['func'] : FormUtil::getPassedValue('func', 'index', 'GETPOST', FILTER_SANITIZE_STRING);
        $pager['type'] = isset($params['type']) ? $params['type'] : FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING);
    } else {
        $pager['route'] = $params['route'];
        unset($params['route']);
    }
    $pagerUrl = function ($pager) use($view) {
        if (!isset($pager['route'])) {
            return ModUtil::url($pager['module'], $pager['type'], $pager['func'], $pager['args']);
        }
        return $view->getContainer()->get('router')->generate($pager['route'], $pager['args']);
    };
    $allVars = array_merge($view->getRequest()->request->all(), $view->getRequest()->query->all(), $view->getRequest()->attributes->get('_route_params', array()));
    $pager['args'] = array();
    if (empty($pager['module']) && empty($pager['route'])) {
        $pager['module'] = System::getVar('startpage');
        $starttype = System::getVar('starttype');
        $pager['type'] = !empty($starttype) ? $starttype : 'user';
        $startfunc = System::getVar('startfunc');
        $pager['func'] = !empty($startfunc) ? $startfunc : 'index';
        $startargs = explode(',', System::getVar('startargs'));
        foreach ($startargs as $arg) {
            if (!empty($arg)) {
                $argument = explode('=', $arg);
                if ($argument[0] == $pager['posvar']) {
                    $allVars[$argument[0]] = $argument[1];
                }
            }
        }
    }
    // If $forwardvars set, add only listed vars to query string, else add all POST and GET vars
    if (isset($params['forwardvars'])) {
        if (!is_array($params['forwardvars'])) {
            $params['forwardvars'] = preg_split('/[,;\\s]/', $params['forwardvars'], -1, PREG_SPLIT_NO_EMPTY);
        }
        foreach ((array) $params['forwardvars'] as $key => $var) {
            if (!empty($var) && !empty($allVars[$var])) {
                $pager['args'][$var] = $allVars[$var];
            }
        }
    } else {
        $pager['args'] = array_merge($pager['args'], $allVars);
    }
    if (isset($params['additionalvars'])) {
        if (!is_array($params['additionalvars'])) {
开发者ID:rmaiwald,项目名称:core,代码行数:67,代码来源:function.pagerabc.php

示例11: 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


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