Example #1
0
File: view.php Project: pwfir/klzm1
 static function image($config, $item, $only_url = false, $pm = false, $links = false)
 {
     if (!($config['news_content_image_pos'] != 'disabled' || $pm || $links)) {
         return '';
     }
     $item['title'] = str_replace('"', """, $item['title']);
     $uri = JURI::getInstance();
     $IMG_LINK = $item['url'];
     $IMG_SOURCE = NSP_GK5_rss_View::getImageFromText($item['text']);
     // get image from the text
     $full_size_img = $IMG_SOURCE;
     //
     if ($config['create_thumbs'] == 1 && $IMG_SOURCE != '') {
         // try to override standard image
         if (strpos($IMG_SOURCE, 'http://') == FALSE) {
             $img_file = NSP_GK5_Thumbs::createThumbnail($IMG_SOURCE, $config, false, false, '', $links);
             if (is_array($img_file)) {
                 $uri = JURI::getInstance();
                 $IMG_SOURCE = $uri->root() . 'modules/mod_news_pro_gk5/cache/' . $img_file[1];
             } elseif ($config['create_thumbs'] == 1) {
                 jimport('joomla.filesystem.file');
                 if (is_file(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'cache' . DS . 'default' . DS . 'default' . $config['module_id'] . '.png')) {
                     $IMG_SOURCE = $uri->root() . 'modules/mod_news_pro_gk5/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_gk5' . DS . 'cache' . DS . 'default' . DS . 'default' . $config['module_id'] . '.png')) {
             $IMG_SOURCE = $uri->root() . 'modules/mod_news_pro_gk5/cache/default/default' . $config['module_id'] . '.png';
         }
     }
     return NSP_GK5_rss_View::getImageHTML($only_url, $IMG_SOURCE, $links, $config, $IMG_LINK, $full_size_img);
 }
Example #2
0
 function initialize($config, $content)
 {
     // tables which will be used in generated content
     $output = array('arts' => array(), 'list' => array());
     // Generating content
     $counter = 0;
     //
     for ($i = 0; $i < count($content); $i++) {
         if ($i < $config['news_column'] * $config['news_rows'] * $config['news_full_pages']) {
             // GENERATING NEWS CONTENT
             if ($config['use_own_article_format'] == 1) {
                 $generated_content = NSP_GK5_Article_Format::generateLayout($config, $content[$i]);
             } else {
                 // GENERATING HEADER
                 $news_header = NSP_GK5_rss_View::header($config, $content[$i]);
                 // GENERATING IMAGE
                 $news_image = NSP_GK5_rss_View::image($config, $content[$i]);
                 // GENERATING READMORE
                 $news_readmore = NSP_GK5_rss_View::readMore($config, $content[$i]);
                 // GENERATING TEXT
                 $news_text = NSP_GK5_rss_View::text($config, $content[$i], $news_readmore);
                 // GENERATE NEWS INFO
                 $news_info = NSP_GK5_rss_View::info($config, $content[$i]);
                 // GENERATE NEWS INFO2
                 $news_info2 = NSP_GK5_rss_View::info($config, $content[$i], 2);
                 // GENERATE CONTENT FOR TAB
                 $generated_content = '';
                 // initialize variable
                 //
                 for ($j = 1; $j < 10; $j++) {
                     //
                     if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                         if ($j == 2) {
                             $generated_content .= '<div class="gkArtContentWrap">';
                         }
                     }
                     //
                     if ($config['news_header_order'] == $j) {
                         $generated_content .= $news_header;
                     }
                     if ($config['news_image_order'] == $j) {
                         $generated_content .= $news_image;
                     }
                     if ($config['news_text_order'] == $j) {
                         $generated_content .= $news_text;
                     }
                     if ($config['news_info_order'] == $j) {
                         $generated_content .= $news_info;
                     }
                     if ($config['news_info2_order'] == $j) {
                         $generated_content .= $news_info2;
                     }
                 }
                 //
                 if ($config['news_content_readmore_pos'] != 'after') {
                     $generated_content .= $news_readmore;
                 }
                 //
                 if ($config['wrap_content'] == 1 && $config['news_image_order'] == 1) {
                     $generated_content .= '</div>';
                 }
             }
             // creating table with news content
             array_push($output['arts'], $generated_content);
         } else {
             array_push($output['list'], NSP_GK5_rss_View::lists($config, $content[$i], $counter));
             //
             $counter++;
         }
     }
     // return the results array
     return $output;
 }
Example #3
0
 static function lists($config, $item, $num)
 {
     $odd = $num % 2;
     if ($config['news_short_pages'] > 0) {
         $text = '';
         $title = '';
         $image = '';
         $readmore = '';
         $link = $item['url'];
         if ($config['list_text_limit'] > 0) {
             $text = NSP_GK5_Utils::cutText(strip_tags(preg_replace("/\\{.+?\\}/", "", $item['text'])), $config, 'list_text_limit', '&hellip;');
             $text = preg_replace("/\\{.+?\\}/", "", $text);
             if (JString::strlen($text) > 0) {
                 $text = '<p>' . $text . '</p>';
             }
         }
         if ($config['list_title_limit'] > 0) {
             $title = htmlspecialchars($item['title']);
             $title = NSP_GK5_Utils::cutText($title, $config, 'list_text_limit', '&hellip;');
             $title = str_replace('"', "&quot;", $title);
             if (JString::strlen($title) > 0) {
                 $title = '<h4><a href="' . $link . '" title="' . htmlspecialchars($item['title']) . '">' . $title . '</a></h4>';
             }
         }
         if ($config['links_image'] == 1) {
             $image = NSP_GK5_rss_View::image($config, $item, false, false, true);
         }
         if ($config['links_readmore'] == 1) {
             $readmore = '<a class="readon" href="' . $link . '">' . (trim($config['readmore_text']) != '' ? $config['readmore_text'] : JText::_('MOD_NEWS_PRO_GK5_NSP_READMORE')) . '</a>';
         }
         // creating rest news list
         return '<li class="' . ($odd == 1 ? 'odd' : 'even') . '">' . $image . ($image != '' ? '<div>' . $title . $text . $readmore . '</div>' : $title . $text . $readmore) . '</li>';
     } else {
         return '';
     }
 }