Created
January 6, 2012 08:35
-
-
Save psiborg/1569723 to your computer and use it in GitHub Desktop.
PHP Object Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* =========================================================================== | |
| * $Id$ | |
| * | |
| * @fileoverview | |
| * | |
| * | |
| * @author Jim Ing (@jim_ing) | |
| * =========================================================================== | |
| */ | |
| /** | |
| * @desc | |
| * | |
| */ | |
| class Base { | |
| public $lang = ''; // language code (en|fr) | |
| //------------------------------------------------------------------------ | |
| /** | |
| * @desc | |
| * Constructor. | |
| */ | |
| function __construct ($lang) { | |
| global $_CONFIG; | |
| if ($lang) { | |
| $this->lang = $lang; | |
| } | |
| else if ($_CONFIG['lang']) { | |
| $this->lang = $_CONFIG['lang']; | |
| } | |
| } | |
| /** | |
| * @desc | |
| * | |
| */ | |
| public function hello ($str) { | |
| try { | |
| header('Content-Type: text/html'); | |
| header('Content-Language: ' . $this->lang); | |
| echo 'Hello ' . $str . PHP_EOL; | |
| } | |
| catch (Exception $e) { | |
| header('Content-Type: text/plain'); | |
| die('Exception: ' . $e->getMessage()); | |
| } | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment