本文整理汇总了PHP中cmsFramework类的典型用法代码示例。如果您正苦于以下问题:PHP cmsFramework类的具体用法?PHP cmsFramework怎么用?PHP cmsFramework使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cmsFramework类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct();
Configure::write('Community.profileUrl', $this->profileUrl);
if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
$this->community = true;
$Menu = ClassRegistry::getClass('MenuModel');
$this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage');
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
}
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community');
}
// For JomSocial <= 2.1
if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) {
$this->default_thumb = 'components/com_community/assets/default_thumb.jpg';
}
$cache_key = 'jomsocial_config_' . md5(cmsFramework::getConfig('secret'));
$JSConfig = S2Cache::read($cache_key);
if (false == $JSConfig) {
// Read the JomSocial configuration to determine the storage location for avatars
$JSConfig = json_decode($this->query("SELECT params FROM #__community_config WHERE name = 'config'", 'loadResult'), true);
$JSConfigForJReviews = array('user_avatar_storage' => $JSConfig['user_avatar_storage'], 'storages3bucket' => $JSConfig['storages3bucket']);
S2Cache::write($cache_key, $JSConfigForJReviews);
}
$this->avatar_storage = $JSConfig['user_avatar_storage'];
$this->s3_bucket = $JSConfig['storages3bucket'];
Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
}
}
示例2: reviewVoting
function reviewVoting($review)
{
$review_id = $review['Review']['review_id'];
$User = cmsFramework::getUser();
$output = '<div class="reviewHelpful">';
$output .= '<div class="jrHelpfulTitle">' . __t("Was this review helpful to you?", true) . ' </div>';
$output .= '<div id="jr_reviewVote' . $review_id . '" style="float:left;">';
if ($this->Access->canVoteHelpful($review['User']['user_id'])) {
$output .= '<span class="jrVote jrButton" onclick="jreviews.review.voteYes(this,{review_id:' . $review_id . '})">';
} elseif ($User->id > 0) {
$output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("You are not allowed to vote", true, true) . '\');">';
} else {
$output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("Login or register to vote", true, true) . '\');">';
}
$output .= '<span class="jrButtonText" style="color: green;">' . $review['Vote']['yes'] . '</span><span class="jrIcon jrIconThumbUp"></span>';
$output .= '</span>';
if ($this->Access->canVoteHelpful($review['User']['user_id'])) {
$output .= '<span class="jrVote jrButton" onclick="jreviews.review.voteNo(this,{review_id:' . $review_id . '})">';
} elseif ($User->id > 0) {
$output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("You are not allowed to vote", true, true) . '\');">';
} else {
$output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("Login or register to vote", true, true) . '\');">';
}
$output .= '<span class="jrButtonText" style="color: red;">' . $review['Vote']['no'] . '</span><span class="jrIcon jrIconThumbDown"></span>';
$output .= '</span>';
$output .= '<span class="jr_loadingSmall jr_hidden"></span>';
$output .= '</div>';
$output .= '</div>';
return $output;
}
示例3: addFavorite
function addFavorite($results)
{
$listing_ids = array_keys($results);
if (!isset($this->Config)) {
App::import('Component', 'config', 'jreviews');
$this->Config = ClassRegistry::getClass('ConfigComponent');
}
if ($this->Config->favorites_enable) {
# Get favoured count
$query = "\n SELECT \n content_id AS listing_id, count(*) AS favored FROM #__jreviews_favorites AS Favorite\n\t\t\t WHERE \n Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t GROUP BY \n listing_id\n ";
$this->_db->setQuery($query);
$favored = $this->_db->loadAssocList('listing_id');
# Check if in user's favorites list
$User =& cmsFramework::getUser();
if ($User->id) {
$query = "\n SELECT \n Favorite.user_id, Favorite.content_id AS listing_id\n\t\t\t\t FROM \n #__jreviews_favorites AS Favorite\n\t\t\t\t WHERE \n Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t\t AND Favorite.user_id = " . $User->id;
$this->_db->setQuery($query);
$my_favorite = $this->_db->loadAssocList('listing_id');
}
foreach ($results as $key => $result) {
if (isset($favored[$result['Listing']['listing_id']]['favored'])) {
$results[$key]['Favorite']['favored'] = $favored[$result['Listing']['listing_id']]['favored'];
} else {
$results[$key]['Favorite']['favored'] = 0;
}
if (isset($my_favorite[$result['Listing']['listing_id']]['user_id'])) {
$results[$key]['Favorite']['my_favorite'] = 1;
} else {
$results[$key]['Favorite']['my_favorite'] = 0;
}
}
}
return $results;
}
示例4: reviews
function reviews()
{
$access = $this->cmsVersion == CMS_JOOMLA15 ? $this->Access->getAccessId() : $this->Access->getAccessLevels();
$feed_filename = PATH_ROOT . 'cache' . DS . 'jreviewsfeed_' . md5($access . $this->here) . '.xml';
$this->Feeds->useCached($feed_filename, 'reviews');
$extension = Sanitize::getString($this->params, 'extension', 'com_content');
$cat_id = Sanitize::getInt($this->params, 'cat');
$section_id = Sanitize::getInt($this->params, 'section');
$dir_id = Sanitize::getInt($this->params, 'dir');
$listing_id = Sanitize::getInt($this->params, 'id');
$this->encoding = cmsFramework::getCharset();
$feedPage = null;
$this->EverywhereAfterFind = true;
// Triggers the afterFind in the Observer Model
$this->limit = $this->Config->rss_limit;
$rss = array('title' => $this->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->Config->rss_image, 'image_link' => WWW_ROOT);
$queryData = array('conditions' => array('Review.published = 1', "Review.mode = '{$extension}'"), 'fields' => array('Review.mode AS `Review.extension`'), 'limit' => $this->limit, 'order' => array('Review.created DESC'));
if ($extension == 'com_content') {
$queryData['conditions'][] = 'Listing.state = 1';
$queryData['conditions'][] = '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )';
$queryData['conditions'][] = '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )';
# Shows only links users can access
if ($this->cmsVersion == CMS_JOOMLA15) {
$access_id = $this->Access->getAccessId();
$queryData['conditions'][] = 'Listing.access <= ' . $access_id;
$queryData['conditions'][] = 'Category.access <= ' . $access_id;
} else {
$cat_id > 0 and $cat_id = array_keys($this->Category->getChildren($cat_id));
$access_id = $this->Access->getAccessLevels();
$queryData['conditions'][] = 'Listing.access IN ( ' . $access_id . ')';
$queryData['conditions'][] = 'Category.access IN ( ' . $access_id . ')';
}
}
if (!empty($cat_id) && $extension == 'com_content') {
// Category feeds only supported for core content
$queryData['conditions'][] = 'JreviewsCategory.id IN (' . $this->quote($cat_id) . ')';
$feedPage = 'category';
} elseif ($section_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'Listing.sectionid= ' . $section_id;
$feedPage = 'section';
} elseif ($dir_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'JreviewsCategory.dirid= ' . $dir_id;
$feedPage = 'directory';
} elseif ($extension != 'com_content') {
unset($this->Review->joins['listings'], $this->Review->joins['jreviews_categories'], $this->Review->joins['listings']);
$feedPage = 'everywhere';
}
if ($listing_id > 0) {
$queryData['conditions'][] = 'Review.pid = ' . $listing_id;
$feedPage = 'listing';
}
# Don't run it here because it's run in the Everywhere Observer Component
$this->Review->runProcessRatings = false;
$reviews = $this->Review->findAll($queryData);
$this->set(array('feedPage' => $feedPage, 'encoding' => $this->encoding, 'rss' => $rss, 'reviews' => $reviews));
return $this->Feeds->saveFeed($feed_filename, 'reviews');
}
示例5: startup
function startup(&$controller)
{
# Check feed cache
if (Sanitize::getString($controller->params, 'action') == 'xml') {
$this->useCached(PATH_ROOT . DS . 'cache' . DS . 'jreviewsfeed_' . md5($controller->here) . '.xml');
}
$this->encoding = cmsFramework::getCharset();
$this->params =& $controller->params;
$this->c =& $controller;
}
示例6: __construct
function __construct()
{
parent::__construct();
$User =& cmsFramework::getUser();
// Used in MyReviews page to differentiate from other component reviews
$this->tag = __t("MYBLOG_TAG", true);
// Uncomment line below to show tag in My Reviews page
$this->fields[] = "'{$this->tag}' AS `Listing.tag`";
// Set default WHERE statement
$this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0');
}
示例7: array
function &getInstance()
{
static $instance = array();
if (!isset($instance[0]) || !$instance[0]) {
$instance[0] = new sef_jreviews();
require dirname(__FILE__) . DS . 'jreviews' . DS . 'framework.php';
App::import('Model', 'Menu', 'jreviews');
$instance[0]->__Menu = ClassRegistry::getClass('MenuModel');
// Read url param style setting from JReviews config cache file
$cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
$Config = S2Cache::read($cache_file);
$instance[0]->joomla_style_params = is_object($Config) and isset($Config->url_param_joomla) ? $Config->url_param_joomla : false;
$version = new JVersion();
$instance[0]->cmsVersion = $version->RELEASE;
}
return $instance[0];
}
示例8: onProfileDisplay
function onProfileDisplay()
{
if (!file_exists($this->_path . DS . 'admin.jreviews.php')) {
return JText::_('jReviews is not installed. Please contact site administrator.');
} else {
$user = CFactory::getActiveProfile();
$userId = $user->id;
$cacheSetting = $this->params->get('cache', 1) ? JApplication::getCfg('caching') : 0;
# Load CSS stylesheets -- done here because when cache is on css is not loaded
if ($cacheSetting) {
# MVC initalization script
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
require 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
$cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
$Config =& S2Cache::read($cache_file);
if (!is_object($Config)) {
//Create config file
$eParams['data']['controller'] = 'common';
$eParams['data']['action'] = 'index';
$Dispatcher = new S2Dispatcher('jreviews', false, true);
$Dispatcher->dispatch($eParams);
$Config =& S2Cache::read($cache_file);
unset($Dispatcher);
}
App::import('Helper', 'html');
$Html =& RegisterClass::getInstance('HtmlHelper');
$Html->viewTheme = $Config->template;
$Html->app = 'jreviews';
$Html->startup();
App::import('Helper', 'libraries', 'jreviews');
$Libraries =& RegisterClass::getInstance('LibrariesHelper');
$Html->css(array('theme', 'plugins', 'paginator'));
$Html->js(array('jreviews', 'jquery' => 'jquery', 'jq.scrollable'), $Libraries->js());
}
$cache =& JFactory::getCache('plgCommunityJreviews_myfavorites');
$cache->setCaching($cacheSetting);
$callback = array('plgCommunityJreviews_myfavorites', '_getPage');
$contents = $cache->call($callback, $userId, $this->params, $cacheSetting);
return $contents;
}
}
示例9: getVersion
function getVersion()
{
$page = '';
$new_version = 'none';
$session_var = cmsFramework::getSessionVar('new_version', 'jreviews');
if (empty($session_var)) {
if (function_exists('curl_init')) {
// Version checker
$curl_handle = curl_init('http://www.reviewsforjoomla.com/updates_server/files.php');
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
// return instead of echo
@curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle, CURLOPT_HEADER, 0);
$data = curl_exec($curl_handle);
curl_close($curl_handle);
$current_versions = json_decode($data, true);
$this->Config->updater_betas and isset($current_versions['jreviews']['beta']) and $current_versions['jreviews'] = array_merge($current_versions['jreviews'], $current_versions['jreviews']['beta']);
$remoteVersion = $current_versions['components']['jreviews']['version'];
$remoteVersion = (int) str_replace('.', '', $remoteVersion);
$localVersion = (int) str_replace('.', '', strip_tags($this->Config->version));
if ($remoteVersion > $localVersion) {
$new_version = 'new';
}
} else {
$new_version = 'curl';
}
cmsFramework::setSessionVar('new_version', $new_version, 'jreviews');
} else {
$new_version = $session_var;
}
switch ($new_version) {
case 'new':
$page = '<a style="font-weight:normal;font-size:13px;color:red;" href="#updater_version_check" id="updater_notification">' . __a("New version available", true) . '</a>';
break;
case 'curl':
$page = '<span style="font-weight:normal;font-size:13px;color:red;">Version checker requires curl</span>';
break;
default:
$page = '';
break;
}
return $this->ajaxResponse(array(), false, compact('page'));
}
示例10: __construct
function __construct()
{
parent::__construct();
$User =& cmsFramework::getUser();
// Used in MyReviews page to differentiate from other component reviews
$this->tag = __t("MYBLOG_TAG", true);
// Uncomment line below to show tag in My Reviews page
$this->fields[] = "'{$this->tag}' AS `Listing.tag`";
// Set default WHERE statement
$this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0');
if (!defined('MVC_FRAMEWORK_ADMIN')) {
# Shows only links users can access
$Access = Configure::read('JreviewsSystem.Access');
if ($this->cmsVersion == CMS_JOOMLA15) {
$this->conditions[] = 'Listing.access <= ' . $User->gid;
} else {
$this->conditions[] = 'Listing.access IN ( ' . $Access->getAccessLevels() . ')';
}
}
}
示例11: _save
function _save()
{
$response = array();
$this->data['Vote']['user_id'] = $this->_user->id;
$this->data['Vote']['review_id'] = (int) $this->data['Vote']['review_id'];
# Exact vote check to prevent form tampering. User can cheat the js and enter any interger, thus increasing the count
$this->data['Vote']['vote_yes'] = Sanitize::getInt($this->data['Vote'], 'vote_yes') ? 1 : 0;
$this->data['Vote']['vote_no'] = Sanitize::getInt($this->data['Vote'], 'vote_no') ? 1 : 0;
$this->data['Vote']['created'] = gmdate('Y-m-d H:i:s');
$this->data['Vote']['ipaddress'] = $this->ipaddress;
if (!$this->data['Vote']['review_id']) {
return $this->ajaxError(s2Messages::submitErrorGeneric());
}
// Find duplicates
$duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], 'ipaddress = ' . $this->Vote->Quote($this->data['Vote']['ipaddress']))));
// It's a guest so we only care about checking the IP address if this feature is not disabled and
// server is not localhost
if (!$this->_user->id) {
if (!$this->Config->vote_ipcheck_disable && $this->ipaddress != '127.0.0.1') {
// Do the ip address check everywhere except in localhost
$duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], 'ipaddress = ' . $this->Vote->Quote($this->ipaddress))));
}
} else {
$duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], "(user_id = {$this->_user->id}" . ($this->ipaddress != '127.0.0.1' && !$this->Config->vote_ipcheck_disable ? " OR ipaddress = " . $this->Vote->Quote($this->ipaddress) . ") " : ')'))));
}
if ($duplicate > 0) {
# Hides vote buttons and shows message alert
$response[] = "jQuery('#jr_reviewVote{$this->data['Vote']['review_id']}').fadeOut('medium',function(){\n jQuery(this).html('" . __t("You already voted.", true, true) . "').fadeIn();\n });";
return $this->ajaxResponse($response);
}
if ($this->Vote->store($this->data)) {
# Hides vote buttons and shows message alert
$response[] = "jQuery('#jr_reviewVote{$this->data['Vote']['review_id']}').fadeOut('medium',function(){\n jQuery(this).html('" . __t("Thank you for your vote.", true, true) . "').fadeIn();\n });";
# Facebook wall integration only for positive votes
$facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_votes');
$token = cmsFramework::getCustomToken($this->data['Vote']['review_id']);
$facebook_integration and $this->data['Vote']['vote_yes'] and $response[] = "\n jQuery.ajax({url:s2AjaxUri+jreviews.ajax_params()+'&url=facebook/_postVote/id:{$this->data['Vote']['review_id']}&{$token}=1',dataType:'script'});\n ";
return $this->ajaxResponse($response);
}
return $this->ajaxError(s2Messages::submitErrorDb());
}
示例12: _save
function _save()
{
$response = array();
$formToken = cmsFramework::getCustomToken($this->review_id);
if ($this->denyAccess == true || !Sanitize::getString($this->params['form'], $formToken)) {
return $this->ajaxError(s2Messages::accessDenied());
}
# Validate form token
$this->components = array('security');
$this->__initComponents();
if ($this->invalidToken) {
return $this->ajaxError(s2messages::invalidToken());
}
// Check if an owner reply already exists
$this->OwnerReply->fields = array();
if ($reply = $this->OwnerReply->findRow(array('fields' => array('OwnerReply.owner_reply_text', 'OwnerReply.owner_reply_approved'), 'conditions' => array('OwnerReply.id = ' . $this->review_id)))) {
if ($reply['OwnerReply']['owner_reply_approved'] == 1) {
$error_text = __t("A reply for this review already exists.", true);
$response[] = "jQuery('#jr_ownerReplyLink{$this->review_id}').remove();";
return $this->ajaxError($error_text, $response);
}
}
if ($this->Config->owner_replies) {
if ($this->data['OwnerReply']['owner_reply_text'] != '' && $this->data['OwnerReply']['id'] > 0) {
$this->data['OwnerReply']['owner_reply_created'] = date('Y-m-d H:i:s');
$this->data['OwnerReply']['owner_reply_approved'] = 1;
// Replies will be moderated by default
if ($this->OwnerReply->store($this->data)) {
$update_text = $this->data['OwnerReply']['owner_reply_approved'] ? __t("Your reply was submitted and has been approved.", true) : __t("Your reply was submitted and will be published once it is verified.", true);
$response[] = "jQuery('#jr_ownerReplyLink{$this->review_id}').remove();";
return $this->ajaxUpdateDialog($update_text, $response);
}
return $this->ajaxError(s2Messages::submitErrorDb());
}
# Validation failed
if (isset($this->Security)) {
$reponse[] = "jQuery('s2Token').val('" . $this->Security->reissueToken() . "')";
}
return $this->ajaxValidation(__t("The reply is empty.", true), $response);
}
}
示例13: reviews
function reviews()
{
$extension = Sanitize::getString($this->params, 'extension', 'com_content');
$cat_id = Sanitize::getInt($this->params, 'cat');
$section_id = Sanitize::getInt($this->params, 'section');
$dir_id = Sanitize::getInt($this->params, 'dir');
$listing_id = Sanitize::getInt($this->params, 'id');
$this->encoding = cmsFramework::getCharset();
$feedPage = null;
$this->EverywhereAfterFind = true;
// Triggers the afterFind in the Observer Model
$this->limit = $this->Config->rss_limit;
$rss = array('title' => $this->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->Config->rss_image, 'image_link' => WWW_ROOT);
$queryData = array('conditions' => array('Review.published = 1', "Review.mode = '{$extension}'"), 'fields' => array('Review.mode AS `Review.extension`'), 'limit' => $this->limit, 'order' => array('Review.created DESC'));
if ($cat_id > 0 && $extension == 'com_content') {
// Category feeds only supported for core content
$queryData['conditions'][] = 'JreviewsCategory.id= ' . $cat_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'category';
} elseif ($section_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'Listing.sectionid= ' . $section_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'section';
} elseif ($dir_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'JreviewsCategory.dirid= ' . $dir_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'directory';
} elseif ($extension != 'com_content') {
unset($this->Review->joins['listings'], $this->Review->joins['jreviews_categories'], $this->Review->joins['listings']);
$feedPage = 'everywhere';
}
if ($listing_id > 0) {
$queryData['conditions'][] = 'Review.pid = ' . $listing_id;
$feedPage = 'listing';
}
# Don't run it here because it's run in the Everywhere Observer Component
$this->Review->runProcessRatings = false;
$reviews = $this->Review->findAll($queryData);
$this->set(array('feedPage' => $feedPage, 'encoding' => $this->encoding, 'rss' => $rss, 'reviews' => $reviews));
return $this->Feeds->saveFeed(PATH_ROOT . DS . 'cache' . DS . 'jreviewsfeed_' . md5($this->here) . '.xml', 'reviews');
}
示例14: uninstall
function uninstall()
{
$db = cmsFramework::getDB();
// Delete GeoMaps module
$query = "DELETE FROM #__modules WHERE module = 'mod_jreviews_geomaps'";
$db->setQuery($query);
$db->query();
if ($this->cmsVersion == CMS_JOOMLA16) {
$query = "DELETE FROM #__extensions WHERE name = 'mod_jreviews_geomaps'";
$db->setQuery($query);
$db->query();
}
// Remove GeoMaps module files
$target = PATH_ROOT . 'modules' . DS . 'mod_jreviews_geomaps';
$Folder = new Folder();
if (@$Folder->delete($target)) {
return '<div style="color:green;">GeoMaps Module successfully uninstalled.</div>';
} else {
return '<div style="color:red;">There was a problem uninstalling the GeoMaps module.</div>';
}
}
示例15: favorite
function favorite($listing)
{
$output = '';
$listing_id = $listing['Listing']['listing_id'];
$User = cmsFramework::getUser();
$output .= '<span class="jrFavoriteWidget" title="' . __t("Favorites", true) . '">';
$output .= '<span class="jrIcon jrIconFavorites"></span>';
$output .= '<span id="jr_favoriteCount' . $listing_id . '">' . $listing['Favorite']['favored'] . '</span>';
$output .= '</span>';
if ($listing['Favorite']['my_favorite']) {
// Already in user's favorites
$output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Remove from favorites", true) . '" onclick="jreviews.favorite.remove(this,{listing_id:' . $listing_id . '})">' . __t("Remove", true) . '</span>';
} elseif ($User->id) {
// Not in user's favorites
$output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Add to favorites", true) . '" onclick="jreviews.favorite.add(this,{listing_id:' . $listing_id . '})">' . __t("Add", true) . '</span>';
} else {
// This is a guest user, needs to register to use the favorites widget
$output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Add to favorites", true) . '" onclick="s2Alert(\'' . __t("Register to add this entry to your favorites", true) . '\');">' . __t("Add", true) . '</span>';
}
return $output;
}