本文整理匯總了PHP中IPSMember::canRepUp方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::canRepUp方法的具體用法?PHP IPSMember::canRepUp怎麽用?PHP IPSMember::canRepUp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::canRepUp方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: repButtons
function repButtons($member, $data = array())
{
$IPBHTML = "";
if (IPSLib::locationHasHooks('skin_global_other', $this->_funcHooks['repButtons'])) {
$count_fbe0dd9307850715511aba5ed44b249a = is_array($this->functionData['repButtons']) ? count($this->functionData['repButtons']) : 0;
$this->functionData['repButtons'][$count_fbe0dd9307850715511aba5ed44b249a]['member'] = $member;
$this->functionData['repButtons'][$count_fbe0dd9307850715511aba5ed44b249a]['data'] = $data;
}
// Apps can set the key empty to disable, but this will allow all apps to use the popup to show who repped
if (!isset($data['jsCallback'])) {
$data['jsCallback'] = "ipb.global.repPopUp( this, {$data['primaryId']}, '{$data['app']}', '{$data['type']}' );";
}
$repClickable = ($this->memberData['gbw_view_reps'] and $data['jsCallback']) ? 'onclick="' . $data['jsCallback'] . '"' : '';
$this->templateVars['repClickable'] = "";
$this->__default__templateVars['repClickable'] = "";
if ($this->memberData['gbw_view_reps']) {
$this->templateVars['repClickable'] = " clickable";
} else {
$this->templateVars['repClickable'] = $this->__default__templateVars['repClickable'];
}
$IPBHTML .= "" . ($this->settings['reputation_enabled'] ? "" . (!($this->settings['reputation_protected_groups'] && in_array($member['member_group_id'], explode(',', $this->settings['reputation_protected_groups']))) ? "" . ($this->settings['reputation_point_types'] == 'like' ? "<div class='ipsLikeBar right clearfix' id='{$data['domCountId']}'>\n <ul class='ipsList_inline'>\n " . ((!isset($data['hide_text']) or !$data['hide_text']) ? "<li id=\"{$data['domLikeStripId']}\" class='ipsLikeBar_info' " . (!$data['likeFormatted'] ? "style=\"display:none\"" : "") . ">\n {$data['likeFormatted']}\n </li>" : "") . "\n " . (IPSMember::canGiveRep($data, $member) !== false && $this->memberData['member_id'] ? "<li " . (IPSMember::canRepUp($data, $member) === false ? "style=\"display:none\"" : "") . ">\n <a class='ipsLikeButton ipsLikeButton_enabled rep_up' href='{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}' title='{$this->lang->words['do_like_up']}'>{$this->lang->words['like_this']}</a>\n </li>\n <li " . (IPSMember::canRepDown($data, $member) === false ? "style=\"display:none\"" : "") . ">\n <a class='ipsLikeButton ipsLikeButton_disabled rep_down' href='{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=-1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}' title='{$this->lang->words['do_like_down']}'>{$this->lang->words['unlike_this']}</a>\n </li>" : "") . "\n </ul>\n </div>" : "<div class='rep_bar clearfix " . (!$data['position'] || $data['position'] == 'right' ? "right" : "") . "' id='{$data['domCountId']}'>\n \n " . (IPSMember::canGiveRep($data, $member) !== false && $this->memberData['member_id'] ? "\n<div class=\"orate-btns\">\n <span>\n <a href='{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}' class='rep_up' title='{$this->lang->words['reputation_up']}' >" . $this->registry->getClass('output')->getReplacement("rep_up") . "</a>\n <a href='{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=-1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}' class='rep_down' title='{$this->lang->words['reputation_down']}' >" . $this->registry->getClass('output')->getReplacement("rep_down") . "</a>\n </span>\n </div>\n " : "") . "\n\n " . ($this->settings['reputation_point_types'] != 'like' ? "" . ($data['rep_points'] == 0 ? "\n <span class='reputation2 zero2 rep_show" . $this->templateVars["repClickable"] . "' title='{$this->lang->words['reputation']}' {$repClickable}>\n " : "") . "\n " . ($data['rep_points'] > 0 ? "\n <span class='reputation2 positive2 rep_show" . $this->templateVars["repClickable"] . "' title='{$this->lang->words['reputation']}' {$repClickable}>\n " : "") . "\n " . ($data['rep_points'] < 0 ? "\n <span class='reputation2 negative2 rep_show" . $this->templateVars["repClickable"] . "' title='{$this->lang->words['reputation']}' {$repClickable}>\n " : "") . "\n " . intval($data['rep_points']) . "\n </span>" : "") . "\n</div>") . "" : "") . "" : "") . "\n<script type='text/javascript'>\n ipb.global.registerReputation( '{$data['domCountId']}', { domLikeStripId: '{$data['domLikeStripId']}', app: '{$data['app']}', type: '{$data['type']}', typeid: '{$data['primaryId']}' }, parseInt('{$data['rep_points']}') );\n</script>";
return $IPBHTML;
}
示例2: _doRating
/**
* Adds a rating to the index
*
* @return @e void
*/
protected function _doRating()
{
/* INIT */
$app = $this->request['app_rate'];
$type = $this->request['type'];
$type_id = intval($this->request['type_id']);
$rating = intval($this->request['rating']);
/* Check */
if (!$app || !$type || !$type_id || !$rating) {
$this->returnString($this->lang->words['ajax_incomplete_data']);
}
/* Get the rep library */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
$repCache = new $classToLoad();
/* Add the rating */
if ($repCache->addRate($type, $type_id, $rating, '', 0, $app) !== false) {
$formatted = $repCache->getLikeFormatted(array('id' => $type_id, 'app' => $app, 'type' => $type));
$current = $repCache->getCurrentMemberRating(array('id' => $type_id, 'app' => $app, 'type' => $type, 'memberId' => $this->memberData['member_id']));
$rating = $repCache->getCurrentRating(array('id' => $type_id, 'app' => $app, 'type' => $type));
$this->returnJsonArray(array('status' => 'ok', 'rating' => $rating, 'likeData' => $formatted, 'canRepUp' => IPSMember::canRepUp($current, $this->memberData), 'canRepDown' => IPSMember::canRepDown($current, $this->memberData)));
} else {
if ($repCache->error_message) {
$this->returnJsonError($repCache->error_message);
}
$this->returnString('done');
}
}
示例3: repButtons
function repButtons($member, $data = array())
{
$IPBHTML = "";
if (IPSLib::locationHasHooks('skin_global_other', $this->_funcHooks['repButtons'])) {
$count_13530034eaab611754789dc47e2536e3 = is_array($this->functionData['repButtons']) ? count($this->functionData['repButtons']) : 0;
$this->functionData['repButtons'][$count_13530034eaab611754789dc47e2536e3]['member'] = $member;
$this->functionData['repButtons'][$count_13530034eaab611754789dc47e2536e3]['data'] = $data;
}
$IPBHTML .= "" . ((!($this->settings['reputation_protected_groups'] && in_array($member['member_group_id'], explode(',', $this->settings['reputation_protected_groups']))) and $this->memberData['member_id']) ? "" . ($this->settings['reputation_point_types'] == 'like' ? "" . (IPSMember::canGiveRep($data, $member) !== false ? "" . (IPSMember::canRepUp($data, $member) !== false ? "\n\t\t\t\t<likeURL><![CDATA[{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}]]></likeURL>\n\t\t\t" : "") . "" : "") . "" : "" . (IPSMember::canGiveRep($data, $member) !== false ? "\n\t\t\t<repupURL><![CDATA[{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}]]></repupURL>\n\t\t" : "") . "\n\t\t" . (IPSMember::canRepDown($data, $member) !== false ? "\n\t\t\t<repDownURL><![CDATA[{$this->settings['base_url']}app=core&module=global&section=reputation&do=add_rating&app_rate={$data['app']}&type={$data['type']}&type_id={$data['primaryId']}&rating=-1&secure_key={$this->member->form_hash}&post_return={$data['primaryId']}]]></repDownURL>\n\t\t" : "") . "") . "" : "") . "";
return $IPBHTML;
}
示例4: addRate
/**
* Adds a rating to the index and updates caches
*
* @access public
* @param string $type Type of content, ex; Post
* @param integer $type_id ID of the type, ex: pid
* @param integer $rating Either 1 or -1
* @param string $message Message associated with this rating
* @param integer $member_id Id of the owner of the content being rated
* @param string [$app] App for this content, by default the current application
* @todo [Future] Move forum notifications to an onRep memberSync callback
* @return bool
*/
public function addRate($type, $type_id, $rating, $message = '', $member_id = 0, $app = '')
{
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
/* Online? */
if (!$this->rep_system_on) {
$this->error_message = $this->lang->words['reputation_offline'];
return false;
}
/* INIT */
$app = $app ? $app : ipsRegistry::$current_application;
$rating = intval($rating);
if (!$this->memberData['member_id']) {
$this->error_message = $this->lang->words['reputation_guest'];
return false;
}
if ($rating != -1 && $rating != 1) {
$this->error_message = $this->lang->words['reputation_invalid'];
return false;
}
/* Does the rep item exist? */
if (!$this->likeItemExists($app, $type, $type_id)) {
/* See ticket #845557 - item may not exist when not in LIKE mode. Need to add functionalty so each app can return boolean if item exists in native tables */
//$this->error_message = $this->lang->words['reputation_invalid'];
//return false;
}
/* Check for existing rating */
$currentRating = $this->getCurrentMemberRating(array('app' => $app, 'type' => $type, 'id' => $type_id, 'memberId' => $this->memberData['member_id']));
/* Check the point types */
if ($rating == -1 && IPSMember::canRepDown($currentRating, $this->memberData) === false) {
$this->error_message = $this->lang->words['reputation_invalid'];
return false;
}
if ($rating == 1 && IPSMember::canRepUp($currentRating, $this->memberData) === false) {
$this->error_message = $this->lang->words['reputation_invalid'];
return false;
}
/* Day Cutoff */
$day_cutoff = time() - 86400;
/* Check Max Positive Votes */
if ($rating == 1) {
if (intval($this->memberData['g_rep_max_positive']) === 0) {
$this->error_message = $this->lang->words['reputation_quota_pos'];
return false;
}
$total = $this->DB->buildAndFetch(array('select' => 'count(*) as votes', 'from' => 'reputation_index', 'where' => 'member_id=' . $this->memberData['member_id'] . ' AND rep_rating=1 AND rep_date > ' . $day_cutoff));
if ($total['votes'] >= $this->memberData['g_rep_max_positive']) {
$this->error_message = $this->lang->words['reputation_quota_pos'];
return false;
}
}
/* Check Max Negative Votes if not like mode */
if ($rating == -1 and !$this->isLikeMode()) {
if (intval($this->memberData['g_rep_max_negative']) === 0) {
$this->error_message = $this->lang->words['reputation_quota_neg'];
return false;
}
$total = $this->DB->buildAndFetch(array('select' => 'count(*) as votes', 'from' => 'reputation_index', 'where' => 'member_id=' . $this->memberData['member_id'] . ' AND rep_rating=-1 AND rep_date > ' . $day_cutoff));
if ($total['votes'] >= $this->memberData['g_rep_max_negative']) {
$this->error_message = $this->lang->words['reputation_quota_neg'];
return false;
}
}
/* If no member id was passed in, we have to query it using the config file */
if (!$member_id) {
/* Reputation Config */
if (is_file(IPSLib::getAppDir($app) . '/extensions/reputation.php')) {
$rep_author_config = array();
require IPSLib::getAppDir($app) . '/extensions/reputation.php';
/*maybeLibHook*/
} else {
$this->error_message = $this->lang->words['reputation_config'];
return false;
}
if (!$rep_author_config[$type]['column'] || !$rep_author_config[$type]['table']) {
$this->error_message = $this->lang->words['reputation_config'];
return false;
}
$_col = $rep_author_config[$type]['id_field'] ? $rep_author_config[$type]['id_field'] : $type;
/* Query the content author */
$content_author = $this->DB->buildAndFetch(array('select' => "{$rep_author_config[$type]['column']} as id", 'from' => $rep_author_config[$type]['table'], 'where' => "{$_col}={$type_id}"));
$member_id = $content_author['id'];
}
if (!ipsRegistry::$settings['reputation_can_self_vote'] && $member_id == $this->memberData['member_id']) {
$this->error_message = $this->lang->words['reputation_yourown'];
return false;
}
/* Query the member group */
//.........這裏部分代碼省略.........