', ']]>', $content); $permalink = get_permalink(); if ($limit == false) { $final_output = $content; } else { $final_output = substr(strip_tags( preg_replace('!]*>(.*?)!ism', '', $content) ), 0, $limit ) . '...'; $final_output .= '
' . get_option( 'ot_text_readmore' ) . '
'; } echo $final_output; } function ot_friendly_search() { $enabled = get_option( 'ot_friendly_search' ); $permalinks_enabled = get_option( 'permalink_structure' ); if (empty( $permalinks_enabled )) { // Cant work so ignore! return true; } elseif (! empty( $enabled )) { echo 'onsubmit="location.href=\''; bloginfo('home'); echo '/search/\' + encodeURIComponent(this.s.value).replace(/%20/g, \'+\'); return false;"'; } } function ot_title_limit( $limit ) { $enabled = get_option( 'ot_title_limit' ); // Don't limit if disabled if ($enabled == 'false') { the_title(); return true; } // Get the content withouth editing it $content = get_the_title(); if (strlen( $content ) > $limit) { $content = substr( $content, 0, $limit) . '...'; } echo $content; } // Grabs the gravatar function ot_post_gravatar( $size=null ) { $default_size = 40; if (is_null( $size )) { $size = &$default_size; } $enabled = get_option( 'ot_use_author_gravatar' ); if (empty($enabled)) { return false; } elseif ($enabled == 'false') { return false; } global $authordata; $gravatar_url = 'http://www.gravatar.com/avatar/' . md5($authordata->user_email) . '.jpg?s=' . $size; $default = urlencode( get_option('home') . "/wp-content/themes/one-theme/img/default.jpg" ); $gravatar_url .= '&default=' . $default; // Add the gravatar image $content = '
' . $authordata->name . '
'; echo $content; } function ot_get_youtube_video( $url=null ) { // Parse the URL if (is_null($url)) { $featured_video_url_segments = explode('=', get_option( 'ot_featured_video_url' )); } else { $featured_video_url_segments = explode('=', $url); } $featured_video_id = $featured_video_url_segments[1]; // Make the connection to YouTube if(! $yh = @fsockopen( 'gdata.youtube.com', '80', $error_no, $error_str, 30 )) { // Debug //die("Cannot connect to YouTube"); return false; } // Send the request for our video information fwrite( $yh, "GET http://gdata.youtube.com/feeds/api/videos/{$featured_video_id}\n" ); $xml_response = ''; // Get YouTube's Response while (! feof( $yh )) { $xml_response .= fgets( $yh, 1024); } // Extract the row of data we need from the response preg_match( "/\/", $xml_response, $matches ); // Clean it up and convert it to an array $end = preg_replace( array( '/()/', "/'/", '/\s/' ), array( '$2', '', '&' ), $matches[0] ); parse_str( $end, $the_data ); $the_data['xml_response'] = $xml_response; return $the_data; } function ot_featured_video() { // Get the video mode $mode = get_option( 'ot_video_mode' ); if (empty( $mode )) { return false; } elseif (! is_numeric( $mode )) { die( 'Unexpected input for video mode!' ); } switch ($mode) { case 1: // Don't do anything if the option is empty if (!( get_option( 'ot_featured_video_url' ))) { return false; } $the_data = ot_get_youtube_video(); if($the_data['xml_response'] == 'Video not found') { echo '
' . "\n"; echo '

' . ot_lang( 'featured_video' ) . '

' . "\n"; echo 'Sorry, the video has been removed.' . "\n"; echo '
' . "\n"; echo '
'. "\n"; } else { echo '
' . "\n"; echo '

' . ot_lang( 'featured_video' ) . '

' . "\n"; echo '' . "\n"; echo ' '. "\n"; echo ''. "\n"; echo '
' . "\n"; echo '
'. "\n"; } break; case 2: $code = get_option( 'ot_embed_video' ); if (empty( $code )) { return false; } echo '
' . "\n"; echo '

' . ot_lang( 'featured_video' ) . '

' . "\n"; echo stripcslashes( $code ); echo '
' . "\n"; echo '
'. "\n"; break; default: die( 'Unexpected video mode!' ); break; } } function ot_ads( $position ) { // Get the options switch ($position) { case 'right': $adsense_id = get_option( 'ot_adsense_right_id' ); $adsense_channel = get_option( 'ot_adsense_right_channel' ); $ad_code = get_option( 'ot_ad_right' ); break; case 'category': $adsense_id = get_option( 'ot_adsense_category_id' ); $adsense_channel = get_option( 'ot_adsense_category_channel' ); $ad_code = get_option( 'ot_ad_cat_top' ); break; case 'top': $adsense_id = get_option( 'ot_adsense_top_id' ); $adsense_channel = get_option( 'ot_adsense_top_channel' ); $ad_code = get_option( 'ot_ad_post_top' ); break; case 'bottom': $adsense_id = get_option( 'ot_adsense_bottom_id' ); $adsense_channel = get_option( 'ot_adsense_bottom_channel' ); $ad_code = get_option( 'ot_ad_post_bottom' ); break; case 'cat-bottom': $adsense_id = get_option( 'ot_adsense_cat_bottom_id' ); $adsense_channel = get_option( 'ot_adsense_cat_bottom_channel' ); $ad_code = get_option( 'ot_ad_cat_bottom' ); break; case 'sidebar': $adsense_id = get_option( 'ot_adsense_sidebar_id' ); $adsense_channel = get_option( 'ot_adsense_sidebar_channel' ); $ad_code = get_option( 'ot_ad_sidebar_top' ); break; default: die('unsupported adsense position'); break; } if ((empty( $adsense_id )) and (empty( $ad_code ))) { return false; } elseif (empty( $ad_code )) { if (empty( $adsense_channel )) { ot_adsense( $position, $adsense_id ); } else { ot_adsense( $position, $adsense_id, $adsense_channel ); } } elseif(empty($adsense_id)) { echo '
'. "\n"; echo '

' . ot_lang( 'advertisement' ) . '

'. "\n"; echo $ad_code; echo '
'; } else { die('Unexpected Ad Combination'); } } function ot_adsense( $position, $id, $channel=null ) { $show_header = false; // Set up colors switch (ot_get_color()) { case 'blue': $border_color = 'ffffff'; $bg_color = 'ffffff'; $link_color = '006699'; $text_color = '191919'; $url_color = '006699'; break; case 'black': $border_color = 'ffffff'; $bg_color = 'ffffff'; $link_color = '3c3c3c'; $text_color = '333333'; $url_color = '3c3c3c'; break; case 'green': $border_color = 'ffffff'; $bg_color = 'ffffff'; $link_color = '487f00'; $text_color = '333333'; $url_color = '487f00'; break; case 'pink': $border_color = 'ffffff'; $bg_color = 'ffffff'; $link_color = 'be1469'; $text_color = '333333'; $url_color = 'be1469'; break; case 'red': $border_color = 'ffffff'; $bg_color = 'ffffff'; $link_color = 'a60909'; $text_color = '333333'; $url_color = 'a60909'; break; default: $border_color = 'f8f8f8'; $bg_color = 'f8f8f8'; $link_color = '006699'; $text_color = '191919'; $url_color = '006699'; break; } /** * Set up positioning and header and add extra colors */ switch ($position) { case 'right': $show_header = true; $width = 120; $height = 600; $bg_color = 'FFFFFF'; $border_color = 'FFFFFF'; break; case 'category': $show_header = false; $width = 468; $height = 60; break; case 'top': $show_header = false; $width = 468; $height = 60; break; case 'bottom': $show_header = true; $width = 336; $height = 280; $bg_color = 'FFFFFF'; $border_color = 'FFFFFF'; break; case 'cat-bottom': $show_header = true; $width = 336; $height = 280; $bg_color = 'FFFFFF'; $border_color = 'FFFFFF'; break; case 'sidebar': $show_header = true; $width = 336; $height = 280; $bg_color = 'FFFFFF'; $border_color = 'FFFFFF'; break; default: die ('unsupported adsense position'); // DEBUG break; } // Output echo '
'. "\n"; echo $show_header == true ? '

' . ot_lang( 'advertisement' ) . '

'. "\n" : ''; echo '' . "\n"; echo '' . "\n"; echo '
'; return true; } function ot_popular_thumbs() { $enabled = get_option( 'ot_use_hot_conversation' ); $use_thumbs = get_option( 'ot_use_category_thumbs' ); if (! $enabled ) { return false; } elseif( $enabled == 'false') { return false; } if (! $use_thumbs) { return false; } if ($use_thumbs == 'false') { return false; } global $wpdb; $sql = 'SELECT pm.meta_value AS file, p.post_title, p.ID FROM ' . $wpdb->prefix . 'posts p LEFT JOIN ' . $wpdb->prefix . 'postmeta pm on p.ID = pm.post_id WHERE pm.meta_key = "Thumbnail" ORDER BY p.comment_count DESC LIMIT 4;'; $result = mysql_query( $sql ); if (! $result ) return false; $thumbs = array(); while ($row = mysql_fetch_assoc( $result )) { $thumbs[] = $row; } if(count($thumbs) < 2) { return false; } elseif ((count( $thumbs ) < 2) && (count( $thumbs ) > 4)) { while ( (count($thumbs) % 2) != 0 ) { array_pop( $thumbs ); } } echo '' . "\n"; echo '
'. "\n"; } function ot_feedburner_subscribe() { $id = get_option( 'ot_feedburner_id' ); if (! $id ) return false; echo '

' . ot_lang( 'subscribe' ) . '

' . "\n"; echo '
' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo ot_lang( 'subscribe_detail' ) . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo '
' . "\n"; } function ot_paginate() { // Some info global $paged; $on_page = intval($paged); $no_prev = false; $no_next = false; // Fix page if ($on_page == 0) { $on_page = 1; } // Get the max number of pages global $wp_the_query; $max_pages = $wp_the_query->max_num_pages; // Are we near the start? $start_pos = $on_page - 2; if ($start_pos <= 0) { $amt_from_zero = ($start_pos * $start_pos) + 1; // to account for 0 $start_pos = 1; } // Are we near the end? $end_pos = $on_page + 2; if ($end_pos >= $max_pages) { $amt_from_end = $end_pos - $max_pages; $end_pos = $max_pages; } // How does this affect the range? if (isset( $amt_from_zero ) && isset( $amt_from_end )) { // Leave them both alone } elseif(isset( $amt_from_zero )) { // try and add the remainder on to the end_pos $end_pos = $end_pos + $amt_from_zero; if ($end_pos >= $max_pages) { $end_pos = $max_pages; } } elseif(isset( $amt_from_end )) { // try and subtract the remainder from the start_pos $start_pos = $start_pos - $amt_from_end; if ($start_pos <= 0) { $start_pos = 1; } } // Sort out next and prev if (($on_page - 1) <= 0) $no_prev = true; if (($on_page + 1) > $max_pages) $no_next = true; // How many pages do we have? $links_to_print = ($end_pos - $start_pos) + 1; // print the list echo '' . "\n"; } function ot_footer_links() { $page_data = get_pages(); $footer_links = get_option( 'ot_footer_links' ); if (! empty( $footer_links )) { $include_string = ''; foreach ( $footer_links as $link_id ) { $include_string .= $link_id . ','; $children = get_page_children( $link_id, $page_data ); foreach ( $children as $child ) { $include_string .= $child->ID . ','; } } wp_list_pages( array( 'exclude' => $include_string, 'depth' => 1, 'title_li' => 0 ) ); } else { wp_list_pages( array( 'depth' => 1, 'title_li' => 0 ) ); } } function ot_footer_affiliate_link() { $link = get_option( 'ot_affiliate_link' ); ?> WordPress Wordpress One Theme One Theme ID . ','; } } wp_list_pages( array( 'exclude' => $include_string, 'title_li' => 0, 'depth' => 2 ) ); } else { wp_list_pages( array( 'title_li' => 0, 'depth' => 2 ) ); } } function ot_sub_menu() { $cat_data = get_pages(); $links = get_option( 'ot_sub_menu_links' ); if (! empty( $links )) { $include_string = ''; foreach ( $links as $link_id ) { $include_string .= $link_id . ','; // also add the children $children_str = get_category_children( $link_id ); $children = explode( '/', $children_str ); foreach ( $children as $child ) { $include_string .= $child->term_id . ','; } } wp_list_categories( array( 'exclude' => $include_string, 'title_li' => 0, 'depth' => 2 ) ); } else { wp_list_categories( array( 'title_li' => 0, 'depth' => 2 ) ); } } function ot_thumb_small( $id=null ) { global $post; if (is_null( $id )) { $id = $post->ID; } $enabled = get_option( 'ot_use_category_thumbs' ); if ($enabled == 'false') { return false; } elseif(empty($enabled)) return false; ?>
Blue Theme Green Theme Pink Theme Black Theme Red Theme
ID; $post_title = $post->post_title; $keywords = explode( ' ', $post_title ); $word_count = count( $keywords ); if ($word_count == 0) { return false; } $overusedwords = array( '', 'a', 'an', 'the', 'and', 'of', 'i', 'to', 'is', 'in', 'with', 'for', 'as', 'that', 'on', 'at', 'this', 'my', 'was', 'our', 'it', 'you', 'we', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '10', 'about', 'after', 'all', 'almost', 'along', 'also', 'amp', 'another', 'any', 'are', 'area', 'around', 'available', 'back', 'be', 'because', 'been', 'being', 'best', 'better', 'big', 'bit', 'both', 'but', 'by', 'c', 'came', 'can', 'capable', 'control', 'could', 'course', 'd', 'dan', 'day', 'decided', 'did', 'didn', 'different', 'div', 'do', 'doesn', 'don', 'down', 'drive', 'e', 'each', 'easily', 'easy', 'edition', 'end', 'enough', 'even', 'every', 'example', 'few', 'find', 'first', 'found', 'from', 'get', 'go', 'going', 'good', 'got', 'gt', 'had', 'hard', 'has', 'have', 'he', 'her', 'here', 'how', 'if', 'into', 'isn', 'just', 'know', 'last', 'left', 'li', 'like', 'little', 'll', 'long', 'look', 'lot', 'lt', 'm', 'made', 'make', 'many', 'mb', 'me', 'menu', 'might', 'mm', 'more', 'most', 'much', 'name', 'nbsp', 'need', 'new', 'no', 'not', 'now', 'number', 'off', 'old', 'one', 'only', 'or', 'original', 'other', 'out', 'over', 'part', 'place', 'point', 'pretty', 'probably', 'problem', 'put', 'quite', 'quot', 'r', 're', 'really', 'results', 'right', 's', 'same', 'saw', 'see', 'set', 'several', 'she', 'sherree', 'should', 'since', 'size', 'small', 'so', 'some', 'something', 'special', 'still', 'stuff', 'such', 'sure', 'system', 't', 'take', 'than', 'their', 'them', 'then', 'there', 'these', 'they', 'thing', 'things', 'think', 'those', 'though', 'through', 'time', 'today', 'together', 'too', 'took', 'two', 'up', 'us', 'use', 'used', 'using', 've', 'very', 'want', 'way', 'well', 'went', 'were', 'what', 'when', 'where', 'which', 'while', 'white', 'who', 'will', 'would', 'your'); global $wpdb; $sql = "SELECT ID AS id, post_title AS post_title, post_content AS post_content FROM {$wpdb->prefix}posts WHERE "; for ($i=0; $i < $word_count; $i++) { $keyword = mysql_real_escape_string($keywords[$i]); if (! in_array( $keyword, $overusedwords )) { $sql .= "post_title LIKE '%{$keyword}%' AND ID != {$post_id} AND post_type='post' AND post_status='publish' "; if ($i + 1 != $word_count) $sql .= "OR "; } } $sql .= 'LIMIT 3'; $result = mysql_query( $sql ); if (! $result) { ?> 0) { for ($i=0; $i < $num_rows; $i++) { $id = mysql_result( $result, $i, 'ID' ); $title = mysql_result( $result, $i, 'post_title' ); $content = mysql_result( $result, $i, 'post_content' ); ?>
have_posts()) : $recent->the_post();?>
By on
have_posts()) : $recent->the_post();?> have_posts()) : $recent->the_post(); ?> have_posts()) : $recent->the_post(); ?>
  • have_posts()) : $recent->the_post();?>
', '', $content); $content = str_ireplace('
', '', $content); $content = str_ireplace('
', '', $content); echo $content; } function ot_author_details() { $enabled = get_option( 'ot_use_author_details' ); if ($enabled == 'false') { return false; } ?>
<?php the_author() ?> <?php comments_number('');?> Comments '); ?>
: