WebDancer Designed by saqqdy';
$options['copyright_content'] = 'Copyright ©2009-2012';
$options['analysis_code'] = '';
update_option('mytheme_options', $options);
}
return $options;
}
function add() {
if(isset($_POST['mytheme_save'])) {
$options = mythemeOptions::getOptions();
// meta
$options['description'] = stripslashes($_POST['description']);
$options['keywords'] = stripslashes($_POST['keywords']);
// google custom search engine
if($_POST['google_cse']) {
$options['google_cse'] = (bool)true;
} else {
$options['google_cse'] = (bool)false;
}
$options['google_cse_cx'] = stripslashes($_POST['google_cse_cx']);
// notice
if($_POST['notice']) {
$options['notice'] = (bool)true;
} else {
$options['notice'] = (bool)false;
}
$options['notice_content'] = stripslashes($_POST['notice_content']);
// categories & tags & author
if($_POST['categories']) {
$options['categories'] = (bool)true;
} else {
$options['categories'] = (bool)false;
}
if(!$_POST['tags']) {
$options['tags'] = (bool)false;
} else {
$options['tags'] = (bool)true;
}
if(!$_POST['author']) {
$options['author'] = (bool)false;
} else {
$options['author'] = (bool)true;
}
// twitter
if($_POST['twitter_user']) {
$options['twitter_user'] = (bool)true;
} else {
$options['twitter_user'] = (bool)false;
}
$options['twitter_user_url'] = stripslashes($_POST['twitter_user_url']);
// copyright and copyright content
$options['copy'] = stripslashes($_POST['copy']);
$options['copyright_content'] = stripslashes($_POST['copyright_content']);
// img by saqqdy
$options['analysis_code'] = stripslashes($_POST['analysis_code']);
update_option('mytheme_options', $options);
} else {
mythemeOptions::getOptions();
}
add_theme_page("WebDancer", "WebDancer", 'edit_themes', basename(__FILE__), array('mythemeOptions', 'display'));
}
function display() {
$options = mythemeOptions::getOptions();
?>
'sidebar_right1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => 'sidebar_right2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => 'sidebar_left1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => 'sidebar_left2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => 'sidebar_left3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => 'sidebar_left4',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
}
// create document title
function mytheme_doctitle() {
$site_name = get_bloginfo('name');
$separator = '|';
if(is_single()) {
$content = single_post_title('', FALSE);
} elseif(is_home() || is_front_page()) {
$content = get_bloginfo('description');
} elseif(is_page()) {
$content = single_post_title('', FALSE);
} elseif(is_search()) {
$content = 'Search Result for:';
$content .= ' ' . esc_html(stripslashes(get_search_query()), true);
} elseif(is_category()) {
$content = 'Category Archives:';
$content .= ' ' . single_cat_title("", false);
} elseif(is_tag()) {
$content = 'Tag Archives:';
$content .= ' ' . mytheme_tag_query();
} elseif(is_404()) {
$content = 'Not Found';
} else {
$content = get_bloginfo('description');
}
if(get_query_var('paged')) {
$content .= ' ' . $separator . ' ';
$content .= 'Page';
$content .= ' ';
$content .= get_query_var('paged');
}
if($content) {
if(is_home() || is_front_page()) {
$elements = array(
'site_name' => $site_name,
'separator' => $separator,
'content' => $content
);
} else {
$elements = array(
'content' => $content,
'separator' => $separator,
'site_name' => $site_name
);
}
} else {
$elements = array(
'site_name' => $site_name
);
}
$elements = apply_filters('mytheme_doctitle', $elements);
if(is_array($elements)) {
$doctitle = implode(' ', $elements);
} else {
$doctitle = $elements;
}
echo $doctitle;
}
// create nice multi tag title
function mytheme_tag_query() {
$nice_tag_query = get_query_var('tag');
$nice_tag_query = str_replace(' ', '+', $nice_tag_query);
$tag_slugs = preg_split('%[,+]%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY);
$tag_ops = preg_split('%[^,+]*%', $nice_tag_query, -1, PREG_SPLIT_NO_EMPTY);
$tag_ops_counter = 0;
$nice_tag_query = '';
foreach($tag_slugs as $tag_slug) {
$tag = get_term_by('slug', $tag_slug, 'post_tag');
if($tag_ops[$tag_ops_counter] == ',') {
$tag_ops[$tag_ops_counter] = ', ';
} elseif($tag_ops[$tag_ops_counter] == '+') {
$tag_ops[$tag_ops_counter] = ' + ';
}
$nice_tag_query = $nice_tag_query . $tag -> name . $tag_ops[$tag_ops_counter];
$tag_ops_counter += 1;
}
return $nice_tag_query;
}
// comment class
function blogtxt_comment_class( $print = true ) {
global $comment, $post, $blogtxt_comment_alt;
$c = array($comment->comment_type);
if ( $comment->user_id > 0 ) {
$user = get_userdata($comment->user_id);
$c[] = "byuser commentauthor-$user->user_login";
if ( $comment->user_id === $post->post_author )
$c[] = 'bypostauthor';
}
blogtxt_date_classes(mysql2date('U', $comment->comment_date), $c, 'c-');
if ( ++$blogtxt_comment_alt % 2 )
$c[] = 'alt';
$c[] = "c$blogtxt_comment_alt";
if ( is_trackback() ) {
$c[] = 'trackback';
}
$c = join(' ', apply_filters('comment_class', $c));
return $print ? print($c) : $c;
}
function blogtxt_date_classes($t, &$c, $p = '') {
$t = $t + (get_option('gmt_offset') * 3600);
$c[] = $p . 'y' . gmdate('Y', $t);
$c[] = $p . 'm' . gmdate('m', $t);
$c[] = $p . 'd' . gmdate('d', $t);
$c[] = $p . 'h' . gmdate('h', $t);
}
// custom comments for wp_list_comments
// code from Jinwen - http://www.saywp.com, modified by welee
function custom_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
$countComments = 1;
?>
id="li-comment-">