fastfood_get_js_modules(),
'post_expander_wait' => __( 'Post loading, please wait...', 'fastfood' ),
'quote_link_info' => esc_attr( __( 'Add selected text as a quote', 'fastfood' ) ),
'quote_link_alert' => __( 'Nothing to quote. First of all you should select some text...', 'fastfood' )
);
wp_localize_script( 'fastfood-script', 'fastfood_l10n', $data );
}
}
}
// add a js-selecting class
if ( !function_exists( 'fastfood_body_class_script' ) ) {
function fastfood_body_class_script(){
?>
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){
$imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1, '.', '');
} else {
$imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 0, '.', '');
}
}
$output = '';
// get other EXIF and IPTC data of digital photograph
$output .= __("Width", "fastfood" ) . ": " . $imgmeta['width']."px
";
$output .= __("Height", "fastfood" ) . ": " . $imgmeta['height']."px
";
if ( $imgmeta['image_meta']['created_timestamp'] ) $output .= __("Date Taken", "fastfood" ) . ": " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."
";
if ( $imgmeta['image_meta']['copyright'] ) $output .= __("Copyright", "fastfood" ) . ": " . $imgmeta['image_meta']['copyright']."
";
if ( $imgmeta['image_meta']['credit'] ) $output .= __("Credit", "fastfood" ) . ": " . $imgmeta['image_meta']['credit']."
";
if ( $imgmeta['image_meta']['title'] ) $output .= __("Title", "fastfood" ) . ": " . $imgmeta['image_meta']['title']."
";
if ( $imgmeta['image_meta']['caption'] ) $output .= __("Caption", "fastfood" ) . ": " . $imgmeta['image_meta']['caption']."
";
if ( $imgmeta['image_meta']['camera'] ) $output .= __("Camera", "fastfood" ) . ": " . $imgmeta['image_meta']['camera']."
";
if ( $imgmeta['image_meta']['focal_length'] ) $output .= __("Focal Length", "fastfood" ) . ": " . $imgmeta['image_meta']['focal_length']."mm
";
if ( $imgmeta['image_meta']['aperture'] ) $output .= __("Aperture", "fastfood" ) . ": f/" . $imgmeta['image_meta']['aperture']."
";
if ( $imgmeta['image_meta']['iso'] ) $output .= __("ISO", "fastfood" ) . ": " . $imgmeta['image_meta']['iso']."
";
if ( $imgmeta['image_meta']['shutter_speed'] ) $output .= __("Shutter Speed", "fastfood" ) . ": " . sprintf( '%s seconds', $imgmeta['image_meta']['shutter_speed']) . "
"
?>
]*>([\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; } } } // Get first gallery if ( !function_exists( 'fastfood_get_gallery_shortcode' ) ) { function fastfood_get_gallery_shortcode() { global $post; $pattern = get_shortcode_regex(); if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( 'gallery', $matches[2] ) ) // gallery shortcode is being used { $key = array_search( 'gallery', $matches[2] ); $attrs = shortcode_parse_atts( $matches['3'][$key] ); return $attrs; } } } // run the gallery preview if ( !function_exists( 'fastfood_gallery_preview' ) ) { function fastfood_gallery_preview() { $attrs = fastfood_get_gallery_shortcode(); $attrs['preview'] = true; return fastfood_gallery_shortcode( '', $attrs ); } } // the gallery preview walker if ( !function_exists( 'fastfood_gallery_preview_walker' ) ) { function fastfood_gallery_preview_walker( $attachments = '', $id = 0 ) { if ( ! $id ) return false; if ( empty( $attachments ) ) $attachments = get_children( array( 'post_parent' => $id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); if ( empty( $attachments ) ) return false; $permalink = get_permalink( $id ); $images_count = count( $attachments ); $first_image = array_shift( $attachments ); $other_imgs = array_slice( $attachments, 0, 4 ); $output = '' . wp_get_attachment_image( $first_image->ID, 'medium' ) . ''; $output .= ''; return preg_replace( $pattern, $replacement, $output ); } //filters wp_title() function fastfood_filter_wp_title( $title ) { if ( is_single() && empty( $title ) ) { $_post = get_queried_object(); $title = fastfood_title_tags_filter( '', $_post->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; } // add links to admin bar function fastfood_admin_bar_plus() { global $wp_admin_bar; if ( !current_user_can( 'edit_theme_options' ) || !is_admin_bar_showing() ) return; $add_menu_meta = array( 'target' => '_blank' ); $wp_admin_bar->add_menu( array( 'id' => 'ff_theme_options', 'parent' => 'appearance', 'title' => __( 'Theme Options', 'fastfood' ), 'href' => get_admin_url() . 'themes.php?page=fastfood_theme_options', 'meta' => $add_menu_meta ) ); } // filters comments_form() default arguments function fastfood_comment_form_defaults( $defaults ) { global $user_identity; $defaults['comment_field'] = ''; $defaults['label_submit'] = __( 'Say It!','fastfood' ); $defaults['title_reply'] = __( 'Leave a comment','fastfood' ); return $defaults; } // add the avatar before the "logged in as..." message function fastfood_add_avatar_to_logged_in( $text = '', $commenter = false, $user_identity = false ) { $avatar = is_user_logged_in() ? get_avatar( get_current_user_id(), 50, $default = get_option( 'avatar_default' ) ) . ' ' : ''; $text = str_replace( ''; foreach ($other_imgs as $image) { $output .= ''; $output .= '' . wp_get_attachment_image( $image->ID, 'thumbnail' ) . ''; } $output .= '' . sprintf( _n( 'This gallery contains %2$s image', 'This gallery contains %2$s images', $images_count, 'fastfood' ), 'href="' . get_permalink() . '" title="' . esc_attr ( __( 'View gallery', 'fastfood' ) ) . '" rel="bookmark"', number_format_i18n( $images_count ) ) . '
'; $output = apply_filters( 'fastfood_gallery_preview_walker', $output ); $output = '' . $output . ''; echo $output; return true; } } //Displays the amount of time since a post or page was written in a nice friendly manner. //Based on Plugin: Date in a nice tone (http://wordpress.org/extend/plugins/date-in-a-nice-tone/) function fastfood_friendly_date() { $postTime = get_the_time('U'); $currentTime = time(); $timeDifference = $currentTime - $postTime; $minInSecs = 60; $hourInSecs = 3600; $dayInSecs = 86400; $monthInSecs = $dayInSecs * 31; $yearInSecs = $dayInSecs * 366; //if over 2 years if ($timeDifference > ($yearInSecs * 2)) { $dateWithNiceTone = __( 'quite a long while ago...', 'fastfood' ); //if over a year } else if ($timeDifference > $yearInSecs) { $dateWithNiceTone = __( 'over a year ago', 'fastfood' ); //if over 2 months } else if ($timeDifference > ($monthInSecs * 2)) { $num = round($timeDifference / $monthInSecs); $dateWithNiceTone = sprintf(__('%s months ago', 'fastfood' ),$num); //if over a month } else if ($timeDifference > $monthInSecs) { $dateWithNiceTone = __( 'a month ago', 'fastfood' ); //if more than 2 days ago } else { $htd = human_time_diff( get_the_time('U'), current_time('timestamp') ); $dateWithNiceTone = sprintf(__('%s ago', 'fastfood' ), $htd ); } return apply_filters( 'fastfood_filter_friendly_date', $dateWithNiceTone ); } // page hierarchy if ( !function_exists( 'fastfood_multipages' ) ) { function fastfood_multipages( $r_pos ){ global $post; $args = array( 'post_type' => 'page', 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'numberposts' => 0, 'no_found_rows' => true, ); $childrens = get_posts( $args ); // retrieve the child pages $the_parent_page = $post->post_parent; // retrieve the parent page $has_herarchy = false; if ( ( $childrens ) || ( $the_parent_page ) ){ ?> '', 'size' => array( 40, 40 ), 'class' => '', 'default' => '', 'linked' => 0, ); $args = wp_parse_args( $args, $defaults ); if ( has_post_thumbnail( $args['id'] ) ) { $output = get_the_post_thumbnail( $args['id'], $args['size'], array( 'class' => $args['class'] ) ); } else { $output = $args['default']; } if ( $args['linked'] ) $thumb = '' . $output . ''; else $thumb = $output; return apply_filters( 'fastfood_filter_get_the_thumb', $thumb ); } // display the post title with the featured image function fastfood_featured_title( $args = '' ) { global $post; $defaults = array( 'alternative' => '', 'fallback' => '', 'featured' => true, 'href' => get_permalink(), 'target' => '', 'title' => the_title_attribute( array( 'echo' => 0 ) ), 'echo' => 1, ); $args = wp_parse_args( $args, $defaults ); if ( fastfood_get_opt( 'fastfood_hide_frontpage_title' ) && is_page() && is_front_page() ) return; if ( fastfood_get_opt( 'fastfood_hide_pages_title' ) && is_page() ) return; if ( fastfood_get_opt( 'fastfood_hide_posts_title' ) && is_single() ) return; $selected_ids = explode( ',', fastfood_get_opt( 'fastfood_hide_selected_entries_title' ) ); if ( in_array( $post->ID, $selected_ids ) ) return; $post_title = $args['alternative'] ? $args['alternative'] : get_the_title(); $post_title = $post_title ? $post_title : $args['fallback']; $link_target = $args['target'] ? ' target="'.$args['target'].'"' : ''; if ( !fastfood_get_opt( 'fastfood_featured_title' ) ) $args['featured'] = false; $thumb = ( $args['featured'] && has_post_thumbnail( $post->ID ) ) ? get_the_post_thumbnail( $post->ID, array( fastfood_get_opt( 'fastfood_featured_title_size' ), fastfood_get_opt( 'fastfood_featured_title_size' ) ) ) : ''; $title_class = $thumb ? 'entry-title storytitle featured-' . fastfood_get_opt( 'fastfood_featured_title_size' ) : 'storytitle'; $title_content = is_singular() ? $thumb . $post_title : '' . $thumb . $post_title . ''; if ( $post_title || $thumb ) $post_title = '' . $title_content . '
'; $post_title = apply_filters( 'fastfood_filter_featured_title', $post_title ); if ( $args['echo'] ) echo $post_title; else return $post_title; } // print extra info for posts/pages if ( !function_exists( 'fastfood_extrainfo' ) ) { function fastfood_extrainfo( $args = '' ) { $defaults = array( 'auth' => 1, 'date' => 1, 'comms' => 1, 'tags' => 1, 'cats' => 1, 'hiera' => 0, 'list_view' => 0, ); $args = wp_parse_args( $args, $defaults ); //xinfos disabled when... if ( ! fastfood_get_opt( 'fastfood_xinfos_global' ) ) return; //xinfos globally disabled if ( is_page() && is_front_page() && ! fastfood_get_opt( 'fastfood_xinfos_on_front' ) ) return; // is front page if ( is_page() && ! fastfood_get_opt( 'fastfood_xinfos_on_page' ) ) return; if ( is_single() && ! fastfood_get_opt( 'fastfood_xinfos_on_post' ) ) return; if ( !is_singular() && ! fastfood_get_opt( 'fastfood_xinfos_on_list' ) ) return; if ( fastfood_get_opt( 'fastfood_xinfos_static' ) ) $args['list_view'] = true; if ( ! fastfood_get_opt( 'fastfood_xinfos_byauth' ) ) $args['auth'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_date' ) ) $args['date'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_comm' ) ) $args['comms'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_tag' ) ) $args['tags'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_cat' ) ) $args['cats'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_hiera' ) ) $args['hiera'] = false; $post_author = ( ( $args['auth'] === true ) || ( $args['auth'] === 1 ) ) ? '' . get_the_author() . '' : ' '; $post_author = sprintf( __( 'by %s', 'fastfood' ), $post_author ); $categories = __( 'Categories', 'fastfood' ) . ': ' . get_the_category_list(', '); $tags = __( 'Tags', 'fastfood' ) . ': ' . ( ( get_the_tags() ) ? get_the_tag_list( '', ', ' , '') : __( 'No Tags', 'fastfood' ) ); $comments = __( 'Comments', 'fastfood' ) . ': ' . fastfood_get_comments_link(); $date = sprintf( __( 'Published on: %s', 'fastfood' ), '' . get_the_time( get_option( 'date_format' ) ) . '' ); $r_pos = 10; if ( !$args['list_view'] ) { ?> ID ); $esc_href = esc_url( get_permalink() ); $esc_title = esc_attr( get_the_title() ); $esc_href_short = esc_url( home_url() . '/?p=' . $post->ID ); $text = ''; if ( fastfood_get_opt( 'fastfood_I_like_it_plus1' ) ) $text .=' '; if ( fastfood_get_opt( 'fastfood_I_like_it_twitter' ) ) $text .=' '; if ( fastfood_get_opt( 'fastfood_I_like_it_facebook' ) ) $text .=' '; if ( fastfood_get_opt( 'fastfood_I_like_it_linkedin' ) ) $text .=''; if ( fastfood_get_opt( 'fastfood_I_like_it_stumbleupon' ) ) $text .=' '; if ( fastfood_get_opt( 'fastfood_I_like_it_pinterest' ) && is_attachment() && wp_attachment_is_image() ) $text .=' '; if ( $text ) { echo ''; add_action( 'wp_footer', 'fastfood_like_it_scripts' ); } } } // the "like" badges scripts (asynchronously loaded) if ( !function_exists( 'fastfood_like_it_scripts' ) ) { function fastfood_like_it_scripts(){ ?> $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); foreach ( $attachments as $key => $attachment ) { if ( $attachment->ID == $post->ID ) break; } $prev_k = $key - 1; $next_k = $key + 1; $prev_image = ( isset( $attachments[ $prev_k ] ) ) ? '« ' . wp_get_attachment_image( $attachments[ $prev_k ]->ID, array( 70, 70 ) ) . '' : ''; $next_image = ( isset( $attachments[ $next_k ] ) ) ? '' . wp_get_attachment_image( $attachments[ $next_k ]->ID, array( 70, 70 ) ) . ' »' : ''; ?>' . apply_filters( 'fastfood_filter_like_it', $text ) . 'ID, array( 70, 70 ) ); ?>1 && get_option( 'page_comments' ) ) { ?> is_main_query() && $query->is_home() ) { if ( ! fastfood_get_opt( 'fastfood_post_view_aside') ) $terms[] = 'post-format-aside'; if ( ! fastfood_get_opt( 'fastfood_post_view_status' ) ) $terms[] = 'post-format-status'; if ( isset( $terms ) ) { $tax_query = array( array( 'taxonomy' => 'post_format', 'terms' => $terms, 'field' => 'slug', 'operator' => 'NOT IN', ), ); $query->set( 'tax_query', $tax_query ); } } } // Search reminder function fastfood_search_reminder() { global $wp_query; $text = ''; $term = get_queried_object(); if ( ! fastfood_get_opt( 'fastfood_breadcrumb' ) ) { if ( is_archive() ) { $title = ''; $type = ''; if ( is_category() || is_tag() || is_tax() ) { if ( is_category() ) $type = __( 'Category', 'fastfood' ); elseif ( is_tag() ) $type = __( 'Tag', 'fastfood' ); elseif ( is_tax() ) $type = __( 'Taxonomy', 'fastfood' ); $title = $term->name; } elseif ( is_date() ) { $type = __( 'Date', 'fastfood' ); if ( is_day() ) { $title = get_the_date(); } else if ( is_month() ) { $title = single_month_title( ' ', false ); } else if ( is_year() ) { $title = get_query_var( 'year' ); } } elseif ( is_author() ) { $type = __( 'Author', 'fastfood' ); $title = $term->display_name; } $text = sprintf( __( '%s archive', 'fastfood' ), get_bloginfo( 'name' ) ) . '' . $type . ' : ' . $title . ' (' . $wp_query->found_posts . ')
'; } elseif ( is_search() ) { $text = sprintf( __( 'Search results for “%s”', 'fastfood' ), '' . esc_html( get_search_query() ) . ' (' . $wp_query->found_posts . ')' ); } } if ( $text ) { ?>' . __( 'Pages', 'fastfood' ) . ':&after=
' ); ?> '; } /** * Displays the link to the comments popup window for the current post ID. * */ function fastfood_get_comments_link( $args = '' ) { $defaults = array( 'zero' => false, 'one' => false, 'more' => false, 'css_class' => '', 'none' => false, 'id' => false, ); $args = wp_parse_args( $args, $defaults ); extract($args, EXTR_SKIP); if ( false === $zero ) $zero = __( 'No Comments', 'fastfood' ); if ( false === $one ) $one = __( '1 Comment', 'fastfood' ); if ( false === $more ) $more = __( '% Comments', 'fastfood' ); if ( false === $none ) $none = __( 'Comments Off', 'fastfood' ); $id = ( $id ) ? (int)$id : get_the_ID(); $css_class = ( ! empty( $css_class ) ) ? ' class="' . esc_attr( $css_class ) . '"' : ''; $number = get_comments_number( $id ); if ( 0 == $number && !comments_open() && !pings_open() ) { $output = '' . $none . ''; } elseif ( post_password_required() ) { $output = __( 'Enter your password to view comments', 'fastfood' ); } else { $label = fastfood_get_opt( 'fastfood_cust_comrep' ) ? '#comments' : '#respond'; $href = ( 0 == $number ) ? get_permalink() . $label : get_comments_link(); $title = esc_attr( sprintf( __( 'Comment on %s', 'fastfood'), the_title_attribute( array( 'echo' => 0 ) ) ) ); if ( $number > 1 ) $text = str_replace( '%', number_format_i18n( $number ), $more ); elseif ( $number == 0 ) $text = $zero; else $text = $one; $output = '' . $text . ''; } return apply_filters( 'fastfood_get_comments_link' , $output ); } // set up custom colors and header image function fastfood_setup() { // Register localization support load_theme_textdomain( 'fastfood', get_template_directory() . '/languages' ); // Theme uses wp_nav_menu() in three location register_nav_menus( array( 'primary' => __( 'Main Navigation Menu', 'fastfood' ) ) ); register_nav_menus( array( 'secondary1' => __( 'Secondary Navigation Menu #1', 'fastfood' ) ) ); register_nav_menus( array( 'secondary2' => __( 'Secondary Navigation Menu #2', 'fastfood' ) ) ); // Register Features Support add_theme_support( 'automatic-feed-links' ); // Thumbnails support add_theme_support( 'post-thumbnails' ); // Add the editor style if ( fastfood_get_opt( 'fastfood_editor_style' ) ) add_editor_style( 'css/editor-style.css' ); // This theme uses post formats if ( fastfood_get_opt( 'fastfood_post_formats' ) ) { $pformats = array(); if ( fastfood_get_opt( 'fastfood_post_formats_gallery' ) ) $pformats[] = 'gallery'; if ( fastfood_get_opt( 'fastfood_post_formats_aside' ) ) $pformats[] = 'aside'; if ( fastfood_get_opt( 'fastfood_post_formats_status' ) ) $pformats[] = 'status'; if ( fastfood_get_opt( 'fastfood_post_formats_quote' ) ) $pformats[] = 'quote'; $pformats = apply_filters( 'fastfood_filter_post_formats', $pformats ); if ( ! empty( $pformats ) ) add_theme_support( 'post-formats', $pformats ); } } // the custom header (filterable) function fastfood_header(){ // Allow plugins/themes to override the default header. $output = apply_filters('fastfood_header', ''); if ( $output != '' ) return $output; if ( fastfood_get_opt( 'fastfood_head_link' ) && ( get_header_image() != '' ) ) { $output = ''; } else { $output = ''; } return $output; } // the custom header style - add style customization to page - gets included in the site header function fastfood_custom_css(){ ?>' . get_bloginfo( 'name' ) . '
' . get_bloginfo( 'description' ) . '
', '
' . $avatar, $text ); return $text; } // retrieve the post content, then die (for "post_expander" ajax request) function fastfood_post_expander_show_post ( ) { if ( have_posts() ) { while ( have_posts() ) { the_post(); the_content(); } } die(); } //is a "post_expander" ajax request? function fastfood_post_expander_activate ( ) { if ( isset( $_POST["ff_post_expander"] ) ) { add_action( 'wp', 'fastfood_post_expander_show_post' ); } } //add a video player using HTML5 if ( !function_exists( 'fastfood_video_player' ) ) { function fastfood_video_player() { $embed_defaults = wp_embed_defaults(); $file = wp_get_attachment_url(); $mime = get_post_mime_type(); $mime_type = explode( '/', $mime ); if ( isset( $mime_type[0] ) && $mime_type[0] == 'video' ) { ?>