Y.P.Y
Well-Known Member
ساده، سبک، مطمعن:
PHP:
<?php
# Name: Skin
# Description: Skin class/engine.
# Version: 1.0.0
# PHP: +5
# Database: 0
# Author: Yousha Aleayoub(Y.P.Y)
# Copyright: (c) 1389/2011 Y.P.Y. All rights reserved.
# License: Gnu/GPL
# Contact: [email protected]
# Link: http://ypy.ir
if(!defined('Local_Access'))
{
exit();
}
final class Skin
{
private $_Str_Path, $_File, $_Ary_Variable;
public static $Ary_Information= array('Name'=>'', 'Description'=>'', 'Version'=>'', 'PHP'=>'', 'Database'=>'', 'Author'=>'', 'Copyright'=>'', 'License'=>'', 'Contact'=>'', 'Link'=>'');
final private function __clone()
{
exit();
}
# | __construct
public function Skin($Str_Path, $File)
{
if(is_array(&$File))
{
foreach($File as $_Value)
{
if(file_exists($Str_Path . $_Value) && is_readable($Str_Path . $_Value) && (filesize($Str_Path . $_Value) > 50))
{
$this->_Str_Path= $Str_Path;
$this->_File= $_Value;
break;
}
else
{
continue;
}
}
}
else
{
if(file_exists($Str_Path . $File) && is_readable($Str_Path . $File) && (filesize($Str_Path . $File) > 50))
{
$this->_Str_Path= $Str_Path;
$this->_File= $File;
}
else
{
return(false);
}
}
return(true);
}
public function Get_Profile()
{
if((!file_exists($this->_Str_Path . 'profile.inf') || !is_readable($this->_Str_Path . 'profile.inf') || filesize($this->_Str_Path . 'profile.inf') < 100))
{
return(false);
}
return(parse_ini_file($this->_Str_Path . 'profile.inf'));
}
public function __set($Str_Name, $Value)
{
$this->_Ary_Variable[$Str_Name]= $Value;
}
public function __unset($Str_Name)
{
unset($this->_Ary_Variable[$Str_Name]);
}
public function __get($Str_Name)
{
return(array_key_exists(&$Str_Name, &$this->_Ary_Variable) ? $this->_Ary_Variable[$Str_Name] : '');
}
public function Display()
{
foreach($this->_Ary_Variable as $_Key=>$_Value)
{
$this->$_Key= $_Value;
}
require_once($this->_Str_Path . $this->_File);
}
public function Reset()
{
$this->_Str_Path= '';
$this->_File= '';
$this->_Ary_Variable= array();
}
public function Debug()
{
}
public function __destruct()
{
unset($this->_Str_Path, $this->_File, $this->_Ary_Variable, $Ary_Information);
}
}
?>
آخرین ویرایش: