minor formatting fixes

This commit is contained in:
Ben Word
2011-06-22 20:20:12 -06:00
parent 09244176e1
commit a290f07e03

View File

@@ -77,12 +77,12 @@ add_filter('get_search_query', 'roots_search_query');
// thanks to Scott Walkinshaw (scottwalkinshaw.com)
function roots_root_relative_url($input) {
preg_match('/(https?:\/\/[^\/|"]+)/', $input, $matches);
// make sure we aren't making external links relative
if (isset($matches[0]) && strpos($matches[0], site_url()) === false) {
return $input;
} else {
return str_replace(end($matches), '', $input);
}
// make sure we aren't making external links relative
if (isset($matches[0]) && strpos($matches[0], site_url()) === false) {
return $input;
} else {
return str_replace(end($matches), '', $input);
}
}
add_filter('bloginfo_url', 'roots_root_relative_url');
@@ -107,7 +107,7 @@ add_filter('the_author_posts_link', 'roots_root_relative_url');
// Leaving plugins_url alone in admin to avoid potential issues (such as Gravity Forms)
if (!is_admin()) {
add_filter('plugins_url', 'roots_root_relative_url');
add_filter('plugins_url', 'roots_root_relative_url');
}
// remove root relative URLs on any attachments in the feed
@@ -349,42 +349,42 @@ function roots_nav_menu_args($args = '') {
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
class roots_nav_walker extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth, $args) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
function start_el(&$output, $item, $depth, $args) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$slug = sanitize_title($item->title);
$slug = sanitize_title($item->title);
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes = array_filter($classes, 'roots_check_current');
$classes = array_filter($classes, 'roots_check_current');
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-' . $slug, $item, $args );
$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-' . $slug, $item, $args );
$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $class_names . '>';
$output .= $indent . '<li' . $id . $class_names . '>';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
function roots_check_current($val) {
return preg_match('/current-menu/', $val);
return preg_match('/current-menu/', $val);
}
?>
?>