Esempio n. 1
0
File: view.php Progetto: pwfir/klzm1
 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . $item["category_url"] . '" target="' . $config['open_links_window'] . '">' . $item['catname'] . '</a>' : $item['catname'];
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']) . '" alt="' . htmlspecialchars($item['author']) . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $item['author'] . '</span>' : $item['author'];
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%STARS', $info_stars, $news_info);
     } else {
         return '';
     }
     //
     return $news_info;
 }
Esempio n. 2
0
 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . static::categoryLink($item) . '" target="' . $config['open_links_window'] . '">' . $item['catname'] . '</a>' : $item['catname'];
         //
         $author = trim(htmlspecialchars($item['author_alias'])) != '' ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']) . '" alt="' . $author . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $author . '</span>' : $author;
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         $info_comments = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
             //
             if (isset($item['comments'])) {
                 if ($item['comments'] == 1) {
                     $info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
                 } else {
                     if ($item['comments'] > 1 && $item['comments'] < 5) {
                         $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
                     } else {
                         if ($item['comments'] >= 5) {
                             $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
                         }
                     }
                 }
             }
             $info_comments = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments . '</a>';
         }
         //
         $info_comments_short = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments_short = 0;
             //
             if (isset($item['comments'])) {
                 $info_comments_short = $item['comments'];
             }
             $info_comments_short = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments_short . '</a>';
         }
         // Featured label
         $info_featured = '';
         if (stripos($news_info, '%FEATURED') !== FALSE && $item['frontpage'] == '1') {
             $info_featured = '<strong class="is-featured">' . JText::_('MOD_NEWS_PRO_GK5_FEATURED') . '</strong>';
         }
         // Tags
         $info_tags = '';
         if (isset($item['tags']) && count($item['tags']) > 0) {
             $i = 0;
             foreach ($item['tags'] as $tag_name => $tag_id) {
                 $link = urldecode(JRoute::_(TagsHelperRoute::getTagRoute($tag_id)));
                 if ($i == 0) {
                     $info_tags .= '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 } else {
                     $info_tags .= ', <a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 }
                 //
                 $i++;
             }
         }
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%STARS', $info_stars, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%TAGS', $info_tags, $news_info);
         $news_info = str_replace('%FEATURED', $info_featured, $news_info);
         // only if comments used
         if ($config['com_content_comments_source'] != 'none') {
             $news_info = str_replace('%COMMENTS_SHORT', $info_comments_short, $news_info);
             $news_info = str_replace('%COMMENTS', $info_comments, $news_info);
         }
     } else {
         return '';
     }
     //
     return $news_info;
 }
Esempio n. 3
0
	static function info($config, $item, $num = 1) {
		// %AUTHOR %DATE %HITS %CATEGORY
		$news_info = '';
		//
		if($num == 1){
			if($config['news_content_info_pos'] != 'disabled') {
				$class = 'nspInfo1 t'.$config['news_content_info_pos'].' f'.$config['news_content_info_float'];	
			}
		} else {
			if($config['news_content_info2_pos'] != 'disabled') {
				$class = 'nspInfo2 t'.$config['news_content_info2_pos'].' f'.$config['news_content_info2_float'];
			}			
		}
		//
		if(
			($config['news_content_info_pos'] != 'disabled' && $num == 1) || 
			($config['news_content_info2_pos'] != 'disabled' && $num == 2)
		) {
	        $news_info = '<p class="nspInfo '.$class.'">'.$config['info'.(($num == 2) ? '2' : '').'_format'].'</p>';
	        //
	        $info_category = ($config['category_link'] == 1) ? '<a href="'. NSP_GK5_com_content_View::categoryLink($item) .'" >'.$item['catname'].'</a>' : $item['catname'];	        
	        //
	        $author = (trim(htmlspecialchars($item['author_alias'])) != '') ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
	        $info_author = ($config['user_avatar'] == 1) ? '<span><img src="'. NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']).'" alt="'.$author.' - avatar" class="nspAvatar" width="'.$config['avatar_size'].'" height="'.$config['avatar_size'].'" /> '.$author.'</span>' : $author;
	        $info_date = JHTML::_('date', $item['date'], $config['date_format']);			
	        $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS').$item['hits'];
	        
	        // case when there is no rates
	        if($item['rating_count'] == 0) {
	        	$item['rating_count'] = 1;
	        }
	        
	        $info_rate = ($item['rating_count'] > 0) ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') .' '. number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>': '';
	        
	        $info_stars = '<span class="nsp-stars">';
	        $stars_count = floor($item['rating_sum'] / $item['rating_count']);
	        for($i = 0; $i < 5; $i++) {
	        	$info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
	        }
	        $info_stars .= '</span>'; 
	        
	        $info_comments = '';
	        
	        if($config['com_content_comments_source'] != 'none') {
		    	$link = NSP_GK5_com_content_View::itemLink($item); 
		    	
		    	$info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
		        //
		        if(isset($item['comments'])) { 
		        	if($item['comments'] == 1) {
		            	$info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
		            } else if($item['comments'] > 1 && $item['comments'] < 5) {
		            	$info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
		            } else if($item['comments'] >= 5) {
		            	$info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
		            }
		        }
		        
		        $info_comments = '<a href="'.$link.'">'.$info_comments.'</a>';
	        }
	        //
	        $info_comments_short = '';
	        
	        if($config['com_content_comments_source'] != 'none') {
	        	$link = NSP_GK5_com_content_View::itemLink($item); 
	        	
	        	$info_comments_short = 0;
	            //
	            if(isset($item['comments'])) { 
	            	$info_comments_short = $item['comments'];
	            }
	            
	            $info_comments_short = '<a href="'.$link.'">'.$info_comments_short.'</a>';
	        }
	        // 
	        $news_info = str_replace('%AUTHOR', $info_author, $news_info);
	        $news_info = str_replace('%DATE', $info_date, $news_info);
	        $news_info = str_replace('%HITS', $info_hits, $news_info);
	        $news_info = str_replace('%CATEGORY', $info_category, $news_info);
	        $news_info = str_replace('%STARS', $info_stars, $news_info);
	        $news_info = str_replace('%RATE', $info_rate, $news_info);
	        // only if comments used
	       	if($config['com_content_comments_source'] != 'none') {
	        	$news_info = str_replace('%COMMENTS_SHORT', $info_comments_short, $news_info);
	        	$news_info = str_replace('%COMMENTS', $info_comments, $news_info);
	        }
	    } else {
	    	return '';
	    }
		//
		return $news_info;		
	}