本文整理汇总了PHP中Xoops\Core\Request::getText方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getText方法的具体用法?PHP Request::getText怎么用?PHP Request::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xoops\Core\Request
的用法示例。
在下文中一共展示了Request::getText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setVarsFromRequest
/**
* The name says it all
*/
public function setVarsFromRequest()
{
$xoops = Xoops::getInstance();
//Required fields
if (isset($_REQUEST['categoryid'])) {
$this->setVar('categoryid', Request::getInt('categoryid'));
}
if (isset($_REQUEST['title'])) {
$this->setVar('title', Request::getString('title'));
}
if (isset($_REQUEST['body'])) {
$this->setVar('body', Request::getText('body'));
}
//Not required fields
if (isset($_REQUEST['summary'])) {
$this->setVar('summary', Request::getText('summary'));
}
if (isset($_REQUEST['subtitle'])) {
$this->setVar('subtitle', Request::getString('subtitle'));
}
if (isset($_REQUEST['item_tag'])) {
$this->setVar('item_tag', Request::getString('item_tag'));
}
if (isset($_REQUEST['image_featured'])) {
$image_item = Request::getArray('image_item');
$image_featured = Request::getString('image_featured');
//Todo: get a better image class for xoops!
//Image hack
$image_item_ids = array();
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
$qb->select('i.image_id', 'i.image_name')->fromPrefix('image', 'i')->orderBy('i.image_id');
$result = $qb->execute();
while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
$image_name = $myrow['image_name'];
$id = $myrow['image_id'];
if ($image_name == $image_featured) {
$this->setVar('image', $id);
}
if (in_array($image_name, $image_item)) {
$image_item_ids[] = $id;
}
}
$this->setVar('images', implode('|', $image_item_ids));
}
if (isset($_REQUEST['uid'])) {
$this->setVar('uid', Request::getInt('uid'));
} elseif ($this->isNew()) {
$this->setVar('uid', $xoops->isUser() ? $xoops->user->getVar('uid') : 0);
}
if (isset($_REQUEST['author_alias'])) {
$this->setVar('author_alias', Request::getString('author_alias'));
if ($this->getVar('author_alias') != '') {
$this->setVar('uid', 0);
}
}
if (isset($_REQUEST['datesub'])) {
$this->setVar('datesub', strtotime($_REQUEST['datesub']['date']) + $_REQUEST['datesub']['time']);
} elseif ($this->isNew()) {
$this->setVar('datesub', time());
}
if (isset($_REQUEST['item_short_url'])) {
$this->setVar('short_url', Request::getString('item_short_url'));
}
if (isset($_REQUEST['item_meta_keywords'])) {
$this->setVar('meta_keywords', Request::getString('item_meta_keywords'));
}
if (isset($_REQUEST['item_meta_description'])) {
$this->setVar('meta_description', Request::getString('item_meta_description'));
}
if (isset($_REQUEST['weight'])) {
$this->setVar('weight', Request::getInt('weight'));
}
if (isset($_REQUEST['allowcomments'])) {
$this->setVar('cancomment', Request::getInt('allowcomments'));
} elseif ($this->isNew()) {
$this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments'));
}
if (isset($_REQUEST['status'])) {
$this->setVar('status', Request::getInt('status'));
} elseif ($this->isNew()) {
$this->setVar('status', $this->publisher->getConfig('submit_status'));
}
if (isset($_REQUEST['dohtml'])) {
$this->setVar('dohtml', Request::getInt('dohtml'));
} elseif ($this->isNew()) {
$this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml'));
}
if (isset($_REQUEST['dosmiley'])) {
$this->setVar('dosmiley', Request::getInt('dosmiley'));
} elseif ($this->isNew()) {
$this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley'));
}
if (isset($_REQUEST['doxcode'])) {
$this->setVar('doxcode', Request::getInt('doxcode'));
} elseif ($this->isNew()) {
$this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode'));
}
//.........这里部分代码省略.........
示例2: testGetText
/**
* @covers Xoops\Core\Request::getText
*/
public function testGetText()
{
$varname = 'RequestTest';
$_REQUEST[$varname] = 'Lorem ipsum </i><script>alert();</script>';
$this->assertEquals($_REQUEST[$varname], Request::getText($varname));
}