this.");
function get_toni_colors() {
return array(
'Blue' => '',
'Gray' => 'gray',
'Green' => 'green',
'Purple' => 'purple');
}
function get_toni_color() {
$toni_color = get_option('toni_color');
return clean_toni_color($toni_color);
}
function toni_color_select() {
echo "\n";
}
function toni_color_radios() {
$colors = get_toni_colors();
$current_color = get_toni_color();
$theme_uri = get_template_directory_uri();
$i = 0;
foreach ( $colors as $name => $value ) {
$checked = ($current_color == $value) ? " checked='checked'" : '';
$filename = "preview{$value}.jpg";
echo "
| |
\n";
++$i;
}
}
function clean_toni_color($toni_color) {
$toni_colors = get_toni_colors();
if ( in_array($toni_color, $toni_colors) )
return $toni_color;
else
return '';
}
function toni_color() {
echo get_toni_color();
}
function toni_css() {
_deprecated_function( __FUNCTION__, '1.2', 'toni_scripts()' );
$toni_color = get_toni_color();
$url = get_bloginfo('stylesheet_url');
if ( !empty($toni_color) )
$url = str_replace('style.css', "style_{$toni_color}.css", $url);
$url = apply_filters('bloginfo', $url, 'stylesheet_url');
$url = convert_chars($url);
echo $url;
}
/**
* Enqueue scripts and styles
*/
function toni_scripts() {
$color = get_toni_color();
wp_enqueue_style( 'toni', get_stylesheet_uri() );
if ( $color )
wp_enqueue_style( 'toni-scheme', get_template_directory_uri() . "/style_$color.css", array( 'toni' ) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'toni_scripts' );
add_action('admin_menu', 'toni_add_theme_page');
function toni_add_theme_page() {
global $toni_message;
if ( isset($_POST['action']) && 'toni_update' == $_POST['action'] && isset( $_POST['toni_nonce'] ) && wp_verify_nonce( $_POST['toni_nonce'], 'toni_save_theme_options' ) && current_user_can( 'edit_theme_options' ) ) {
$color = clean_toni_color($_POST['toni_color']);
update_option('toni_color', $color);
$colors = array_flip(get_toni_colors());
$Color = $colors[$color];
$message = sprintf( __( "Color changed to %s" ), esc_html( $Color ) );
$toni_message = "";
}
add_theme_page( __( 'Theme Options', 'toni' ), __( 'Theme Options', 'toni' ), 'edit_theme_options', 'theme_options', 'toni_theme_page');
}
function toni_theme_page() {
global $toni_message;
echo $toni_message;
?>
'ffffff',
'border' => 'cccccc',
'text' => '666666',
'link' => '767676',
'url' => '999999'
);
break;
case 'green':
$themecolors = array(
'bg' => 'ffffff',
'border' => 'e7fbc8',
'text' => '666666',
'link' => '728d49',
'url' => '728d49'
);
break;
case 'purple':
$themecolors = array(
'bg' => 'ffffff',
'border' => 'e2c6e3',
'text' => '666666',
'link' => '996699',
'url' => '996699'
);
break;
default:
$themecolors = array(
'bg' => 'ffffff',
'text' => '333333',
'link' => '52759a',
'border' => 'c0d3e2',
'url' => '52759a',
);
break;
}
function toni_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
?>
id="comment-">
tag based on what is being viewed.
*
* @since Toni 1.0
*/
function toni_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'toni' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'toni_wp_title', 10, 2 );