Skip to content

Commit

Permalink
Quote cleanup; fix invalid HTML in one case
Browse files Browse the repository at this point in the history
More swapping of " for ' on strings that don't need the extra
processing provided by using "double quotes".

Fixed a case in the sidebox settings that would generate invalid
HTML (missing a closing </a>) under certain conditions.

Removed references to deleted variable $shortname from
functions.php (merged in with 'updatehandler' branch).
  • Loading branch information
dgw committed Jan 11, 2011
1 parent 5279f33 commit 29182a7
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 129 deletions.
16 changes: 8 additions & 8 deletions archives.php
Expand Up @@ -31,11 +31,11 @@
if ($postresults) {
// The month year title things
$text = sprintf('%s %d', $month[zeroise($monthresult->month,2)], $monthresult->year);
$text_id = strtolower(str_replace(" ","",$text));
$text_id = strtolower(str_replace(' ','',$text));
$postcount = count($postresults);
if($postcount=="1") $postcount_text = "post"; else $postcount_text = "posts";
$output .= "<h2 class=\"archive_h2\"><a onclick=\"jQuery('#$text_id').toggle();\">" . $text . "<span> (" . count($postresults) . " ".$postcount_text." )</span></a></h2>";
$output .= "<ul id='$text_id' class='hide'>\n";
if($postcount=='1') $postcount_text = 'post'; else $postcount_text = 'posts';
$output .= '<h2 class="archive_h2"><a onclick="jQuery(\'#$text_id\').toggle();">' . $text . '<span> (' . count($postresults) . ' '.$postcount_text.' )</span></a></h2>';
$output .= "<ul id=\"$text_id\" class=\"hide\">\n";

foreach ($postresults as $postresult) {
if ($postresult->post_date != '0000-00-00 00:00:00') {
Expand All @@ -46,9 +46,9 @@
else
$text = $postresult->ID;
$title_text = esc_html($text, 1);
$output .= ' <li>' . mysql2date('m/d', $postresult->post_date) . ':&nbsp;' . "<a href='$url' title='$title_text'>$text</a>";
$output .= ' <li>' . mysql2date('m/d', $postresult->post_date) . ':&nbsp;' . "<a href=\"$url\" title=\"$title_text\">$text</a>";
$output .= '&nbsp;(' . $postresult->comment_count . ' ';
if($postresult->comment_count=="1") $output.= "comment"; else $output.= "comments";
if($postresult->comment_count=='1') $output.= 'comment'; else $output.= 'comments';
$output .= ")</li>\n";
}
}
Expand All @@ -57,7 +57,7 @@
}
update_option('hfy_archives_'.$lastpost,$output);
}else{
$output = '<strong>'. __('Not Found','lightword') .'</strong> '. __("Sorry, but you are looking for something that isn't here.","lightword") .'';
$output = '<strong>'. __('Not Found','lightword') .'</strong> '. __('Sorry, but you are looking for something that isn\'t here.','lightword') .'';
}

}
Expand All @@ -68,7 +68,7 @@
<?php endwhile; else: ?>

<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<p><?php _e('Sorry, but you are looking for something that isn\'t here.','lightword'); ?></p>

<?php endif; ?>

Expand Down
6 changes: 3 additions & 3 deletions comments.php
Expand Up @@ -65,7 +65,7 @@
<h2 style="background:transparent;"><?php comment_form_title( __('Leave a comment', 'lightword'), 'Reply' ); ?></h2>

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.','lightword'), get_option('siteurl')."/wp-login.php?redirect_to=".urlencode(get_permalink()));?></p>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.','lightword'), get_option('siteurl').'/wp-login.php?redirect_to='.urlencode(get_permalink()));?></p>
<?php else : ?>

<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
Expand Down Expand Up @@ -103,8 +103,8 @@
</div>

<div class="tab-content">
<?php if($trackbacks_nr == "0" && pings_open()) { echo "<p class=\"no\">"; ?><?php _e('No trackbacks yet.','lightword'); ?><?php echo "</p>"; } ?>
<?php if(!pings_open()) { echo "<p class=\"no\">"; ?><?php _e('Trackbacks are disabled.','lightword'); ?><?php echo "</p>"; } ?>
<?php if($trackbacks_nr == '0' && pings_open()) { echo '<p class="no">'; ?><?php _e('No trackbacks yet.','lightword'); ?><?php echo '</p>'; } ?>
<?php if(!pings_open()) { echo '<p class="no">'; ?><?php _e('Trackbacks are disabled.','lightword'); ?><?php echo '</p>'; } ?>
<?php foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type != 'comment') { ?>
Expand Down
2 changes: 1 addition & 1 deletion footer.php
Expand Up @@ -4,7 +4,7 @@
<span class="text">
<?php
$blog_name = '<a href="'.get_bloginfo('url').'">'.get_bloginfo('name').'</a>';
printf(__('Copyright %s %s %s &middot; Powered by %s <br/>','lightword'),'&copy;',date('Y'),$blog_name,'<a href="http://www.wordpress.org" title="WordPress" target="_blank">WordPress</a>')
printf(__('Copyright %s %s %s &middot; Powered by %s <br/>','lightword'),'&copy;',date('Y'),$blog_name,'<a href="http://www.wordpress.org/" title="WordPress" target="_blank">WordPress</a>')
;?>
<?php _e('<a href="http://www.lightworddesign.net/" target="_blank" title="Lightword Theme">Lightword Theme</a> by Andrei Luca','lightword')
;?>
Expand Down
188 changes: 94 additions & 94 deletions functions.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions header.php
Expand Up @@ -22,10 +22,10 @@

<div id="top_bar">
<div class="center_menu">
<ul id="front_menu" <?php global $lw_remove_searchbox, $lw_use_dumb_menu; $lw_menu_width = ""; if($lw_remove_searchbox == "true") $lw_menu_width = " class=\"expand\" "; echo $lw_menu_width; ?>>
<ul id="front_menu" <?php global $lw_remove_searchbox, $lw_use_dumb_menu; $lw_menu_width = ''; if($lw_remove_searchbox == 'true') $lw_menu_width = ' class="expand" '; echo $lw_menu_width; ?>>
<?php echo lightword_homebtn(__('Home','lightword')); ?>
<?php
if ( function_exists('wp_nav_menu') && $lw_use_dumb_menu != "true") {
if ( function_exists('wp_nav_menu') && $lw_use_dumb_menu != 'true') {
$lightword_menu = wp_nav_menu( array( 'menu' => 'lightword_top_menu', 'echo' => false, 'menu_id' => 'front_menu', 'container' => '', 'theme_location' => 'lightword_top_menu', 'link_before' => '<span>', 'link_after' => '</span>' ) );
$lightword_menu = preg_replace( array( '/^<ul id="front_menu" class="menu">/', '/\n<\/ul>$/' ), '', $lightword_menu);
echo $lightword_menu;
Expand Down
10 changes: 5 additions & 5 deletions index.php
Expand Up @@ -4,11 +4,11 @@

<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<div <?php if (function_exists('post_class')) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<?php lightword_show_sidebox(); ?>
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php lightword_simple_date(); ?>
<?php if ($lw_post_author == "Main page" || $lw_post_author == "Both") : ?>
<?php if ($lw_post_author == 'Main page' || $lw_post_author == 'Both') : ?>
<div class="about_author">
<h4><?php _e('Posted by','lightword'); ?> <a href="<?php the_author_meta('url'); ?>"><?php the_author(); ?></a></h4>
</div>
Expand All @@ -19,8 +19,8 @@
<?php wp_link_pages('before=<div class="nav_link">'.__('PAGES','lightword').': &after=</div>&next_or_number=number&pagelink=<span class="page_number">%</span>'); ?>

<div class="cat_tags clear">
<span class="category"><?php if($lw_disable_tags == "true" || !get_the_tags()) { _e('Filed under:','lightword'); echo " "; the_category(', ');} else if (get_the_tags() && $lw_disable_tags == "false") { _e('Tagged as:','lightword'); echo " "; the_tags(''); } ?></span>
<span class="continue"><?php $pos = strpos($post->post_content, '<!--more-->'); if($pos==''){ ?><a class="nr_comm_spot" href="<?php the_permalink(); ?>#comments"><?php if(lightword_fb_get_comment_type_count('comment')==1) _e('1 Comment','lightword'); elseif('open' != $post->comment_status) _e('Comments Off','lightword'); elseif(lightword_fb_get_comment_type_count('comment') == 0) _e('No Comments','lightword'); else echo lightword_fb_get_comment_type_count('comment')." ".__('Comments','lightword'); ?></a><?php }else{ ?><a title="<?php _e('Read more about','lightword'); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>#more-<?php echo $id; ?>"><?php _e('Continue reading','lightword'); ?></a><?php } ?></span><div class="clear"></div>
<span class="category"><?php if($lw_disable_tags == 'true' || !get_the_tags()) { _e('Filed under:','lightword'); echo ' '; the_category(', ');} else if (get_the_tags() && $lw_disable_tags == 'false') { _e('Tagged as:','lightword'); echo ' '; the_tags(''); } ?></span>
<span class="continue"><?php $pos = strpos($post->post_content, '<!--more-->'); if($pos==''){ ?><a class="nr_comm_spot" href="<?php the_permalink(); ?>#comments"><?php if(lightword_fb_get_comment_type_count('comment')==1) _e('1 Comment','lightword'); elseif('open' != $post->comment_status) _e('Comments Off','lightword'); elseif(lightword_fb_get_comment_type_count('comment') == 0) _e('No Comments','lightword'); else echo lightword_fb_get_comment_type_count('comment').' '.__('Comments','lightword'); ?></a><?php }else{ ?><a title="<?php _e('Read more about','lightword'); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>#more-<?php echo $id; ?>"><?php _e('Continue reading','lightword'); ?></a><?php } ?></span><div class="clear"></div>
</div>
<div class="cat_tags_close"></div>
</div>
Expand All @@ -30,7 +30,7 @@
<?php endwhile; else: ?>

<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<p><?php _e('Sorry, but you are looking for something that isn\'t here.','lightword'); ?></p>

<?php endif; ?>

Expand Down
6 changes: 3 additions & 3 deletions page.php
Expand Up @@ -2,7 +2,7 @@
<div id="content-body">
<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<div <?php if (function_exists('post_class')) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php edit_post_link(__('Edit this page','lightword'), '', ''); ?>

Expand All @@ -11,11 +11,11 @@
<?php wp_link_pages('before=<div class="nav_link">'.__('PAGES','lightword').': &after=</div>&next_or_number=number&pagelink=<span class="page_number">%</span>'); ?>

</div>
<?php if ( comments_open() && $lw_disable_comments == "false" ) : comments_template(); endif; ?>
<?php if ( comments_open() && $lw_disable_comments == 'false' ) : comments_template(); endif; ?>
<?php endwhile; else: ?>

<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<p><?php _e('Sorry, but you are looking for something that isn\'t here.','lightword'); ?></p>

<?php endif; ?>
</div>
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Expand Up @@ -103,5 +103,8 @@ CHANGELOG | V2.0.0.6
| Added an option to disable WP3 menus
| Search form should no longer be placed too high when RSS badge is enabled (not removed)

CHANGELOG | V2.0.0.7
| No more invalid HTML with "Show only in posts" sidebox option and comments closed

Best regards,
Andrei Luca
2 changes: 1 addition & 1 deletion sidebar-child.php
Expand Up @@ -3,7 +3,7 @@

/* Widgetized sidebar, if you have the plugin installed. */

if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar Child") ) : ?>
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Child') ) : ?>


<h3><?php _e('Pages','lightword'); ?></h3>
Expand Down
2 changes: 1 addition & 1 deletion sidebar.php
Expand Up @@ -4,7 +4,7 @@

/* Widgetized sidebar, if you have the plugin installed. */

if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar") ) : ?>
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) : ?>


<h3><?php _e('Pages','lightword'); ?></h3>
Expand Down
12 changes: 6 additions & 6 deletions single-page-template.php
Expand Up @@ -15,7 +15,7 @@
<title><?php wp_title('&laquo;', true, 'right'); ?><?php bloginfo('name'); ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
<?php global $lw_layout_settings; if($lw_layout_settings == "Wider") : ?>
<?php global $lw_layout_settings; if($lw_layout_settings == 'Wider') : ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/wider.css" type="text/css" />
<?php else: ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/original.css" type="text/css" />
Expand All @@ -34,8 +34,8 @@
<?php lightword_header_image(); ?>
<div id="header">
<?php lightword_rss_feed(); ?>
<?php global $lw_remove_rss; if($lw_remove_rss == "true") { ?>
<?php echo "<style type=\"text/css\">/*<![CDATA[*/ #header{background:transparent url(".get_template_directory_uri()."/images/single-page-template/content_top_no_rss.png) no-repeat; } #content-body,x:-moz-any-link{float:left;margin-right:28px;}#content-body, x:-moz-any-link, x:default{float:none;margin-right:25px;}/*]]>*/</style>"; } ?>
<?php global $lw_remove_rss; if($lw_remove_rss == 'true') {
echo '<style type="text/css">/*<![CDATA[*/ #header{background:transparent url('.get_template_directory_uri().'/images/single-page-template/content_top_no_rss.png) no-repeat; } #content-body,x:-moz-any-link{float:left;margin-right:28px;}#content-body, x:-moz-any-link, x:default{float:none;margin-right:25px;}/*]]>*/</style>'; } ?>

<div id="top_bar">
<div class="center_menu">
Expand All @@ -61,7 +61,7 @@
<div id="content-body">
<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<div <?php if (function_exists('post_class')) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php edit_post_link(__('Edit this page','lightword'), '', ''); ?>

Expand All @@ -70,11 +70,11 @@
<?php wp_link_pages('before=<div class="nav_link">'.__('PAGES','lightword').': &after=</div>&next_or_number=number&pagelink=<span class="page_number">%</span>'); ?>

</div>
<?php if ( comments_open() && $lw_disable_comments == "false" ) : comments_template(); endif; ?>
<?php if ( comments_open() && $lw_disable_comments == 'false' ) : comments_template(); endif; ?>
<?php endwhile; else: ?>

<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<p><?php _e('Sorry, but you are looking for something that isn\'t here.','lightword'); ?></p>

<?php endif; ?>
</div>
Expand Down
10 changes: 5 additions & 5 deletions single.php
Expand Up @@ -2,7 +2,7 @@
<div id="content-body">
<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<div <?php if (function_exists('post_class')) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
<?php lightword_show_sidebox(); ?>
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php edit_post_link(__('Edit this post','lightword'), '<span class="edit_content">', '</span>'); ?>
Expand All @@ -13,21 +13,21 @@
<?php if(function_exists('wp_print')) { print_link(); } ?>
<?php wp_link_pages('before=<div class="nav_link">'.__('PAGES','lightword').': &after=</div>&next_or_number=number&pagelink=<span class="page_number">%</span>'); ?>

<?php if ($lw_enjoy_post == "true" && is_attachment() != TRUE) : ?>
<?php if ($lw_enjoy_post == 'true' && is_attachment() != TRUE) : ?>
<div class="promote clear">
<h3><?php _e('Enjoy this article?','lightword'); ?></h3>
<p><a href="<?php bloginfo('rss2_url'); ?>"><?php _e('Consider subscribing to our rss feed!','lightword'); ?></a></p>
</div>
<?php endif; ?>

<?php if ($lw_post_author == "Single page" || $lw_post_author == "Both" && is_attachment() != TRUE) : ?>
<?php if ($lw_post_author == 'Single page' || $lw_post_author == 'Both' && is_attachment() != TRUE) : ?>
<div class="about_author">
<h4><?php _e('Posted by','lightword'); ?> <a href="<?php the_author_meta('url'); ?> "><?php the_author(); ?></a></h4>
</div>
<?php endif; ?>

<div class="cat_tags clear">
<span class="category"><?php if($lw_disable_tags == "true" || !get_the_tags()) { _e('Filed under:','lightword'); echo " "; the_category(', ');} else if (get_the_tags() && $lw_disable_tags == "false") { _e('Tagged as:','lightword'); echo " "; the_tags(''); } ?></span>
<span class="category"><?php if($lw_disable_tags == 'true' || !get_the_tags()) { _e('Filed under:','lightword'); echo ' '; the_category(', ');} else if (get_the_tags() && $lw_disable_tags == 'false') { _e('Tagged as:','lightword'); echo ' '; the_tags(''); } ?></span>
<span class="continue"><a class="nr_comm_spot" href="<?php the_permalink(); ?>#respond"><?php if('open' != $post->comment_status) _e('Comments Off','lightword'); else _e('Leave a comment','lightword'); ?></a></span><div class="clear"></div>
</div>
<div class="cat_tags_close"></div>
Expand All @@ -46,7 +46,7 @@
<?php endwhile; else: ?>

<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<p><?php _e('Sorry, but you are looking for something that isn\'t here.','lightword'); ?></p>

<?php endif; ?>
</div>
Expand Down

0 comments on commit 29182a7

Please sign in to comment.