Advertisement
Guest User

TH1

a guest
Oct 14th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2. /*
  3. | Tema Manager Sederhana
  4. | Koding by Yaya Laressa
  5. */
  6.  
  7. class Tema {
  8.     public $namafile;
  9.  
  10.     public function __construct($namafile) {
  11.         $this->namafile = $namafile;
  12.     }
  13.  
  14.     public function terapkan() {
  15.         $file = sprintf('./tema/%s.html', $this->namafile);
  16.         $fh_skin = fopen($file, 'r');
  17.         $tema = @fread($fh_skin, filesize($file));
  18.         fclose($fh_skin);
  19.        
  20.         return $this->jalankan($tema);
  21.     }
  22.    
  23.     private function jalankan($tema) {
  24.         $tema = preg_replace_callback('/{\$th->(.+?)}/i', create_function('$matches', 'global $TH; return $TH[$matches[1]];'), $tema);
  25.         return $tema;
  26.     }
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement