ok here is my functions.php:
PHP Code:
<?php
// Directory constants
define('INCLUDES', TEMPLATEPATH . '/includes');
define('ADMIN', TEMPLATEPATH . '/admin');
define('WIDGETS', TEMPLATEPATH . '/widgets');
define('FUNCTIONS', TEMPLATEPATH . '/functions');
define('LAYOUTS', TEMPLATEPATH . '/layouts');
// the
$wud = wp_upload_dir();
define('U_DIR', $wud['basedir']);
// U_URL is used like : U_URL.'/swift_custom' so I wonder
// why that line is not in the define??? Anyway...
if (isset($blog_id) && $blog_id > 0) {
define('U_URL', get_bloginfo('template_url') . '/includes');
define('UU_URL', $wud['baseurl']);
} else {
define('U_URL', $wud['baseurl']);
}
require_once (INCLUDES . '/sidebar-init.php'); // Initializes the sidebars
require_once (INCLUDES . '/navigation.php');
require_once (INCLUDES . '/thumb.php');
require_once (INCLUDES . '/wp-pagenavi.php');
require_once (ADMIN. '/admin-core.php');
require_once (ADMIN. '/admin-header.php');
require_once (ADMIN. '/swift-options-init.php');
require_once (ADMIN. '/swift-design-options-init.php');
require_once (ADMIN. '/pageorder.php');
require_once (ADMIN. '/categoryorder.php');
require_once (ADMIN. '/create-styles.php');
require_once (FUNCTIONS. '/custom-functions.php');
require_once (LAYOUTS. '/blog-loop.php');
require_once (LAYOUTS. '/mag-loop.php');
require_once (WIDGETS . '/widget-functions.php');
require_once (WIDGETS . '/widgets.php');
add_action('widgets_init', create_function('', 'return register_widget("swiftTabs");'));
add_action('widgets_init', create_function('', 'return register_widget("swiftPopularPosts");'));
add_action('widgets_init', create_function('', 'return register_widget("swiftAdsWidget");'));
add_action('widgets_init', create_function('', 'return register_widget("SubscribeBox");'));
add_action('widgets_init', create_function('', 'return register_widget("HomePageOnlyText");'));
add_action('update_option', 'create_style_sheet');
add_action('update_option', 'resetSwiftOptions');
add_action('admin_head', 'first_run_options');
add_action('switch_theme', 'delete_stuff');
// EDL: Added Register Settings
add_action('admin_init', 'register_swift_settings');
function register_swift_settings() {
global $swift_options, $swift_design_options;
foreach ($swift_options as $value) {
if($value['id']!=NULL) {
register_setting('swift_settings_group', $value['id']);
}
}
foreach ($swift_design_options as $value) {
if($value['id']!=NULL) {
register_setting('swift_settings_group_design', $value['id']);
}
}
}
// EDL: Date Thing
$dateformat = get_option('date_format');$timeformat = get_option('time_format');
function fv_date_diff($d1, $d2){
if ($d1 < $d2){
$temp = $d2;
$d2 = $d1;
$d1 = $temp;
} else {
$temp = $d1; //temp can be used for day count if required
}
$d1 = date_parse(date("Y-m-d H:i:s",$d1));
$d2 = date_parse(date("Y-m-d H:i:s",$d2));
//seconds
if ($d1['second'] >= $d2['second']){
$diff['second'] = $d1['second'] - $d2['second'];
} else {
$d1['minute']--;
$diff['second'] = 60-$d2['second']+$d1['second'];
}
//minutes
if ($d1['minute'] >= $d2['minute']){
$diff['minute'] = $d1['minute'] - $d2['minute'];
} else {
$d1['hour']--;
$diff['minute'] = 60-$d2['minute']+$d1['minute'];
}
//hours
if ($d1['hour'] >= $d2['hour']){
$diff['hour'] = $d1['hour'] - $d2['hour'];
} else {
$d1['day']--;
$diff['hour'] = 24-$d2['hour']+$d1['hour'];
}
//days
if ($d1['day'] >= $d2['day']){
$diff['day'] = $d1['day'] - $d2['day'];
} else {
$d1['month']--;
$diff['day'] = date("t",$temp)-$d2['day']+$d1['day'];
}
//months
if ($d1['month'] >= $d2['month']){
$diff['month'] = $d1['month'] - $d2['month'];
} else {
$d1['year']--;
$diff['month'] = 12-$d2['month']+$d1['month'];
}
//years
$diff['year'] = $d1['year'] - $d2['year'];
return $diff;
}
?>
And my /admin/swift/design-options.php:
PHP Code:
<?php require_once('admin-header.php');?>
<?php admin_header();?>
<div class="tabs">
<ul class="tabmenu hidden">
<li><a href="#Layout">Layout Options</a></li>
<li><a href="#Fonts">Fonts</a></li>
<li><a href="#colors">Colors</a></li>
<li><a href="#bgImages">Background Images</a></li>
<li><a href="#Rounded-Corners">Rounded Corners</a></li>
<li><a href="#Custom-CSS">Custom CSS</a></li>
</ul>
<form method="post" action="options.php">
<?php settings_fields('swift_settings_group_design');
global $themename, $shortname2, $swift_design_options;
$options_list='';
foreach ($swift_design_options as $value)
{
if($value['id']!=NULL)$options_list.=$value['id'].',';
switch ( $value['type'] )
{
case "open":
?>
<div class="open">
<?php break; case "close": ?>
</div>
<?php break; case "clear": ?>
<div class="clear"></div>
<?php break; case "tab-title": ?>
<div id="<?php echo $value['name']; ?>">
<h2><?php echo $value['name']; ?></h2>
<?php break; case "heading": ?>
<div id="sub-heading">
<h3><?php echo $value['name']; ?></h3>
<?php break; case "sub-heading": ?>
<div class="sub-heading"><h4><?php echo $value['name']; ?></h4></div>
<?php break; case 'text': ?>
<div class="text">
<input name="<?php echo $value['id']; ?>" class="color" id="<?php echo stripslashes(get_option( $value['id'] )); ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option( $value['id'] ) != "") { echo stripslashes(get_option( $value['id'] )); } else { echo stripslashes($value['std']); } ?>" />
<span class="title"><?php echo $value['name']; ?></span>
<div class="clear"></div>
</div>
<?php break; case 'regulartext': ?>
<div class="text">
<span class="title"><?php echo $value['name']; ?></span>
<input class="width" name="<?php echo $value['id']; ?>" id="<?php echo stripslashes(get_option( $value['id'] )); ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option( $value['id'] ) != "") { echo stripslashes(get_option( $value['id'] )); } else { echo stripslashes($value['std']); } ?>" />
<span class="desc"><?php echo $value['desc']; ?></span>
</div>
<?php break; case 'textarea': ?>
<div class="textarea clearfix">
<span class="title"><?php echo $value['name']; ?></span>
<textarea name="<?php echo $value['id']; ?>"type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'] )); } else { echo $value['std']; } ?></textarea>
<span class="desc"><?php echo $value['desc']; ?></span>
<br />
</div>
<?php break; case "checkbox": ?>
<div class="checkbox">
<?php if(get_option($value['id'])=="true"){ $checked = "checked=\"checked\""; }else{ $checked = "";}
?>
<input type="checkbox" class="cb" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
<span class="title"><?php echo $value['name']; ?></span>
<span class="desc">(<?php echo $value['desc']; ?>)</span>
</div>
<?php break; case 'ordering':
swift_mypageorder();
swift_mycategoryorder();
?>
<?php break; case 'radio': ?>
<div class="radio text">
<span class="title"><?php echo $value['name']; ?></span>
<?php foreach ($value['options'] as $option) { ?>
<label>
<input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $option?>" <?php if ( get_settings( $value['id'] ) == $option){ echo 'checked';} ?>/><?php echo $option?>
</label>
<?php } ?>
</div>
<?php break; case 'select': ?>
<div class="select text">
<span class="title"><?php echo $value['name']; ?></span>
<select class="width" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?>
<option <?php
if ( get_settings( $value['id'] ) == $option) { echo ' selected'; }?> >
<?php echo $option; ?>
</option>
<?php } ?>
</select>
<span class="description"><?php echo $value['desc']; ?></span>
</div>
<?php break; case 'hidden': ?>
<input name="<?php echo $value['id']; ?>" id="<?php echo stripslashes(get_option( $value['id'] )); ?>" type="hidden" value="<?php echo rand()?>" />
<?php
}
}
?>
<input type="hidden" name="colour-options" value="update" />
<p class="submit">
<input type="submit" class="button-primary alignright" value="<?php _e('Save Changes') ?>" />
<input type="submit" name="design-reset" class="button-primary alignleft" value="Reset" id="reset" />
<div class="clear"></div>
</p>
</div>
</form>
</div><!-- /swift-wrapper-->
Bookmarks