- Redirecty save_license/delete_license/toggle_beta kierują teraz na #licenses - Dodano akcję discover_versions: skanuje updates/*/ver_*.zip przez glob(), rejestruje nieznane wersje jako beta w pp_update_versions - Przycisk "Wykryj wersje z dysku" w zakładce Wersje - Tpl::__isset() dla poprawnej obsługi isset() na właściwościach szablonu - Usunięto tymczasowy plik diagnostyczny _diag_licenses.php Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
81 lines
1.7 KiB
PHP
81 lines
1.7 KiB
PHP
<?php
|
|
namespace Shared\Tpl;
|
|
|
|
class Tpl
|
|
{
|
|
protected $dir = 'templates/';
|
|
protected $vars = array();
|
|
|
|
function __construct( $dir = null )
|
|
{
|
|
if ( $dir !== null )
|
|
$this->dir = $dir;
|
|
}
|
|
|
|
public static function view( $file, $values = '' )
|
|
{
|
|
$tpl = new self;
|
|
if ( is_array( $values ) ) foreach ( $values as $key => $val )
|
|
$tpl->$key = $val;
|
|
return $tpl->render( $file );
|
|
}
|
|
|
|
public function secureHTML( $val )
|
|
{
|
|
$out = stripslashes( $val );
|
|
$out = str_replace( "'", "'", $out );
|
|
$out = str_replace( '"', """, $out );
|
|
$out = str_replace( "<", "<", $out );
|
|
$out = str_replace( ">", ">", $out );
|
|
return $out;
|
|
}
|
|
|
|
public function render( $file )
|
|
{
|
|
if ( file_exists( 'templates_user/' . $file . '.php' ) )
|
|
{
|
|
ob_start();
|
|
include 'templates_user/' . $file . '.php';
|
|
$out = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
return $out;
|
|
}
|
|
else if ( file_exists( 'templates/' . $file . '.php' ) )
|
|
{
|
|
ob_start();
|
|
include 'templates/' . $file . '.php';
|
|
$out = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
return $out;
|
|
}
|
|
else if ( file_exists( $file . '.php' ) )
|
|
{
|
|
ob_start();
|
|
include $file . '.php';
|
|
$out = ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
return $out;
|
|
}
|
|
else
|
|
return '<div class="alert alert-danger" role="alert">Nie znaleziono pliku widoku: <b>' . $this->dir . $file . '.php</b>';
|
|
}
|
|
|
|
public function __set( $name, $value )
|
|
{
|
|
$this->vars[ $name ] = $value;
|
|
}
|
|
|
|
public function __isset( $name )
|
|
{
|
|
return isset( $this->vars[ $name ] );
|
|
}
|
|
|
|
public function __get( $name )
|
|
{
|
|
return $this->vars[ $name ];
|
|
}
|
|
}
|