prefix . "dailytop10"; $app_theme = "TechNoise"; $app_version = '1.0'; function blogname(){ $blog = get_bloginfo('name'); $e = explode(' ', $blog, 2); $exp = " " . $e[0] . ""; if ($e[1]) $exp .= " " . $e[1]; return $exp; } function mod_install_top10 () { global $wpdb; global $table_top10_name; if($wpdb->get_var("SHOW TABLES LIKE '$table_top10_name'") != $table_top10_name) { $sql = "CREATE TABLE " . $table_top10_name . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, visittime date DEFAULT '0000-00-00' NOT NULL, postnum int NOT NULL, postcount int DEFAULT '0' NOT NULL, UNIQUE KEY id (id) );"; require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); dbDelta($sql); } } function get_wp_todays_date() { global $OFFSET; $format = "Y-m-d"; if ($offset) { $nowtime = gmdate($format, time() + 3600*$OFFSET); } else { $nowtime = date($format, time()); } return $nowtime; } add_action( 'after_setup_theme', 'theme_setup' ); if ( ! function_exists( 'theme_setup' ) ): function theme_setup() { add_theme_support( 'post-thumbnails' ); add_theme_support( 'automatic-feed-links' ); load_theme_textdomain( 'technoise', TEMPLATEPATH . '/languages' ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); register_nav_menus( array( 'pages' => __( 'Pages Navigation', 'technoise' ), 'categories' => __( 'Categories Navigation', 'technoise' ), ) ); } endif; function theme_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Widget', 'technoise' ), 'id' => 'primary-widgets', 'description' => __( 'Sidebar Middle Right Widget (East)', 'technoise' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Footer Widget', 'technoise' ), 'id' => 'footer-widgets', 'description' => __( 'Footer Widget', 'technoise' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } add_action( 'widgets_init', 'theme_widgets_init' ); function the_short_title($limit=40,$echo=1,$title=''){ if (empty($title)){ $title = the_title('','',false); } if (strlen($title)<=$limit){ }else{ $title = substr_replace(the_title('','',false),'...',$limit); } if ($echo==1){ echo $title; }else{ return $title; } } add_action ('the_content', 'update_post_counter'); function update_post_counter($c){ global $post, $wpdb, $table_top10_name; if (is_single()): $counter = (int) get_post_meta($post->ID, 'post-counter', true); $counter = $counter + 1; update_post_meta($post->ID, 'post-counter', $counter); $entry_exists = $wpdb->get_var("SELECT COUNT(*) as total from $table_top10_name where visittime='" . get_wp_todays_date() . "' and postnum='" . $post->ID . "'"); if($entry_exists>0){ $entry_data = $wpdb->get_var("SELECT id from $table_top10_name where visittime='" . get_wp_todays_date() . "' and postnum='" . $post->ID . "'"); $wpdb->query("UPDATE $table_top10_name SET postcount = postcount+1, visittime = '" . get_wp_todays_date() . "' WHERE id = '" . $entry_data . "'"); }else{ $wpdb->query("INSERT INTO $table_top10_name (visittime, postnum, postcount) VALUES ('" . get_wp_todays_date() . "', '" . $post->ID . "', 1)"); } endif; return $c; } function get_today_hotstories ($limit=10, $title = 0){ global $wpdb, $table_top10_name; $todays_widget_temp = ''; $results = $wpdb->get_results("SELECT * from $table_top10_name inner join {$wpdb->posts} on {$wpdb->posts}.ID=$table_top10_name.postnum WHERE visittime = '" . get_wp_todays_date() . "' and postcount > 0 and post_status = 'publish' $and ORDER BY postcount DESC LIMIT $limit"); if ($results): foreach ($results as $list) { $postnum = $list->postnum; $postcount = $list->postcount; $id_post = $list->ID; $title_post = $list->post_title; $home_url_perma = get_permalink($id_post); $todays_widget_temp .= "
  • $title_post ($postcount views)
  • \n"; } else: $todays_widget_temp .= "
  • No posts viewed yet. $and
  • "; endif; echo $todays_widget_temp; } function the_description($args=''){ global $post; $content = $post->post_content; $defaults = array( 'more_link' => false, 'more_text' => 'Read More', 'limit' => 150, 'wrap_tag' => 'p' ); $r = wp_parse_args( $args, $defaults ); $content = preg_replace("/\[caption.*\[\/caption\]/", '', $content); $output = substr(strip_tags($content), 0, $r["limit"]-3) . "..."; $output = apply_filters('wptexturize', $output); $output = apply_filters('convert_chars', $output); if ($r['wrap_tag']) $output2 = '<' . $r['wrap_tag'] . '>'; $output2 .= $output; if ($r['more_link']) $output2 .= ' ' . $r['more_text'] . ''; if ($r['wrap_tag']) $output2 .= ''; echo $output2; } function theme_excerpt_length( $length ) { return 25; } add_filter( 'excerpt_length', 'theme_excerpt_length' ); function theme_continue_reading_link() { return ' ' . __( 'Read Articles ', 'technoise' ) . ''; } function theme_auto_excerpt_more( $more ) { return ' ...'; } add_filter( 'excerpt_more', 'theme_auto_excerpt_more' ); function theme_post_image ($args=''){ global $post; $THEME = get_bloginfo('template_directory') . '/'; $THEME_IMAGES = $THEME . 'images/'; $defaults = array( 'key' => 'featured_image', 'zoom_crop' => 0, 'width' => 150, 'height' => 150, 'no_image' => 'post', 'hide_empty' => 1 ); $no_image = array ( 'slider' => $THEME_IMAGES . 'demo/demo-slider.gif', 'slider_small' => $THEME_IMAGES . 'demo/slider-small.gif', 'post' => $THEME_IMAGES . 'demo/post.gif', 'reviews' => $THEME_IMAGES . 'demo/reviews.gif', ); $r = wp_parse_args( $args, $defaults ); $p = has_post_thumbnail($post->ID); $image = ''; if ($p){ $attachment_id = get_post_thumbnail_id( $post->ID ); $post_src = wp_get_attachment_image_src( $attachment_id, 'full' ); $image = $post_src[0]; }else{ $image = get_post_meta($post->ID, $r['key'], true); if (!strstr($image, 'http://') && $image) $image = home_url ('/') . $image; } if (!$image): $image = $THEME_IMAGES . 'no-image.jpg';; endif; $g = $THEME . "thumb.php?src=" . urlencode( $image ) . "&h=" . $r['height'] . "&w=" . $r['width'] . "&zc=" . $r['zoom_crop'] . "&q=100&a=t"; echo $g; } function the_post_single_category($class=""){ $category = get_the_category(); $category = $category[0]; $class = $class==""?"":' class="' . $class . '"'; echo '' . $category->name . ""; } function single_cat_link(){ $category = get_the_category(); $category = $category[0]; echo get_category_link($category->term_id); } function theme_post_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • id="li-comment-">
    says:
    comment_approved == '0') { ?>

    $depth, 'max_depth' => $args['max_depth']))) ?>
  • - ]+>', $commenter ) ) {$commenter = ereg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = ereg_replace( '(' . get_the_title(theme_get_image_id($i)) . '
  • '; endif; $i++; endwhile; } function theme_get_image_id($num = 0, $postID='') { global $post; if (!$postID) $postID = $post->ID; $children = get_children(array( 'post_parent' => $postID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' )); $count = 0; foreach ((array)$children as $key => $value) { $images[$count] = $value; $count++; } if(isset($images[$num])) return $images[$num]->ID; else return false; } function theme_get_image($num = 0, $postID='') { global $post; if (!$postID) $postID = $post->ID; $children = get_children(array( 'post_parent' => $postID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' )); $count = 0; foreach ((array)$children as $key => $value) { $images[$count] = $value; $count++; } if(isset($images[$num])) return wp_get_attachment_url($images[$num]->ID); else return false; } function theme_posted_on() { printf( __( 'Written by %1$s on %2$s', 'twentyten' ), sprintf( '%3$s', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), get_the_author() ), get_the_date() ); } function wp_list_popular_author ($args=''){ global $wpdb; $defaults = array('limit' => 9, 'order' => 'desc', 'echo' => true); $r = wp_parse_args( $args, $defaults ); $authors = $wpdb->get_results ("SELECT DISTINCT post_author, COUNT(ID) AS total FROM wp_posts WHERE post_type = 'post' AND (post_status = 'publish') GROUP BY post_author order by total " . $r['order'] . " LIMIT " . $r['limit']); foreach ($authors as $author){ $userinfo = get_userdata($author->post_author); $output .= '
  • ' . userphoto__get_userphoto($author->post_author, 100, '', '', '', '') . '
    ' . $userinfo->display_name . '
  • '; } if ($r['echo']) echo $output; else return $output; } function technoise_post_type() { register_post_type( 'gallery', array('labels' => array( 'name' => __( 'Gallery', 'technoise' ), 'singular_name' => __( 'Gallery', 'technoise' ), 'add_new' => __( 'Add New', 'technoise' ), 'add_new_item' => __( 'Add New Gallery', 'technoise' ), 'edit' => __( 'Edit', 'technoise' ), 'edit_item' => __( 'Edit Gallery', 'technoise' ), 'new_item' => __( 'New Gallery', 'technoise' ), 'view' => __( 'View Gallery', 'technoise' ), 'view_item' => __( 'View Gallery', 'technoise' ), 'search_items' => __( 'Search Gallery', 'technoise' ), 'not_found' => __( 'No gallery found', 'technoise' ), 'not_found_in_trash' => __( 'No gallery found in trash', 'technoise' ), 'parent' => __( 'Parent Gallery', 'technoise' ), ), 'description' => __( 'This is where you can create new gallery on your site.', 'technoise' ), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'publicly_queryable' => true, 'exclude_from_search' => false, 'menu_position' => 5, 'menu_icon' => get_stylesheet_directory_uri() . '/images/theme-ico.gif', 'hierarchical' => false, 'rewrite' => array( 'slug' => 'pictures', 'with_front' => false ), 'query_var' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions' ), ) ); } add_action( 'init', 'technoise_post_type', 0 ); class BlogOptions { function init() { if(isset($_POST['themeoptions'])) { $optionsd = BlogOptions::getOptions(); $options = $_POST['themeoptions']; $error_s = "updated=true"; update_option('Blog_Setting_Options', $options); wp_redirect('admin.php?page=theme-config&' . $error_s); } else { $options = BlogOptions::getOptions(); } } function getOptions() { $options = get_option('Blog_Setting_Options'); if (!is_array($options)) { $options = array( 'google_analytics' => '', 'publisher_id' => '', 'layout' => array( 'hc1' => 3, 'hc2' => 7, 'hc3' => 49, 'hc_multi' => array(32,94,46,66,7,49), ), 'publisher_id' => '', 'social' => array( 'twitter' => 'templatescraze', 'facebook' => 'http://www.facebook.com/pages/TemplatesCraze/108340095879312', 'feedburner' => 'templatescraze', 'linkedin' => 'templatescraze' ), ); update_option('Blog_Setting_Options', $options); } return $options; } function configration() { $themeoption = BlogOptions::getOptions(); if ( $_GET['updated'] ) echo '

    Theme Options Saved.

    '; echo ''; ?>

    Theme Options

    Tech Noise is proudly designed by ", 'technoise'); ?>">

    | "> | ">

    Advertisement Settings

    Social Media Settings

    Paste your SocialMedia information in the box below.

    Google Analytics

    Paste your Google Analytics code in the box below.

    updates = array(); $current->version_checked = $app_version; } $locale = apply_filters( 'core_version_check_locale', get_locale() ); $current->last_checked = time(); set_site_transient( $theme_name.'_update_theme', $current ); if ( method_exists( $wpdb, 'db_version' ) ) $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version()); else $mysql_version = 'N/A'; if ( is_multisite( ) ) { $user_count = get_user_count( ); $num_blogs = get_blog_count( ); $wp_install = network_site_url( ); $multisite_enabled = 1; } else { $user_count = count_users( ); $multisite_enabled = 0; $num_blogs = 1; $wp_install = home_url( '/' ); } $local_package = isset( $wp_local_package )? $wp_local_package : ''; $url = "http://www.templatescraze.com/free-wp-themes/vcheck/?theme_name=$theme_name&theme_version=$app_version"; $options = array( 'timeout' => 30, 'user-agent' => $app_theme . '/' . $app_version . '; ' . home_url( '/' ), 'headers' => array( 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ) ) ); $response = wp_remote_get($url, $options); if ( is_wp_error( $response ) ) return false; if ( 200 != $response['response']['code'] ) return false; $body = json_decode( $response['body'], true ); $updates = new stdClass(); $updates->last_checked = time(); $updates->version_checked = $app_version; $updates->latest_version = $body["version"]; $updates->link_to_download = $body["downloadfrom"]; set_site_transient( $theme_name.'_update_theme', $updates); } function technoise_update_nag() { global $app_version, $app_theme; if ( !current_user_can('update_core') ) return false; $theme_name = trim(strtolower($app_theme)); $cur = get_site_transient( $theme_name.'_update_theme' ); if ( empty($cur) ) return false; if ( version_compare($cur->version_checked, $cur->latest_version, '>=' ) ) return false; if ( current_user_can('update_core') ) { $msg = sprintf( __('%1$s version %2$s is now available! Customers can download it now or check What\'s new!.'), $app_theme, $cur->latest_version, $cur->link_to_download, "http://www.templatescraze.com/free-wp-themes/version_info/?theme_name=$theme_name&theme_version=" . $cur->latest_version . "&preview_iframe=1&TB_iframe=true" ); } else { $msg = sprintf( __('%1$s version %2$s is now available! Please notify the site administrator.'), $app_theme, $cur->latest_version ); } echo "
    $msg
    "; } add_action( 'admin_notices', 'technoise_update_nag', 4 ); if (is_admin()) add_action('init', 'technoise_update_checks'); function wp_footer_links_box (){ global $themeoption; ?>