akaramazov
PHP код:
<?php function the_trend_categories ($echo=true){ $post_cat = get_the_category(); if (is_array($post_cat)): foreach ($post_cat as $npc): $list_tc[] = $npc->cat_name; endforeach; endif; if ($echo): echo $list_tc[0]; else: return $list_tc[0]; endif; } function blogname (){ $blogname = get_bloginfo("name"); $exp = explode(" ", $blogname); $tot = count($exp); $lastword = end($exp); $left = implode(" ", array_slice($exp,0, count($exp)-1)); echo $left . " <span>" . $lastword . "</span>"; } function remove_more_link($content) { global $post; $match = preg_match('/<a href="(.+)" class="more-link">(.+)/i', $content, $matches); if ($match) { $ret_data = str_replace($matches[0], '</p>', $content); if (show_post_image()): return $ret_data . '<a href="' . $matches[1] . '" class="more-links" id="readmore-post-' . $post->ID . '" title="Read More">Read More</a>'; else: return $ret_data ; endif; } return $content; } add_filter('the_content', 'remove_more_link'); function show_post_image(){ global $post; $showImage = get_post_meta($post->ID, "show-image", true); if ($showImage=="false") return false; return true; } function the_tab_image ($w=82, $h=57, $def = "No Image Found", $key='image'){ global $post; $image = get_post_meta($post->ID, $key, true); $g = blogdir . "thumb.php?src=" . $image . "&h=$h&w=$w&zc=1&q=100&nmT=" . $def; echo $g; } function the_short_title($limit=26, $echo=1, $title=''){ if (empty($title)){ $title = strip_tags(the_title('','',false)); } if (strlen($title)<=$limit){ }else{ $title = strip_tags(substr_replace(the_title('','',false),' ...',$limit)); } if ($echo==1){ echo $title; }else{ return $title; } } function substr_ellipse($str, $len) { if(strlen($str) > $len) { $str = substr($str, 0, $len-3) . "..."; } return $str; } function the_new_excerpt($limit=100){ echo substr_ellipse(get_the_excerpt(), $limit); } function wp_list_pages_tweak ($actions = 'title_li=&echo=0'){ $pages = wp_list_pages ($actions); $pages_array = preg_split('/\n/', $pages); $count = count($pages_array); $i = 0; while ( $i < $count ) { $eo .= preg_replace('/<li (.+)>(.+)/i', '<li $1>', $category_array[$i]) . "\n"; $i++; } echo '<!--Pages Tweak-->' . $eo . '<!--/Pages Tweak-->'; } function the_list_categories_tweak ($categories){ $category_array = preg_split('/\n/', $categories); $count = count($category_array); $i = 0; while ( $i < $count ) { if ( preg_match('/<ul class=(\'|")children(\'|")/i', $category_array[$i+1]) ) { $eo .= preg_replace('/<li class=(\'|")(.+)(\'|")>/i', '<li class=$1has-child $2$3>', $category_array[$i]) . "\n"; } else { $eo .= $category_array[$i] . "\n"; } $i++; } return '<!--Categories Tweak-->' . $eo . '<!--/Categories Tweak-->'; } add_action ('wp_list_categories', 'the_list_categories_tweak'); add_action ('wp_footer', 'wp_footer_tweak'); function wp_footer_tweak (){ ?>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footAdsense"></div>
<div class="copyright">© Copyright <?php echo date("Y");?> <a href="<?php echo get_option('home'); ?>/" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>. All Rights Reserved | Designed by <a href="http://themes.rock-kitty.net/" title="FREE Wordpress Themes" target="_blank">FREE Wordpress Themes</a> and <a href="http://www.jennings-ford.co.uk/usedsales/summary/fordfocus.aspx" title="Ford Focus for Sale" target="_blank">Ford Focus for Sale</a></div>
</div>
</div>
<script type="text/javascript" src="<?php echo blogdir;?>js/functions.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/HandelGothicEF.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/football.js"></script>
<?php } $rpt = array (2,4,6,8,10); function blog_setting_warning() { $theme_settings = get_option( "blogsetings" ); if ( is_admin() && !is_array($theme_settings) ) { echo " <div id='theme-warning' class='updated fade'><p><strong>".__('Theme is not configured yet.')."</strong> ".sprintf(__('You must <a href="%1$s">configure this theme</a> for it to work.'), "themes.php?page=blog-options")."</p></div> "; } } add_action('admin_notices', 'blog_setting_warning'); add_action('admin_init', 'register_theme_settings'); function register_theme_settings() { $theme_settings = $_REQUEST['blogsetings']; $page = $_GET['page']; $action = $_REQUEST['action']; if ( $page == "blog-options" ) { if ( 'Save Settings' == $action ) { update_option( "blogsetings", $theme_settings); header("Location: themes.php?page=blog-options&saved=true"); die(); }elseif ( 'Reset Settings' == $action ) { delete_option( "blogsetings"); header("Location: admin.php?page=blog-options&reset=true"); die(); } } } function theme_options_css_js() { ?>
<style type="text/css">
.metabox-holder {
width: 350px; float: left;
margin: 0px; padding: 0px 10px 0px 0px;
}
.metabox-holder .postbox .inside {
padding: 0px 10px 0px 10px;
}
.catOptions { width:100%; height:184px!important; }
.catOption { width:100%; height:132px!important; }
</style>
<?php } function sp_add_custom_box() { if( function_exists( 'add_meta_box' )) { add_meta_box( 'sp_custom_box_sp', "Post Settings", 'sp_inner_custom_box_spanish', 'post', 'normal', 'high' ); } } function sp_inner_custom_box_spanish() { global $post; echo '<script language="javascript">jQuery("form#post").attr("enctype","multipart/form-data");</script>'; echo '<input type="hidden" name="sp_noncename" id="sp_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; echo '<p><label for="_nov"><strong>No of Visits: </strong></label></p>'; echo '<textarea style="width: 95%;height: 25px;" id="_nov" name="_post-counter">' . get_post_meta($post->ID, 'post-counter', true) . '</textarea><br /><br />'; echo '<p><label for="_featured_title"><strong>Show Image?<br /></strong></label></p>'; echo '<select style="width: 95%;height: 25px;" name="_show-image">'; echo '<option value="true"'; echo get_post_meta($post->ID, 'show-image', true)=="true"?" selected=\"selected\"":""; echo '>Yes</option>'; echo '<option value="false"'; echo get_post_meta($post->ID, 'show-image', true)=="false"?" selected=\"selected\"":""; echo '>No</option>'; echo '</select><br /><br />'; } function sp_save_postdata($post_id, $post) { if ( !wp_verify_nonce( $_POST['sp_noncename'], plugin_basename(__FILE__) )) { return $post->ID; } if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post->ID )) return $post->ID; } else { if ( !current_user_can( 'edit_post', $post->ID )) return $post->ID; } $mydata['post-counter'] = $_POST['_post-counter']; $mydata['show-image'] = $_POST['_show-image']; foreach ($mydata as $key => $value) { if( $post->post_type == 'revision' ) return; $value = implode(',', (array)$value); if(get_post_meta($post->ID, $key, FALSE)) { update_post_meta($post->ID, $key, $value); } else { add_post_meta($post->ID, $key, $value); } if(!$value) delete_post_meta($post->ID, $key); } } add_action('admin_menu', 'sp_add_custom_box'); add_action('save_post', 'sp_save_postdata', 1, 2); ?>