first commit

This commit is contained in:
2024-10-25 23:02:37 +02:00
commit faeb2e52e8
7653 changed files with 1095335 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
<?php
namespace front\view;
class Articles
{
public static function news( $page_id, $articles )
{
$tpl = new \Tpl;
$tpl -> page_id = $page_id;
$tpl -> articles = $articles;
return $tpl -> render( 'articles/news' );
}
public static function full_article( $article_id, $lang_id )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article_id, $lang_id );
return $tpl -> render( 'articles/article' );
}
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
$out .= $tpl -> render( 'articles/article-miniature' );
}
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
$articles[] = \front\factory\Articles::article_details( $article, $lang_id );
$tpl = new \Tpl;
$tpl -> page_id = $page['id'];
$tpl -> articles = $articles;
$out .= $tpl -> render( 'articles/articles-entries' );
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function full_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
$out .= $tpl -> render( 'articles/article-full' );
}
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace front\view;
class Banners
{
public static function banners( $banners )
{
$tpl = new \Tpl;
$tpl -> banners = $banners;
return $tpl -> render( 'banner/banners' );
}
public static function main_banner( $banner )
{
if ( !\S::get_session( 'banner_close' ) && is_array( $banner ) )
{
$tpl = new \Tpl;
$tpl -> banner = $banner;
return $tpl -> render( 'banner/main-banner' );
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class Languages
{
public static function languages()
{
$tpl = new \Tpl;
$tpl -> languages = \front\factory\Languages::active_languages();
return $tpl -> render( 'site/languages' );
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace front\view;
class Menu
{
public static function pages( $pages, $level = 0, $current_page = 0 )
{
$tpl = new \Tpl;
$tpl -> pages = $pages;
$tpl -> level = $level;
$tpl -> current_page = $current_page;
return $tpl -> render( 'menu/pages' );
}
public static function menu( $menu, $current_page )
{
$tpl = new \Tpl;
$tpl -> menu = $menu;
$tpl -> current_page = $current_page;
return $tpl -> render( 'menu/menu' );
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace front\view;
class Newsletter
{
public static function newsletter()
{
$tpl = new \Tpl;
return $tpl -> render( 'newsletter/newsletter' );
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class Scontainers
{
public static function scontainer( $id )
{
$tpl = new \Tpl;
$tpl -> scontainer = \front\factory\Scontainers::scontainer_details( $id );
return $tpl -> render( 'scontainers/scontainer' );
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace front\view;
class ShopCategory
{
static public function category_description( $category )
{
return \Tpl::view( 'shop-category/category-description', [
'category' => $category
] );
}
static public function category_view( $category, $lang_id, $bs = 1 )
{
global $settings, $page;
if ( !$settings['infinitescroll'] )
{
$results = \front\factory\ShopCategory::category_products( $category, $lang_id, $bs );
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$tpl -> link = $category['language']['seo_link'] ? $url = $category['language']['seo_link'] : $url = 'k-' . $category['id'] . '-' . \S::seo( $category['language']['title'] );
$pager = $tpl -> render( 'site/pager' );
}
return \Tpl::view( 'shop-category/category', [
'category' => $category,
'products' => $results['products'],
'pager' => $pager,
'category_description' => (int)$bs <= 1 ? true : false,
'category_additional_text' => true
] );
}
$products_count = \front\factory\ShopCategory::category_products_count( $category, $lang_id );
return \Tpl::view( 'shop-category/category-infinitescroll', [
'category' => $category,
'products_count' => $products_count,
'category_description' => (int)$bs <= 1 ? true : false,
'category_additional_text' => true
] );
}
public static function categories( $categories, $current_category = 0, $level = 0 )
{
$tpl = new \Tpl;
$tpl -> level = $level;
$tpl -> current_category = $current_category;
$tpl -> categories = $categories;
return $tpl -> render( 'shop-category/categories' );
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace front\view;
class ShopClient
{
public static function address_edit( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-client/address-edit' );
}
public static function client_addresses( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-client/client-addresses' );
}
public static function client_menu( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-client/client-menu' );
}
public static function client_orders( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-client/client-orders' );
}
public static function recover_password()
{
$tpl = new \Tpl;
return $tpl -> render( 'shop-client/recover-password' );
}
public static function mini_login()
{
global $client;
$tpl = new \Tpl;
$tpl -> client = $client;
return $tpl -> render( 'shop-client/mini-login' );
}
public static function login_form( $values = '' )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-client/login-form' );
}
public static function register_form()
{
$tpl = new \Tpl;
return $tpl -> render( 'shop-client/register-form' );
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class ShopOrder
{
public static function order_details( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-order/order-details' );
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class ShopPaymentMethod
{
public static function basket_payment_methods( $payment_methods, $payment_id )
{
$tpl = new \Tpl;
$tpl -> payment_methods = $payment_methods;
$tpl -> payment_id = $payment_id;
return $tpl -> render( 'shop-basket/basket-payments-methods' );
}
}

View File

@@ -0,0 +1,6 @@
<?php
namespace front\view;
class ShopTransport
{
}

View File

@@ -0,0 +1,482 @@
<?php
namespace front\view;
use shop\Product;
class Site
{
const menu_pattern = '/MENU:[0-9]*/';
const menu_main_pattern = '/MENU_GLOWNE:[0-9]*/';
const container_pattern = '/KONTENER:[0-9]*/';
const language_pattern = '/LANG:[a-zA-Z0-9_-]*/';
const products_promoted = '/PROMOWANE_PRODUKTY((:([0-9]*))?)/';
const news_pattern = '/AKTUALNOSCI:([0-9]*)((:([0-9]*))?)/';
const article_products_category_pattern = '/PRODUKTY_KATEGORIA:([0-9]*)((:([0-9]*))?)/';
const news_list_pattern = '/AKTUALNOSCI_LISTA:([0-9]*)((:([0-9]*))?)/';
const top_news_pattern = '/NAJPOULARNIEJSZE_ARTYKULY:([0-9]*)((:([0-9]*))?)/';
const single_product_pattern = '/PRODUKT:[0-9]*/';
const products_box = '/PRODUKTY_BOX:[0-9,]*/';
const produkty_top = '/PRODUKTY_TOP((:([0-9]*))?)/';
const produkty_new = '/PRODUKTY_NEW((:([0-9]*))?)/';
public static function show()
{
global $page, $settings, $settings, $lang, $lang_id;
if ( (int) \S::get( 'layout_id' ) )
$layout = new \cms\Layout( (int) \S::get( 'layout_id' ) );
if ( \S::get( 'article' ) )
$layout = \front\factory\Layouts::article_layout( \S::get( 'article' ) );
if ( \S::get( 'product' ) )
$layout = \front\factory\Layouts::product_layout( \S::get( 'product' ) );
if ( \S::get( 'category' ) )
$layout = \front\factory\Layouts::category_layout( \S::get( 'category' ) );
if ( !$layout )
$layout = \front\factory\Layouts::active_layout( $page['id'] );
if ( $settings['devel'] == true and file_exists( 'devel.html' ) )
$html = file_get_contents( 'devel.html' );
else
{
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
$html = $layout['m_html'];
else
$html = $layout['html'];
}
if ( $settings['facebook_link'] )
$html = str_replace( '</body>', \front\view\Site::facebook( $settings['facebook_link'] ) . '</body>', $html );
$html = str_replace( '[COPYRIGHT]',
\front\view\Site::copyright(),
$html );
$html = str_replace( '[BANER_STRONA_GLOWNA]', \front\view\Banners::main_banner( \front\factory\Banners::main_banner() ), $html );
$html = str_replace( '[BANERY]', \front\view\Banners::banners( \front\factory\Banners::banners() ), $html );
$html = str_replace( '[KATEGORIE]', \Tpl::view( 'shop-category/categories', [
'level' => $level,
'current_category' => \S::get( 'category' ),
'categories' => \front\factory\ShopCategory::categories_details()
] ), $html );
/* BOX - promowane produkty */
preg_match_all( self::products_promoted, $html, $products_promoted_list );
if ( is_array( $products_promoted_list[0] ) ) foreach( $products_promoted_list[0] as $products_promoted_tmp )
{
$products_promoted_tmp = explode( ':', $products_promoted_tmp );
$products_promoted_tmp[1] ? $limit = $products_promoted_tmp[1] : $limit = 6;
$products_promoted_tmp[1] ? $pattern = '[PROMOWANE_PRODUKTY:' . $products_promoted_tmp[1] . ']' : $pattern = '[PROMOWANE_PRODUKTY]';
$html = str_replace( $pattern,
\Tpl::view( 'shop-product/promoted-products', [
'products' => \front\factory\ShopProduct::promoted_products( $limit )
] ),
$html
);
}
/* BOX - aktualnsci */
preg_match_all( self::news_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
{
$news_list_tmp = explode( ':', $news_list_tmp );
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ']';
$html = str_replace( $pattern, \front\view\Articles::news(
$news_list_tmp[1],
\front\factory\Articles::news( $news_list_tmp[1], $news_limit, $lang_id )
), $html );
}
$html = str_replace( '[KOSZYK]',
\Tpl::view( 'shop-basket/basket-mini', [
'basket' => \S::get_session( 'basket' ),
'lang_id' => $lang_id,
'coupon' => \S::get_session( 'coupon' )
] ),
$html );
$html = str_replace( '[NEWSLETTER]',
\front\view\Newsletter::newsletter(),
$html );
$html = str_replace( '[UZYTKOWNIK_MINI_LOGOWANIE]',
\front\view\ShopClient::mini_login(),
$html );
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
$html = str_replace( '[CSS]', $layout['m_css'], $html );
else
$html = str_replace( '[CSS]', $layout['css'], $html );
if ( \S::is_mobile() and !empty( $layout['m_html'] ) )
$html = str_replace( '[JAVA_SCRIPT]', $layout['m_js'], $html );
else
$html = str_replace( '[JAVA_SCRIPT]', $layout['js'], $html );
preg_match_all( self::menu_pattern, $html, $menu );
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
{
$menu_tmp = explode( ':', $menu_tmp );
$html = str_replace( '[MENU:' . $menu_tmp[1] . ']', \front\view\Menu::menu( \front\factory\Menu::menu_details( $menu_tmp[1] ), $page['id'] ), $html );
}
preg_match_all( self::menu_main_pattern, $html, $menu );
if ( is_array( $menu[0] ) ) foreach( $menu[0] as $menu_tmp )
{
$menu_tmp = explode( ':', $menu_tmp );
$html = str_replace(
'[MENU_GLOWNE:' . $menu_tmp[1] . ']',
\Tpl::view( 'menu/main-menu', [
'menu' => \front\factory\Menu::menu_details( $menu_tmp[1] )
] ),
$html );
}
preg_match_all( self::language_pattern, $html, $language_list );
if ( is_array( $language_list[0] ) ) foreach( $language_list[0] as $language_list_tmp )
{
$language_list_tmp = explode( ':', $language_list_tmp );
$html = str_replace( '[LANG:' . $language_list_tmp[1] . ']', $lang[ $language_list_tmp[1] ], $html );
}
//
// KATEGORIA SKLEPU
//
if ( \S::get( 'category' ) )
{
$category = \front\factory\ShopCategory::category_details( \S::get( 'category' ) );
if ( $category['language']['meta_title'] )
$page['language']['title'] = $category['language']['meta_title'];
else
$page['language']['title'] = $category['language']['title'];
$page['show_title'] = true;
$page['language']['meta_keywords'] = $category['language']['meta_keywords'];
$page['language']['meta_description'] = $category['language']['meta_description'];
$page['language']['page_title'] = $category['language']['category_title'] ? $category['language']['category_title'] : $category['language']['title'];
// CANONICAL
$html = str_replace( '[CANONICAL]', '', $html );
}
//
// ARTYKUŁ
//
if ( \S::get( 'article' ) )
{
$article = \front\factory\Articles::article_details( \S::get( 'article' ), $lang_id );
if ( $article['language']['meta_title'] )
$page['language']['title'] = $article['language']['meta_title'];
else
$page['language']['title'] = $article['language']['title'];
$page['show_title'] = false;
$page['language']['meta_keywords'] = $article['language']['meta_keywords'];
$page['language']['meta_description'] = $article['language']['meta_description'];
// CANONICAL
$html = str_replace( '[CANONICAL]', '', $html );
}
//
// PRODUKT
//
if ( \S::get( 'product' ) )
{
$product = Product::getFromCache( \S::get( 'product' ), $lang_id, $_GET['permutation_hash'] );
if ( $product['language']['meta_title'] )
$page['language']['title'] = $product['language']['meta_title'];
else
$page['language']['title'] = $product['language']['name'];
$page['show_title'] = false;
$page['language']['meta_keywords'] = $product['language']['meta_keywords'];
$page['language']['meta_description'] = $product['language']['meta_description'];
// CANONICAL
if ( $product['language']['canonical'] )
$html = str_replace( '[CANONICAL]', '<link rel="canonical" href="' . $product['language']['canonical'] . '">', $html );
else
$html = str_replace( '[CANONICAL]', '', $html );
}
//
// PRODUCENT
//
if ( \S::get( 'producer_id' ) )
{
$producer = new \shop\Producer( \S::get( 'producer_id' ) );
if ( $producer['languages'][$lang_id]['meta_title'] )
$page['language']['meta_title'] = $producer['languages'][$lang_id]['meta_title'];
}
//
// STRONA CMS
//
if ( $page )
{
// CANONICAL
$html = str_replace( '[CANONICAL]', '', $html );
}
$html = str_replace( '[CANONICAL]', '', $html );
$html = str_replace( '[ZAWARTOSC]', \front\controls\Site::route( $product, $category ), $html );
/* pojedynczy produkt */
preg_match_all( self::single_product_pattern, $html, $single_product_array );
if ( is_array( $single_product_array[0] ) ) foreach( $single_product_array[0] as $single_product )
{
$single_product = explode( ':', $single_product );
$html = str_replace(
'[PRODUKT:' . $single_product[1] . ']',
\Tpl::view( 'shop-product/product-mini', [
'product' => \shop\Product::getFromCache( (int)$single_product[1], $lang_id )
] ),
$html
);
}
/* lista produktów */
preg_match_all( self::products_box, $html, $products_box_array );
if ( is_array( $products_box_array[0] ) ) foreach( $products_box_array[0] as $products_box )
{
unset( $products_id ); unset( $product_id ); unset( $products );
$products_box = explode( ':', $products_box );
$products_id = explode( ',', $products_box[1] );
foreach ( $products_id as $product_id )
$products[] = Product::getFromCache( (int)$product_id, $lang_id );
$html = str_replace(
'[PRODUKTY_BOX:' . $products_box[1] . ']',
\Tpl::view( 'shop-product/products-box', [
'products' => $products
] ),
$html
);
}
/* lista popularnych produktów */
preg_match_all( self::produkty_top, $html, $products_top_array );
if ( is_array( $products_top_array[0] ) ) foreach( $products_top_array[0] as $products_top )
{
unset( $products_id_arr );
unset( $limit );
unset( $product_id );
unset( $top_products_arr );
$products_top = explode( ':', $products_top );
$products_top[1] ? $limit = $products_top[1] : $limit = 6;
$products_top[1] ? $pattern = '[PRODUKTY_TOP:' . $products_top[1] . ']' : $pattern = '[PRODUKTY_TOP]';
$products_id_arr = \front\factory\ShopProduct::top_products( $limit );
foreach ( $products_id_arr as $product_id ){
$top_products_arr[] = Product::getFromCache( (int)$product_id, $lang_id );
}
$html = str_replace( $pattern,
\Tpl::view( 'shop-product/products-top', [
'products' => $top_products_arr,
] ),
$html
);
}
/* lista ostatnio dodanych produktów */
preg_match_all( self::produkty_new, $html, $products_top_array );
if ( is_array( $products_top_array[0] ) ) foreach( $products_top_array[0] as $products_top )
{
unset( $products_id_arr );
unset( $limit );
unset( $product_id );
unset( $top_products_arr );
$products_top = explode( ':', $products_top );
$products_top[1] ? $limit = $products_top[1] : $limit = 10;
$products_top[1] ? $pattern = '[PRODUKTY_NEW:' . $products_top[1] . ']' : $pattern = '[PRODUKTY_NEW]';
$products_id_arr = \front\factory\ShopProduct::new_products( $limit );
foreach ( $products_id_arr as $product_id ){
$top_products_arr[] = Product::getFromCache( (int)$product_id, $lang_id );
}
$html = str_replace( $pattern,
\Tpl::view( 'shop-product/products-new', [
'products' => $top_products_arr,
] ),
$html
);
}
$html = str_replace( '[TITLE]', $page['language']['meta_title'] ? $page['language']['meta_title'] . ' | ' . $settings['firm_name'] : $page['language']['title'] . ' | ' . $settings['firm_name'], $html );
$html = str_replace( '[META_KEYWORDS]', $page['language']['meta_keywords'], $html );
$html = str_replace( '[META_DESCRIPTION]', $page['language']['meta_description'], $html );
$html = str_replace( '[JEZYKI]', \front\view\Languages::languages(), $html );
$html = str_replace( '[TYTUL_STRONY]', self::title( $page['language']['title'], $page['show_title'], $page['language']['page_title'] ), $html );
$html = str_replace( '[WYSZUKIWARKA]', \shop\Search::simple_form(), $html );
/* atrybut noindex */
if ( \S::get( 'article' ) )
{
\front\factory\Articles::article_noindex( \S::get( 'article' ) ) ? $noindex = 'noindex' : $noindex = 'all';
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
}
else
{
$page['language']['noindex'] ? $noindex = 'noindex' : $noindex = 'all';
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
}
if ( $page['language']['canonical'] )
$html = str_replace( '</head>', '<link rel="canonical" href="' . $page['language']['canonical'] . '" /></head>', $html );
while ( strpos( $html, '[PHP]' ) !== false )
{
$text = explode( '[PHP]', $html );
$before = $text[0];
for ( $i = 1; $i < count( $text ); $i++ )
{
$temp = explode( '[/PHP]' , $text[$i] );
$code = $temp[0];
ob_start();
eval( $code );
$out .= ob_get_contents();
ob_end_clean();
$out .= $temp[1];
}
$html = $before . $out;
}
/* BOX - blog produkty kategoria */
preg_match_all( self::article_products_category_pattern, $html, $category_list );
if ( is_array( $category_list[0] ) ) foreach( $category_list[0] as $category_list_tmp )
{
$category_list_tmp = explode( ':', $category_list_tmp );
$category_list_tmp[2] != '' ? $products_limit = $category_list_tmp[2] : $products_limit = 4;
$category_list_tmp[2] != '' ? $pattern = '[PRODUKTY_KATEGORIA:' . $category_list_tmp[1] . ':' . $category_list_tmp[2] . ']' : $pattern = '[PRODUKTY_KATEGORIA:' . $category_list_tmp[1] . ']';
$html = str_replace(
$pattern,
\Tpl::view( 'shop-category/blog-category-products', [
'products' => \front\factory\ShopCategory::blog_category_products( $category_list_tmp[1], $lang_id, $products_limit )
] ),
$html );
}
// prosta lista aktualności z wybranej podstrony
preg_match_all( self::news_list_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
{
$news_list_tmp = explode( ':', $news_list_tmp );
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ']';
$news_list = \Article::getNews( $news_list_tmp[1], $news_limit, $lang_id );
$view_news_list = \Article::newsList( $news_list );
$html = str_replace( $pattern, $view_news_list, $html );
}
// prosta lista z najpopularniejszymi artykułami
preg_match_all( self::top_news_pattern, $html, $news_list );
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
{
$news_list_tmp = explode( ':', $news_list_tmp );
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
$news_list_tmp[2] != '' ? $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ']';
$news_list = \Article::getTopNews( $news_list_tmp[1], $news_limit, $lang_id );
$view_news_list = \Article::newsList( $news_list );
$html = str_replace( $pattern, $view_news_list, $html );
}
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
preg_match_all( self::container_pattern, $html, $container_list );
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
{
$container_list_tmp = explode( ':', $container_list_tmp );
$html = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $html );
}
return $html;
}
public static function facebook( $facebook_link )
{
$tpl = new \Tpl;
$tpl -> facebook_link = $facebook_link;
return $tpl -> render( 'site/facebook' );
}
static public function title( $title, $show_title, $page_title )
{
return \Tpl::view( 'site/title', [
'title' => $title,
'page_title' => $page_title,
'show_title' => $show_title
] );
}
public static function alert()
{
if ( $alert = \S::get_session( 'alert' ) )
{
\S::delete_session( 'alert' );
return $tpl = \Tpl::view( 'site/alert', [
'alert' => $alert
] );
}
if ( $error = \S::get_session( 'error' ) )
{
\S::delete_session( 'error' );
$tpl = new \Tpl;
$tpl -> error = $error;
return $tpl -> render( 'site/error' );
}
}
public static function copyright()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/copyright' );
}
public static function contact()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/contact' );
}
public static function cookie_information()
{
$tpl = new \Tpl;
return $tpl -> render( 'site/cookie-information' );
}
}
?>