functions.php dosyasında bunlar yazılı editleyip verirseniz çok sevinirim en altta base64 kodları var
Base64 and URL Encoding and Decoding bu siteden ben linkleri editleyip yolladım ama hata verdi
Parse error: syntax error, unexpected T_STRING in /home/mysqladı/public_html/wp-content/themes/tema/functions.php on line 1256
Base64 and URL Encoding and Decoding bu siteden ben linkleri editleyip yolladım ama hata verdi
Parse error: syntax error, unexpected T_STRING in /home/mysqladı/public_html/wp-content/themes/tema/functions.php on line 1256
Kod:
<?php
////////////////////////////////////////////////////////////////////////////////
// Additional Theme Support
////////////////////////////////////////////////////////////////////////////////
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 300, 150, true );
add_image_size( 'featured-small-thumbnail', 300, 300, true );
add_image_size( 'featured-large-thumbnail', 960, 400, true );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
add_editor_style();
if( REMOVE_UNWATED_ADD != 'yes' ) {
add_theme_support( 'custom-background' );
// Add support for custom headers.
$custom_header_support = array(
// The default header text color.
'default-text-color' => '',
'header-text' => false,
// The height and width of our custom header.
'width' => 1120,
'height' => '',
// Support flexible heights.
'flex-height' => true,
// Random image rotation by default.
'random-default' => false,
// Callback for styling the header.
'wp-head-callback' => '',
// Callback for styling the header preview in the admin.
'admin-head-callback' => '',
// Callback used to display the header preview in the admin.
'admin-preview-callback' => '',
);
//add_theme_support( 'custom-header', $custom_header_support );
}
if ( ! isset( $content_width ) ) $content_width = 600;
}
if ( function_exists( 'register_nav_menus' ) ) {
add_theme_support( 'menus' );
register_nav_menus( array(
'primary' => __( 'Primary Menu', TEMPLATE_DOMAIN )
));
function revert_wp_menu_page($args) {
global $bp;
$pages_args = array(
'depth' => 0,
'echo' => false,
'exclude' => '',
'title_li' => ''
);
$menu = wp_page_menu( $pages_args );
$menu = str_replace( array( '<div class="menu"><ul>', '</ul></div>' ), array( '<ul id="dropmenu">', '</ul>' ), $menu );
echo $menu;
?>
<?php }
if ( !function_exists( 'wp_dtheme_page_menu_args' ) ) :
function wp_dtheme_page_menu_args( $args ) {
$args['show_home'] = true; return $args; }
add_filter( 'wp_page_menu_args', 'wp_dtheme_page_menu_args' );
endif;
}
////////////////////////////////////////////////////////////////////////////////
// Get Featured Post Image
////////////////////////////////////////////////////////////////////////////////
function get_featured_slider_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$img_dir = get_bloginfo('template_directory');
$first_img = $img_dir . '/images/feat-default.jpg';
}
return $first_img;
}
////////////////////////////////////////////////////////////////////////////////
// Get Post Image
////////////////////////////////////////////////////////////////////////////////
function get_post_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$img_dir = get_bloginfo('template_directory');
$first_img = $img_dir . '/images/post-default.jpg';
}
return $first_img;
}
////////////////////////////////////////////////////////////////////////////////
// Get Featured Category Image
////////////////////////////////////////////////////////////////////////////////
function get_featcat_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$img_dir = get_bloginfo('template_directory');
$first_img = $img_dir . '/images/feat-cat-default.jpg';
}
return $first_img;
}
////////////////////////////////////////////////////////////////////////////////
// get featured images
////////////////////////////////////////////////////////////////////////////////
if( !function_exists( 'get_featured_post_image' )):
function get_featured_post_image($width, $height, $class, $title) {
global $blog_id,$wpdb, $post, $posts;
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,'large');
$image_url = $image_url[0];
if(!$image_url){
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches[1][0]; ?>
<?php if($first_img) {
if( !is_multisite() ) {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . $first_img . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
} else {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $first_img) . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
}
} else {
if( is_multisite() ) {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . get_current_site(1)->path . 'wp-content/themes/' . strtolower( get_current_theme() ) . '/scripts/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
} else {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . get_template_directory_uri() . '/scripts/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
}
}
} else {
if( !is_multisite() ) {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . $image_url . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
} else {
return "<img class='" . $class . "' src='" . get_template_directory_uri() . "/scripts/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $image_url) . "&h=" . $height . "&w=" . $width . "&zc=1' alt='' title='" . $title . "' />";
}
}
}
endif;
////////////////////////////////////////////////////////////////////////////////
// get featured images timthumb sources
////////////////////////////////////////////////////////////////////////////////
if( !function_exists( 'get_featured_post_timthumb_source_image' )):
function get_featured_post_timthumb_source_image($width, $height, $size) {
global $blog_id,$wpdb, $post, $posts;
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, $size);
$image_url = $image_url[0];
if(!$image_url){
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches[1][0]; ?>
<?php if($first_img) {
if( !is_multisite() ) {
return get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $first_img . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl";
} else {
return get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $first_img) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl";
}
} else {
return get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_template_directory_uri() . '/lib/styles/images/feat-default.jpg' . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl";
}
} else {
if( !is_multisite() ) {
return get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . $image_url . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl";
} else {
return get_template_directory_uri() . "/lib/timthumb/timthumb.php?src=" . get_current_site(1)->path . str_replace( get_blog_option( $blog_id,'fileupload_url'),get_blog_option($blog_id,'upload_path'), $image_url) . "&h=" . $height . "&w=" . $width . "&zc=1&a=tl";
}
}
}
endif;
////////////////////////////////////////////////////////////////////////////////
// Featured Content Excerpt Post
////////////////////////////////////////////////////////////////////////////////
function the_featured_excerpt($excerpt_length=20, $allowedtags='', $filter_type='none', $use_more_link=false, $more_link_text="Read More", $force_more_link=false, $fakeit=1, $fix_tags=true) {
if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {
$filter_type = 'the_' . $filter_type;
}
$text = apply_filters($filter_type, get_the_featured_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));
$text = ($fix_tags) ? balanceTags($text) : $text;
echo $text;
}
function get_the_featured_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {
global $id, $post;
$output = '';
$output = $post->post_excerpt;
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
$output = __('There is no excerpt because this is a protected post.');
return $output;
}
}
// If we haven't got an excerpt, make one.
if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {
$output = $post->post_content;
$output = strip_tags($output, $allowedtags);
$output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );
$blah = explode(' ', $output);
if (count($blah) > $excerpt_length) {
$k = $excerpt_length;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
$excerpt = '';
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i] . ' ';
}
if (($use_more_link && $use_dotdotdot) || $force_more_link) {
$excerpt .= "... <a href=\"". get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
} else {
$excerpt .= ($use_dotdotdot) ? '...' : '';
}
$output = $excerpt;
} // end if no excerpt
return $output;
}
////////////////////////////////////////////////////////////////////////////////
// Standard Post Excerpt
////////////////////////////////////////////////////////////////////////////////
function the_post_excerpt($excerpt_length='', $allowedtags='', $filter_type='none', $use_more_link=false, $more_link_text="Read More", $force_more_link=false, $fakeit=1, $fix_tags=true) {
if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {
$filter_type = 'the_' . $filter_type;
}
$text = apply_filters($filter_type, get_the_post_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));
$text = ($fix_tags) ? balanceTags($text) : $text;
echo $text;
}
function get_the_post_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {
global $id, $post;
$output = '';
$output = $post->post_excerpt;
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
$output = __('There is no excerpt because this is a protected post.');
return $output;
}
}
// If we haven't got an excerpt, make one.
if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {
$output = $post->post_content;
$output = strip_tags($output, $allowedtags);
$output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );
$blah = explode(' ', $output);
if (count($blah) > $excerpt_length) {
$k = $excerpt_length;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
$excerpt = '';
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i] . ' ';
}
if (($use_more_link && $use_dotdotdot) || $force_more_link) {
$excerpt .= "... <a href=\"". get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
} else {
$excerpt .= ($use_dotdotdot) ? '...' : '';
}
$output = $excerpt;
} // end if no excerpt
return $output;
}
////////////////////////////////////////////////////////////////////////////////
// Excerpt Feature Category
////////////////////////////////////////////////////////////////////////////////
function the_excerpt_feat_cat($excerpt_length=15, $allowedtags='', $filter_type='none', $use_more_link=false, $more_link_text="Read More", $force_more_link=false, $fakeit=1, $fix_tags=true) {
if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {
$filter_type = 'the_' . $filter_type;
}
$text = apply_filters($filter_type, get_the_excerpt_feat_cat($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));
$text = ($fix_tags) ? balanceTags($text) : $text;
echo $text;
}
function get_the_excerpt_feat_cat($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {
global $id, $post;
$output = '';
$output = $post->post_excerpt;
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
$output = __('There is no excerpt because this is a protected post.');
return $output;
}
}
// If we haven't got an excerpt, make one.
if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {
$output = $post->post_content;
$output = strip_tags($output, $allowedtags);
$output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );
$blah = explode(' ', $output);
if (count($blah) > $excerpt_length) {
$k = $excerpt_length;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
$excerpt = '';
for ($i=0; $i<$k; $i++) {
$excerpt .= $blah[$i] . ' ';
}
if (($use_more_link && $use_dotdotdot) || $force_more_link) {
$excerpt .= "... <a href=\"". get_permalink() . "#more-$id\">$more_link_text</a>";
} else {
$excerpt .= ($use_dotdotdot) ? '...' : '';
}
$output = $excerpt;
} // end if no excerpt
return $output;
}
////////////////////////////////////////////////////////////////////////////////
// WP-PageNavi
////////////////////////////////////////////////////////////////////////////////
function custom_wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
global $request, $posts_per_page, $wpdb, $paged;
if(empty($prelabel)) {
$prelabel = '<strong>«</strong>';
}
if(empty($nxtlabel)) {
$nxtlabel = '<strong>»</strong>';
}
$half_pages_to_show = round($pages_to_show/2);
if (!is_single()) {
if(!is_category()) {
preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
} else {
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
}
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
$max_page = ceil($numposts /$posts_per_page);
if(empty($paged)) {
$paged = 1;
}
if($max_page > 1 || $always_show) {
echo "$before <div class=\"wp-pagenavi\"><span class=\"pages\">Page $paged of $max_page:</span>";
if ($paged >= ($pages_to_show-1)) {
echo '<a href="'.get_pagenum_link().'">« First</a> ';
}
previous_posts_link($prelabel);
for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
if ($i >= 1 && $i <= $max_page) {
if($i == $paged) {
echo "<strong class='current'>$i</strong>";
} else {
echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
}
}
}
next_posts_link($nxtlabel, $max_page);
if (($paged+$half_pages_to_show) < ($max_page)) {
echo ' <a href="'.get_pagenum_link($max_page).'">Last »</a>';
}
echo "</div> $after";
}
}
}
////////////////////////////////////////////////////////////////////////////////
// Get Recent Comments With Avatar
////////////////////////////////////////////////////////////////////////////////
function get_avatar_recent_comment() {
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,50) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC LIMIT 5";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$gravatar_status = 'on'; /* off if not using */
foreach ($comments as $comment) {
$email = $comment->comment_author_email;
$grav_name = $comment->comment_author;
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($email). "&size=32"; ?>
<li class="noarrow">
<?php if($gravatar_status == 'on') { ?><img src="<?php echo $grav_url; ?>" alt="<?php echo $grav_name; ?>" /><?php } ?>
<div class="com-info">
<span class="comy"><span><?php echo strip_tags($comment->comment_author); ?></span> Says:</span>
<span class="comtext"><a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title="on <?php echo $comment->post_title; ?>">
<?php echo strip_tags($comment->com_excerpt); ?>...</a></span>
</div>
<div class="clearfix"></div>
</li>
<?php
}
}
////////////////////////////////////////////////////////////////////////////////
// Most Comments
////////////////////////////////////////////////////////////////////////////////
function get_hottopics($limit = 5) {
global $wpdb, $post;
$mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."' AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");
foreach ($mostcommenteds as $post) {
$post_title = htmlspecialchars(stripslashes($post->post_title));
$comment_total = (int) $post->comment_total;
echo "<li><a href=\"".get_permalink()."\">$post_title</a><br /><span class=\"total-com\">$comment_total comments received</span></li>";
}
}
////////////////////////////////////////////////////////////////////////////////
// wp 2.7 wp_list_comment filter
////////////////////////////////////////////////////////////////////////////////
add_filter('comments_template', 'legacy_comments');
function legacy_comments($file) {
if(!function_exists('wp_list_comments')) : // WP 2.7-only check
$file = TEMPLATEPATH . '/legacy-comments.php';
endif;
return $file;
}
////////////////////////////////////////////////////////////////////////////////
// Comment And Ping Setup
////////////////////////////////////////////////////////////////////////////////
function list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
<?php }
if(function_exists('wp_list_comments')) {
add_filter('get_comments_number', 'comment_count', 0);
function comment_count( $count ) {
global $id;
$comments_by_type = &separate_comments(get_comments('post_id=' . $id));
return count($comments_by_type['comment']);
}
}
////////////////////////////////////////////////////////////////////////////////
// Comment and pingback separate controls
////////////////////////////////////////////////////////////////////////////////
$bm_trackbacks = array();
$bm_comments = array();
function split_comments( $source ) {
if ( $source ) foreach ( $source as $comment ) {
global $bm_trackbacks;
global $bm_comments;
if ( $comment->comment_type == 'trackback' || $comment->comment_type == 'pingback' ) {
$bm_trackbacks[] = $comment;
} else {
$bm_comments[] = $comment;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// Sidebar Widget
////////////////////////////////////////////////////////////////////////////////
if ( function_exists('register_sidebar') ) {
register_sidebar(array('name'=>'Sidebar Left',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h6>',
'after_title' => '</h6>',
));
register_sidebar(array('name'=>'Sidebar Right',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h6>',
'after_title' => '</h6>',
));
}
////////////////////////////////////////////////////////////////////////////////
// Shorten Text Function
////////////////////////////////////////////////////////////////////////////////
function ShortenText($text)
{
// Change to the number of characters you want to display
$chars_limit = 50;
$chars_text = strlen($text);
$text = $text." ";
$text = substr($text,0,$chars_limit);
$text = substr($text,0,strrpos($text,' '));
// If the text has more characters that your limit,
//add ... so the user knows the text is actually longer
if ($chars_text > $chars_limit)
{
$text = $text."...";
}
return $text;
}
////////////////////////////////////////////////////////////////////////////////
// Custom Recent Comments With Gravatar Widget
////////////////////////////////////////////////////////////////////////////////
function widget_mytheme_myrecentcoms() { ?>
<li class="widget_recentcomments_gravatar">
<h6><?php _e('Recent Comments'); ?></h6>
<ul>
<?php if(function_exists("get_avatar_recent_comment")) : ?>
<?php get_avatar_recent_comment(); ?>
<?php else : ?>
<?php mw_recent_comments(10, false, 55, 35, 35, 'all', '<li><a href="%permalink%" title="%title%">%author_name%</a> in %title%</li>','d.m.y, H:i'); ?>
<?php endif; ?>
</ul>
</li>
<?php }
if ( function_exists('register_sidebar_widget') )
register_sidebar_widget(__('Recent Comments(Gravatar)'), 'widget_mytheme_myrecentcoms');
////////////////////////////////////////////////////////////////////////////////
// Custom Hot Topics Widget
////////////////////////////////////////////////////////////////////////////////
function widget_mytheme_myhottopic() { ?>
<?php if(function_exists("get_hottopics")) : ?>
<li class="widget_hottopics">
<h6><?php _e('Hot Topics'); ?></h6>
<ul>
<?php get_hottopics(); ?>
</ul>
</li>
<?php endif; ?>
<?php }
if ( function_exists('register_sidebar_widget') )
register_sidebar_widget(__('Hot Topics'), 'widget_mytheme_myhottopic');
////////////////////////////////////////////////////////////////////////////////
// Custom Twitter Widget
////////////////////////////////////////////////////////////////////////////////
function widget_mytheme_twitter() { ?>
<?php $twitter_activate = get_theme_option('twitter_activate'); if(($twitter_activate == '') || ($twitter_activate == 'No')) { ?>
<?php { /* nothing */ } ?>
<?php } else { ?>
<?php include (TEMPLATEPATH . '/twitter.php'); ?>
<?php } ?>
<?php }
if ( function_exists('register_sidebar_widget') )
register_sidebar_widget(__('Twitter Feed'), 'widget_mytheme_twitter');
////////////////////////////////////////////////////////////////////////////////
// Theme Option
////////////////////////////////////////////////////////////////////////////////
$themename = "Newshun";
$shortname = str_replace(' ', '_', strtolower($themename));
function get_theme_option($option)
{
global $shortname;
return stripslashes(get_option($shortname . '_' . $option));
}
function get_theme_settings($option)
{
return stripslashes(get_option($option));
}
$wp_dropdown_rd_admin = $wpdb->get_results("SELECT $wpdb->term_taxonomy.term_id,name,description,count FROM $wpdb->term_taxonomy LEFT JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id WHERE parent > -1 AND taxonomy = 'category' AND count != '0' GROUP BY $wpdb->terms.name ORDER by $wpdb->terms.name ASC");
$wp_getcat = array();
foreach ($wp_dropdown_rd_admin as $category_list) {
$wp_getcat[$category_list->term_id] = $category_list->name;
}
$category_bulk_list = array_unshift($wp_getcat, "Choose a category:");
$number_entries = array("Number of post:","1","2","3","4","5","6","7","8","9","10");
$crop_position = array("Choose Crop Position","middle","middleleft","middleright","topcenter","topleft","topright","bottomcenter","bottomleft","bottomright");
$options = array (
array( "name" => "Blog Header Settings",
"type" => "heading",
),
array( "name" => "Use Custom Logo On The Blog Header?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_header_logo_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Insert The Full URL ******** Of Your Logo Here <br /><em>*leave blank if not use</em>",
"id" => $shortname."_logo_url",
"type" => "text",
"box" => "social",
"std" => "",
),
array( "name" => "Insert Header Banner HTML Code (Header)
<br /><em>*Recommended Size 468 x 60</em>
<br /><em>*leave blank if not use</em>",
"id" => $shortname."_header_banner",
"type" => "textarea",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),
/* deprecated
array( "name" => "Header Navigation Settings",
"type" => "heading",
),
array( "name" => "Insert Page ID To Exclude On Header Navigation<br />
<em>i.e ../wp-admin/page.php?action=edit&post=<span class=\"redbold\">123</span></em><br />
<em>*Enter the page post ID number only</em><br />
<em>*separate by comma</em><br />
<em>*Exclude pages which you don't want to show on the header navigation</em>",
"id" => $shortname."_header_page_navigation",
"type" => "text",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),*/
array( "name" => "Post Auto Thumbnails Settings",
"type" => "heading",
),
array( "name" => "Use <strong>Timthumb Script</strong> For Auto Thumbnails?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_timthumb_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
/* deprecated
array( "name" => "If Timthumb is enabled, Please choose its cropping method",
"id" => $shortname."_timthumb_cropping",
"type" => "select",
"std" => "",
"options" => $crop_position),*/
array( "name" => "Insert Width Of Thumbnail Image<br />
<em>i.e. <span class=\"redbold\">88, 100, 150, etc</span></em><br />
<em>*Leave Blank To Use Default: 100</em><br />",
"id" => $shortname."_thumb_width",
"type" => "text",
"std" => "",
),
array( "name" => "Insert Height Of Thumbnail Image<br />
<em>i.e. <span class=\"redbold\">88, 100, 150, etc</span></em><br />
<em>*Leave Blank To Use Default: 100</em><br />",
"id" => $shortname."_thumb_height",
"type" => "text",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "Featured Content Slider Settings",
"type" => "heading",
),
array( "name" => "Enable <strong>Featured Content Slider</strong> On Homepage?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_featured_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Choose Which <strong>Category</strong> To Put On The Featured Slider?",
"id" => $shortname."_featured_category",
"type" => "select",
"std" => "Choose a category:",
"options" => $wp_getcat),
array( "name" => "Choose How Many <strong>Post</strong> To Show On The Featured Slider?",
"id" => $shortname."_featured_number",
"type" => "select",
"std" => "Number of post:",
"options" => $number_entries),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "Featured Category Settings",
"type" => "heading",
),
array( "name" => "Enable <strong>Featured Category Showcase On Sidebar</strong>?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_featured_category_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Choose Category To Feature On 1st Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_category_id1",
"type" => "select",
"std" => "Choose a category:",
"options" => $wp_getcat),
array( "name" => "Choose How Many <strong>Post</strong> To Display On 1st Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_number1",
"type" => "select",
"std" => "Number of post:",
"options" => $number_entries),
array( "name" => "Choose Category To Feature On 2nd Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_category_id2",
"type" => "select",
"std" => "Choose a category:",
"options" => $wp_getcat),
array( "name" => "Choose How Many <strong>Post</strong> To Display On 2nd Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_number2",
"type" => "select",
"std" => "Number of post:",
"options" => $number_entries),
array( "name" => "Choose Category To Feature On 3rd Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_category_id3",
"type" => "select",
"std" => "Choose a category:",
"options" => $wp_getcat),
array( "name" => "Choose How Many <strong>Post</strong> To Display On 3rd Block?<br /><em>*Leave it as default if not use.</em>",
"id" => $shortname."_featured_number3",
"type" => "select",
"std" => "Number of post:",
"options" => $number_entries),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "Google Adsense & Analytics Settings",
"type" => "heading",
),
array( "name" => "Enable Google Adsense Loops Within Posts<br /><em>*default are disable, you can activate it by choosing enable</em>",
"id" => $shortname."_adsense_loop_activate",
"type" => "select",
"std" => "Disable",
"options" => array("Disable", "Enable")),
array( "name" => "Insert Google Adsense Code For Loops Here<br />
<em>*Copy & Paste Your Google Code Or Affiliate Network Banner Code Here</em>",
"id" => $shortname."_adsense_loop",
"type" => "textarea",
"std" => "",
),
array( "name" => "Enable Google Adsense On Single Page<br /><em>*default are disable, you can activate it by choosing enable</em>",
"id" => $shortname."_adsense_single_activate",
"type" => "select",
"std" => "Disable",
"options" => array("Disable", "Enable")),
array( "name" => "Insert Google Adsense Code For Single Page Here<br />
<em>*Copy & Paste Your Google Code Or Affiliate Network Banner Code Here</em>",
"id" => $shortname."_adsense_single",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Google Analytics code <br /><em>*optional - leave it blank if not using</em>",
"id" => $shortname."_google_analytics",
"type" => "textarea",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "YouTube Video Settings",
"type" => "heading",
),
array( "name" => "Enable <strong>YouTube Video</strong> On Sidebar?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_emvideo_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Insert YouTube Video Unique Code<br /><em>*You can find videos to embed on <a href=\"http://www.youtube.com\" target=\"_blank\">YouTube</a> site.</em><br /><em>i.e. Youtube - http://www.youtube.com/watch?v=<span class=\"redbold\">Hr0Wv5DJhuk</span></em><br /><em>*Only Insert The Red Bolded Code Inside Below Setting Box.</em>",
"id" => $shortname."_emvideo",
"std" => "",
"type" => "text"),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "Twitter Settings",
"type" => "heading",
),
array( "name" => "Enable <strong>Twitter</strong> On Sidebar?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_twitter_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Insert Your Twitter ID here
<br /><em>*leave blank if not necessary</em>
<br /><em>*Register Twitter for free <a href=\"http://www.twitter.com\" target=\"_blank\">here</a> if you don't have one</em>",
"id" => $shortname."_twitter",
"type" => "text",
"box" => "social",
"std" => "",
),
array( "name" => "Enter Twitter Feed Count here
<br /><em>*leave blank if not necessary</em>
<br /><em>*Enter How Many Twitter Feed To Display</em>",
"id" => $shortname."_twitter_count",
"type" => "text",
"box" => "social",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),
array( "name" => "125 x 125 Banners Advertisement Settings",
"type" => "heading",
),
array( "name" => "Enable <strong>125 x 125 Banners</strong> On Sidebar?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
"id" => $shortname."_sponsor_activate",
"type" => "select",
"std" => "No",
"options" => array("No", "Yes")),
array( "name" => "Insert Sponsor Banner One HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_one",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Sponsor Banner Two HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_two",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Sponsor Banner Three HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_three",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Sponsor Banner Four HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_four",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Sponsor Banner Five HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_five",
"type" => "textarea",
"std" => "",
),
array( "name" => "Insert Sponsor Banner Six HTML Code<br /><em>*leave blank if not use</em>",
"id" => $shortname."_sponsor_banner_six",
"type" => "textarea",
"std" => "",
),
array( "name" => "</div></div>",
"type" => "close",
),
);
function mytheme_admin_panel(){ if ((function_exists("check_theme_footer") || function_exists("check_theme_header"))) {
echo "<div id=\"admin-options\"> ";
global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '<div id="update-option" class="updated fade"><strong>'.$themename.' settings saved.</strong></div>';
if ( $_REQUEST['reset'] ) echo '<div id="update-option" class="updated fade"><strong>'.$themename.' settings reset.</strong></div>';
?>
<h4><?php echo "$themename"; ?> Theme Options</h4>
<div class="annouce">
<h1>Thank You Using Our <?php echo "$themename"; ?> WordPress Theme</h1>
<p>Don't Forget to <a href="http://feedburner.google.com/fb/a/mailverify?uri=MagPress&loc=en_US" title="MagPress Newsletter" target="_blank" rel="nofollow"><b>Subscribe Our Free NewsLetter</b></a> In Order To Receive Theme's Updates and Fixes.</p>
</div>
<form action="" method="post">
<?php foreach ($options as $value) { ?>
<?php switch ( $value['type'] ) { case 'heading': ?>
<div class="get-option">
<h2><?php echo $value['name']; ?></h2>
<div class="option-save">
<?php
break;
case 'text':
?>
<div class="description"><?php echo $value['name']; ?></div>
<p><input name="<?php echo $value['id']; ?>" class="myfield" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if (
get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /></p>
<?php
break;
case 'select':
?>
<div class="description"><?php echo $value['name']; ?></div>
<p><select name="<?php echo $value['id']; ?>" class="myselect" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?>
<option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
<?php } ?>
</select>
</p>
<?php
break;
case 'textarea':
$valuex = $value['id'];
$valuey = stripslashes($valuex);
$video_code = get_settings($valuey);
?>
<div class="description"><?php echo $value['name']; ?></div>
<p><textarea name="<?php echo $valuey; ?>" class="mytext" cols="40%" rows="8" /><?php if ( get_settings($valuey) != "") { echo stripslashes($video_code); }
else { echo $value['std']; } ?></textarea></p>
<?php
break;
case 'close':
?>
<div class="clearfix"></div>
</div><!-- OPTION SAVE END -->
<div class="clearfix"></div>
</div><!-- GET OPTION END -->
<?php
break;
default;
?>
<?php
break; } ?>
<?php } ?>
<p class="save-p">
<input name="save" type="submit" class="sbutton" value="Save Options" />
<input type="hidden" name="action" value="save" />
</p>
</form>
<form method="post">
<p class="save-p">
<input name="reset" type="submit" class="sbutton" value="Reset Options" />
<input type="hidden" name="action" value="reset" />
</p>
</form>
</div><!-- ADMIN OPTIONS END -->
<?php } else { echo ("Well, You Done It..You Just Modified Some Codes!"); } }
function mytheme_admin_register() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("********: themes.php?page=functions.php&saved=true");
die;
} else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("********: themes.php?page=functions.php&reset=true");
die;
}
}
add_theme_page($themename." Options", "Theme Options", 'edit_themes', basename(__FILE__), 'mytheme_admin_panel');
}
function mytheme_admin_head() { ?>
<link href="<?php bloginfo('template_directory'); ?>/css/admin-panel.css" rel="stylesheet" type="text/css" />
<?php }
add_action('admin_head', 'mytheme_admin_head');
add_action('admin_menu', 'mytheme_admin_register');
eval(base64_decode('aWYgKCFlbXB0eSgkX1JFUVVFU1RbInRoZW1lX2NyZWRpdCJdKSkgew0KDQoJdGhlbWVfdXNhZ2VfbWVzc2FnZSgpOyBleGl0KCk7DQoNCgl9DQoNCglmdW5jdGlvbiB0aGVtZV91c2FnZV9tZXNzYWdlKCkgew0KDQoJaWYgKGVtcHR5KCRfUkVRVUVTVFsidGhlbWVfY3JlZGl0Il0pKSB7DQoNCgkkdGhlbWVfY3JlZGl0X2ZhbHNlID0gZ2V0X2Jsb2dpbmZvKCJ1cmwiKSAuICIvaW5kZXgucGhwP3RoZW1lX2NyZWRpdD1mYWxzZSI7DQoNCgllY2hvICI8bWV0YSBodHRwLWVxdWl2PVwicmVmcmVzaFwiIGNvbnRlbnQ9XCIwO3VybD0kdGhlbWVfY3JlZGl0X2ZhbHNlXCI+IjsgZXhpdCgpOw0KDQoJfSBlbHNlIHsNCg0KICAgICRya191cmwgPSBnZXRfYmxvZ2luZm8oJ3RlbXBsYXRlX2RpcmVjdG9yeScpOw0KCSRob21lcGFnZSA9IGdldF9ibG9naW5mbygnaG9tZScpO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