Files

375 lines
16 KiB
PHP

<? global $lang, $lang_id, $page; ?>
<?
function date_pl( $string )
{
$string = str_replace('Mon', 'poniedziałek', $string);
$string = str_replace('Tue', 'wtorek', $string);
$string = str_replace('Wed', 'środa', $string);
$string = str_replace('Thu', 'czwartek', $string);
$string = str_replace('Fri', 'piątek', $string);
$string = str_replace('Sat', 'sobota', $string);
$string = str_replace('Sun', 'niedziela', $string);
$string = str_replace('Jan', 'styczeń', $string);
$string = str_replace('Feb', 'luty', $string);
$string = str_replace('Mar', 'marzec', $string);
$string = str_replace('Apr', 'kwiecień', $string);
$string = str_replace('May', 'maj', $string);
$string = str_replace('Jun', 'czerwiec', $string);
$string = str_replace('Jul', 'lipiec', $string);
$string = str_replace('Aug', 'sierpień', $string);
$string = str_replace('Sep', 'wrzesień', $string);
$string = str_replace('Oct', 'październik', $string);
$string = str_replace('Nov', 'listopad', $string);
$string = str_replace('Dec', 'grudzień', $string);
return $string;
}
$text = $this -> article['language']['text'];
$text = \front\factory\Articles::generateHeadersIds( $text );
?>
<div class="article article-<?= $this -> article['id'];?>">
<div class="row">
<!-- <div class="col-lg-8 offset-lg-2"> -->
<div class="col-12">
<p class="article-sub-title">BLOG</p>
<?
if ( $this -> article['show_title'] )
echo '<h1 class="article-title">' . $this -> article['language']['title'] . '</h1>';
if ( $this -> article['id_author'] ):
$author = \front\factory\Authors::get_single_author( $this -> article['id_author'] );
?>
<div class="author">
<img class="image" src="<?= $author['image'];?>" alt="<?= htmlspecialchars( $author['author'] );?>">
<p class="name"><?= $author['author'];?></p>
<? if($author['author_position']) : ?>
<div class="autor-position">
<p><?= $author['author_position'];?></p>
</div>
<? endif; ?>
<?
if ( $this -> article['show_date_add'] )
echo '<div class="date-add">' . date_pl( date( 'M', strtotime( $this -> article[ 'date_add' ] ) ) ) . ' ' . date( 'Y', strtotime($this -> article[ 'date_add' ] ) ) .'</div>';
if ( $this -> article['show_date_modify'] )
echo '<div class="date-add">' . date_pl( date( 'M', strtotime( $this -> article[ 'date_modify' ] ) ) ) . ' ' . date( 'Y', strtotime($this -> article[ 'date_modify' ] ) ) .'</div>';
?>
</div>
<?
endif;
?>
</div>
<!-- <div class="col-lg-10 offset-lg-1"> -->
<div class="col-12">
<? if ( $main_img = $this -> article['language']['main_image'] ):?>
<div class="main-image">
<img src="<?= $main_img;?>" alt="<?= htmlspecialchars( $this -> article['language']['title'] );?>">
</div>
<? endif;?>
</div>
<!-- <div class="<?= in_array( 11, $this -> article['pages'] ) ? 'col-12' : 'col-lg-8 offset-lg-2';?>"> -->
<div class="col-12">
<? if ( $this -> article['repeat_entry'] ):?>
<div class="entry">
<?= $this -> article['language']['entry'];?>
</div>
<? endif;?>
<!-- <? if ( $this -> article['language']['table_of_contents'] ):?>
<div class="table-of-contents">
<div class="title">
<?= \S::lang( 'spis-tresci' );?>
</div>
<?= $this -> article['language']['table_of_contents'];?>
</div>
<? else: ?>
<div class="table-of-contents">
<div class="title">
<?= \S::lang( 'spis-tresci' );?>
</div>
<div class="spis_arr">
<?= \front\factory\Articles::generateTableOfContents( $text );?>
</div>
</div>
<? endif;?> -->
<? if ($this->article['layout_id'] != 1 && $this->article['layout_id'] != 41) : ?>
<div class="table-of-contents">
<div class="title">
<?= \S::lang( 'spis-tresci' );?>
</div>
<div class="spis_arr">
<?= \front\factory\Articles::generateTableOfContents( $text );?>
</div>
</div>
<? endif; ?>
<div class="text">
<?
/* artykuł wewnątrz innego artykułu */
preg_match_all( '/ARTYKUL:[0-9]*/', $this -> article['language']['text'], $articles_list );
if ( is_array( $articles_list[0] ) ) foreach( $articles_list[0] as $article_tmp )
{
$article_tmp = explode( ':', $article_tmp );
if ( $article_tmp[1] != $this -> article['id'] )
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', \front\view\Articles::article_full( $article_tmp[1], $lang_id ), $text );
else
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', '', $text );
}
/* galeria w innym miejscu niż na końcu */
if ( strpos( $this -> article['language']['text'], '[GALERIA]' ) !== false )
{
if ( is_array( $this -> article['images'] ) ):
$tpl = new \Tpl;
$tpl -> article = $this -> article;
$tpl -> images = $this -> article['images'];
$gallery = $tpl -> render( 'articles/article-gallery' );
endif;
$text = preg_replace('/(<p(.*)>\[GALERIA\]<\/p>|<div(.*)>\[GALERIA\]<\/div>)/', $gallery, $text );
}
/* załączniki w innym miejscu niż na końcu */
if ( strpos( $this -> article['language']['text'], '[ZALACZNIKI]' ) !== false )
{
if ( is_array( $this -> article['files'] ) ):
$tpl = new \Tpl;
$tpl -> article_id = $this -> article['id'];
$tpl -> files = $this -> article['files'];
$files = $tpl -> render( 'articles/article-files' );
endif;
$text = preg_replace('/(<p(.*)>\[ZALACZNIKI\]<\/p>|<div(.*)>\[ZALACZNIKI\]<\/div>)/', $files, $text );
}
/* slider */
if ( strpos( $text, '[SLIDER]' ) !== false )
{
while ( strpos( $text, '[SLIDER]' ) !== false )
{
$text_tmp = explode( '[SLIDER]', $text );
$before = $text_tmp[0];
for ( $i = 1; $i < count( $text_tmp ); $i++ )
{
$temp = explode( '[/SLIDER]' , $text_tmp[$i] );
$code = $temp[0];
ob_start();
$images_tmp = explode( '|', $code );
if ( is_array( $images_tmp ) and !empty( $images_tmp ) ) foreach ( $images_tmp as $image_tmp )
{
$image = explode( ';', $image_tmp );
$images[] = $image;
}
$tpl = new \Tpl;
$tpl -> images = $images;
$tpl -> article_id = $this -> article['id'];
$tpl -> i = $i;
echo $tpl -> render( 'articles/slider' );
$out .= ob_get_contents();
ob_end_clean();
$out .= $temp[1];
}
$text = $before . $out;
}
}
$dom = new DomDocument('1.0', 'UTF-8');
$dom -> loadHTML( '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $text );
$elements = $dom -> getElementsByTagName( 'img' );
foreach ( $elements as $element )
{
if ( strpos( $element -> getAttribute( 'class' ), 'zoom' ) !== false )
{
$element_tmp = $dom -> createElement( 'a', '' );
$element_tmp -> setAttribute( 'href', $element -> getAttribute( 'src' ) );
$element_tmp -> setAttribute( 'rel', 'article-' . $this -> article['id'] );
$element_tmp -> setAttribute( 'class', 'fancybox' );
$element_tmp_2 = $element -> cloneNode( false );
$element_tmp -> appendChild( $element_tmp_2 );
$element -> parentNode -> replaceChild( $element_tmp, $element );
}
}
echo $dom -> saveHTML();
?>
</div>
<!-- <?
if ( $this -> article['id_author'] ):
?>
<div class="author-footer">
<img class="image" src="<?= $author['image'];?>" alt="<?= htmlspecialchars( $author['author'] );?>">
<div class="right">
<p class="name"><?= $author['author'];?></p>
<p class="description"><?= $author['languages'][$lang_id]['description'];?></p>
</div>
</div>
<?
endif;
?> -->
</div>
</div>
<?
$this -> article['language']['seo_link'] ? $url = $this -> article['language']['seo_link'] : $url = 'a-' . $this -> article['id'] . '-' . \S::seo( $this -> article['language']['title'] );
if ( $this -> article['tags'] ):
echo '<div class="article-tags">';
echo '<ul>';
foreach ( $this -> article['tags'] as $tag ):
echo '<li>';
echo '<a href="/tag,' . \S::seo( $tag ) . '">' . $tag . '</a>';
echo '</li>';
endforeach;
echo '</ul>';
echo '</div>';
endif;
?>
<?
if ( is_array( $this -> article['images'] ) and strpos( $this -> article['language']['text'], '[GALERIA]' ) === false ):
$tpl = new \Tpl;
$tpl -> article = $this -> article;
$tpl -> images = $this -> article['images'];
echo $tpl -> render( 'articles/article-gallery' );
endif;
if ( is_array( $this -> article['files'] ) and strpos( $this -> article['language']['text'], '[ZALACZNIKI]' ) === false ):
$tpl = new \Tpl;
$tpl -> article_id = $this -> article['id'];
$tpl -> files = $this -> article['files'];
echo $tpl -> render( 'articles/article-files' );
endif;
if ( $this -> article['social_icons'] ):
?>
<div class="social-icons">
<a class="fb" href="http://www.facebook.com/sharer.php?u=<?= \S::get_domain_url( $_SERVER['SERVER_NAME'] );?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="facebook" target="_blank" rel="nofollow">
<img src="/images/system/logo-facebook.jpg" alt="facebook" />
</a>
<a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?= \S::get_domain_url( $_SERVER['SERVER_NAME'] );?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="pinterest" target="_blank" rel="nofollow">
<img src="/images/system/logo-pinterest.jpg" alt="pinterest" />
</a>
<a class="twitter" href="http://twitter.com/share?url=<?= \S::get_domain_url( $_SERVER['SERVER_NAME'] );?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=600');return false;" title="twitter" target="_blank" rel="nofollow">
<img src="/images/system/logo-twitter.jpg" alt="twitter" />
</a>
<a class="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?= \S::get_domain_url( $_SERVER['SERVER_NAME'] );?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=850');return false;" title="linked in" target="_blank" rel="nofollow">
<img src="/images/system/logo-linkedin.jpg" alt="linkedin" />
</a>
<a class="gp" href="https://plus.google.com/share?url=<?= \S::get_domain_url( $_SERVER['SERVER_NAME'] );?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="google+" target="_blank" rel="nofollow">
<img src="/images/system/logo-google.jpg" alt="google+" />
</a>
</div>
<?
endif;
?>
<div class="article-footer">
<div class="article-footer-col-left">
<?
if ( $this -> article['show_date_add'] )
echo '<div class="footer-date-add"><p>Data publikacji: <strong>' . date_pl( date( 'M', strtotime( $this -> article[ 'date_add' ] ) ) ) . ' ' . date( 'Y', strtotime($this -> article[ 'date_add' ] ) ) .'</strong></p></div>';
?>
<? if ( $this -> article['id_author'] ): ?>
<div class="footer-author">
<p>Autor: <strong><?= $author['author'];?></strong></p>
</div>
<? endif; ?>
</div>
<div class="article-footer-col-right">
<a href="https://<? if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language( \S::get_domain( $_SERVER['HTTP_HOST'] ) ) ) echo \S::get_session( 'current-lang' );?><?= \S::get_domain( $_SERVER['HTTP_HOST'] ) . '/' . $url;?>" class="btn1 btn-clip">
<img src="/upload/filemanager/new-2024/assets/Copy2.svg" alt="">
Skopiuj link do artykułu
</a>
</div>
</div>
</div>
<? if (!$this -> article -> layout_id) : ?>
<?= \front\view\Articles::news(12, \front\factory\Articles::news( 12, 7, $lang_id)); ?>
<? endif; ?>
<link class="footer" href="/libraries/fancyBox/jquery.fancybox.css" rel="stylesheet" type="text/css">
<link class="footer" href="/libraries/fancyBox/helpers/jquery.fancybox-buttons.css" rel="stylesheet" type="text/css">
<script class="footer" type="text/javascript" src="/libraries/fancyBox/jquery.fancybox.js"></script>
<script class="footer" type="text/javascript" src="/libraries/fancyBox/helpers/jquery.fancybox-buttons.js"></script>
<script class="footer" type="text/javascript">
$( document ).ready(function()
{
$('body').on('click', '.btn-clip', function(e) {
e.preventDefault();
var href = $(this).attr('href');
navigator.clipboard.writeText(href)
.then(function() {
})
.catch(function(error) {
console.error("error: ", error);
});
})
$( ".gallery a.image" ).fancybox({
closeBtn : false,
helpers : {
buttons : {}
}
});
<? if ( $this -> article['language']['table_of_contents'] ):?>
window.addEventListener('DOMContentLoaded', () => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
const id = entry.target.getAttribute('id');
if ( entry.intersectionRatio > 0) {
document.querySelector('.article-<?= $this -> article['id'];?> .table-of-contents li a[href$="#' + id + '"]').parentElement.classList.add('active');
} else {
document.querySelector('.article-<?= $this -> article['id'];?> .table-of-contents li a[href$="#' + id + '"]').parentElement.classList.remove('active');
}
});
});
document.querySelectorAll( '.article-<?= $this -> article['id'];?> .text div[id]' ).forEach((div) => {
observer.observe(div);
});
});
<? endif;?>
});
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "<?php echo $this -> article['language']['title']; ?>",
"description": "<?php echo trim( preg_replace('/\s+/', ' ', strip_tags( $this -> article['language']['entry'] )) );?>",
"author": {
"@type": "Person",
"name": "<?php echo $author['author'];?>",
"jobTitle": "<?php echo $author['author_position'];?>"
},
"publisher": {
"@type": "Organization",
"name": "Zaufane.pl",
"logo": {
"@type": "ImageObject",
"url": "https://zaufane.pl/cache/upload/filemanager/images/logo.png.webp"
}
},
"datePublished": "<?php echo $this -> article[ 'date_add' ]; ?>",
"mainEntityOfPage": {
"@type": "WebPage",
"url": "https://zaufane.pl/certyfikat-zaufanepl-klucz-do-zaufania-klientow-w-twojej-firmie"
},
"articleSection": [
"Zaufanie klientów",
"Marketing opinii",
"Opinie w sklepie internetowym"
],
"image": "https://zaufane.pl/<?php echo $this -> article['language']['main_image']; ?>"
}
</script>