本文整理汇总了PHP中RSMembershipHelper::_getItemCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::_getItemCategories方法的具体用法?PHP RSMembershipHelper::_getItemCategories怎么用?PHP RSMembershipHelper::_getItemCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::_getItemCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkContent
public static function checkContent(&$has_access, &$found_shared, &$redirect, $memberships, $extras)
{
// Get the database object
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$shared = RSMembershipHelper::getShared(array('article', 'category'));
$view = JFactory::getApplication()->input->get('view', '', 'cmd');
$id = JFactory::getApplication()->input->get('id', 0, 'int');
if ($view == 'article') {
$categories = RSMembershipHelper::_getItemCategories($id);
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'article' && $share->params == $id || $share->type == 'category' && in_array($share->params, $categories)) {
$found_shared = true;
// Found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$query->clear();
$query->select($db->qn('share_redirect'))->from($db->qn($table))->where($db->qn('id') . ' = ' . $db->q($share->{$what}));
$db->setQuery($query);
$redirect = $db->loadResult();
}
}
}
} elseif ($view == 'category') {
$categories = RSMembershipHelper::_getCategoryParents($id);
array_push($categories, $id);
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'category' && in_array($share->params, $categories)) {
$found_shared = true;
// Found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$query->clear();
$query->select($db->qn('share_redirect'))->from($db->qn($table))->where($db->qn('id') . ' = ' . $db->q($share->{$what}));
$db->setQuery($query);
$redirect = $db->loadResult();
}
}
}
}
}
示例2: checkContentJ16
function checkContentJ16(&$has_access, &$found_shared, &$redirect, $memberships, $extras)
{
// Get the database object
$db =& JFactory::getDBO();
$shared = RSMembershipHelper::getShared(array('article', 'category'));
$view = JRequest::getVar('view');
$id = JRequest::getInt('id');
if ($view == 'article') {
$categories = RSMembershipHelper::_getItemCategories($id);
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'article' && $share->params == $id || $share->type == 'category' && in_array($share->params, $categories)) {
$found_shared = true;
// Found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$db->setQuery("SELECT `share_redirect` FROM " . $table . " WHERE `id`='" . $share->{$what} . "'");
$redirect = $db->loadResult();
}
}
}
} elseif ($view == 'category') {
$categories = RSMembershipHelper::_getCategoryParents($id);
array_push($categories, $id);
foreach ($shared as $share) {
$what = isset($share->membership_id) ? 'membership_id' : 'extra_value_id';
$where = isset($share->membership_id) ? $memberships : $extras;
$table = isset($share->membership_id) ? '#__rsmembership_memberships' : '#__rsmembership_extra_values';
if ($share->type == 'category' && in_array($share->params, $categories)) {
$found_shared = true;
// Found a membership that shares this article
if (!empty($where) && in_array($share->{$what}, $where)) {
$has_access = true;
break;
} else {
// Get the redirect page
$db->setQuery("SELECT `share_redirect` FROM " . $table . " WHERE `id`='" . $share->{$what} . "'");
$redirect = $db->loadResult();
}
}
}
}
}