

<div class="news-page-custom custom-page-news"  id="site-content" style="background: #fff;padding-left:0px; padding-right: 0px;">
    
    <div class="newsPage container">
         <div class="container mt-5" style="margin-top:30px !important;padding-left:0px; padding-right: 0px;">
          <div class="section-header">
            <h2>HABERLER</h2>
            <div class="line" style="background-color:#FF0000"></div>
          </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                    <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="/" title="Haberler">Haberler</a></li>
                <li class="breadcrumb-item"><a href="/{{$news->category->slug}}" title="{{mb_convert_case($news->category->name, MB_CASE_TITLE, "UTF-8")}}">{{mb_convert_case($news->category->name, MB_CASE_TITLE, "UTF-8")}}</a></li>
                <li class="breadcrumb-item active" aria-current="page">{{$news->name}}</li>
            </ol>
        </nav>
            </div>
        </div>
        <div class="divider"></div>

        <div class="row">
            <div class="col-md-9">
                
                  <div class="row">
        <div class="col-12">
            <div class="d-flex justify-content-between align-items-center">
                <div class="row" style="width:100%">
                    <div class="col-md-9">
                        <div class="article-title"><h1 class="article-title ">{{ltrim($news->name)}}</h1></div>

                    </div>                  
                </div>
            </div>
        </div>
    </div>
       <div class="row">
                            <div class="col-12">
                                <div class="article-sub-content">
                                    <h2 class="article-sub-content">{{$news->short_description}}</h2>
                                </div>
                            </div>
                        </div>
  <div class="row align-items-center">
    <!-- Tarih Bilgisi -->
    <div class="col-md-8 d-flex newsDates">
      <span>Giriş: {{$news->date}} {{$news->time}}</span>
      <span class="mx-3">|</span>
      <span>Güncelleme: {{$news->change_date_time}}</span>
    </div>

    <!-- Paylaşım Simgeleri -->
    <div class="col-md-4 text-end d-flex justify-content-end align-items-center">
      <span class="me-2 newsShare">Paylaş</span>
      <span class="divider"></span>
      <a href="#" class="mx-2 newsShareIcon"><i class="bi bi-facebook"></i></a>
      <a href="#" class="mx-2  newsShareIcon"><i class="bi bi-twitter"></i></a>
      <a href="#" class="mx-2  newsShareIcon"><i class="bi bi-linkedin"></i></a>
      <a href="#" class="mx-2  newsShareIcon"><i class="bi bi-whatsapp"></i></a>
      <a href="#" class="mx-2  newsShareIcon"><i class="bi bi-telegram"></i></a>
    </div>
  </div>

    <!-- Article Content -->
    

    <!-- Article Image -->

    @if(isset($news->news_image))
    <div class="row">
        <div class="col-12">
            <img src="{{env('PANEL_URL')}}/uploads/images/news/{{ date("Y/m/d", strtotime($news->date)) }}/{{$news->news_image}}" alt="{{$news->name}}" class="article-image">
        </div>
    </div>
    @endif

    <div class="row">
        <div class="col-12">
            <div class="article-content">

          @php 
$description = $news->description;
$description = str_replace('http://panel.ogaste.com/', '/', $description);
$description = str_replace('https://panel.ogaste.com/', '/', $description);
$description = str_replace('height', '/', $description);
$description = str_replace('oembed url', 'iframe frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" style="width: 100%;height: 500px" src', $description);
$description = str_replace('</oembed>', '</iframe>', $description);

$paragraphs = preg_split('/(<\/p>)/i', $description, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);

$p_count = 0;
foreach ($paragraphs as $part) {
    if (stripos($part, '</p>') !== false) {
        $p_count++;
    }
}

if($p_count > 0 ){
// Eklenmesi gereken konumu hesaplıyoruz
$insert_pos = ceil($p_count / 2) * 2 - 2;

// <div> etiketini ekliyoruz
if ($p_count > 1) {
    $inserted = false;
    $new_description = '';
    $current_p_count = 0;

    foreach ($paragraphs as $part) {
        $new_description .= $part;
        if (stripos($part, '</p>') !== false) {
            $current_p_count++;
        }
        if (!$inserted && $current_p_count >= $insert_pos) {
            $new_description .= '<div class="newsinads" style="padding: 10px; text-align: center;">' . config('settings.reklam_alan_haber_ici', 'Varsayılan Başlık') . '</div>';
            $inserted = true;
        }
    }

    $description = $new_description;
} else {
    $description .= '<div class="newsinads" style="padding: 10px; text-align: center;">' . config('settings.reklam_alan_haber_ici', 'Varsayılan Başlık') . '</div>';
}

}else{


$paragraphs = preg_split('/(<br\/>)/i', $description, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$p_count = 0;
foreach ($paragraphs as $part) {
    if (stripos($part, '<br/>') !== false) {
        $p_count++;
    }
}

$insert_pos = ceil($p_count / 2) * 2 - 2;

// <div> etiketini ekliyoruz
if ($p_count > 1) {
    $inserted = false;
    $new_description = '';
    $current_p_count = 0;

    foreach ($paragraphs as $part) {
        $new_description .= $part;
        if (stripos($part, '<br/>') !== false) {
            $current_p_count++;
        }
        if (!$inserted && $current_p_count >= $insert_pos) {
            $new_description .= '<div class="newsinads" style="padding: 10px; text-align: center;">' . config('settings.reklam_alan_haber_ici', 'Varsayılan Başlık') . '</div>';
            $inserted = true;
        }
    }

    $description = $new_description;
} else {
    $description .= '<div class="newsinads" style="padding: 10px; text-align: center;">' . config('settings.reklam_alan_haber_ici', 'Varsayılan Başlık') . '</div>';
}

}

$description = preg_replace('/<figure[^>]*>.*?<\/figure>/s', '', $description);

@endphp

{!! $description !!}

<div class="ads">
                    {!! showAd('204') !!}
                </div>

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<script async src="//www.instagram.com/embed.js"></script>
            </div>
        </div>
    </div>




    <!-- Article Footer -->


    <div class="row">
        <div class="col-12 article-footer">
    @if(isset($news->kaynak)) <p>Kaynak: {{$news->kaynak}}</p> @endif
    @if(isset($news->tag))
    @php 

    $tagParcala=explode(',',$news->tag);

    @endphp
            <div class="article-tags">
            @foreach($tagParcala as $tag)
                <a href="#" title="{{$tag}} Haberleri">{{$tag}}</a>
                @endforeach
            </div>
            @endif
        </div>
    </div>

      <div class="container newseight" style="margin-top:20px;padding-left:0px; padding-right: 0px;">
            <div class="container mt-5" style="padding-left:0px; padding-right: 0px;">
        <div class="section-header">
            <h2>{{$category->name}}</h2>
            <div class="line" style="background-color:#{{$category->color}}"></div>
        </div>
    </div>
        <div class="row"  style="margin-top:20px">
           @foreach($categoryhaberlerNews as $ekonomikhaberNews)
            <div class="col-md-4">
                 <div class="news-card">
            {!! getNewsLink($ekonomikhaberNews)!!}<img src="{{env('PANEL_URL')}}/uploads/images/news/{{ date("Y/m/d", strtotime($ekonomikhaberNews->date)) }}/{{$ekonomikhaberNews->news_image}}" alt="{{$ekonomikhaberNews->name}}" style="height:165px"></a>
            <div class="news-badge"style="background-color:#{{$ekonomikhaberNews->category->color}} !important;">{{$ekonomikhaberNews->category->name}}</div>
             <div class="card-body">
                <h5 class="card-title"> {!! getNewsLink($ekonomikhaberNews)!!}<div class="news-title">{{$ekonomikhaberNews->name}}</div></a></h5></div>
        </div>
            </div>
                        @endforeach
            
           
        </div>
    </div>


            </div>
            <div class="col-md-3">
                <div class="ads">
                    <a href="https://www.sahibinden.com/ilan/emlak-konut-satilik-bursa-nin-yeni-eglence-yasam-merkezi-odunluk-opera-da-1-plus1-daire-1008778061/detay" target="_blank"><img src="https://enbursa.com/wp-content/uploads/2022/11/opera_web-300x250-1.jpg" ad826x90"="" data-lazy-src="https://enbursa.com/wp-content/uploads/2022/11/opera_web-300x250-1.jpg" data-ll-status="loaded" class="entered lazyloaded"><noscript><img src="https://enbursa.com/wp-content/uploads/2022/11/opera_web-300x250-1.jpg"ad826x90"></noscript>          </a>
                </div>
                <div class="row">
                     <div class="col-md-12 one-cikan" style="padding-right:0px !important">
                <div class="container mt-5" style="padding-left:0px !important;padding-right:0px !important">
                  <div class="section-header" style="display: contents;">
                    <h2>ÖNE ÇIKANLAR</h2>
                    <div class="line" style="background-color:#FF0000;     margin-top: 5px;"></div>
                  </div>
                  <div class="row">
                     @php $i=0; @endphp
                      @foreach($categoryhaberlerTop as $news)
                      @php $i++; @endphp
                    <div class="col-md-12">
                        <div class=" one-cikan-card ">
                          <div class="circle col-md-2">{{$i}}</div>
                          <div class="text col-md-10">
                         <a href="/{{$news->slug ?? ''}}.html" title="{{ $news->name }}"><span>{{$news->name}}</span></a>
                            
                          </div>
                        </div>
                    </div>        
                    @endforeach                          
                  </div>
                </div>
              </div>
                    

                </div>


            </div>
        </div>
    </div>

</div>


<style type="text/css">
    
.article-content figure{
    text-align: center;
}

.article-content  img {
      width: auto;
    object-fit: contain;
    max-height: 500px;
    text-align: center;
    margin: 0 auto;
}




</style>

