Skip to content
Permalink
Browse files

Reduce WP Coding Standards Messages Part 4

no changes in functions, fixed transalatable strings
  • Loading branch information...
kniebremser committed Jun 11, 2019
1 parent fb839af commit 20ea108725068a7ceca51426a6246fc083e2970d
@@ -61,14 +61,17 @@
$title_string = __( 'Archive is unable to be found.', 'comicpress' );
}
} else $title_string = __( 'No Archive Found.', 'comicpress' );
if ( have_posts() ) { ?>
if ( have_posts() ) {
?>
<h2 class="page-title"><?php echo $title_string; ?></h2>
<?php if ( isset( $wp_query->query_vars['chapters'] ) || ( $wp_query->query_vars['post_type'] == 'comic' ) ) { ?>
<?php
if ( isset( $wp_query->query_vars['chapters'] ) || ( $wp_query->query_vars['post_type'] == 'comic' ) ) {
?>
<div class="archiveresults">
<?php
printf(
/* translators: Number of found comic */
_n( '%d comic.', '%d comics.', $count, 'comicpress' ),
_n( '%d comic', '%d comics', 'comicpress' ),
$count
);
?>
@@ -80,17 +83,17 @@
<?php
printf(
/* translators: Number of found results */
_n( '%d result.', '%d results.', $count, 'comicpress' ),
_n( '%d result', '%d results', 'comicpress' ),
$count
);
?>
</div>
<?php } ?>
<?php
}
?>
<div class="clear"></div>
<?php
if ( function_exists( 'ceo_pluginfo' ) && ( isset( $wp_query->query_vars['chapters'] ) || isset( $wp_query->query_vars['characters'] ) || isset( $wp_query->query_vars['locations'] ) || ( $wp_query->query_vars['post_type'] == 'comic' ) ) && ( comicpress_themeinfo( 'display_archive_as_links' ) && ! comicpress_is_bbpress() ) ) {
?>
<?php
while ( have_posts() ) :
the_post();
?>
@@ -101,12 +104,14 @@
<div class="archivecomicframe">
<?php
$thumbnail = ceo_display_comic_thumbnail( 'thumbnail', $post );
$thumbnail = ( ! $thumbnail ) ? __( 'No Thumbnail or Featured Image Found', 'comicpress' ) : $thumbnail; ?>
$thumbnail = ( ! $thumbnail ) ? __( 'No Thumbnail or Featured Image Found.', 'comicpress' ) : $thumbnail;
?>
<a href="<?php the_permalink(); ?>" title="<?php echo the_title(); ?>"><?php echo $thumbnail; ?></a><br />
</div>
</div>
<?php endwhile; ?>
<?php } elseif ( comicpress_themeinfo( 'display_archive_as_links' ) || comicpress_is_bbpress() ) { ?>
<?php
endwhile;
} elseif ( comicpress_themeinfo( 'display_archive_as_links' ) || comicpress_is_bbpress() ) { ?>
<div <?php post_class(); ?>>
<div class="post-head"></div>
<div class="entry">
@@ -124,35 +129,40 @@
<a href="<?php echo get_permalink( $post->ID ); ?>" rel="bookmark" title="<?php _e( 'Permanent Link:', 'comicpress' ); ?> <?php the_title(); ?>"><?php the_title(); ?></a>
</td>
</tr>
<?php endwhile; ?>
<?php
endwhile;
?>
</table>
</div>
<div class="post-foot"></div>
</div>
<?php } else {
<?php
} else {
while (have_posts() ) : the_post();
$post_format = ( $post->post_type !== 'post' ) ? $post->post_type : get_post_format();
get_template_part( 'content', $post_format );
endwhile;
}
?>
<div class="clear"></div>
<?php comicpress_pagination(); ?>

<?php } else { ?>
<?php
comicpress_pagination();
} else {
?>
<h2 class="page-title">
<?php echo $title_string; ?>
</h2>
<div class="archiveresults">
<?php
printf(
/* translators: Number of found results */
_n( '%d result.', '%d results.', $count, 'comicpress' ),
_n( '%d result', '%d results', 'comicpress' ),
$count
);
?>
</div>
<div class="clear"></div>
<?php } ?>

<?php get_footer(); ?>
<?php
}
get_footer();
?>
@@ -1,29 +1,29 @@
<?php
if (!function_exists('comicpress_random_default_avatar')) {
function comicpress_random_default_avatar($id_or_email = '') {
$current_avatar_directory = comicpress_themeinfo('avatar_directory');
if ( ! function_exists( 'comicpress_random_default_avatar') ) {
function comicpress_random_default_avatar( $id_or_email = '' ) {
$current_avatar_directory = comicpress_themeinfo( 'avatar_directory' );
if (!empty($current_avatar_directory) && ($current_avatar_directory !== 'none')) {
if (is_dir(get_stylesheet_directory() . '/images/avatars/' . $current_avatar_directory)) {
$count = count($results = glob(get_stylesheet_directory() . '/images/avatars/'.$current_avatar_directory.'/*'));
if ( ! empty( $current_avatar_directory ) && ( $current_avatar_directory !== 'none' ) ) {
if ( is_dir( get_stylesheet_directory() . '/images/avatars/' . $current_avatar_directory) ) {
$count = count( $results = glob( get_stylesheet_directory() . '/images/avatars/' . $current_avatar_directory . '/*') );
$blogurl = get_stylesheet_directory_uri();
} else {
$count = count($results = glob(get_template_directory() . '/images/avatars/'.$current_avatar_directory.'/*'));
$count = count( $results = glob( get_template_directory() . '/images/avatars/' . $current_avatar_directory . '/*') );
$blogurl = get_template_directory_uri();
}
if ($count) {
if ( $count ) {
$default = '';
$checknum = hexdec(substr(md5($id_or_email),0,5)) % $count;
if ($count > 0) {
$default = basename($results[(int)$checknum]);
$checknum = hexdec( substr( md5( $id_or_email ), 0, 5 ) ) % $count;
if ( $count > 0 ) {
$default = basename( $results[ (int) $checknum] );
} else {
return false;
}
return $blogurl.'/images/avatars/'.$current_avatar_directory.'/'.$default;
return $blogurl . '/images/avatars/' . $current_avatar_directory . '/' . $default;
}
}
return get_option('avatar_default');
return get_option( 'avatar_default' );
}
}
@@ -5,38 +5,39 @@
* Author URI: http://frumph.net/
* Version: 1.0.8
*
* @package Comicpress
*/
add_filter('body_class','comicpress_body_class');
add_filter( 'body_class', 'comicpress_body_class' );
function comicpress_body_class($classes = array()) {
function comicpress_body_class( $classes = array() ) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $post, $wp_query, $comicpress_is_signup;
if (is_user_logged_in()) {
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$user_login = $current_user->user_login;
if (!empty($user_login)) $classes[] = 'user-'.strtolower($user_login);
$user_login = $current_user->user_login;
if ( ! empty( $user_login ) ) $classes[] = 'user-' . strtolower( $user_login );
} else {
$classes[] = 'user-guest';
}
if (comicpress_is_signup()) $classes[] = 'signup';
if ( comicpress_is_signup() ) $classes[] = 'signup';
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) $classes[] = 'ie';
else $classes[] = 'unknown';
if($is_iphone) $classes[] = 'iphone';
if (wp_is_mobile()) $classes[] = 'is-mobile';
if ( $is_lynx ) $classes[] = 'lynx';
elseif ( $is_gecko ) $classes[] = 'gecko';
elseif ( $is_opera ) $classes[] = 'opera';
elseif ( $is_NS4 ) $classes[] = 'ns4';
elseif ( $is_safari ) $classes[] = 'safari';
elseif ( $is_chrome ) $classes[] = 'chrome';
elseif ( $is_IE ) $classes[] = 'ie';
else $classes[] = 'unknown';
if ( $is_iphone ) $classes[] = 'iphone';
if ( wp_is_mobile() ) $classes[] = 'is-mobile';
// Hijacked from the hybrid theme, http://themehybrid.com/
if (is_single()) {
foreach ( (array)get_the_category( $wp_query->post->ID ) as $cat ) :
// Hijacked from the hybrid theme, http://themehybrid.com/ .
if ( is_single() ) {
foreach ( (array) get_the_category( $wp_query->post->ID ) as $cat ) :
$classes[] = 'single-category-' . sanitize_html_class( $cat->slug, $cat->term_id );
endforeach;
$classes[] = 'single-author-' . get_the_author_meta( 'user_nicename', $wp_query->post->post_author );
@@ -51,21 +52,21 @@ function comicpress_body_class($classes = array()) {
$classes[] = 'sticky-post';
}
// NOT hijacked from anything, doi! people should do this.
$timestamp = current_time('timestamp');
$rightnow = (int)date('Gi',$timestamp);
$ampm = date('a', $timestamp);
// NOT hijacked from anything, doi! people should do this.
$timestamp = current_time( 'timestamp' );
$rightnow = (int) date( 'Gi',$timestamp );
$ampm = date( 'a', $timestamp );
$classes[] = $ampm;
// $classes[] = 'time-'.$rightnow;
if ($rightnow > 559 && (int)$rightnow < 1800) $classes[] = 'day';
if ($rightnow < 600 || (int)$rightnow > 1759) $classes[] = 'night';
// $classes[] = 'time-'.$rightnow;
if ( $rightnow > 559 && (int) $rightnow < 1800 ) $classes[] = 'day';
if ( $rightnow < 600 || (int )$rightnow > 1759 ) $classes[] = 'night';
if ($rightnow > 2329 || $rightnow < 30) $classes[] = 'midnight';
if ($rightnow > 459 && $rightnow < 1130) $classes[] = 'morning';
if ($rightnow > 1129 && $rightnow < 1230) $classes[] = 'noon';
if ($rightnow > 1759 && $rightnow < 2330) $classes[] = 'evening';
if ( $rightnow > 2329 || $rightnow < 30 ) $classes[] = 'midnight';
if ( $rightnow > 459 && $rightnow < 1130 ) $classes[] = 'morning';
if ( $rightnow > 1129 && $rightnow < 1230 ) $classes[] = 'noon';
if ( $rightnow > 1759 && $rightnow < 2330 ) $classes[] = 'evening';
$classes[] = strtolower(date('D', $timestamp));
$classes[] = strtolower( date( 'D', $timestamp ) );
if ( is_attachment() ) {
$classes[] = 'attachment attachment-' . $wp_query->post->ID;
@@ -75,23 +76,26 @@ function comicpress_body_class($classes = array()) {
endforeach;
}
if (comicpress_sidebars_disabled()) $classes[] = 'wide';
if ( comicpress_sidebars_disabled() ) $classes[] = 'wide';
$layout = get_theme_mod('comicpress-customize-select-layout', '3c');
if (empty($layout)) $layout = '3c';
$classes[] = 'layout-'.$layout;
$layout = get_theme_mod( 'comicpress-customize-select-layout', '3c' );
if ( empty( $layout ) ) $layout = '3c';
$classes[] = 'layout-' . $layout;
return $classes;
}
add_filter('post_class','comicpress_post_class');
add_filter( 'post_class', 'comicpress_post_class' );
function comicpress_post_class($classes = '') {
function comicpress_post_class( $classes = '' ) {
global $post;
static $post_alt;
$args = array(
'entry_tax' => array( 'category', 'post_tag' )
'entry_tax' => array(
'category',
'post_tag',
)
);
/* Microformats. */
@@ -102,22 +106,21 @@ function comicpress_post_class($classes = '') {
if ( $post_alt % 2 )
$classes[] = 'odd';
else
$classes[] = 'even';
else $classes[] = 'even';
/* Sticky class (only on home/blog page). */
if( is_sticky() && is_home() )
$classes[] = 'sticky';
/* Author class. */
if ( !is_attachment() )
if ( ! is_attachment() )
$classes[] = 'post-author-' . sanitize_html_class( get_the_author_meta( 'user_nicename' ), get_the_author_meta( 'ID' ) );
/* User-created classes. */
if ( !empty( $class ) ) :
if ( !is_array( $class ) )
if ( ! empty( $class ) ) :
if ( ! is_array( $class ) )
$class = preg_split( '#\s+#', $class );
$classes = array_merge( $classes, $class );
$classes = array_merge( $classes, $class );
endif;
/* Password-protected posts. */
@@ -127,22 +130,20 @@ function comicpress_post_class($classes = '') {
return $classes;
}
add_filter('comment_class','comicpress_comment_class');
add_filter( 'comment_class', 'comicpress_comment_class' );
function comicpress_comment_class($classes = '') {
function comicpress_comment_class( $classes = '' ) {
global $current_user;
/*
* http://microid.org
*/
/* http://microid.org */
$email = get_comment_author_email();
$url = get_comment_author_url();
if(!empty($email) && !empty($url)) {
$microid = 'microid-mailto+http:sha1:' . sha1(sha1('mailto:'.$email).sha1($url));
if ( ! empty( $email ) && ! empty( $url ) ) {
$microid = 'microid-mailto+http:sha1:' . sha1( sha1( 'mailto:' . $email) . sha1( $url ) );
$classes[] = $microid;
}
if ($current_user->user_email == $email) $classes[] = 'ucomment';
if ( $current_user->user_email == $email ) $classes[] = 'ucomment';
return $classes;
}
?>
?>

0 comments on commit 20ea108

Please sign in to comment.
You can’t perform that action at this time.