本文整理汇总了PHP中Contao\Input::resetCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::resetCache方法的具体用法?PHP Input::resetCache怎么用?PHP Input::resetCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contao\Input
的用法示例。
在下文中一共展示了Input::resetCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetPost
/**
* Tests the getPost() method.
*
* @dataProvider postProvider
*/
public function testGetPost($key, $input, $value, $expected)
{
$widget = $this->getMock('Contao\\Widget');
$class = new \ReflectionClass('Contao\\Widget');
$method = $class->getMethod('getPost');
$method->setAccessible(true);
$_POST[$input] = $value;
Input::resetCache();
Input::initialize();
$this->assertEquals($expected, $method->invoke($widget, $key));
}
示例2: testGetPost
/**
* Tests the getPost() method.
*
* @param string $key
* @param string $input
* @param mixed $value
* @param string $expected
*
* @dataProvider postProvider
*/
public function testGetPost($key, $input, $value, $expected)
{
// Prevent "undefined index" errors
$errorReporting = error_reporting();
error_reporting($errorReporting & ~E_NOTICE);
$widget = $this->getMock('Contao\\Widget');
$class = new \ReflectionClass('Contao\\Widget');
$method = $class->getMethod('getPost');
$method->setAccessible(true);
$_POST[$input] = $value;
Input::resetCache();
Input::initialize();
$this->assertEquals($expected, $method->invoke($widget, $key));
// Restore the error reporting level
error_reporting($errorReporting);
}
示例3: restorePost
/**
* Restore the post values with the passed values.
*
* @param array $post The Post values to restore.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
*/
private function restorePost($post)
{
$_POST = $post;
Input::resetCache();
}
示例4: doReplace
//.........这里部分代码省略.........
} else {
$picture = \System::getContainer()->get('contao.image.picture_factory')->create(TL_ROOT . '/' . $strFile, $size);
$picture = array('img' => $picture->getImg(TL_ROOT), 'sources' => $picture->getSources(TL_ROOT));
$picture['alt'] = $alt;
$picture['class'] = $class;
$pictureTemplate = new \FrontendTemplate($strTemplate);
$pictureTemplate->setData($picture);
$arrCache[$strTag] = $pictureTemplate->parse();
}
// Add a lightbox link
if ($rel != '') {
if (strncmp($rel, 'lightbox', 8) !== 0) {
$attribute = ' rel="' . \StringUtil::specialchars($rel) . '"';
} else {
$attribute = ' data-lightbox="' . \StringUtil::specialchars(substr($rel, 8)) . '"';
}
$arrCache[$strTag] = '<a href="' . TL_FILES_URL . $strFile . '"' . ($alt != '' ? ' title="' . \StringUtil::specialchars($alt) . '"' : '') . $attribute . '>' . $arrCache[$strTag] . '</a>';
}
} catch (\Exception $e) {
$arrCache[$strTag] = '';
}
break;
// Files (UUID or template path)
// Files (UUID or template path)
case 'file':
if (\Validator::isUuid($elements[1])) {
$objFile = \FilesModel::findByUuid($elements[1]);
if ($objFile !== null) {
$arrCache[$strTag] = $objFile->path;
break;
}
}
$arrGet = $_GET;
\Input::resetCache();
$strFile = $elements[1];
// Take arguments and add them to the $_GET array
if (strpos($elements[1], '?') !== false) {
$arrChunks = explode('?', urldecode($elements[1]));
$strSource = \StringUtil::decodeEntities($arrChunks[1]);
$strSource = str_replace('[&]', '&', $strSource);
$arrParams = explode('&', $strSource);
foreach ($arrParams as $strParam) {
$arrParam = explode('=', $strParam);
$_GET[$arrParam[0]] = $arrParam[1];
}
$strFile = $arrChunks[0];
}
// Check the path
if (\Validator::isInsecurePath($strFile)) {
throw new \RuntimeException('Invalid path ' . $strFile);
}
// Include .php, .tpl, .xhtml and .html5 files
if (preg_match('/\\.(php|tpl|xhtml|html5)$/', $strFile) && file_exists(TL_ROOT . '/templates/' . $strFile)) {
ob_start();
include TL_ROOT . '/templates/' . $strFile;
$arrCache[$strTag] = ob_get_clean();
}
$_GET = $arrGet;
\Input::resetCache();
break;
// HOOK: pass unknown tags to callback functions
// HOOK: pass unknown tags to callback functions
default:
if (isset($GLOBALS['TL_HOOKS']['replaceInsertTags']) && is_array($GLOBALS['TL_HOOKS']['replaceInsertTags'])) {
foreach ($GLOBALS['TL_HOOKS']['replaceInsertTags'] as $callback) {
$this->import($callback[0]);