Consistent syntax formatting

This commit is contained in:
Scott Walkinshaw
2012-01-15 21:47:33 -05:00
parent eca31bd915
commit 92b1d6d23c
2 changed files with 46 additions and 35 deletions

View File

@@ -208,15 +208,17 @@ function roots_gallery_shortcode($attr) {
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ( $output != '' )
if ($output != '') {
return $output;
}
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if ( !$attr['orderby'] )
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array(
'order' => 'ASC',
@@ -231,8 +233,9 @@ function roots_gallery_shortcode($attr) {
), $attr));
$id = intval($id);
if ( 'RAND' == $order )
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$include = preg_replace( '/[^0-9,]+/', '', $include );
@@ -249,8 +252,9 @@ function roots_gallery_shortcode($attr) {
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
}
if ( empty($attachments) )
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
@@ -267,8 +271,9 @@ function roots_gallery_shortcode($attr) {
$selector = "gallery-{$instance}";
$gallery_style = $gallery_div = '';
if ( apply_filters( 'use_default_gallery_style', true ) )
if (apply_filters('use_default_gallery_style', true)) {
$gallery_style = "";
}
$size_class = sanitize_html_class($size);
$gallery_div = "<section id='$selector' class='clearfix gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
$output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div);
@@ -291,9 +296,10 @@ function roots_gallery_shortcode($attr) {
</{$captiontag}>";
}
$output .= "</{$icontag}>";
if ( $columns > 0 && ++$i % $columns == 0 )
if ($columns > 0 && ++$i % $columns == 0) {
$output .= '';
}
}
$output .= "</section>\n";
@@ -423,6 +429,7 @@ add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags');
function roots_notice_tagline() {
global $current_user;
$user_id = $current_user->ID;
if (!get_user_meta($user_id, 'ignore_tagline_notice')) {
echo '<div class="error">';
echo '<p>', sprintf(__('Please update your <a href="%s">site tagline</a> <a href="%s" style="float: right;">Hide Notice</a>', 'roots'), admin_url('options-general.php'), '?tagline_notice_ignore=0'), '</p>';
@@ -473,19 +480,23 @@ function roots_clean_style_tag($input) {
function roots_body_class() {
$term = get_queried_object();
if (is_single())
if (is_single()) {
$cat = get_the_category();
if(!empty($cat))
}
if(!empty($cat)) {
return $cat[0]->slug;
elseif(isset($term->slug))
} elseif(isset($term->slug)) {
return $term->slug;
elseif(isset($term->page_name))
} elseif(isset($term->page_name)) {
return $term->page_name;
elseif(isset($term->post_name))
} elseif(isset($term->post_name)) {
return $term->post_name;
else
} else {
return;
}
}
// first and last classes for widgets
// http://wordpress.org/support/topic/how-to-first-and-last-css-classes-for-sidebar-widgets