Explorar el Código

Added a new key replacement mode named "key-regex", which first replaces %key% from <var> with the key value, and then uses uses a regular expression for replacing by passing substring references.

DieFeM hace 12 años
padre
commit
b4b8e1cf91
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      modules/gamemanager/cfg_text_replace.php

+ 5 - 0
modules/gamemanager/cfg_text_replace.php

@@ -174,6 +174,11 @@ foreach($file_replacements as $filepath => $replacements)
 				$file_content = preg_replace("/$default/m", "$var $info_param,", $file_content, 1);
 			elseif ($options == "sqc")//separated & quoted & ending with a comma
 				$file_content = preg_replace("/$default/m", "$var \"$info_param\",", $file_content, 1);
+			elseif ($options == "key-regex")//replace %key% in <var> and use a regular expression
+			{
+				$var = str_replace("%key%", $info_param, $var);
+				$file_content = preg_replace("/$default/m", "$var", $file_content, 1);
+			}
 			else
 				$file_content = preg_replace("/$default/m", "$var$info_param", $file_content, 1);
 		}