Needed to extend Innovation Theme plugin with some Dutch Social Networks and remove some others. As a lazy developer as I am I've inserted an array into the plugin and changed the code for dynamical reading.
Code:
<?php
/*
Plugin Name: Innovation Theme Settings
Description: Settings for the default GetSimple 3.0 Theme: Innovation
Version: 1.1
Author: Chris Cagle
Author URI: http://www.cagintranet.com/
*/
# get correct id for plugin
$thisfile_innov=basename(__FILE__, ".php");
$innovation_file=GSDATAOTHERPATH .'InnovationSettings.xml';
# add in this plugin's language file
i18n_merge($thisfile_innov,'en_US');
# register plugin
register_plugin(
$thisfile_innov, # ID of plugin, should be filename minus php
i18n_r($thisfile_innov.'/INNOVATION_TITLE'), # Title of plugin
'1.1', # Version of plugin
'Chris Cagle', # Author of plugin
'http://www.cagintranet.com/', # Author URL
i18n_r($thisfile_innov.'/INNOVATION_DESC'), # Plugin Description
'theme', # Page type of plugin
'innovation_show' # Function that displays content
);
# hooks
add_action('theme-sidebar','createSideMenu',array($thisfile_innov, i18n_r($thisfile_innov.'/INNOVATION_TITLE')));
# change /add / remove your Social Networks here ...
$innovation = Array('facebook','twitter','linkedin','hyves','plaxo');
# get XML data
if (file_exists($innovation_file)) {
$x = getXML($innovation_file);
foreach($innovation as $key => $value) {
$social[$value] = $x->$value;
}
} else {
foreach($innovation as $key => $value) {
$social[$value] = '';
}
}
function innovation_show() {
global $innovation_file, $thisfile_innov, $innovation, $social;
// submitted form
if (isset($_POST['submit'])) {
foreach($innovation as $key => $value) {
$social[$value] = null;
}
# check to see if the URLs provided are valid
foreach($innovation as $key => $value) {
if ($_POST[$value] != '') {
if (validate_url($_POST[$value])) {
$social[$value] = $_POST[$value];
} else {
$error .= i18n_r($thisfile_innov.'/'.strtoupper($value).'_ERROR').' ';
}
}
}
# if there are no errors, dave data
if (!$error) {
$xml = @new SimpleXMLElement('<item></item>');
foreach($innovation as $key => $value) {
$xml->addChild($value, $social[$value]);
}
if (! $xml->asXML($innovation_file)) {
$error = i18n_r('CHMOD_ERROR');
} else {
$x = getXML($innovation_file);
foreach($innovation as $key => $value) {
$social[$value] = $x->$value;
}
$success = i18n_r('SETTINGS_UPDATED');
}
}
}
?>
<h3><?php i18n($thisfile_innov.'/INNOVATION_TITLE'); ?></h3>
<?php
if($success) {
echo '<p style="color:#669933;"><b>'. $success .'</b></p>';
}
if($error) {
echo '<p style="color:#cc0000;"><b>'. $error .'</b></p>';
}
?>
<form method="post" action="<?php echo $_SERVER ['REQUEST_URI']?>">
<?php foreach($innovation as $key => $value) { ?>
<p><label for="inn_<?php echo $value ?>" ><?php i18n($thisfile_innov.'/'.strtoupper($value).'_URL'); ?></label><input id="inn_<?php echo $value ?>" name="<?php echo $value ?>" class="text" value="<?php echo $social[$value]; ?>" /></p>
<?php } ?>
<p><input type="submit" id="submit" class="submit" value="<?php i18n('BTN_SAVESETTINGS'); ?>" name="submit" /></p>
</form>
<?php
}