Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Wordpress options table reader for serailized data for wpml plugin

View gist:fabd02a1491fad761fff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<?php
error_reporting(1);
/**
* This code will create a code for wpml-config.xml file.
* 1) Save the file and call it a.php
* 2) Upload the file to wordpress root folder (it should be in same folder as wp-config.php file and not in theme folder)
* 3) Then execute the file using http://your-domain.com/a.php?option_name=XXX
* Copy the code to line 2 of your wpml-config.xml file
* Author: Harshad Mane
* Modified t by Nick M. of kriesi.at support to include an additional layer in depth , layout for easier reading
* WPML.org
*/
?>
<?php
$option_name = $_GET['option_name'];
if ($option_name) {
require ('./wp-load.php');
$get_array = get_option($option_name);
//echo '&lt;wpml-config&gt;' . "<br />";
echo '&lt;admin-texts&gt;' . "<br />";
echo '&lt;key name="' . $option_name . '"&gt;' . "<br />";
foreach($get_array as $key => $value) {
if (is_array($value)) {
echo '&nbsp;&nbsp;&nbsp;&lt;key name="' . $key . '"&gt;' . "<br />";
foreach($value as $value1 => $value2) {
if (is_array($value2)) {
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;key name="' . $value1 . '"&gt;' . "<br />";
foreach($value2 as $value3 => $value4) {
if (is_array($value4)) {
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;key name="' . $value3 . '"&gt;' . "<br />";
foreach($value4 as $value5 => $value6) {
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;key name="' . $value5 . '" /&gt;' . "<br />";
}
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/key&gt;' . "<br />";
} else { echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;key name="' . $value3 . '" /&gt;' . "<br />";}
}
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/key&gt;' . "<br />";
} else { echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;key name="' . $value1 . '" /&gt;' . "<br />";}
}
echo '&nbsp;&nbsp;&nbsp;&lt;/key&gt;' . "<br />";
} else { echo '&nbsp;&nbsp;&nbsp;&lt;key name="' . $key . '" /&gt;' . "<br />";}
}
echo '&lt;/key&gt;' . "<br />";
echo '&lt;/admin-texts&gt;' . "<br />";
// echo '&lt;/wpml-config&gt;';
}
else {
echo "Please enter option name!!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.