| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Languages 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 class applyAction extends Action 19 { 20 function execute(&$controller, &$request) 21 { 22 23 $domain = mosGetParam($_POST,'domain'); 24 $textdomain = mosGetParam($_POST,'textdomain'); 25 $lang = mosGetParam($_POST,'lang'); 26 $comments = mosGetParam($_POST,'comments'); 27 $headers = mosGetParam($_POST,'headers'); 28 29 $catalog = new PHPGettext_catalog($domain, $textdomain); 30 $catalog->setproperty('mode', 'po'); 31 $catalog->setproperty('lang', $lang); 32 $catalog->load(); 33 34 $catalog->setComments($comments); 35 $catalog->setHeaders($headers); 36 $plural_forms = $catalog->headers['Plural-Forms']; 37 preg_match('/nplurals[\s]*[=]{1}[\s]*([\d]+);[\s]*plural[\s]*[=]{1}[\s]*(.*);/', $plural_forms, $matches); 38 $is_plural = $matches[1] > 1; 39 foreach ($_POST as $key => $value) { 40 41 // if (preg_match('/^([a-z]+)[_]?([0-9]+)?_([0-9]+)$/', $key, $matches)) { 42 if (preg_match('/^([a-z]+[_]?[a-z]+?)[_]?([0-9]+)?_([0-9]+)$/', $key, $matches)) { 43 switch ($matches[1]) 44 { 45 case 'msgid': 46 $messages[$matches[3]]['msgid'] = $value; 47 break; 48 case 'msgid_plural': 49 if ($is_plural){ 50 $messages[$matches[3]]['msgid_plural'] = $value; 51 } 52 break; 53 case 'msgstr': 54 if (!empty($messages[$matches[3]]['msgid_plural'])) { 55 if ($matches[2] != '') { 56 $messages[$matches[3]]['msgstr'][$matches[2]] = stripslashes($value); 57 } else { 58 $messages[$matches[3]]['msgstr'][0] = stripslashes($value); 59 $messages[$matches[3]]['msgstr'][1] = ''; 60 } 61 } else { 62 $messages[$matches[3]]['msgstr'] = stripslashes($value); 63 } 64 break; 65 case 'fuzzy': 66 $messages[$matches[3]]['fuzzy'] = $value == 'true' ? true : false; 67 break; 68 } 69 } 70 } 71 foreach ($messages as $index => $arr) { 72 if (strcmp($catalog->strings[$index]->msgid, $arr['msgid']) == 0) { 73 $catalog->strings[$index]->setmsgstr($arr['msgstr']); 74 $catalog->strings[$index]->msgid_plural = isset($arr['msgid_plural'])?$arr['msgid_plural']:null;; 75 $catalog->strings[$index]->setfuzzy($arr['fuzzy']); 76 } 77 } 78 $catalog->save(); 79 if ($request->get('act') == 'catalogs') { 80 $request->set('domain', $domain); 81 } 82 $controller->view('edit'); 83 } 84 } 85 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |