本文整理汇总了PHP中System::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP System::getVar方法的具体用法?PHP System::getVar怎么用?PHP System::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::getVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getlinks
/**
* get available admin panel links
* @return array array of admin links
*/
public function getlinks()
{
$links = array();
if (SecurityUtil::checkPermission('SecurityCenter::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url('SecurityCenter', 'admin', 'modifyconfig'), 'text' => $this->__('Settings'), 'class' => 'z-icon-es-config');
$links[] = array('url' => ModUtil::url('SecurityCenter', 'admin', 'allowedhtml'), 'text' => $this->__('Allowed HTML settings'), 'class' => 'z-icon-es-options');
$links[] = array('url' => ModUtil::url('SecurityCenter', 'admin', 'viewidslog'),
'text' => $this->__('View IDS Log'),
'class' => 'z-icon-es-log',
'links' => array(
array('url' => ModUtil::url('SecurityCenter', 'admin', 'viewidslog'),
'text' => $this->__('View IDS Log')),
array('url' => ModUtil::url('SecurityCenter', 'admin', 'exportidslog'),
'text' => $this->__('Export IDS Log')),
array('url' => ModUtil::url('SecurityCenter', 'admin', 'purgeidslog'),
'text' => $this->__('Purge IDS Log'))
));
$outputfilter = System::getVar('outputfilter');
if ($outputfilter == 1) {
$links[] = array('url' => ModUtil::url('SecurityCenter', 'admin', 'purifierconfig'), 'text' => $this->__('HTMLPurifier settings'), 'class' => 'z-icon-es-options');
}
}
return $links;
}
示例2: smarty_outputfilter_admintitle
/**
* Zikula_View outputfilter to add a title to all admin pages
*
* @param string $source Output source.
* @param Zikula_View_Theme $view Reference to Zikula_View_Theme instance.
*
* @return string
*/
function smarty_outputfilter_admintitle($source, $view)
{
// get the first heading tags
// module - usually display module
preg_match("/<h2>([^<]*)<\\/h2>/", $source, $header2);
// function pagetitle
preg_match("/<h3>([^<]*)<\\/h3>/", $source, $header3);
// init the args
$titleargs = array();
// checks for header level 3
if ($header3 && isset($header3[1]) && $header3[1]) {
$titleargs[] = $header = strip_tags($header3[1]);
// put its value on any z-adminpage-func element
$source = preg_replace('/z-admin-pagefunc">(.*?)</', 'z-adminpage-func">' . $header . '<', $source, 1);
}
// checks for header level 2
if ($header2 && isset($header2[1]) && $header2[1]) {
$titleargs[] = $header = strip_tags($header2[1]);
// put its value on any z-adminpage-func element
$source = preg_replace('/z-admin-pagemodule">(.*?)</', 'z-admin-pagemodule">' . $header . '<', $source, 1);
}
if (!empty($titleargs)) {
$titleargs[] = __('Administration');
$titleargs[] = System::getVar('sitename');
$title = implode(' - ', $titleargs);
$source = preg_replace('/<title>(.*?)<\\/title>/', '<title>' . $title . '</title>', $source, 1);
}
// return the modified page source
return $source;
}
示例3: smarty_function_manuallink
/**
* Zikula_View function to create manual link.
*
* This function creates a manual link from some parameters.
*
* Available parameters:
* - manual: name of manual file, manual.html if not set
* - chapter: an anchor in the manual file to jump to
* - newwindow: opens the manual in a new window using javascript
* - width: width of the window if newwindow is set, default 600
* - height: height of the window if newwindow is set, default 400
* - title: name of the new window if newwindow is set, default is modulename
* - class: class for use in the <a> tag
* - assign: if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
*
* Example
* {manuallink newwindow=1 width=400 height=300 title=rtfm }
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string|void
*/
function smarty_function_manuallink($params, Zikula_View $view)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
$userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
$stdlang = System::getVar('language_i18n');
$title = isset($params['title']) ? $params['title'] : 'Manual';
$manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
$chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
$class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
$width = isset($params['width']) ? $params['width'] : 600;
$height = isset($params['height']) ? $params['height'] : 400;
$modname = ModUtil::getName();
$possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
foreach ($possibleplaces as $possibleplace) {
if (file_exists($possibleplace)) {
$url = $possibleplace . $chapter;
break;
}
}
if (isset($params['newwindow'])) {
$link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
} else {
$link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
}
if (isset($params['assign'])) {
$ret = array('url' => $url, 'link' => $link);
$view->assign($params['assign'], $ret);
return;
} else {
return $link;
}
}
示例4: initUrlRoutes
/**
* Initialise the url routes for this application.
*
* @return Zikula_Routing_UrlRouter The router instance treating all initialised routes
*/
protected function initUrlRoutes()
{
$fieldRequirements = $this->requirements;
$isDefaultModule = System::getVar('shorturlsdefaultmodule', '') == 'MUBoard';
$defaults = array();
$modulePrefix = '';
if (!$isDefaultModule) {
$defaults['module'] = 'MUBoard';
$modulePrefix = ':module/';
}
$defaults['func'] = 'view';
$viewFolder = 'view';
// normal views (e.g. orders/ or customers.xml)
$this->router->set('va', new Zikula_Routing_UrlRoute($modulePrefix . $viewFolder . '/:ot:viewending', $defaults, $fieldRequirements));
$defaults['func'] = 'search';
$viewFolder = 'search';
// normal views (e.g. orders/ or customers.xml)
$this->router->set('se', new Zikula_Routing_UrlRoute($modulePrefix . $viewFolder . '/:ot:viewending', $defaults, $fieldRequirements));
// TODO filter views (e.g. /orders/customer/mr-smith.csv)
// $this->initRouteForEachSlugType('vn', $modulePrefix . $viewFolder . '/:ot/:filterot/', ':viewending', $defaults, $fieldRequirements);
$defaults['func'] = 'display';
// normal display pages including the group folder corresponding to the object type
$this->initRouteForEachSlugType('dn', $modulePrefix . ':ot/', ':displayending', $defaults, $fieldRequirements);
// additional rules for the leading object type (where ot is omitted)
$defaults['ot'] = 'category';
$this->initRouteForEachSlugType('dl', $modulePrefix . '', ':displayending', $defaults, $fieldRequirements);
return $this->router;
}
示例5: display
function display()
{
// call ZFeed that provides SimplePie
$this->feed = new ZFeed($this->url, System::getVar('temp'), $this->refreshTime * 60);
$items = $this->feed->get_items();
//$items = $this->feed->get_items(0, $this->maxNoOfItems);
$itemsData = array();
foreach ($items as $item) {
if (count($itemsData) < $this->maxNoOfItems) {
$itemsData[] = array(
'title' => $this->decode($item->get_title()),
'description' => $this->decode($item->get_description()),
'permalink' => $item->get_permalink());
}
}
$this->feedData = array(
'title' => $this->decode($this->feed->get_title()),
'description' => $this->decode($this->feed->get_description()),
'permalink' => $this->feed->get_permalink(),
'items' => $itemsData);
$this->view->assign('feed', $this->feedData);
$this->view->assign('includeContent', $this->includeContent);
return $this->view->fetch($this->getTemplate());
}
示例6: main
/**
* display theme changing user interface
*/
public function main()
{
// check if theme switching is allowed
if (!System::getVar('theme_change')) {
LogUtil::registerError($this->__('Notice: Theme switching is currently disabled.'));
$this->redirect(ModUtil::url('Users', 'user', 'main'));
}
if (!SecurityUtil::checkPermission('Theme::', '::', ACCESS_COMMENT)) {
return LogUtil::registerPermissionError();
}
// get our input
$startnum = FormUtil::getPassedValue('startnum', isset($args['startnum']) ? $args['startnum'] : 1, 'GET');
// we need this value multiple times, so we keep it
$itemsperpage = $this->getVar('itemsperpage');
// get some use information about our environment
$currenttheme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
// get all themes in our environment
$allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER);
$previewthemes = array();
$currentthemepic = null;
foreach ($allthemes as $key => $themeinfo) {
$themename = $themeinfo['name'];
if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_medium.png')) {
$themeinfo['previewImage'] = $themepic;
$themeinfo['largeImage'] = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_large.png';
} else {
$themeinfo['previewImage'] = 'system/Theme/images/preview_medium.png';
$themeinfo['largeImage'] = 'system/Theme/images/preview_large.png';
}
if ($themename == $currenttheme['name']) {
$currentthemepic = $themepic;
unset($allthemes[$key]);
} else {
$previewthemes[$themename] = $themeinfo;
}
}
$previewthemes = array_slice($previewthemes, $startnum-1, $itemsperpage);
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
$this->view->assign('currentthemepic', $currentthemepic)
->assign('currenttheme', $currenttheme)
->assign('themes', $previewthemes)
->assign('defaulttheme', ThemeUtil::getInfo(ThemeUtil::getIDFromName(System::getVar('Default_Theme'))));
// assign the values for the pager plugin
$this->view->assign('pager', array('numitems' => sizeof($allthemes),
'itemsperpage' => $itemsperpage));
// Return the output that has been generated by this function
return $this->view->fetch('theme_user_main.tpl');
}
示例7: search
/**
* Performs the actual search processing.
*/
public function search($args)
{
ModUtil::dbInfoLoad('Search');
$dbtables = DBUtil::getTables();
$pageTable = $dbtables['content_page'];
$pageColumn = $dbtables['content_page_column'];
$contentTable = $dbtables['content_content'];
$contentColumn = $dbtables['content_content_column'];
$contentSearchTable = $dbtables['content_searchable'];
$contentSearchColumn = $dbtables['content_searchable_column'];
$translatedPageTable = $dbtables['content_translatedpage'];
$translatedPageColumn = $dbtables['content_translatedpage_column'];
$sessionId = session_id();
// check whether we need to search also in translated content
$multilingual = System::getVar('multilingual');
$currentLanguage = ZLanguage::getLanguageCode();
$searchWhereClauses = array();
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($pageColumn['title']), $pageColumn['language']) . ')';
if ($multilingual) {
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($translatedPageColumn['title']), $translatedPageColumn['language']) . ')';
}
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($contentSearchColumn['text']), $contentSearchColumn['language']) . ')';
// add default filters
$whereClauses = array();
$whereClauses[] = '(' . implode(' OR ', $searchWhereClauses) . ')';
$whereClauses[] = $pageColumn['active'] . ' = 1';
$whereClauses[] = "({$pageColumn['activeFrom']} IS NULL OR {$pageColumn['activeFrom']} <= NOW())";
$whereClauses[] = "({$pageColumn['activeTo']} IS NULL OR {$pageColumn['activeTo']} >= NOW())";
$whereClauses[] = $contentColumn['active'] . ' = 1';
$whereClauses[] = $contentColumn['visiblefor'] . (UserUtil::isLoggedIn() ? ' <= 1' : ' >= 1');
$titleFields = $pageColumn['title'];
$additionalJoins = '';
if ($multilingual) {
// if searching in non-default languages, we need the translated title
$titleFields .= ', ' . $translatedPageColumn['title'] . ' AS translatedTitle';
// join also the translation table if required
$additionalJoins = "LEFT OUTER JOIN {$translatedPageTable} ON {$translatedPageColumn['pageId']} = {$pageColumn['id']} AND {$translatedPageColumn['language']} = '{$currentLanguage}'";
// prevent content snippets in other languages
$whereClauses[] = $contentSearchColumn['language'] . ' = \'' . $currentLanguage . '\'';
}
$where = implode(' AND ', $whereClauses);
$sql = "\n SELECT DISTINCT {$titleFields},\n {$contentSearchColumn['text']} AS description,\n {$pageColumn['id']} AS pageId,\n {$pageColumn['cr_date']} AS createdDate\n FROM {$pageTable}\n JOIN {$contentTable}\n ON {$contentColumn['pageId']} = {$pageColumn['id']}\n JOIN {$contentSearchTable}\n ON {$contentSearchColumn['contentId']} = {$contentColumn['id']}\n {$additionalJoins}\n WHERE {$where}\n ";
$result = DBUtil::executeSQL($sql);
if (!$result) {
return LogUtil::registerError($this->__('Error! Could not load items.'));
}
$objectArray = DBUtil::marshallObjects($result);
foreach ($objectArray as $object) {
$pageTitle = $object['page_title'];
if ($object['translatedTitle'] != '') {
$pageTitle = $object['translatedTitle'];
}
$searchItemData = array('title' => $pageTitle, 'text' => $object['description'], 'extra' => $object['pageId'], 'created' => $object['createdDate'], 'module' => 'Content', 'session' => $sessionId);
if (!\DBUtil::insertObject($searchItemData, 'search_result')) {
return \LogUtil::registerError($this->__('Error! Could not save the search results.'));
}
}
return true;
}
示例8: getCookie
/**
* Get a cookie.
*
* @param string $name Name of cookie.
* @param boolean $signed Override system setting to use signatures.
* @param boolean $default Default value.
*
* @return mixed Cookie value as string or bool false.
*/
public static function getCookie($name, $signed = true, $default = '')
{
$cookie = FormUtil::getPassedValue($name, $default, 'COOKIE');
if (System::getVar('signcookies') && !$signed == false) {
return SecurityUtil::checkSignedData($cookie);
}
return $cookie;
}
示例9: setupCsfrProtection
/**
* Listen on 'core.init' module.
*
* @param Zikula_Event $event Event.
*
* @return void
*/
public function setupCsfrProtection(Zikula_Event $event)
{
if ($event['stage'] & Zikula_Core::STAGE_MODS) {
// todo - handle this in DIC later
// inject secret
$def = $this->serviceManager->get('token.generator');
$def->setSecret(System::getVar('signingkey'));
}
}
示例10: smarty_function_timezoneselect
/**
* Template plugin to display timezone list.
*
* Example {timezoneselect selected='Timezone'}.
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view The Zikula_View.
*
* @see function.timezoneselect.php::smarty_function_timezoneselect().
*
* @return string The results of the module function.
*/
function smarty_function_timezoneselect($params, Zikula_View $view)
{
require_once $view->_get_plugin_filepath('function', 'html_options');
$timezones = DateUtil::getTimezones();
if (!isset($params['selected']) || empty($params['selected']) || !isset($timezones[$params['selected']])) {
$params['selected'] = System::getVar('timezone_offset');
}
return smarty_function_html_options(array('options' => $timezones, 'selected' => $params['selected'], 'print_result' => false), $view);
}
示例11: smarty_function_sitename
/**
* Zikula_View function to display the sitename
*
* Available parameters:
* - assign if set, the title will be assigned to this variable
*
* Example
* {sitename}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.sitename.php::smarty_function_sitename()
* @return string The sitename.
*/
function smarty_function_sitename($params, $view)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('sitename', '$modvars.ZConfig.sitename')), E_USER_DEPRECATED);
$sitename = System::getVar('sitename');
if (isset($params['assign'])) {
$view->assign($params['assign'], $sitename);
} else {
return $sitename;
}
}
示例12: smarty_function_id
/**
* Smarty function to generate a valid atom ID for the feed
*
* Example
*
* <id>{id}</id>
*
* @return string the atom ID
*/
function smarty_function_id($params, &$smarty)
{
$baseurl = System::getBaseUrl();
$parts = parse_url($baseurl);
$starttimestamp = strtotime(System::getVar('startdate'));
$startdate = strftime('%Y-%m-%d', $starttimestamp);
$sitename = System::getVar('sitename');
$sitename = preg_replace('/[^a-zA-Z0-9-\\s]/', '', $sitename);
$sitename = DataUtil::formatForURL($sitename);
return "tag:{$parts['host']},{$startdate}:{$sitename}";
}
示例13: createLocalDir
/**
* Create a directory below zikula's local cache directory.
*
* @param string $dir The name of the directory to create.
* @param mixed $mode The (UNIX) mode we wish to create the files with.
* @param bool $absolute Whether to process the passed dir as an absolute path or not.
*
* @return boolean true if successful, false otherwise.
*/
public static function createLocalDir($dir, $mode = null, $absolute = true)
{
$sm = ServiceUtil::getManager();
$base = $sm['kernel.cache_dir'] . '/ztemp';
$path = $base . '/' . $dir;
$mode = isset($mode) ? (int) $mode : System::getVar('system.chmod_dir');
if (!FileUtil::mkdirs($path, $mode, $absolute)) {
return false;
}
return true;
}
示例14: getCookie
/**
* Get a cookie.
*
* @param string $name Name of cookie.
* @param boolean $signed Override system setting to use signatures.
* @param boolean $default Default value.
*
* @return mixed Cookie value as string or bool false.
*/
public static function getCookie($name, $signed = true, $default = '')
{
$request = \ServiceUtil::get('request');
if (!$request->cookies->has($name)) {
return $default;
}
$cookie = $request->cookies->get($name);
if (System::getVar('signcookies') && !$signed == false) {
return SecurityUtil::checkSignedData($cookie);
}
return $cookie;
}
示例15: reloadMultilingualRoutingSettings
/**
* Reloads the multilingual routing settings by reading system variables and checking installed languages.
*
* @param array $args No arguments available.
*
* @return bool
*/
public function reloadMultilingualRoutingSettings($args)
{
unset($args);
$defaultLocale = \System::getVar('language_i18n', $this->getContainer()->getParameter('locale'));
$installedLanguages = \ZLanguage::getInstalledLanguages();
$isRequiredLangParameter = \System::getVar('languageurl', 0);
$configDumper = $this->get('zikula.dynamic_config_dumper');
$configDumper->setConfiguration('jms_i18n_routing', array('default_locale' => $defaultLocale, 'locales' => $installedLanguages, 'strategy' => $isRequiredLangParameter ? 'prefix' : 'prefix_except_default'));
$cacheClearer = $this->get('zikula.cache_clearer');
$cacheClearer->clear('symfony');
return true;
}