本文整理汇总了PHP中Input::setGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::setGet方法的具体用法?PHP Input::setGet怎么用?PHP Input::setGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::setGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggleVisibility
/**
* Disable/enable a user group
*
* @param integer $intId
* @param boolean $blnVisible
* @param DataContainer $dc
*/
public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
{
// Set the ID and action
Input::setGet('id', $intId);
Input::setGet('act', 'toggle');
if ($dc) {
$dc->id = $intId;
// see #8043
}
// Check the field access
if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
$this->log('Not enough permissions to activate/deactivate member group ID "' . $intId . '"', __METHOD__, TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
$objVersions = new Versions('tl_member_group', $intId);
$objVersions->initialize();
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $dc ?: $this);
}
}
}
// Update the database
$this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
$objVersions->create();
}
示例2: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
// Do not index or cache the page if no news item has been specified
if (!\Input::get('items')) {
/** @var \PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
$this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
// Do not index or cache the page if there are no archives
if (!is_array($this->news_archives) || empty($this->news_archives)) {
/** @var \PageModel $objPage */
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
return parent::generate();
}
示例3: generate
/**
* @return string
*/
public function generate()
{
// Backend
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['member_rating'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('member', \Input::get('auto_item'));
}
// activate comment by token via url
if (strlen(\Input::get('activation_token'))) {
$this->activateOrDelete();
exit;
}
// set the ratedUser var
$this->ratedUser = \MemberModel::findByPk(\Input::get('member'));
if ($this->ratedUser === null) {
return '';
}
// overwrite default template
if ($this->memberRatingDetailTemplate != '') {
$this->strTemplate = $this->memberRatingDetailTemplate;
}
return parent::generate();
}
示例4: getPageIdFromUrlStr
/**
* @param $arrFragments
* @return array
*/
public function getPageIdFromUrlStr($arrFragments)
{
if (count($arrFragments) > 0 && !\Config::get('taxonomyDisable')) {
$setTaxonomy = false;
$arrFolderUrlFragments = array();
$arrTempFragments = $arrFragments;
if (\Config::get('folderUrl') && isset($arrFragments[0]) && !in_array('auto_item', $arrFragments)) {
$arrFolderUrlFragments = explode('/', $arrFragments[0]);
}
$arrTempFragments = count($arrFolderUrlFragments) > 1 ? $arrFolderUrlFragments : $arrTempFragments;
$setAutoItems = $this->setParameter($arrTempFragments);
$arrCustomizedFragments = array();
if ($setAutoItems['specie'] || $setAutoItems['auto_item']) {
$rootTaxonomy = $this->Database->prepare('SELECT id FROM tl_taxonomies WHERE (alias = ? OR alias = ?) AND published = "1"')->limit(1)->execute($setAutoItems['specie'], $setAutoItems['auto_item']);
if ($rootTaxonomy->numRows) {
$setTaxonomy = true;
}
}
if ($setTaxonomy) {
$arrCustomizedFragments[] = $arrFragments[0];
foreach ($setAutoItems as $param => $value) {
if ($param === 'auto_item') {
$arrCustomizedFragments[] = $param;
$arrCustomizedFragments[] = $value;
continue;
}
\Input::setGet($param, $value);
}
// overwrite fragments
$arrFragments = $arrCustomizedFragments;
}
}
return array_unique($arrFragments);
}
示例5: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### FAQ READER ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
// Do not index or cache the page if no FAQ has been specified
if (!\Input::get('items')) {
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
$this->faq_categories = deserialize($this->faq_categories);
// Do not index or cache the page if there are no categories
if (!is_array($this->faq_categories) || empty($this->faq_categories)) {
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
return '';
}
return parent::generate();
}
示例6: generate
/**
* Generate the module
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['mod_airquality_full'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Set the item from the auto_item parameter
if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
// Return if there are no items
if (!\Input::get('items')) {
return '';
}
if (TL_MODE == 'FE') {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/airquality/assets/js/Chart.min.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/airquality/assets/styles/style.css';
}
return parent::generate();
}
示例7: toggleVisibility
/**
* Disable/enable
*
* @param integer $intId
* @param boolean $blnVisible
* @param DataContainer $dc
*/
public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
{
// Set the ID and action
Input::setGet('id', $intId);
Input::setGet('act', 'toggle');
if ($dc) {
$dc->id = $intId;
// see #8043
}
// Check the field access
if (!$this->User->hasAccess('tl_articlefilter_groups::published', 'alexf')) {
$this->log('Not enough permissions to publish/unpublish articlefilter group ID "' . $intId . '"', __METHOD__, TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_articlefilter_groups']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_articlefilter_groups']['fields']['published']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $dc ?: $this);
}
}
}
$time = time();
// Update the database
$this->Database->prepare("UPDATE tl_articlefilter_groups SET tstamp={$time}, published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
}
示例8: toggleVisibility
/**
* Disable/enable a user group
* @param integer
* @param boolean
* @param \DataContainer
*/
public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
{
// Check permissions to edit
Input::setGet('id', $intId);
Input::setGet('act', 'toggle');
$this->checkPermission();
// Check permissions to publish
if (!$this->User->hasAccess('tl_product_price::published', 'alexf')) {
$this->log('Not enough permissions to publish/unpublish price item ID "' . $intId . '"', __METHOD__, TL_ERROR);
$this->redirect('contao/main.php?act=error');
}
$objVersions = new Versions('tl_product_price', $intId);
$objVersions->initialize();
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $dc ?: $this);
}
}
}
// Update the database
$this->Database->prepare("UPDATE tl_product_price SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
$objVersions->create();
$this->log('A new version of record "tl_product_price.id=' . $intId . '" has been created' . $this->getParentEntries('tl_product_price', $intId), __METHOD__, TL_GENERAL);
}
示例9: generateRelated
/**
* Generate the list in related categories mode
*
* Use the categories of the current news item. The module must be
* on the same page as news reader module.
*
* @return string
*/
protected function generateRelated()
{
// Set the item from the auto_item parameter
if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
// Return if there is no item specified
if (!\Input::get('items')) {
return '';
}
$this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
// Return if there are no archives
if (!is_array($this->news_archives) || empty($this->news_archives)) {
return '';
}
$news = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
// Return if the news item was not found
if ($news === null) {
return '';
}
$GLOBALS['NEWS_FILTER_CATEGORIES'] = false;
$GLOBALS['NEWS_FILTER_DEFAULT'] = deserialize($news->categories, true);
$GLOBALS['NEWS_FILTER_EXCLUDE'] = array($news->id);
return parent::generate();
}
示例10: generate
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['memberreader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// logic for this is done in HeimrichHannot\Memberplus\Hooks::getPageIdFromUrlHook
if (\Input::get('article_reader')) {
\Input::setGet('items', \Input::get('article_reader'));
} else {
if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
}
if (!\Input::get('items')) {
return '';
}
$this->mlGroups = deserialize($this->mlGroups);
if (!is_array($this->mlGroups) || empty($this->mlGroups)) {
return '';
}
return parent::generate();
}
示例11: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist_plus'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
// Return if there are no archives
if (!is_array($this->news_archives) || empty($this->news_archives)) {
return '';
}
$this->news_featured = 'featured';
// unset search string for highlighted section
\Input::setGet('searchKeywords', null);
$this->objArticles = NewsPlusModel::findPublishedByPids($this->news_archives, array(), array(), $this->news_featured == 'featured', $this->numberOfItems, 0);
if ($this->objArticles === null) {
return '';
}
return parent::generate();
}
示例12: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### Filial-REGION-SUCHE ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
// Ajax Requests abfangen
if (\Input::get('id') && $this->Environment->get('isAjaxRequest')) {
$this->generateAjax();
exit;
}
// template overwrite
if (strlen($this->mod_bm_template)) {
$this->strTemplate = $this->mod_bm_template;
}
// Set the item from the auto_item parameter
if (!isset($_GET['s']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('s', \Input::get('auto_item'));
}
return parent::generate();
}
示例13: toggleVisibility
/**
* Disable/enable a user group
*
* @param integer $intId
* @param boolean $blnVisible
* @param DataContainer $dc
*
* @throws Contao\CoreBundle\Exception\AccessDeniedException
*/
public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
{
// Set the ID and action
Input::setGet('id', $intId);
Input::setGet('act', 'toggle');
if ($dc) {
$dc->id = $intId;
// see #8043
}
// Check the field access
if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to activate/deactivate member group ID ' . $intId . '.');
}
$objVersions = new Versions('tl_member_group', $intId);
$objVersions->initialize();
// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $dc ?: $this);
}
}
}
// Update the database
$this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
$objVersions->create();
$this->log('A new version of record "tl_member_group.id=' . $intId . '" has been created' . $this->getParentEntries('tl_member_group', $intId), __METHOD__, TL_GENERAL);
}
示例14: __construct
public function __construct()
{
// Set the item from the auto_item parameter
if (!isset($_GET['store']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('store', \Input::get('auto_item'));
}
parent::__construct();
}
示例15: searchGlossarTerms
public function searchGlossarTerms($strContent, $strTemplate)
{
global $objPage;
if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
\Input::setGet('items', \Input::get('auto_item'));
}
$arrGlossar = array($objPage->glossar);
if ($objPage->disableGlossar == 1) {
return $strContent;
}
// HOOK: search for terms in Events, faq and news
$arrGlossar = array($objPage->glossar);
if (isset($GLOBALS['TL_HOOKS']['glossarContent']) && is_array($GLOBALS['TL_HOOKS']['glossarContent'])) {
foreach ($GLOBALS['TL_HOOKS']['glossarContent'] as $type => $callback) {
$this->import($callback[0]);
$cb_output = $this->{$callback}[0]->{$callback}[1](\Input::get('items'), $strContent, $template, $objPage->language);
if (!empty($cb_output)) {
$arrGlossar[] = $cb_output;
}
}
}
if (!empty($arrGlossar)) {
$this->term = implode('|', $arrGlossar);
}
$this->term = str_replace('||', '|', $this->term);
$Glossar = \GlossarModel::findByLanguage($objPage->language);
if (empty($Glossar)) {
$Glossar = \GlossarModel::findByFallback(1);
}
$arrGlossar = array();
if (empty($Glossar)) {
return $strContent;
}
while ($Glossar->next()) {
$arrGlossar[] = $Glossar->id;
}
/* replace content with tags to stop glossary replacement */
if (\Config::get('activateGlossarTags') == 1) {
$GlossarTags = $this->replaceGlossarTags($strContent);
}
$Term = \SwGlossarModel::findBy(array("title IN ('" . str_replace('|', "','", $this->term) . "') AND pid IN ('" . implode("','", $arrGlossar) . "')"), array($Glossar->id), array('order' => ' CHAR_LENGTH(title) DESC'));
$strContent = $this->replace($strContent, $Term, $Glossar);
if (\Config::get('glossar_no_fallback') == 1 || $objPage->glossar_no_fallback == 1) {
/* reinsert glossar hidden content */
if (\Config::get('activateGlossarTags') == 1) {
$strContent = $this->insertTagContent($strContent, $GlossarTags);
}
return $strContent;
}
/* Replace the fallback languages */
$Term = \SwGlossarModel::findBy(array("title IN ('" . str_replace('|', "','", $objPage->fallback_glossar) . "')"), array(), array('order' => ' CHAR_LENGTH(title) DESC'));
$strContent = $this->replace($strContent, $Term);
/* reinsert glossar hidden content */
if (\Config::get('activateGlossarTags') == 1) {
$strContent = $this->insertTagContent($strContent, $GlossarTags);
}
return $strContent;
}