\[GALERIA\]<\/p>|
\[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('/(
\[ZALACZNIKI\]<\/p>|
\[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( '' . "\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();
?>
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;
?>
= $lang['wstecz'];?>