PHP Classes

File: PHP-DS/PHP_DS.php

Recommend this page to a friend!
  Classes of berkay karata?   PHP-DS   PHP-DS/PHP_DS.php   Download  
File: PHP-DS/PHP_DS.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP-DS
Translate text in PHP code to different languages
Author: By
Last change:
Date: 6 years ago
Size: 10,983 bytes
 

Contents

Class file image Download
<?php //---------------------------------------------------------------------------------------------------- // LANG SUPPORT FOR CLASSES, METHODS and PRINTS APP //---------------------------------------------------------------------------------------------------- // // Author : Berkay Karata? <berkaykarats@icloud.com> // Site : // Lisans : The MIT License // Copyright : Copyright (c) 2017, TÜRKÇE FRAMEWORK // //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- // R00t-DIR //---------------------------------------------------------------------------------------------------- define( 'PHP_DS_KÖK_D?Z?N', dirname(__FILE__) ); //---------------------------------------------------------------------------------------------------- // Include Core //---------------------------------------------------------------------------------------------------- include(PHP_DS_KÖK_D?Z?N."/core/CORE_1-1-0.php"); //---------------------------------------------------------------------------------------------------- // LANGUAGE SETTING FOR USING PHP-DS //---------------------------------------------------------------------------------------------------- if(!isset($PHP_DS_LANGUAGE)){Berkay\PHP_DS_ba??ml?l?k::sistemi_durdur();} //---------------------------------------------------------------------------------------------------- // Namespace //---------------------------------------------------------------------------------------------------- use Berkay\PHP_DS; $Dil_Deste?i = new PHP_DS(PHP_DS_KÖK_D?Z?N."/lang/".$PHP_DS_LANGUAGE.".php"); //---------------------------------------------------------------------------------------------------- // Using Settings //---------------------------------------------------------------------------------------------------- #S?n?f ?smi De?i?tirme $Dil_Deste?i->s?n?f ="a_class"; #Anahtar Tipi $Dil_Deste?i->kullan?m="nesne"; #De?i?ken Varsay?lan? De?i?tirme $Dil_Deste?i->de?i?ken_v="a_param"; #Fonksiyon Varsay?lan? De?i?tirme $Dil_Deste?i->fonksiyon_v="a_func"; #Dil Deste?i Sa?lanacak Kod $Dil_Deste?i->kod=' class a_class { // --------------------------------------------------------------------------------------------------- // Params //---------------------------------------------------------------------------------------------------- public $a_param1 = "a_param8"; public $a_param2 = "a_param9"; public $a_param3 = "a_param10"; public $a_param4 = "a_param11"; public $a_param5 = null; public $a_param6 = null; public $a_param7 = null; // --------------------------------------------------------------------------------------------------- // Constructor function //---------------------------------------------------------------------------------------------------- function __construct($dosya=null) { // --------------------------------------------------------------------------------------------------- // Assign a language file to a variable //---------------------------------------------------------------------------------------------------- $this->a_param6 = $dosya; // --------------------------------------------------------------------------------------------------- // De?i?ken bo?sa //---------------------------------------------------------------------------------------------------- if($this->a_param6==null) { // --------------------------------------------------------------------------------------------------- // Language file not found //---------------------------------------------------------------------------------------------------- die("a_param12"); } //---------------------------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------------------------- // Language support function //---------------------------------------------------------------------------------------------------- public function a_func1() { // --------------------------------------------------------------------------------------------------- // If the specified language file is not found //---------------------------------------------------------------------------------------------------- if(!@include($this->a_param6)) { // --------------------------------------------------------------------------------------------------- // Error //---------------------------------------------------------------------------------------------------- die ("a_param13.\n".$this->a_param6); //---------------------------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------------------------- // Call the code generator function //---------------------------------------------------------------------------------------------------- $this->olu?tur($dil,$this->a_param5); //---------------------------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------------------------- // Code generator function //---------------------------------------------------------------------------------------------------- private function olu?tur($dil=null,$kod=null) { //---------------------------------------------------------------------------------------------------- // SWITCHES //---------------------------------------------------------------------------------------------------- // // Usable : __callStatic , __call : $anahtar_= null; switch ($this->a_param2) { case \'a_param9\': $kullan?m="__callStatic"; $anahtar_="public static"; break; default: $kullan?m="__call"; $anahtar_="public"; break; } //---------------------------------------------------------------------------------------------------- // COMPLETE SWITCHES //---------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------- // CREATE CODE ACCORDING TO LANGUAGE FILE //---------------------------------------------------------------------------------------------------- // Details of Functions //---------------------------------------------------------------------------------------------------- $fonksiyon_say?s?= substr_count($kod, $this->a_param3); // --------------------------------------------------------------------------------------------------- // Indexes //---------------------------------------------------------------------------------------------------- $i = $fonksiyon_say?s?; $orta = null; // --------------------------------------------------------------------------------------------------- // Loop by function sequence //---------------------------------------------------------------------------------------------------- do { // --------------------------------------------------------------------------------------------------- // Body part of support codes //---------------------------------------------------------------------------------------------------- $orta= $orta. \' case @\'.$dil[\'F\'.$i].\': return call_user_func_array(array(@\'.$dil[$this->a_param1].\',"\'.$this->a_param3.$i.\'"), $elemanlar); break;\'; // --------------------------------------------------------------------------------------------------- // Cycle continues up to the number of functions //---------------------------------------------------------------------------------------------------- $i--; } while ($i<=$fonksiyon_say?s? && $i>0); // --------------------------------------------------------------------------------------------------- // CREATE CODE ACCORDING TO LANGUAGE FILE //---------------------------------------------------------------------------------------------------- // Details of Variables //---------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------- // Indexes //---------------------------------------------------------------------------------------------------- do { $de?i?ken_say?s? = substr_count($kod, $this->a_param4.@$i_d); } while(@$i_d); // --------------------------------------------------------------------------------------------------- // Loop by variable sequence //---------------------------------------------------------------------------------------------------- for ($i_d= $de?i?ken_say?s?-1; $i_d<$de?i?ken_say?s? && $i_d>0; $i_d--) { // --------------------------------------------------------------------------------------------------- // Adapt Variables //---------------------------------------------------------------------------------------------------- $kod = @str_ireplace($this->a_param4.$i_d,$dil[\'$\'.$i_d],$kod); } // --------------------------------------------------------------------------------------------------- // Support for methodization by language file //---------------------------------------------------------------------------------------------------- $destek=$anahtar_.\' function \'.$kullan?m.\'($method, $elemanlar) { global $dil; switch ($method) { \'.$orta.\' default: echo"a_param14"; exit; break; }}}\'; // --------------------------------------------------------------------------------------------------- // Convert to class name for using //---------------------------------------------------------------------------------------------------- $kod = str_ireplace($this->a_param1,$dil[$this->a_param1],$kod); // --------------------------------------------------------------------------------------------------- // Edit code //---------------------------------------------------------------------------------------------------- $kod = ltrim($kod); $kod = rtrim($kod); // --------------------------------------------------------------------------------------------------- // Clear last "}" character to provide support //---------------------------------------------------------------------------------------------------- $kod = rtrim($kod, "}"); eval($kod.$destek); //---------------------------------------------------------------------------------------------------- } // // --------------------------------------------------------------------------------------------------- // Application End //---------------------------------------------------------------------------------------------------- }'; #Dil Deste?ini Sa?la $Dil_Deste?i->ekle();