css_type == "table" ) ? ($k+1) : "" )." >";
                break;
        case 'flatarrow':
            if ($v == 1)  {
                        $c++;
                        if ($set_column > 1) {
                                $row_start_out .= "
1 ? "column_separator" : "" )."\" >";
                        }
                        $row_start_out .= " ";
                }
                $row_start_out .= "";
                break;
    case 'flatlist':
            if ($v == 1)  {
                        $c++;
                        if ($set_column > 1) {
                                $row_start_out .= "| 1? "column_separator" : "" )."\">";
                        }
                        $row_start_out .= " ";
                }
                $row_start_out .= "";
                break;
        default:
                $c++;
            if ($c == 1) {
                        $row_start_out .= "";
                }
        $row_start_out .= "";
                        $c = 0;
                }
          }
/*
         ?>| 1 ? "column_separator" : "" ), ( $this->css_type == "table" ) ? ($k+1) : "" )." width=\"".(int)(100/$set_column)."%\""." valign=\"top\"".">";
        }
      // Start of Module Display for each News Item
      if ( $this->css_type == "table" ) {
              $k = 1 - $k;
          }
        if ( isset($mosConfig_jf_content) && $mosConfig_jf_content){
                  $row = JoomFish::translate( $row, 'content', $mosConfig_lang);
        }
      //---------------------------------------------------------------------
        // define the regular expression for the bot
      $regex = "{moscomment}";
       // perform the replacement
    if ( $show_text ) {
                $row->text = str_replace( $regex, '', $row->text );
                // Removes instances of {mospagebreak} from being displayed
                $row->text = str_replace( '{mospagebreak}', '', $row->text );
        }
      //---------------------------------------------------------------------
          if ( !$plugins_disable ) {
                $results = $mainframe->triggerEvent('onPrepareContent', array (&$row, &$aparams, 1));
          }
      //---------------------------------------------------------------------
      // Loads the section information into variable $section
      /*if ( $show_section  || $show_category ) {
         $section =& JTable::getInstance( 'section' );
         $section->load( $row->sectionid );
         //  Mambelfish Support
         if( $mosConfig_mbf_content ) {
                      $section = JoomFish::translate( $section, 'sections', $mosConfig_lang);
         }
      }
      // loads the category inion into variable $category
      if ( $show_category ) {
             $category = & JTable::getInstance( 'category' );
                 if ( $category ) {
             $category->load( $row->catid );
                 $category->catslug = strlen( $category->alias ) ?  $category->id . ":" . $category->alias : $category->id;
                 // CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug
         //  Mambelfish Support
         if( $mosConfig_mbf_content ) {
            $category = JoomFish::translate( $category, 'categories', $mosConfig_lang);
         }
                 }
      }
          */
      //---------------------------------------------------------------------
      //To show date item created, date mambot called
          $create_date = null;
      if ( ($show_date ) && (intval( $row->created ) <> NULL) ) {
         $create_date = JHTML::_('date', $row->created, $format_date );
      }
      //---------------------------------------------------------------------
      // Converts the user id number of the author to their name and loads this into the $author variable
      /*if ( $show_author ) {
         if ( $row->created_by_alias != '' )
                        $author = $row->created_by_alias;
         else {
                        $db->setQuery("SELECT a.name"
                        ."\n  FROM #__users AS a"
                        ."\n  LEFT JOIN #__content AS b ON a.id=b.created_by"
                        ."\n  WHERE a.id=".$row->created_by);
                        $author = $db->loadResult();
                 }
      }*/
      // Will check to see if item uses a created by alias, if it does, it loads this into the $author variable
      // however, if the item only has a created by value, it converts the user id number of the author to their name and loads this into the $author variable
      //---------------------------------------------------------------------
      if ($show_section ) {
         // $sec_out .= "\n\t\t";
         $sec_out .=  "";
         if ($link_section ) {
            if ($row->sec_published == "1") {
               // $sec_out .=  "\n\t\t\t";
               // $sec_out .=  "sec_id))."' ".modDisplayNewsHelper::dn_style("dn-section")." ";
               if ( $show_tooltips ) {
                       $sec_out .=  "title=\"".htmlspecialchars($text_hover_section.$row->sec_title)."\"";
                   }
               $sec_out .=  ">".$row->sec_title."";
            } else {
               $sec_out .=  $row->sec_title;
            }
         } else {
            $sec_out .=  $row->sec_title;
         }
         $sec_out .=  "";
      }
      //---------------------------------------------------------------------
      // Code for displaying of individual items Category
      if ($show_category ) {
         $cat_out .= "";
         if ($link_category ) {
            if ($row->cat_published == "1") {
               $cat_out .= "cat_title)."\"";
                   }
               $cat_out .= ">".$row->cat_title."";
            } else {
               $cat_out .= $row->cat_title;
            }
         } else {
            $cat_out .= $row->cat_title;
         }
         $cat_out .= "";
      }  //---------------------------------------------------------------------
      // Code for displaying of individual items Date
	  
      if ( $create_date <> null && $show_date && ( ($show_date == 1)  || ($aparams->get('show_date', $globalConfig->get('show_date'))) ) )  {
         $date_out .= "";
         $date_out .= $create_date;
         $date_out .= "";
      }
      //---------------------------------------------------------------------
      // Code for displaying of individual items Author
      if ( $show_author && ( ($show_author == 1)  || ($aparams->get('show_author', $globalConfig->get('show_author'))) ) )  {
         $author_out .= "";
         $author_out .= $row->author;
         $author_out .= "";
      }
      //---------------------------------------------------------------------
      // Code for displaying of individual items Title
      if ($show_title ) {
         $title = $row->title;
         $title = JFilterOutput::ampReplace( $title );
         if ($filter_title ) {
            $title = modDisplayNewsHelper::dn_filter( $title );
                        modDisplayNewsHelper::dn_limit( $title, $filter_title, $length_limit_title, "" );
         }
         /*if ($show_title_nextline ) {
            $length = strlen($title);
            if ($length > $length_chars_title) {
               $titlefirstline = strtok($title, " ");
               $length = strlen($titlefirstline);
               while ($length < $length_chars_title) {
                  $titlefirstline .= " ";
                  $titlefirstline .= strtok(" ");
                  $length = strlen($titlefirstline);
               }
               $lengthfull = strlen($title);
               $titlesecondline = substr($title, $length, $lengthfull);
               $title = $titlefirstline." ";
                        $v = 0;
                }
                break;
      case 'flatlist':
        $row_end_out .= '';
            if ( ($v == $vr) || ($rows_count - $r - 1 < $set_column - $c ) ) {
                        $row_end_out .= "";
                        $v = 0;
                }
                break;
          case 'flatarrow':
        $row_end_out .= '';
            if ( ($v == $vr) || ($rows_count - $r - 1  < $set_column - $c) ) {
                        $row_end_out .= "";
                        $v = 0;
                }
                break;
          default:
        $row_end_out .= '';
            if ($c == $set_column) {
                        $row_end_out .= "".$titlesecondline;
            }
         }*/
         //  HTML for outputing of Title
         $title_out .= "<".( $this->css_type == "content" ? "h2" : "span" )." ".modDisplayNewsHelper::dn_style("dn-head").">";
         if ($link_titles ) {
            $title_out .= "title)."\"";
                }
            $title_out .= ">".$title."";
         } else {
            $title_out .= $title;
         }
         $title_out .= "".( $this->css_type == "content" ? "h2" : "span" ).">";
      }
      //---------------------------------------------------------------------
      if ($show_hits ) {
         $hits_out .= "";
         $hits_out .= $row->hits;
         $hits_out .= "";
      }
            //---------------------------------------------------------------------
      if ($show_vote ) {
                // look for images in template if available
                $img = '';
                $starImageOn    = JHTML::_('image.site',  'rating_star.png', '/images/M_images/' );
                $starImageOff   = JHTML::_('image.site',  'rating_star_blank.png', '/images/M_images/' );
                for ($i=0; $i < $row->rating; $i++) {
                        $img .= $starImageOn;
                }
                for ($i=$row->rating; $i < 5; $i++) {
                        $img .= $starImageOff;
                }
                $rate_out .= '';
                $rate_out .= JText::_( 'User Rating' ) .':'. $img .' / ';
                $rate_out .= intval( $row->rating_count );
                $rate_out .= "
 ";
      }
          $text="";
      // Code for displaying of individual items Intro Text
      if ($show_text ) {
        $text = $row->text;
                if (!$show_image) {
                        $text = preg_replace( '/
 ![]() ]*>/i', '', $text );
                }
                if ($show_image && $image_scale) {
                                $text = preg_replace( '/( ![]() ]*)(\s+width\s*=\s*["\']?\w+["\']?)([^>]*>)/i', '$1 $3', $text );
                                $text = preg_replace( '/( ![]() ]*)(\s+height\s*=\s*["\']?\w+["\?]?)([^>]*>)/i', '$1 $3', $text );
                                $text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?width\s*:\s*\w+\s*[;]?)([^>]*>)/i', '$1 $3', $text );
                                $text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?height\s*:\s*\w+\s*[;]?)([^>]*>)/i', '$1 $3', $text );
                                if ( $image_scale < 3 ) {
                                        $text = preg_replace( '/( ![]() ]*)(>)/i', '$1 '.( $image_scale == 1 ? "width=".$image_width : "height=".$image_height ).' $2', $text );
                                } else if ( $image_scale == 3 ) {
                                        $text = preg_replace_callback( '@( ![]() ]*\s+src\s*=\s*)(["\']*)([^"\']+)(["\']*)([^>]*>)@i',
                                                                create_function(
                                                                        // single quotes are essential here,
                                                                        // or alternative escape all $ as \$
                                                                        '$img',
                                                'return $img[1].$img[2].$img[3].$img[4]." ".modDisplayNewsHelper::imageResize($img[3],'.$image_width.','.$image_height.')." ".$img[5];'
                                                                ),
                                                                $text
                                                        );
                                }
                }
                if ($show_image && $image_align) {
                        $text = preg_replace( '/( ![]() ]*)(\s+align\s*=\s*["\']?\w+["\']?)([^>]*>)/i', '$1 $3', $text );
                        $text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?float\s*:\s*\w+\s*[;]?)([^>]*>)/i', '$1 $3', $text );
                        $text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?align\s*:\s*\w+\s*[;]?)([^>]*>)/i', '$1 $3', $text );
                        switch ($image_align) {
							case 2: $align="left"; break;
							case 3: $align="right"; break;
							case 4: $align="middle"; break;
							case 5: $align="top"; break;
							case 6: $align="bottom"; break;
                            case 7: $align = $r%2 ? "left"  : "right"; break;
                            case 8: $align = $r%2 ? "right" : "left "; break;
                        }
                        if ( $image_align >= 2) {
                                $text = preg_replace( '/( ![]() ]*)(\/\s*>)/i', '$1 align="'.$align.'" $2', $text );
                        }
                }
                /* if ($show_image && $image_valign) {
                        $text = preg_replace( '/( ![]() ]*)(\s+valign\s*=\s*["\']?\w+["\']?)([^>]*>)/i', '$1 $3', $text );
                        $text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?vertical-align\s*:\s*\w+\s*[;]?)([^>]*>)/i', '$1 $3', $text );
                        switch ($image_align) {
                                case 2: $valign="top"; break;
                            case 3: $valign="bottom"; break;
                                case 4: $valign="middle"; break;
                        }
                        if ( $image_align >= 2) {
                                $text = preg_replace( '/( ![]() ]*)(\/\s*>)/i', '$1 valign="'.$valign.'" $2', $text );
                        }
                }*/
				
                if ($show_image && $image_margin<>"") {
					$text = preg_replace( '/( ![]() ]*)(\s+hspace\s*=\s*["\']?\w+["\']?)([^>]*>)/i', '$1 $3', $text );
					$text = preg_replace( '/( ![]() ]*\s+style\s*=\s*".*)(\s?margin[^:"]*\s*:\s*[^;"]*[;]?)([^>]*>)/i', '$1 $3', $text );
					// $text = preg_replace( '/( ![]() ]*\s+)((style\s*=\s*")([^"]*)(["]))+(.*[^>]*>)/i', '$1  $3 $4 $5 ', $text );
					
					$text = preg_replace( '/( ![]() ]*\s+)((style\s*=\s*["])([^"]*)(["]))([^>]*>)/i', 
						'$1 style="margin: '.$image_margin.'; $4 " $6', $text );
						// '$1 AAA="margin:'.$image_margin.'; $4" $6', $text );
					// $text = preg_replace( '/( ![]() ]*)(>)/i', '${1} ; ${2}', $text );
                }
                if ($image_num) {
                        global $i;
                        $i = 0;
                        $text = preg_replace_callback( '/ ![]() ]*>/i',
                                                create_function(
                                                        // single quotes are essential here,
                                                        // or alternative escape all $ as \$
                                                        '$img',
                                                        'global $i; $i ++; if ($i <= '.$image_num.') return $img[0];'
                                                ),
                                                $text
                                        );
                }
// $title_out .= "".$title."";
                if ( $show_image > 1 ) {
                        preg_match_all('/(? ![]() ![]() ]+>)/i',$text, $out);
                        $i = 0;
                        foreach ($out["img"] as $val) {
                                if ($link_image) {
                                        $img_out .= "";
                                }
                                $img_out .= $val;
                                if ($link_image) {
                                        $img_out .= "";
                                }
                                $i++;
                                if ( $image_num ) {
                                        if ( $i >= $image_num-1 ) {
                                                break;
                                        }
                                }
                        }
                        $text = preg_replace( '/ ![]() ]*>/i', '', $text );
                }
                //$link1 = "";
                //$link2 = "";
                // $text ="";
                //foreach ($out["txt"] as $val) {
                //      $text .= $val;
                //}
                if ( $show_image && $link_image && !$link_text ) {
                        $text = preg_replace_callback( '/ ![]() ]*>/i',
                                                create_function(
                                                        // single quotes are essential here,
                                                        // or alternative escape all $ as \$
                                                        '$img',
                                                        "return \"\".\$img[0].\"\";"
                                                ),
                                                $text
                                        );
                }
        $text = JFilterOutput::ampReplace($text);
                $text_limited = 0;
        if ($filter_text ) {
            $text = modDisplayNewsHelper::dn_filter( $text );
                $text_limited = modDisplayNewsHelper::dn_limit( $text, $filter_text, $length_limit_text,
                                                                        "" /* $show_readmore ? JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid )) : ""  */);
         }
         //  HTML for outputing of Intro Text
         $text_out = "";
         if ($link_text ) {
            $text_out .= "title)."\"";
                }
            $text_out .= ">";
         }
         if ($link_text ) {
                $text_out .= preg_replace( '/(]*>)|(<\w*\/a\w*>)/i', '', $text );
         } else {
                $text_out .= $text;
         }
         if ($link_text ) {
            $text_out .= "";
         }
         $text_out .= "";
      }
      //---------------------------------------------------------------------
      // Code for displaying of individual items Read More link
      // $show_text && $show_full_text
        if ( ($show_readmore == 1) ||
             (($show_readmore == 2) && !$show_text ) ||
             (($show_readmore == 2) && $text_limited ) ||
             (($show_readmore == 2) && ( $filter_text < 2 ) && strlen( $row->fulltext ) && !($show_text > 1 ) )
            ) {
         // $readmore_out .= "";
         $readmore_out .= "title)."\"";
             }
         $readmore_out .= ">". ( $text_readmore != "" ? $text_readmore : ( $aparams->get('readmore') ? $aparams->get('readmore') : JText::_('Подробнее...') ) )."";
         //$readmore_out .= "";
      }
      //---------------------------------------------------------------------
                $read_more_shown = 1;
        if ( ! $use_rows_template ) {
                $read_more_shown = 0;
        $pf =0;
         for ( $i=0; $i < strlen( $format); $i += 1 ) {
            if ( $format[$i] == "%" ) {
               $pf = 1;
            } else {
               if ( $pf==1 ) {
                  $pf = 0;
                  switch ( $format[$i] ) {
                  case "s":
                     $row_out .= $sec_out;
                     break;
                  case "c":
                     $row_out .=  $cat_out;
                     break;
                  case "d":
                     $row_out .= $date_out;
                     break;
                  case "t":
                     $row_out .= $title_out;
                     break;
                  case "h":
                     $row_out .= $hits_out;
                     break;
                  case "a":
                     $row_out .= $author_out;
                     break;
                  case "p":
                     $row_out .= $img_out;
                     break;
                  case "i":
                     $row_out .= $text_out;
                     break;
                  case "r":
                     $row_out .= $rate_out;
                     break;
                  case "m":
                     $row_out .= $readmore_out;
                                         $read_more_shown = 1;
                     break;
                  case "%":
                     echo "%";
                     break;
                  default:
                  } // switch
               } else {
                  $row_out .= $format[$i];
               } // if ( pf
            } // if ( $format[i] == "%" )
            // echo $out;
         } // for
                } else {
						$css_type = $this->css_type;
                        eval("\$row_out = $row_template;");
                //eval("\$str = \"$str\";");
                }
                $row_end_out = "";
         // echo "rows_count=$rows_count r=$r set_column=$set_column c=$c ";
          if (!$read_more_shown) {
                        $row_end_out .= $readmore_out; // read more is not element of format, but should be printed at the end of each content entry
          }
      switch ($style) {
      case 'flat':
                // $row_end_out .= ' ';
                $row_end_out .= '';
            if ( ($v == $vr) || ($rows_count - $r - 1  < $set_column - $c) ) {
                        $row_end_out .= "
 |  
                ";
   }
/*
        switch ($style) {
          case 'vert':
      case 'horiz':
      case 'flatlist':
          case 'flatarrow':
          default:
                while ( $c < $set_column) {
                        $c ++;
                        $rows_out .= "
                params->def('multi_column_order',0)) : // vert
                                for ($z = 0; $z < $set_column; $z ++) :
                                        if ($z > 0) : $divider = " column_separator"; endif; ?>
                                        
                                        | total && $target < ($set_count)) :
                                                        $this->item =& $this->getItem($target, $this->params);
                                                        echo $this->loadTemplate('item');
                                                endif;
                                        endfor;
                                                        ?>0) : $divider = " column_separator"; endif; ?> | total && $i < ($set_count)) :
                                                $this->item =& $this->getItem($i, $this->params);
                                                echo $this->loadTemplate('item');
                                                $i ++;
                                        endif;
                                endfor; ?> |  ";
                }
          }
*/
   // End of Loop //
   eval("\$out = $module_template;");
   echo $out;
   /* echo "".
   ( $mod_title_out <> '' ? " | $mod_title_out" : '').
   ( $mod_descr_out <> '' ? "$mod_descr_out" : '' ).
   $mod_start_out.
   $rows_out.
   ( $mod_automore_out <> '' ? $mod_automore_out :'' ).
   $mod_end_out;*/
} // dn_main
}
?> |  |