00001 <?php 00002 /* $Id: Translation.php,v 1.1 2003/09/29 15:48:53 mikko Exp $ */ 00003 /* 00004 * ImaComm - a web based photo album software 00005 * Copyright (C) 2003, Mikko Kokkonen 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or (at 00010 * your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 */ 00021 00030 function translate() 00031 { 00032 if (func_num_args() < 1) 00033 { 00034 return null; 00035 } 00036 $str = func_get_arg(0); 00037 // Replace Java parameters... 00038 if (func_num_args() > 1) 00039 { 00040 for ($p = 1; $p < func_num_args(); $p++) 00041 { 00042 $search[] = '/\{'.($p - 1).'\}/'; 00043 $replace[] = func_get_arg($p); 00044 } 00045 $str = preg_replace($search, $replace, $str); 00046 } 00047 00048 return $str; 00049 } 00050 ?>
1.3