// header generator
function header_vm($config, $news_id, $news_cid, $news_title) {
if($config['news_content_header_pos'] != 'disabled') {
$itemid = $config['vm_itemid'];
$class = ' t'.$config['news_content_header_pos'].' f'.$config['news_content_header_float'];
$title = NSP_GK4_Utils::cutText($news_title, $config['title_limit'], $config['title_limit_type'], '…');
$link = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$news_id.'&virtuemart_category_id='.$news_cid.'&Itemid='.$itemid;
if($config['news_header_link'] == 1)
return '<h4 class="nspHeader'.$class.'"><a href="'.$link.'" title="'.str_replace('"', '', $news_title).'">'.$title.'</a></h4>';
else
return '<h4 class="nspHeader'.$class.'" title="'.str_replace('"', '', $news_title).'">'.$title.'</h4>';
} else
return '';
}
// article text generator
function text_vm($config, $news_id, $news_cid, $news_text, $news_readmore)
{
if($config['news_content_text_pos'] != 'disabled') {
if($config['clean_xhtml'] == 1) $news_text = strip_tags($news_text);
$news_text = NSP_GK4_Utils::cutText($news_text, $config['news_limit'], $config['news_limit_type'], $config['more_text_value']);
$link = 'index.php?page=shop.product_details&category_id='.$news_cid.'&flypage=flypage.tpl&product_id='.$news_id.'&option=com_virtuemart&Itemid='.$config['vm_itemid'];
//
$news_text = ($config['news_text_link'] == 1) ? '<a href="'.$link.'">'.$news_text.'</a>' : $news_text;
$class = ' t'.$config['news_content_text_pos'].' f'.$config['news_content_text_float'];
//
if($config['news_content_readmore_pos'] == 'after')
return '<p class="nspText'.$class.'">'.$news_text.' '.$news_readmore.'</p>';
else
return '<p class="nspText'.$class.'">'.$news_text.'</p>';
}
}
// article image generator
function image_vm($config, $news_id, $news_cid, $news_image, $news_title){
$news_title = str_replace('"', """, $news_title);
$IMG_SOURCE = JURI::root() . $news_image;
$IMG_LINK = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$news_id.'&virtuemart_category_id='.$news_cid.'&Itemid='.$itemid;
if(preg_match('/\<img.*src=.*?\>/',$news_text)){
$imgStartPos = JString::strpos($news_text, 'src="');
if($imgStartPos) $imgEndPos = JString::strpos($news_text, '"', $imgStartPos + 5);
if($imgStartPos > 0) $IMG_SOURCE = JString::substr($news_text, ($imgStartPos + 5), ($imgEndPos - ($imgStartPos + 5)));
}
//
if($config['create_thumbs'] == 1 && $IMG_SOURCE != ''){
// try to override standard image
if(strpos($IMG_SOURCE,'http://') == FALSE) {
if(NSP_GK4_Thumbs::createThumbnail($IMG_SOURCE, $config) !== FALSE) {
$uri = JURI::getInstance();
$IMG_SOURCE = $uri->root().'modules/mod_news_pro_gk4/cache/'.NSP_GK4_Thumbs::translateName($IMG_SOURCE,$config['module_id']);
} elseif($config['create_thumbs'] == 1) {
jimport('joomla.filesystem.file');
if(is_file(JPATH_ROOT.DS.'modules'.DS.'mod_news_pro_gk4'.DS.'cache'.DS.'default'.DS.'default'.$config['module_id'].'.png')) {
$IMG_SOURCE = $uri->root().'modules/mod_news_pro_gk4/cache/default/default'.$config['module_id'].'.png';
}
} else
$IMG_SOURCE = '';
}
} elseif($config['create_thumbs'] == 1) {
jimport('joomla.filesystem.file');
if(is_file(JPATH_ROOT.DS.'modules'.DS.'mod_news_pro_gk4'.DS.'cache'.DS.'default'.DS.'default'.$config['module_id'].'.png')) {
$IMG_SOURCE = $uri->root().'modules/mod_news_pro_gk4/cache/default/default'.$config['module_id'].'.png';
}
}
//
if($IMG_SOURCE != '' && $config['news_content_image_pos'] != 'disabled') {
$class = ' t'.$config['news_content_image_pos'].' f'.$config['news_content_image_float'];
$size = '';
//
if($config['img_width'] != 0 && !$config['img_keep_aspect_ratio']) $size .= 'width:'.$config['img_width'].'px;';
if($config['img_height'] != 0 && !$config['img_keep_aspect_ratio']) $size .= 'height:'.$config['img_height'].'px;';
if($config['img_margin'] != '') $size .= 'margin:'.$config['img_margin'].';';
//
if($config['news_image_link'] == 1) {
return ($config['news_content_image_pos'] == 'center') ? '<div class="center'.$class.'"><a href="'.$IMG_LINK.'"><img class="nspImage" src="'.$IMG_SOURCE.'" alt="'.htmlspecialchars($news_title).'" style="'.$size.'" /></a></div>' : '<a href="'.$IMG_LINK.'"><img class="nspImage'.$class.'" src="'.$IMG_SOURCE.'" alt="'.htmlspecialchars($news_title).'" style="'.$size.'" /></a>';
} else {
return ($config['news_content_image_pos'] == 'center') ? '<div class="center'.$class.'"><img class="nspImage" src="'.$IMG_SOURCE.'" alt="'.htmlspecialchars($news_title).'" '.$size.' /></div>' : '<img class="nspImage'.$class.'" src="'.$IMG_SOURCE.'" alt="'.htmlspecialchars($news_title).'" style="'.$size.'" />';
}
} else
return '';
}
[свернуть]