本文整理汇总了PHP中JSession::has方法的典型用法代码示例。如果您正苦于以下问题:PHP JSession::has方法的具体用法?PHP JSession::has怎么用?PHP JSession::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSession
的用法示例。
在下文中一共展示了JSession::has方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveByPost
/**
* Save history that associated with form data
*
* @param JSession $session
* @param mixed $post
* @param string $pageKey
* @param string $title
*
* @return int ID of saved history
*/
private function saveByPost($session, $post, $pageKey, $title)
{
if (!$session->has($post['postSessionKey'])) {
return;
}
$formData = $session->get($post['postSessionKey']);
$formHash = md5($formData);
$form = json_decode($formData);
$id = $form->cid;
if (is_array($id)) {
$id = array_shift($id);
}
$userId = JFactory::getUser()->id;
$history = JTable::getInstance('History', 'PowerAdminTable');
$history->load(array('user_id' => $userId, 'object_key' => $pageKey, 'object_id' => $id));
if ($history->id == null) {
$history->bind(array('user_id' => $userId, 'object_key' => $pageKey, 'object_id' => $id));
}
$history->bind(array('title' => $title, 'visited' => time(), 'form' => $formData, 'form_hash' => $formHash, 'component' => empty($history->component) && !empty($post['parent']) ? $post['parent'] : $history->component, 'list_page' => empty($history->list_page) && !empty($post['name']) ? $post['name'] : $history->list_page, 'list_page_params' => empty($history->list_page_params) && !empty($post['params']) ? $post['params'] : $history->list_page_params, 'icon' => empty($history->icon) && !empty($post['iconPath']) ? $post['iconPath'] : $history->icon, 'css' => empty($history->css) && !empty($post['iconCss']) ? $post['iconCss'] : $history->css));
$history->description = $post['description'];
$history->store();
return $history->id;
}