本文整理汇总了PHP中Input::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::set方法的具体用法?PHP Input::set怎么用?PHP Input::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function test_confirmation_required()
{
global $ACT, $INPUT, $conf, $auth;
$ACT = 'profile_delete';
$conf['profileconfirm'] = true;
$_SERVER['REMOTE_USER'] = 'testuser';
$input = array('do' => $ACT, 'sectok' => getSecurityToken(), 'delete' => '1', 'confirm_delete' => '1', 'oldpass' => 'wrong');
$_POST = $input;
$_REQUEST = $input;
$INPUT = new Input();
$auth = new Mock_Auth_Plugin();
// password check required - it fails, so don't delete profile
$this->assertFalse(auth_deleteprofile());
// now it passes, we're good to go
$INPUT->set('oldpass', 'password');
$INPUT->post->set('oldpass', 'password');
$this->assertTrue(auth_deleteprofile());
}
示例2: testFilterAsClosure
/**
* Test using a closure as a filter
*
* @return null
*/
public function testFilterAsClosure()
{
global $_GET;
global $_POST;
global $_REQUEST;
global $_FILES;
global $_SERVER;
$validEmail = 'woo@test.com';
// create and register a Filter instance
$filter = new Filter();
$filter->add('testVal', function ($value) {
return 'returned: ' . $value;
});
$input = new Input($filter);
$input->set('get', 'testVal', $validEmail);
$result = $input->get('testVal');
$this->assertEquals('returned: ' . $validEmail, $result);
}
示例3: set
}
}
public static function set($key, $val)
{
self::$data[$key] = $val;
return $val;
}
public function has($key)
{
return isset(self::$data[$key]);
}
public static function posted()
{
return !!count(self::$data);
}
public static function all()
{
return self::$data;
}
}
foreach ($_POST as $key => $val) {
Input::set($key, $val);
}
// http://stackoverflow.com/questions/15485354/angular-http-post-to-php-and-undefined
# POST and PUT from angular. DELETE is empty
$json = json_decode(file_get_contents("php://input"));
if ($json) {
foreach ($json as $key => $val) {
Input::set($key, $val);
}
}
示例4: set
/**
* Sets a parameter in $_GET and $_REQUEST
*
* @param string $name Parameter name
* @param mixed $value Value to set
*/
public function set($name, $value)
{
parent::set($name, $value);
$_REQUEST[$name] = $value;
}
示例5: run
public function run()
{
$timer = new SystemTimer();
$connection = null;
$statsConnection = null;
$rawStatsConnection = null;
$trace = new NullTrace();
if (FajrConfig::get('Debug.Trace') === true) {
$trace = new HtmlTrace($timer, "--Trace--");
}
try {
Input::prepare();
$login = Input::get('login');
Input::set('login', null);
$krbpwd = Input::get('krbpwd');
Input::set('krbpwd', null);
$cosignCookie = Input::get('cosignCookie');
Input::set('cosignCookie', null);
// FIXME this should be refactored
if ($login !== null && $krbpwd !== null || $cosignCookie !== null) {
// we are going to log in, so we get a clean session
// this needs to be done before a connection
// is created, because we pass cookie file name
// that contains session_id into AIS2CurlConnection
// If we regenerated the session id afterwards,
// we could not find the cookie file after a redirect
FajrUtils::dropSession();
}
$connection = new connection\CurlConnection(FajrUtils::getCookieFile());
$rawStatsConnection = new connection\StatsConnection($connection, new SystemTimer());
$connection = $rawStatsConnection;
$connection = new connection\GzipDecompressingConnection($connection, FajrConfig::getDirectory('Path.Temporary'));
$connection = new connection\AIS2ErrorCheckingConnection($connection);
$statsConnection = new connection\StatsConnection($connection, new SystemTimer());
$connection = $statsConnection;
$simpleConnection = new connection\HttpToSimpleConnectionAdapter($connection);
AIS2Utils::connection($simpleConnection);
// toto tu je docasne
if (Input::get('logout') !== null) {
FajrUtils::logout($connection);
FajrUtils::redirect();
}
if ($login !== null && $krbpwd !== null) {
$loggedIn = FajrUtils::login(new CosignLogin($login, $krbpwd), $connection);
$login = null;
$krbpwd = null;
} else {
if ($cosignCookie !== null) {
$loggedIn = FajrUtils::login(new AIS2CookieLogin($cosignCookie), $connection);
$cosignCookie = null;
} else {
$loggedIn = FajrUtils::isLoggedIn();
}
}
if ($loggedIn) {
DisplayManager::addContent('<div class=\'logout\'><a class="button negative" href="' . FajrUtils::linkUrl(array('logout' => true)) . '">
<img src="images/door_in.png" alt=""/>Odhlásiť</a></div>');
$adminStudia = new VSES017\AdministraciaStudiaScreen($trace, $simpleConnection);
if (Input::get('studium') === null) {
Input::set('studium', 0);
}
$zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
$zoznamStudiiTable = new Table(TableDefinitions::zoznamStudii(), 'studium', array('tab' => Input::get('tab')));
$zoznamStudiiTable->addRows($zoznamStudii->getData());
$zoznamStudiiTable->setOption('selected_key', Input::get('studium'));
$zoznamStudiiTable->setOption('collapsed', true);
$zoznamStudiiCollapsible = new Collapsible(new HtmlHeader('Zoznam štúdií'), $zoznamStudiiTable, true);
DisplayManager::addContent($zoznamStudiiCollapsible->getHtml());
$zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), Input::get('studium'));
$zapisneListyTable = new Table(TableDefinitions::zoznamZapisnychListov(), 'list', array('studium' => Input::get('studium'), 'tab' => Input::get('tab')));
if (Input::get('list') === null) {
$tmp = $zapisneListy->getData();
$lastList = end($tmp);
Input::set('list', $lastList['index']);
}
$zapisneListyTable->addRows($zapisneListy->getData());
$zapisneListyTable->setOption('selected_key', Input::get('list'));
$zapisneListyTable->setOption('collapsed', true);
$zapisneListyCollapsible = new Collapsible(new HtmlHeader('Zoznam zápisných listov'), $zapisneListyTable, true);
DisplayManager::addContent($zapisneListyCollapsible->getHtml());
$terminyHodnotenia = new VSES017\TerminyHodnoteniaScreen($trace, $simpleConnection, $adminStudia->getIdZapisnyList($trace, Input::get('list')), $adminStudia->getIdStudium($trace, Input::get('list')));
if (Input::get('tab') === null) {
Input::set('tab', 'TerminyHodnotenia');
}
$tabs = new TabManager('tab', array('studium' => Input::get('studium'), 'list' => Input::get('list')));
// FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
// objekty, ktore v konstruktore robia requesty
$hodnoteniaScreen = new VSES017\HodnoteniaPriemeryScreen($trace, $simpleConnection, $adminStudia->getIdZapisnyList($trace, Input::get('list')));
$tabs->addTab('TerminyHodnotenia', 'Moje skúšky', new MojeTerminyHodnoteniaCallback($trace, $terminyHodnotenia, $hodnoteniaScreen));
$tabs->addTab('ZapisSkusok', 'Prihlásenie na skúšky', new ZoznamTerminovCallback($trace, $terminyHodnotenia, $hodnoteniaScreen));
$tabs->addTab('ZapisnyList', 'Zápisný list', new ZapisanePredmetyCallback($trace, $terminyHodnotenia));
$tabs->addTab('Hodnotenia', 'Hodnotenia/Priemery', new HodnoteniaCallback($trace, $hodnoteniaScreen));
$tabs->setActive(Input::get('tab'));
DisplayManager::addContent($tabs->getHtml());
$version = '<div>Fajr verzia ' . hescape(Version::getVersionString()) . '</div>';
DisplayManager::addContent($version);
$statistics = "<div> Fajr made " . $statsConnection->getTotalCount() . " requests and downloaded " . $rawStatsConnection->getTotalSize() . " bytes (" . $statsConnection->getTotalSize() . " bytes uncompressed) of data from AIS2 in " . sprintf("%.3f", $statsConnection->getTotalTime()) . " seconds. It took " . sprintf("%.3f", $timer->getElapsedTime()) . " seconds to generate this page.</div>";
DisplayManager::addContent($statistics);
} else {
DisplayManager::addContent('loginBox', true);
//.........这里部分代码省略.........
示例6: test_set
public function test_set()
{
$_REQUEST = $this->data;
$_POST = $this->data;
$_GET = $this->data;
$INPUT = new Input();
$INPUT->set('test', 'foo');
$this->assertEquals('foo', $_REQUEST['test']);
$this->assertNull($_POST['test']);
$this->assertNull($_GET['test']);
$INPUT->get->set('test2', 'foo');
$this->assertEquals('foo', $_GET['test2']);
$this->assertEquals('foo', $_REQUEST['test2']);
$this->assertNull($_POST['test']);
}
示例7: Table
DisplayManager::addContent($zoznamStudiiCollapsible->getHtml());
$zapisneListy = $adminStudia->getZapisneListy(Input::get('studium'));
$zapisneListyTable = new Table(TableDefinitions::zoznamZapisnychListov(), 'list', array('studium' => Input::get('studium'), 'tab' => Input::get('tab')));
if (Input::get('list') === null) {
$tmp = $zapisneListy->getData();
$lastList = end($tmp);
Input::set('list', $lastList['index']);
}
$zapisneListyTable->addRows($zapisneListy->getData());
$zapisneListyTable->setOption('selected_key', Input::get('list'));
$zapisneListyTable->setOption('collapsed', true);
$zapisneListyCollapsible = new Collapsible('Zoznam zápisných listov', $zapisneListyTable, true);
DisplayManager::addContent($zapisneListyCollapsible->getHtml());
$terminyHodnotenia = new AIS2TerminyHodnoteniaScreen($adminStudia->getIdZapisnyList(Input::get('list')), $adminStudia->getIdStudium(Input::get('list')));
if (Input::get('tab') === null) {
Input::set('tab', 'TerminyHodnotenia');
}
$tabs = new TabManager('tab', array('studium' => Input::get('studium'), 'list' => Input::get('list')));
// FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
// objekty, ktore v konstruktore robia requesty
$hodnoteniaScreen = new AIS2HodnoteniaPriemeryScreen($adminStudia->getIdZapisnyList(Input::get('list')));
$tabs->addTab('TerminyHodnotenia', 'Moje skúšky', new MojeTerminyHodnoteniaCallback($terminyHodnotenia, $hodnoteniaScreen));
$tabs->addTab('ZapisSkusok', 'Prihlásenie na skúšky', new ZoznamTerminovCallback($terminyHodnotenia, $hodnoteniaScreen));
$tabs->addTab('ZapisnyList', 'Zápisný list', new ZapisanePredmetyCallback($terminyHodnotenia));
$tabs->addTab('Hodnotenia', 'Hodnotenia/Priemery', new HodnoteniaCallback($hodnoteniaScreen));
$tabs->setActive(Input::get('tab'));
DisplayManager::addContent($tabs->getHtml());
$timeDiff = microtime(true) - $startTime;
$version = '<div>Fajr verzia ' . hescape(Version::getVersionString()) . '</div>';
DisplayManager::addContent($version);
$statistics = "<div> Fajr made " . $statsConnection->getTotalCount() . " requests and downloaded " . $rawStatsConnection->getTotalSize() . " bytes (" . $statsConnection->getTotalSize() . " bytes uncompressed) of data from AIS2 in " . sprintf("%.3f", $statsConnection->getTotalTime()) . " seconds. It took " . sprintf("%.3f", $timeDiff) . " seconds to generate this page.</div>";
示例8: reset
/**
*
* @static
* @return void
*/
public static function reset()
{
if (self::$_vars) {
foreach (self::$_vars as $var) {
Input::set('post', $var, NULL);
}
}
}