本文整理汇总了PHP中Xoops\Core\Request::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getVar方法的具体用法?PHP Request::getVar怎么用?PHP Request::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xoops\Core\Request
的用法示例。
在下文中一共展示了Request::getVar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetVar
/**
* @covers Xoops\Core\Request::getVar
*/
public function testGetVar()
{
$varname = 'RequestTest';
$value = 'testing';
$_REQUEST[$varname] = $value;
$this->assertEquals($value, Request::getVar($varname));
$this->assertNull(Request::getVar($varname . 'no-such-key'));
}
示例2: Permission
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package debugbar
* @since
* @author XOOPS Development Team
*/
use Xoops\Core\Request;
use Xmf\Module\Helper;
use Xmf\Module\Permission;
include_once __DIR__ . '/admin_header.php';
$moduleAdmin = new \Xoops\Module\Admin();
$moduleAdmin->displayNavigation('permissions.php');
$helper = Helper::getHelper('monolog');
$permHelper = new Permission();
if ($permHelper) {
// this is the name and item we are going to work with
$gperm_name = 'use_monolog';
$gperm_itemid = 0;
// if this is a post operation get our variables
if ('POST' === Request::getMethod()) {
$name = $permHelper->defaultFieldName($gperm_name, $gperm_itemid);
$groups = Request::getVar($name, array(), 'POST');
$permHelper->savePermissionForItem($gperm_name, $gperm_itemid, $groups);
echo $xoops->alert('success', _MA_MONOLOG_FORM_PROCESSED, _MA_MONOLOG_PERMISSION_FORM);
}
$form = new \Xoops\Form\ThemeForm(_MA_MONOLOG_PERMISSION_FORM, 'form', '', 'POST');
$permElement = $permHelper->getGroupSelectFormForItem($gperm_name, $gperm_itemid, _MA_MONOLOG_PERMISSION_GROUPS, null, true);
$form->addElement($permElement);
$form->addElement(new \Xoops\Form\Button('', 'submit', _MA_MONOLOG_FORM_SUBMIT, 'submit'));
echo $form->render();
}
include_once __DIR__ . '/admin_footer.php';
示例3: launchApp
if ($sessionHelper) {
$var = $sessionHelper->get('test_dir');
if ($var) {
$test_dir = $var;
}
}
// if this is a post operation get our test_dir, save it and redirect to app
if ('GET' == Request::getMethod()) {
$var = Request::getVar('test_dir', '', $hash = 'GET');
if (!empty($var)) {
launchApp($var);
}
}
// if this is a post operation get our test_dir, save it and redirect to app
if ('POST' == Request::getMethod()) {
$test_dir = Request::getVar('test_dir', '', $hash = 'POST');
if (empty($test_dir)) {
$test_dir = $config_test_dir;
}
if ($sessionHelper) {
$sessionHelper->set('test_dir', $test_dir);
}
launchApp($test_dir);
}
$form = new \Xoops\Form\ThemeForm('', 'form', '', 'POST');
$form->addElement(new \Xoops\Form\Text('Unit Test Directory', 'test_dir', 5, 512, $test_dir));
$form->addElement(new \Xoops\Form\Button('', 'submit', 'Launch', 'submit'));
echo $form->render();
echo '<br \\><a href="?test_dir=' . $xoops->path('modules/' . $dir . '/app/tests') . '">Examples</a>';
$xoops->footer();
/**