Ok, here's a code I created, took about 3 minutes, and it's just scratchup, but works.
However, it does not support your values inside the element, for example, it wont support this:
<element value="Here's the value">
It will just take all of that and create one big element, like this:
element value="Here's the value"
Here's the code:
Code: Select all
<?php
$file = "<mod>This is a MOD</mod>\n"
."<title>The MOD title</title>\n"
."<open>Somefile.txt</open>\n"
."<find type=\"partial\">if (\$config['load_activity</find>\n"
."<replace>// if (\$config['load_activity</replace>";
$file_array = explode( "\n", $file );
for( $i = 0; $i < count( $file_array ); $i++ )
{
$element[$i] = preg_replace( ",<([a-zA-Z0-9 \"'=]*?)>(.*)</([a-zA-Z0-9 \"'=]*?)>,", '\\1', $file_array[$i] );
$values[$i] = preg_replace( ",<([a-zA-Z0-9 \"'=]*?)>(.*)</([a-zA-Z0-9 \"'=]*?)>,", '\\2', $file_array[$i] );
$edits[$element[$i]] = $values[$i];
}
?>