symphonycms /
symphony-2
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @package content |
||
| 4 | */ |
||
| 5 | /** |
||
| 6 | * The AjaxTranslate page is used for translating strings on the fly |
||
| 7 | * that are used in Symphony's javascript |
||
| 8 | */ |
||
| 9 | |||
| 10 | class contentAjaxTranslate extends JSONPage |
||
|
0 ignored issues
–
show
|
|||
| 11 | { |
||
| 12 | public function view() |
||
| 13 | { |
||
| 14 | $strings = $_GET['strings']; |
||
| 15 | $namespace = (empty($_GET['namespace']) ? null : General::sanitize($_GET['namespace'])); |
||
| 16 | |||
| 17 | $new = array(); |
||
| 18 | |||
| 19 | foreach ($strings as $key => $value) { |
||
| 20 | // Check value |
||
| 21 | if (empty($value) || $value = 'false') { |
||
| 22 | $value = $key; |
||
| 23 | } |
||
| 24 | |||
| 25 | $value = General::sanitize($value); |
||
| 26 | |||
| 27 | // Translate |
||
| 28 | $new[$value] = Lang::translate(urldecode($value), null, $namespace); |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->_Result = $new; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |
Classes in PHP are usually named in CamelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes
DatabaseProvider.