$val ) { $the_opt[$key] = $the_coa[$key]['default']; } $the_opt['version'] = ''; //null value to keep admin notice alive and invite user to discover theme options update_option( 'boozurk_options' , $the_opt ); } else if ( !isset( $the_opt['version'] ) || $the_opt['version'] < $boozurk_version ) { // check for unset values and set them to default value -> when updated to new version foreach ( $the_coa as $key => $val ) { if ( !isset( $the_opt[$key] ) ) $the_opt[$key] = $the_coa[$key]['default']; } $the_opt['version'] = ''; //null value to keep admin notice alive and invite user to discover theme options update_option( 'boozurk_options' , $the_opt ); } } // print a reminder message for set the options after the theme is installed or updated if ( !function_exists( 'boozurk_setopt_admin_notice' ) ) { function boozurk_setopt_admin_notice() { echo '

' . sprintf( __( "%s theme says: \"Dont forget to set my options!\"", 'boozurk' ), 'Boozurk', get_admin_url() . 'themes.php?page=boozurk_functions' ) . '

'; } } if ( current_user_can( 'manage_options' ) && ( $boozurk_opt['version'] < $boozurk_version ) ) { add_action( 'admin_notices', 'boozurk_setopt_admin_notice' ); } //Image EXIF details if ( !function_exists( 'boozurk_exif_details' ) ) { function boozurk_exif_details(){ global $post; ?>
1) { if ((number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1)) == 1.3 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.5 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.6 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 2.5){ $pshutter = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1, '.', ''); } else { $pshutter = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 0, '.', ''); } } else { $pshutter = $imgmeta['image_meta']['shutter_speed']; } // Start to display EXIF and IPTC data of digital photograph echo __("Width", "boozurk" ) . ": " . $imgmeta['width']."px
"; echo __("Height", "boozurk" ) . ": " . $imgmeta['height']."px
"; if ( $imgmeta['image_meta']['created_timestamp'] ) echo __("Date Taken", "boozurk" ) . ": " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."
"; if ( $imgmeta['image_meta']['copyright'] ) echo __("Copyright", "boozurk" ) . ": " . $imgmeta['image_meta']['copyright']."
"; if ( $imgmeta['image_meta']['credit'] ) echo __("Credit", "boozurk" ) . ": " . $imgmeta['image_meta']['credit']."
"; if ( $imgmeta['image_meta']['title'] ) echo __("Title", "boozurk" ) . ": " . $imgmeta['image_meta']['title']."
"; if ( $imgmeta['image_meta']['caption'] ) echo __("Caption", "boozurk" ) . ": " . $imgmeta['image_meta']['caption']."
"; if ( $imgmeta['image_meta']['camera'] ) echo __("Camera", "boozurk" ) . ": " . $imgmeta['image_meta']['camera']."
"; if ( $imgmeta['image_meta']['focal_length'] ) echo __("Focal Length", "boozurk" ) . ": " . $imgmeta['image_meta']['focal_length']."mm
"; if ( $imgmeta['image_meta']['aperture'] ) echo __("Aperture", "boozurk" ) . ": f/" . $imgmeta['image_meta']['aperture']."
"; if ( $imgmeta['image_meta']['iso'] ) echo __("ISO", "boozurk" ) . ": " . $imgmeta['image_meta']['iso']."
"; if ( $pshutter ) echo __("Shutter Speed", "boozurk" ) . ": " . sprintf( '%s seconds', $pshutter) . "
" ?>
1, 'date' => 1, 'tags' => 1, 'categories' => 1, 'avatar_size' => 48, 'featured' => 0 ); $args = wp_parse_args( $args, $defaults ); ?> ID ) ) { echo '
' . get_the_post_thumbnail( $post->ID, 'thumbnail') . '
'; } ?> post_author; $name = get_the_author_meta('nickname', $author); $alt_name = get_the_author_meta('user_nicename', $author); $avatar = get_avatar($author, $args['avatar_size'], 'Gravatar Logo', $alt_name.'-photo'); $description = get_the_author_meta('description', $author); $author_link = get_author_posts_url($author); ?>
' . __( 'Categories', 'boozurk' ) . ': ' . ''; the_category( ', ' ); echo '
'; } ?> ' . __( 'Tags', 'boozurk' ) . ': ' . ''; if ( !get_the_tags() ) { _e( 'No Tags', 'boozurk' ); } else { the_tags('', ', ', ''); } echo '
'; } ?> ' . __( 'Published on', 'boozurk' ) . ': ' . ''; echo '' . get_the_time( get_option( 'date_format' ) ) . ''; } ?> 24, 'echo' => true ); $args = wp_parse_args( $args, $defaults ); $share = array( //'ID' => array( 'NAME', 'LINK' ), // LINK -> %1$s: title, %2$s: url, %3$s: image/thumbnail 'twitter' => array( 'Twitter', 'http://twitter.com/home?status=%1$s - %2$s' ), 'facebook' => array( 'Facebook', 'http://www.facebook.com/sharer.php?u=%2$s&t=%1$s' ), 'sina' => array( 'Weibo', 'http://v.t.sina.com.cn/share/share.php?url=%2$s' ), 'tencent' => array( 'Tencent', 'http://v.t.qq.com/share/share.php?url=%2$s&title=%1$s&pic=%3$s' ), 'qzone' => array( 'Qzone', 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=%2$s' ), 'reddit' => array( 'Reddit', 'http://reddit.com/submit?url=%2$s&title=%1$s' ), 'stumbleupon' => array( 'StumbleUpon', 'http://www.stumbleupon.com/submit?url=%2$s&title=%1$s' ), 'digg' => array( 'Digg', 'http://digg.com/submit?url=%2$s' ), 'orkut' => array( 'Orkut', 'http://promote.orkut.com/preview?nt=orkut.com&tt=%1$s&du=%2$s&tn=%3$s' ), 'bookmarks' => array( 'Bookmarks', 'https://www.google.com/bookmarks/mark?op=edit&bkmk=%2$s&title=%1$s' ), 'blogger' => array( 'Blogger', 'http://www.blogger.com/blog_this.pyra?t&u=%2$s&n=%1$s&pli=1' ), 'delicious' => array( 'Delicious', 'http://delicious.com/save?v=5&noui&jump=close&url=%2$s&title=%1$s' ), ); $pName = rawurlencode($post->post_title); $pHref = rawurlencode(get_permalink($post->ID)); $pPict = rawurlencode(wp_get_attachment_url(get_post_thumbnail_id($post->ID))); $outer = '
'; foreach( $share as $key => $service ){ $href = sprintf( $service[1], $pName, $pHref, $pPict ); $outer .= '' . $service[0] . ' Button'; } $outer .= '
'; if ( $args['echo'] ) echo $outer; else return $outer; } } // Get first image of a post if ( !function_exists( 'boozurk_get_first_image' ) ) { function boozurk_get_first_image() { global $post, $posts; $first_info = array( 'img' => '', 'title' => '', 'src' => '' ); //search the images in post content preg_match_all( '/]+>/i',$post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_info['img'] = $result[0][0]; $first_img = $result [0][0]; //get the title (if any) preg_match_all( '/(title)=("[^"]*")/i',$first_img, $img_title ); if ( isset( $img_title[2][0] ) ){ $first_info['title'] = str_replace( '"','',$img_title[2][0] ); } //get the path preg_match_all( '/(src)=("[^"]*")/i',$first_img, $img_src ); if ( isset( $img_src[2][0] ) ){ $first_info['src'] = str_replace( '"','',$img_src[2][0] ); } return $first_info; } else { return false; } } } // Get first link of a post if ( !function_exists( 'boozurk_get_first_link' ) ) { function boozurk_get_first_link() { global $post, $posts; $first_info = array( 'anchor' => '', 'title' => '', 'href' => '', 'text' => '' ); //search the link in post content preg_match_all( "/]*>(.*?)<\/a>/i",$post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_info['anchor'] = $result[0][0]; $first_info['text'] = isset( $result[1][0] ) ? $result[1][0] : ''; //get the title (if any) preg_match_all( '/(title)=(["\'][^"]*["\'])/i',$first_info['anchor'], $link_title ); $first_info['title'] = isset( $link_title[2][0] ) ? str_replace( array('"','\''),'',$link_title[2][0] ) : ''; //get the path preg_match_all( '/(href)=(["\'][^"]*["\'])/i',$first_info['anchor'], $link_href ); $first_info['href'] = isset( $link_href[2][0] ) ? str_replace( array('"','\''),'',$link_href[2][0] ) : ''; return $first_info; } else { return false; } } } // Get first blockquote words if ( !function_exists( 'boozurk_get_blockquote' ) ) { function boozurk_get_blockquote() { global $post, $posts; $first_quote = array( 'quote' => '', 'cite' => '' ); //search the blockquote in post content preg_match_all( '/]*>([\w\W]*?)<\/blockquote>/',$post->post_content, $blockquote ); //grab the first one if ( isset( $blockquote[0][0] ) ){ $first_quote['quote'] = strip_tags( $blockquote[0][0] ); $words = explode( " ", $first_quote['quote'], 6 ); if ( count( $words ) == 6 ) $words[5] = '...'; $first_quote['quote'] = implode( ' ', $words ); preg_match_all( '/([\w\W]*?)<\/cite>/',$blockquote[0][0], $cite ); $first_quote['cite'] = ( isset( $cite[1][0] ) ) ? $cite[1][0] : ''; return $first_quote; } else { return false; } } } if ( !function_exists( 'boozurk_theme_admin_scripts' ) ) { function boozurk_theme_admin_scripts() { global $boozurk_version; wp_enqueue_script( 'boozurk-options-script', get_template_directory_uri().'/js/options.dev.js',array('jquery','farbtastic','thickbox'),$boozurk_version, true ); //thebird js $data = array( 'confirm_to_defaults' => __( 'Are you really sure you want to set all the options to their default values?', 'boozurk' ) ); wp_localize_script( 'boozurk-options-script', 'bz_l10n', $data ); } } if ( !function_exists( 'boozurk_widgets_style' ) ) { function boozurk_widgets_style() { //add custom stylesheet wp_enqueue_style( 'bz-widgets-style', get_template_directory_uri() . '/css/widgets.css', false, '', 'screen' ); } } if ( !function_exists( 'boozurk_widgets_scripts' ) ) { function boozurk_widgets_scripts() { global $boozurk_version; wp_enqueue_script( 'bz-widgets-scripts', get_template_directory_uri() . '/js/widgets.dev.js', array('jquery'), $boozurk_version, true ); } } // the custon header style - called only on your theme options page if ( !function_exists( 'boozurk_theme_admin_styles' ) ) { function boozurk_theme_admin_styles() { wp_enqueue_style( 'bz-options-style', get_template_directory_uri() . '/css/options.css', array('farbtastic','thickbox'), '', 'screen' ); } } // sanitize options value if ( !function_exists( 'boozurk_sanitize_options' ) ) { function boozurk_sanitize_options($input) { global $boozurk_version; $the_coa = boozurk_get_coa(); foreach ( $the_coa as $key => $val ) { if( $the_coa[$key]['type'] == 'chk' ) { //CHK if( !isset( $input[$key] ) ) { $input[$key] = 0; } else { $input[$key] = ( $input[$key] == 1 ? 1 : 0 ); } } elseif( $the_coa[$key]['type'] == 'sel' ) { //SEL if ( !in_array( $input[$key], $the_coa[$key]['options'] ) ) $input[$key] = $the_coa[$key]['default']; } elseif( $the_coa[$key]['type'] == 'opt' ) { //OPT if ( !in_array( $input[$key], $the_coa[$key]['options'] ) ) $input[$key] = $the_coa[$key]['default']; } elseif( $the_coa[$key]['type'] == 'col' ) { //COL $color = str_replace( '#' , '' , $input[$key] ); $color = preg_replace( '/[^0-9a-fA-F]/' , '' , $color ); $input[$key] = '#' . $color; } elseif( $the_coa[$key]['type'] == 'url' ) { //URL $input[$key] = esc_url( trim( strip_tags( $input[$key] ) ) ); } elseif( $the_coa[$key]['type'] == 'txt' ) { //TXT if( !isset( $input[$key] ) ) { $input[$key] = ''; } else { $input[$key] = trim( strip_tags( $input[$key] ) ); } } elseif( $the_coa[$key]['type'] == 'int' ) { //INT if( !isset( $input[$key] ) ) { $input[$key] = $the_coa[$key]['default']; } else { $input[$key] = (int) $input[$key] ; } } elseif( $the_coa[$key]['type'] == 'txtarea' ) { //TXTAREA if( !isset( $input[$key] ) ) { $input[$key] = ''; } else { $input[$key] = trim( strip_tags( $input[$key] ) ); } } } foreach ( $input['boozurk_cat_colors'] as $key => $val ) { //CATCOL $color = str_replace( '#' , '' , $input['boozurk_cat_colors'][$key] ); $color = preg_replace( '/[^0-9a-fA-F]/' , '' , $color ); $input['boozurk_cat_colors'][$key] = '#' . $color; } // check for required options foreach ( $the_coa as $key => $val ) { if ( $the_coa[$key]['req'] != '' ) { if ( $input[$the_coa[$key]['req']] == ( 0 || '') ) $input[$key] = 0; } } $input['version'] = $boozurk_version; // keep version number return $input; } } // the theme option page if ( !function_exists( 'boozurk_edit_options' ) ) { function boozurk_edit_options() { if ( !current_user_can( 'edit_theme_options' ) ) wp_die( 'You do not have sufficient permissions to access this page.' ); global $boozurk_opt, $boozurk_current_theme, $boozurk_version; $the_coa = boozurk_get_coa(); $the_groups = boozurk_get_coa( 'groups' ); $the_option_name = 'boozurk_options'; if ( isset( $_GET['erase'] ) ) { $_SERVER['REQUEST_URI'] = remove_query_arg( 'erase', $_SERVER['REQUEST_URI'] ); delete_option( $the_option_name ); boozurk_default_options(); $boozurk_opt = get_option( $the_option_name ); } // update version value when admin visit options page if ( $boozurk_opt['version'] < $boozurk_version ) { $boozurk_opt['version'] = $boozurk_version; update_option( $the_option_name , $boozurk_opt ); } $the_opt = $boozurk_opt; // options have been updated if ( isset( $_REQUEST['settings-updated'] ) ) { //return options save message echo '

' . __( 'Options saved.','boozurk' ) . '

'; } // options to defaults done if ( isset( $_GET['erase'] ) ) { echo '

' . __( 'Defaults values loaded.', 'boozurk' ) . '

'; } ?>

    $name ) { ?>

$val) { ?>
/> $option ) { ?>
$subval) { ?> '; continue;} ?>
: /> $option ) { ?>



'name', 'order' => 'ASC' ); $categories=get_categories($args); foreach($categories as $category) { $hexnumber = '#'; for ($i2=1; $i2<=3; $i2++) { $hexnumber .= dechex( rand(64,255) ); } $catcolor = isset($the_opt[$subval][$category->term_id]) ? $the_opt[$subval][$category->term_id] : $hexnumber; ?>
name; ?>



description ) { ?>
description; ?>

' . __('requires','boozurk') . ': ' . $the_coa[$the_coa[$key]['req']]['description']; ?>

|


Support the theme in your language, provide a translation.

($yearInSecs * 2)) { $dateWithNiceTone = __( 'quite a long while ago...', 'boozurk' ); //if over a year } else if ($timeDifference > $yearInSecs) { $dateWithNiceTone = __( 'over a year ago', 'boozurk' ); //if over 2 months } else if ($timeDifference > ($monthInSecs * 2)) { $num = round($timeDifference / $monthInSecs); $dateWithNiceTone = sprintf(__('%s months ago', 'boozurk' ),$num); //if over a month } else if ($timeDifference > $monthInSecs) { $dateWithNiceTone = __( 'a month ago', 'boozurk' ); //if more than 2 days ago } else { $htd = human_time_diff( get_the_time('U'), current_time('timestamp') ); $dateWithNiceTone = sprintf(__('%s ago', 'boozurk' ), $htd ); } echo $dateWithNiceTone; } } // add 'quoted on' before trackback/pingback comments link if ( !function_exists( 'boozurk_add_quoted_on' ) ) { function boozurk_add_quoted_on( $return ) { global $comment; $text = ''; if ( get_comment_type() != 'comment' ) { $text = '' . __( 'quoted on', 'boozurk' ) . ' '; } return $text . $return; } } // strip tags and apply title format for blank titles function boozurk_titles_filter( $title, $id = null ) { global $boozurk_opt; if ( is_admin() ) return $title; $title = strip_tags( $title, '' ); if ( $id == null ) return $title; if ( !$boozurk_opt['boozurk_blank_title'] ) return $title; if ( empty( $title ) ) { if ( !isset( $boozurk_opt['boozurk_blank_title_text'] ) || empty( $boozurk_opt['boozurk_blank_title_text'] ) ) return __( '(no title)', 'boozurk' ); $postdata = array( get_post_format( $id )? get_post_format_string( get_post_format( $id ) ): __( 'Post', 'boozurk' ), get_the_time( get_option( 'date_format' ), $id ), $id ); $codes = array( '%f', '%d', '%n' ); return str_replace( $codes, $postdata, $boozurk_opt['boozurk_blank_title_text'] ); } else return $title; } //set the excerpt length if ( !function_exists( 'boozurk_excerpt_length' ) ) { function boozurk_excerpt_length( $length ) { global $boozurk_opt; return (int) $boozurk_opt['boozurk_excerpt_length']; } } // use the "excerpt more" string as a link to the post function boozurk_excerpt_more( $more ) { global $boozurk_opt, $post; if ( is_admin() ) return $more; if ( isset( $boozurk_opt['boozurk_excerpt_more_txt'] ) && isset( $boozurk_opt['boozurk_excerpt_more_link'] ) ) { if ( $boozurk_opt['boozurk_excerpt_more_link'] ) { return '' . $boozurk_opt['boozurk_excerpt_more_txt'] . ''; } else { return $boozurk_opt['boozurk_excerpt_more_txt']; } } return $more; } // custom text for the "more" tag function boozurk_more_link( $more_link, $more_link_text ) { global $boozurk_opt; if ( isset( $boozurk_opt['boozurk_more_tag'] ) && !is_admin() ) { $text = str_replace ( '%t', get_the_title(), $boozurk_opt['boozurk_more_tag'] ); return str_replace( $more_link_text, $text, $more_link ); } return $more_link; } //Add new contact methods to author panel if ( !function_exists( 'boozurk_new_contactmethods' ) ) { function boozurk_new_contactmethods( $contactmethods ) { //add Twitter $contactmethods['twitter'] = 'Twitter'; //add Facebook $contactmethods['facebook'] = 'Facebook'; return $contactmethods; } } // Add Thumbnail Column in Manage Posts/Pages List function boozurk_addthumbcolumn($cols) { $cols['thumbnail'] = ucwords( __('thumbnail', 'boozurk') ); return $cols; } // Add Thumbnails in Manage Posts/Pages List function boozurk_addthumbvalue($column_name, $post_id) { $width = (int) 60; $height = (int) 60; if ( 'thumbnail' == $column_name ) { // thumbnail of WP 2.9 $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true ); if ($thumbnail_id) $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true ); if ( isset($thumb) && $thumb ) { echo $thumb; } else { echo ''; } } } // Add Thumbnail Column style in Manage Posts/Pages List if ( !function_exists( 'boozurk_post_manage_style' ) ) { function boozurk_post_manage_style(){ ?> ID ) . ' « '; } // Get the Site Name $site_name = get_bloginfo( 'name' ); // Append name $filtered_title = $title . $site_name; // If site front page, append description if ( is_front_page() ) { // Get the Site Description $site_description = get_bloginfo( 'description' ); // Append Site Description to title $filtered_title .= ' - ' . $site_description; } // Return the modified title return $filtered_title; } // check if in media preview mode $boozurk_is_media = false; if ( isset( $_GET['tb_media'] ) ) { $boozurk_is_media = true; } // media preview if ( !function_exists( 'boozurk_media' ) ) { function boozurk_media () { global $boozurk_is_media; if ( $boozurk_is_media ) { get_template_part( 'lib/media' ); exit; } } }