本文整理汇总了PHP中JRequest::SetVar方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::SetVar方法的具体用法?PHP JRequest::SetVar怎么用?PHP JRequest::SetVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::SetVar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterProcess
/**
* Run right at the end of the form processing
* form needs to be set to record in database for this to hook to be called
*
* @param object $params plugin params
* @param object &$formModel form model
*
* @return bool
*/
public function onAfterProcess($params, &$formModel)
{
jimport('joomla.filesystem.file');
$files[] = COM_FABRIK_BASE . 'components/com_kunena/class.kunena.php';
$define = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.defines.php';
$files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.defines.php';
$files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.link.class.php';
$files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.smile.class.php';
if (!JFile::exists($define)) {
return JError::raiseError(500, 'could not find the Kunena component');
}
require_once $define;
foreach ($files as $file) {
require_once $file;
}
if (JFile::exists(KUNENA_PATH_FUNCS . '/post.php')) {
$postfile = KUNENA_PATH_FUNCS . '/post.php';
} else {
$postfile = KUNENA_PATH_TEMPLATE_DEFAULT . '/post.php';
}
$w = new FabrikWorker();
// $fbSession = CKunenaSession::getInstance();
// Don't need this, session is loaded in CKunenaPost
$catid = $params->get('kunena_category', 0);
$parentid = 0;
$action = 'post';
// Added action in request
JRequest::setVar('action', $action);
$func = 'post';
$contentURL = 'empty';
JRequest::setVar('catid', $catid);
$msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData);
$subject = $params->get('kunena_title');
JRequest::SetVar('message', $msg);
$subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData);
// Added subject in request
JRequest::SetVar('subject', $subject);
$origId = JRequest::getVar('id');
JRequest::setVar('id', 0);
/*
ob_start();
include ($postfile);
ob_end_clean();
*/
ob_start();
include $postfile;
$mypost = new CKunenaPost();
// Public CKunenaPost::display() will call protected method CKunenaPost::post() if JRequest action is 'post'
$mypost->display();
ob_end_clean();
JRequest::setVar('id', $origId);
}
示例2: onBeforeStore
/**
* process the plugin, called when form is submitted
*
* @param object $params
* @param object form
*/
function onBeforeStore( &$params, &$formModel )
{
return;
jimport('joomla.filesystem.file');
$files[] = COM_FABRIK_BASE.'administrator'.DS.'components'.DS.'com_kunena'.DS.'language'.DS.'kunena.english.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'class.kunena.php';
$define = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.session.class.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php';
$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'template'.DS.'default'.DS.'smile.class.php';
if (!JFile::exists($define)) {
return JError::raiseError(500, 'could not find the Kunena component');
}
require_once($define);
foreach ($files as $file) {
require_once($file);
}
if (JFile::exists(KUNENA_ABSTMPLTPATH . '/post.php')) {
$postfile = KUNENA_ABSTMPLTPATH . '/post.php';
}
else {
$postfile = KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'post.php';
}
$w = new FabrikWorker();
$fbSession = CKunenaSession::getInstance();
$catid =$params->get('kunena_category', 0);
$parentid = 0;
$action = 'post';
$func = 'post';
$contentURL = 'empty';
JRequest::setVar('catid', $catid);
$msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData);
$subject = $params->get('kunena_title');
JRequest::SetVar('message', $msg);
$subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData);
$origId = JRequest::getVar('id');
JRequest::setVar('id', 0);
ob_start();
include ($postfile);
ob_end_clean();
JRequest::setVar('id', $origId);
}
示例3: placeCoordinates
/**
* get the coordinates for a place
* @param string $place value selected in widget
*/
private function placeCoordinates($place)
{
if (isset($this->placeCoordinates)) {
return $this->placeCoordinates;
}
$mapElement =& $this->getMapElement();
$mapName = $mapElement->getFullName(false, true, false);
$placeElement =& $this->getPlaceElement()->getElement();
$db =& $this->model->getDb();
$usekey = JRequest::getVar('usekey');
JRequest::setVar('usekey', $placeElement->name);
$row =& $this->model->getRow($db->Quote($place));
JRequest::SetVar('usekey', $usekey);
if (is_object($row)) {
$coords = explode(':', str_replace(array('(', ')'), '', $row->{$mapName}));
$this->placeCoordinates = explode(',', $coords[0]);
} else {
//hmm no exact match lets unset the query and try to find a partial match
//(perhaps the user didnt select anything from the dropdown?)
unset($this->model->getForm()->query);
$row =& $this->model->findRow($placeElement->name, $place);
if (is_object($row)) {
$coords = explode(':', str_replace(array('(', ')'), '', $row->{$mapName}));
$this->placeCoordinates = explode(',', $coords[0]);
} else {
$this->placeCoordinates = array('', '');
}
}
return $this->placeCoordinates;
}
示例4: defined
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/** 1. retrieve input */
$singular = JRequest::getCmd('singular');
$plural = JRequest::getCmd('plural');
/** 2. errors */
if ($singular == '' || $plural == '') {
echo JText::_('COM_JFOOBAR1');
echo JText::_('COM_JFOOBAR2') . '<br /><br />';
echo JText::_('COM_JFOOBAR3') . '<br /><br />';
echo '<strong>' . JURI::base() . JText::_('COM_JFOOBAR4') . '</strong>' . '<br /><br />';
echo JText::_('COM_JFOOBAR5') . '<br /><br />';
echo JText::_('COM_JFOOBAR6') . '<br /><br />';
echo JText::_('COM_JFOOBAR7') . '<br /><br />';
echo JText::_('COM_JFOOBAR8');
return;
}
/** 3. copy, rename, replace literals and install */
DEFINE('MOLAJO', 1);
JRequest::SetVar('createtype', 'component');
JRequest::setVar('singular', $singular);
JRequest::setVar('plural', $plural);
JRequest::setVar('source', 'jfoobars');
include_once dirname(__FILE__) . '/media/create.php';
$create = new InstallerModelCreate();
$results = $create->create();
/** 4. redirect to new component */
$controller = JController::getInstance('jfoobar');
$controller->setRedirect(JRoute::_('index.php?option=com_categories&extension=com_' . $plural, false));
$controller->redirect();