make missed texte translatable

- reduce WPCS messages
- make code better readeble
This commit is contained in:
Kniebremser
2019-07-06 14:41:55 +02:00
parent 9a68236a15
commit 83a0bda3f1
15 changed files with 249 additions and 108 deletions

View File

@@ -15,7 +15,9 @@
?>
<div class="sticky-image">
Featured Post
<?php _e( 'Featured Post', 'comicpress' ); ?>
</div>
<?php

View File

@@ -30,7 +30,9 @@ if ( ! is_home() && ! is_archive() && ! is_search() ) {
?>
<div class="sticky-image">
Featured Post
<?php _e( 'Featured Post', 'comicpress' ); ?>
</div>
<?php

View File

@@ -138,7 +138,7 @@ if ( get_theme_mod( 'comicpress-customize-detach-footer', false ) ) {
?>
queries.
<?php
if ( function_exists( 'memory_get_usage') ) {
if ( function_exists( 'memory_get_usage' ) ) {
$unit = array(
'b',
'kb',

View File

@@ -36,6 +36,7 @@ foreach ( glob( get_template_directory() . '/widgets/*.php' ) as $widgefile ) {
}
function comicpress_setup() {
load_theme_textdomain( 'comicpress', get_template_directory() . '/lang' );
// add_editor_style();
add_theme_support( 'automatic-feed-links' );
@@ -61,6 +62,7 @@ function comicpress_setup() {
}
function comicpress_enqueue_theme_scripts() {
global $is_IE, $wp_styles;
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) && ! comicpress_themeinfo( 'disable_comment_javascript' ) ) wp_enqueue_script( 'comment-reply' );
if ( ! is_admin() ) {
@@ -80,16 +82,18 @@ function comicpress_enqueue_theme_scripts() {
}
function comicpress_init() {
add_action( 'pre_get_posts', 'comicpress_pre_parser', 1, 1 );
}
function comicpress_pre_parser( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
// $query->set('category__in', '8');
$query->set( 'posts_per_page', comicpress_themeinfo( 'home_post_count' ) );
}
if ( ( $query->is_archive() || $query->is_search() || is_post_type_archive() ) && ! $query->is_feed() && $query->is_main_query() ) {
$archive_display_order = comicpress_themeinfo( 'archive_display_order' );
$archive_display_order = comicpress_themeinfo( 'archive_display_order' );
if ( empty( $archive_display_order ) ) $archive_display_order = 'desc';
$query->set( 'order', $archive_display_order );
}
@@ -99,7 +103,9 @@ function comicpress_pre_parser( $query ) {
}
if ( ! function_exists( 'comicpress_register_sidebars' ) ) {
function comicpress_register_sidebars() {
$widgets_list = array(
array(
'id' => 'left-sidebar',
@@ -168,26 +174,33 @@ if ( ! function_exists( 'comicpress_register_sidebars' ) ) {
'after_widget' => "</div>\r\n<div class=\"clear\"></div>\r\n</div>\r\n",
'before_title' => "<h2 class=\"widget-title\">",
'after_title' => "</h2>\r\n",
)
);
) );
}
}
}
function comicpress_get_sidebar( $location = '' ) {
if ( empty( $location ) ) return;
if ( file_exists( get_template_directory() . '/sidebar-' . $location . '.php' ) || file_exists( get_stylesheet_directory() . '/sidebar-' . $location . '.php' ) ) {
get_sidebar( $location );
} elseif ( is_active_sidebar( 'sidebar-' . $location ) ) { ?>
} elseif ( is_active_sidebar( 'sidebar-' . $location ) ) {
?>
<div id="sidebar-<?php echo $location; ?>" class="sidebar">
<?php dynamic_sidebar( 'sidebar-' . $location ); ?>
<div class="clear"></div>
</div>
<?php
}
}
function comicpress_is_signup() {
global $wp_query;
if ( strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php' ) || strpos( $_SERVER['SCRIPT_NAME'], 'wp-activate.php' ) ) return true;
return false;
@@ -195,34 +208,57 @@ function comicpress_is_signup() {
function comicpress_debug_page_foot_code() {
?>
<p>
<?php
echo get_num_queries();
?>
queries.
<?php
if ( function_exists( 'memory_get_usage' ) ) {
$unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' );
echo @round( memory_get_usage( true ) / pow( 1024, ( $i = floor( log( memory_get_usage( true ), 1024 ) ) ) ), 2) . ' ' . $unit[$i]; ?> Memory usage . <?php } timer_stop (1) ?> seconds . </p>
<?php
echo get_num_queries();
?>
queries.
<?php
if ( function_exists( 'memory_get_usage' ) ) {
$unit = array(
'b',
'kb',
'mb',
'gb',
'tb',
'pb',
);
echo @round( memory_get_usage( true ) / pow( 1024, ( $i = floor( log( memory_get_usage( true ), 1024 ) ) ) ), 2 ) . ' ' . $unit[$i];
?>
Memory usage.
<?php
}
timer_stop( 1 )
?>
seconds.
</p>
<?php
}
function comicpress_excerpt_length( $length ) {
return comicpress_themeinfo( 'excerpt_length' );
}
if ( ! function_exists( 'comicpress_auto_excerpt_more' ) ) {
function comicpress_auto_excerpt_more( $more ) {
return __( '[&hellip;]', 'comicpress' ) . '<a class="more-link" href="' . get_permalink() . '">' . __( '&darr; Read the rest of this entry...', 'comicpress' ) . '</a>';
}
}
function comicpress_close_up_shop() {
@mysql_close();
}
if ( ! function_exists( 'comicpress_is_layout ' ) ) {
function comicpress_is_layout( $choices ) {
$choices = explode( ",", $choices );
if ( in_array( get_theme_mod( 'comicpress-customize-select-layout', '3c' ), $choices ) ) return true;
return false;
@@ -230,6 +266,7 @@ if ( ! function_exists( 'comicpress_is_layout ' ) ) {
}
function comicpress_is_bbpress() {
if ( function_exists( 'bbp_is_single_forum' ) &&
( bbp_is_forum()
|| bbp_is_forum_archive()
@@ -257,6 +294,7 @@ function comicpress_is_bbpress() {
}
function comicpress_sidebars_disabled() {
global $wp_query, $post;
if ( ! empty( $post ) && ( is_single() || is_page() ) && ! is_404() ) {
$sidebars_disabled = get_post_meta( $post->ID, 'disable-sidebars', true );
@@ -273,7 +311,9 @@ if ( ! isset( $content_width ) ) {
}
if ( ! function_exists( 'comicpress_display_social_icons' ) ) {
function comicpress_display_social_icons() {
$twitter = comicpress_themeinfo( 'menubar_social_twitter' );
$facebook = comicpress_themeinfo( 'menubar_social_facebook' );
$linkedin = comicpress_themeinfo( 'menubar_social_linkedin' );
@@ -309,11 +349,14 @@ if ( ! function_exists( 'comicpress_display_social_icons' ) ) {
* @return string returns the rawurlencoded filename with the %2F put back to /
*/
function comicpress_clean_filename( $filename ) {
return str_replace( "%2F", "/", rawurlencode( $filename ) );
}
function comicpress_infinite_scroll_loop() {
while ( have_posts() ) : the_post();
while ( have_posts() ) :
the_post();
comicpress_display_post();
endwhile;
}
@@ -401,6 +444,7 @@ function comicpress_load_options() {
}
function comicpress_themeinfo( $whichinfo = null ) {
global $comicpress_themeinfo;
if ( empty( $comicpress_themeinfo ) || $whichinfo == 'reset' ) {
$comicpress_themeinfo = array();
@@ -419,9 +463,9 @@ function comicpress_themeinfo( $whichinfo = null ) {
return $comicpress_themeinfo;
}
// Dashboard Menu Options - Only run in the wp-admin area
if (is_admin()) {
@require_once(get_template_directory().'/options.php');
// Dashboard Menu Options - Only run in the wp-admin area.
if ( is_admin() ) {
@require_once( get_template_directory() . '/options.php' );
/* translators: theme discription for wp-admin */
$bogus_translation = __( 'Publish a WebComic with the ComicPress theme and the Comic Easel plugin.', 'comicpress' );
}
@@ -430,6 +474,7 @@ if (is_admin()) {
* Enqueue WordPress theme styles within Gutenberg.
*/
function comicpress_gutenberg_styles() {
// Load the theme styles within Gutenberg.
wp_enqueue_style( 'comicpress-gutenberg', get_theme_file_uri( '/gutenberg.css' ), false, '@@pkg.version', 'all' );
}

View File

@@ -8,10 +8,10 @@ if ( ! function_exists( 'comicpress_random_default_avatar') ) {
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 . '/*') );
$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 ) {

View File

@@ -150,7 +150,7 @@ function comicpress_comments_callback( $comment, $args, $depth ) {
</span>
<?php
if ( (get_option( 'thread_comments' ) ) && ($args['type'] == 'all' || get_comment_type() == 'comment' ) ) :
if ( ( get_option( 'thread_comments' ) ) && ( $args['type'] == 'all' || get_comment_type() == 'comment' ) ) :
$max_depth = get_option( 'thread_comments_depth' );
echo comment_reply_link( array(
'reply_text' => __( 'Reply', 'comicpress' ),
@@ -163,9 +163,9 @@ function comicpress_comments_callback( $comment, $args, $depth ) {
);
endif;
edit_comment_link( '<span class="comment-edit">' . __( 'Edit', 'comicpress' ) . '</span>',' <span class="separator">|</span> ','' );
edit_comment_link( '<span class="comment-edit">' . __( 'Edit', 'comicpress' ) . '</span>', ' <span class="separator">|</span> ', '' );
if ( $comment->comment_approved == '0' ) :
if ( $comment->comment_approved == '0' ) :
?>
<div class="comment-moderated">

View File

@@ -289,7 +289,9 @@ if ( ! function_exists( 'comicpress_display_post' ) ) {
?>
<div class="sticky-image">
Featured Post
<?php _e( 'Featured Post', 'comicpress' ); ?>
</div>
<?php

View File

@@ -15,7 +15,7 @@ function comicpress_page_editor_options( $post ) {
<tr>
<td valign="top">
<input id="comicpress_sidebar_remove" name="comicpress_sidebar_remove" type="checkbox" value="1"<?php echo $disable_sidebars ? ' checked="checked"' : ''; ?> />
Disable Sidebars
<?php _e( 'Disable Sidebars', 'comicpress' ); ?>
</td>
</tr>
</table>

View File

@@ -4,73 +4,135 @@ if ( have_posts() ) :
while ( have_posts() ) :
the_post()
?>
<div <?php post_class(); ?>>
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-head"></div>
<div class="post-content">
<div class="imagenav-wrap">
<div class="imagenav-left">
<div class="imagenav-bg">
<?php previous_image_link(); ?>
</div>
<div class="imagenav-arrow">
&lsaquo;
<?php _e( '&lsaquo;', 'comicpress' ); ?>
</div>
<div class="imagenav-link">
<?php previous_image_link(); ?>
</div>
</div>
<div class="imagenav-center">
<a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" target="_blank" title="Click for full size." class="imagetitle"><?php the_title(); ?></a><br />
<a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="attachment"><?php _e( '&larr; Back to Gallery', 'comicpress' ); ?></a>
<a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" target="_blank" title="<?php _e( 'Click for full size', 'comicpress' ); ?>" class="imagetitle">
<?php the_title(); ?>
</a>
<br />
<a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="attachment">
<?php _e( '&larr; Back to Gallery', 'comicpress' ); ?>
</a>
</div>
<div class="imagenav-right">
<div class="imagenav-bg">
<?php next_image_link(); ?>
</div>
<div class="imagenav-arrow">
&rsaquo;
<?php _e( '&rsaquo;', 'comicpress' ); ?>
</div>
<div class="imagenav-link">
<?php next_image_link(); ?>
</div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="gallery-image">
<a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" target="_blank" title="<?php _e( 'Click for full size.', 'comicpress' ); ?>" ><img src="<?php echo wp_get_attachment_url( $post->ID ); ?>" alt="<?php the_title(); ?>" /></a>
<a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" target="_blank" title="<?php _e( 'Click for full size', 'comicpress' ); ?>" >
<img src="<?php echo wp_get_attachment_url( $post->ID ); ?>" alt="<?php the_title(); ?>" />
</a>
</div>
<div class="gallery-caption">
<?php the_excerpt(); ?>
</div>
<div class="gallery-content">
<?php the_content(); ?>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="post-foot"></div>
</div>
<?php
edit_post_link(
__( 'Edit this attachment.', 'comicpress' ), '', '');
edit_post_link( __( 'Edit this attachment.', 'comicpress' ), '', '' );
if ( 'open' == $post->comment_status ) {
comments_template( '', true );
}
endwhile;
else :
?>
<div <?php post_class(); ?>>
<div class="post-head"></div>
<div class="post-content">
<p>
<?php _e( 'Sorry, no image matched your criteria.', 'comicpress' ); ?>
</p>
<div class="clear"></div>
</div>
<div class="post-foot"></div>
</div>
<?php
endif;
get_footer()

View File

@@ -295,7 +295,9 @@ function comicpress_admin_options() {
<div id="comicpress-options-pages">
<?php
foreach ( glob( get_template_directory() . '/options/*.php' ) as $file ) { include( $file ); }
foreach ( glob( get_template_directory() . '/options/*.php' ) as $file ) {
include( $file );
}
?>
</div>
@@ -330,70 +332,71 @@ function comicpress_admin_options() {
<div class="eadmin-footer">
<div id="comicpress-version-title">
<div id="comicpress-version-title">
<a href="http://frumph.net/">
ComicPress
<?php
echo comicpress_themeinfo( 'version' );
?>
</a>
</div>
<br />
<?php
_e( 'Developed and maintained by', 'comicpress' );
?>
<a href="http://frumph.net/" target="_blank" rel="noopener noreferrer">
Philip M. Hofer
<a href="http://frumph.net/">
ComicPress
<?php
echo comicpress_themeinfo( 'version' );
?>
</a>
<small>
(<a href="http://frumph.net/" target="_blank" rel="noopener noreferrer">Frumph</a>)
</small>
,
<?php
_e( 'Originally created by', 'comicpress' );
?>
<a href="http://mindfaucet.com/" target="_blank" rel="noopener noreferrer">
Tyler Martin
</a>
<br />
<?php
_e( 'If you like the ComicPress theme, please donate. It will help in developing new features and versions.', 'comicpress' );
?>
<table style="margin:0 auto;">
<tr>
<td style="width:200px;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="46RNWXBE7467Q" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
</td>
<td style="width:200px;">
<form method="post" id="myForm" name="template" enctype="multipart/form-data" action="">
<?php wp_nonce_field( 'update-options' ); ?>
<input name="comicpress_reset" type="submit" class="button" value="<?php _e( 'Reset All Settings', 'comicpress' ); ?>" />
<input type="hidden" name="action" value="comicpress_reset" />
</form>
</td>
<td style="width:200px;">
<form method="post" id="myForm" name="template" enctype="multipart/form-data" action="">
<?php wp_nonce_field( 'update-options' ); ?>
<input name="comicpress_reset_customize" type="submit" class="button" value="<?php _e( 'Reset Customizer Colors', 'comicpress' ); ?>" />
<input type="hidden" name="action" value="comicpress_reset_customize" />
</form>
</td>
</tr>
</table>
</div>
<br />
<?php
printf(
/* translators: 1: Link to website 2: Additional link attribute */
__( 'Developed and maintained by <a href="%1$1s" %2$2s> Philip M. Hofer alias <small>(Frumph)</small></a>.', 'comicpress' ),
esc_url( 'http://frumph.net/' ),
'target="_blank" rel="noopener noreferrer"'
);
?>
<?php
printf(
/* translators: 1: Link to website 2: Additional link attribute */
__( 'Originally created by <a href="%1$1s" %2$2s> Tyler Martin</a>.', 'comicpress' ),
esc_url( 'http://mindfaucet.com/' ),
'target="_blank" rel="noopener noreferrer"'
);
?>
</a>
<br />
<?php
_e( 'If you like the ComicPress theme, please donate. It will help in developing new features and versions.', 'comicpress' );
?>
<table style="margin:0 auto;">
<tr>
<td style="width:200px;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="46RNWXBE7467Q" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
</td>
<td style="width:200px;">
<form method="post" id="myForm" name="template" enctype="multipart/form-data" action="">
<?php wp_nonce_field( 'update-options' ); ?>
<input name="comicpress_reset" type="submit" class="button" value="<?php _e( 'Reset All Settings', 'comicpress' ); ?>" />
<input type="hidden" name="action" value="comicpress_reset" />
</form>
</td>
<td style="width:200px;">
<form method="post" id="myForm" name="template" enctype="multipart/form-data" action="">
<?php wp_nonce_field( 'update-options' ); ?>
<input name="comicpress_reset_customize" type="submit" class="button" value="<?php _e( 'Reset Customizer Colors', 'comicpress' ); ?>" />
<input type="hidden" name="action" value="comicpress_reset_customize" />
</form>
</td>
</tr>
</table>
</div>
<?php
}
?>

View File

@@ -49,12 +49,13 @@
<input id="enable_post_author_gravatar" name="enable_post_author_gravatar" type="checkbox" value="1" <?php checked( true, $comicpress_options['enable_post_author_gravatar'] ); ?> />
</td>
<td>
<?php printf(
/* translators: 1: Link to gravatar.com 2: Additional link attribute */
__( 'Enabling this option will show a gravatar of the post author based on the author email address. Gravatars are associated by your email address and you can create them at <a href="%1s" %2s>Gravatar.com</a>.', 'comicpress' ),
<?php
printf(
/* translators: 1: Link to website 2: Additional link attribute */
__( 'Enabling this option will show a gravatar of the post author based on the author email address. Gravatars are associated by your email address and you can create them at <a href="%1$1s" %2$2s>Gravatar.com</a>.', 'comicpress' ),
esc_url( 'https://gravatar.com/' ),
'target="_blank" rel="noopener noreferrer"'
)
);
?>
</td>
</tr>

View File

@@ -12,12 +12,16 @@
?>
<div id="sidebar-left">
<div class="sidebar">
<?php
do_action( 'comicpress-sidebar-left' );
if ( ! dynamic_sidebar( 'sidebar-left-sidebar' ) ) {
?>
<div class="sidebar-no-widgets">
<?php _e( 'There are currently no widgets assigned to the left-sidebar, place some!', 'comicpress' ); ?>
<br />
<br />
@@ -26,9 +30,13 @@
<br />
<?php _e( 'Widgets can be added by going to your dashboard (wp-admin) &#10132; Appearance &#10132; Widgets, drag a widget you want to see into one of the appropriate sidebars.', 'comicpress' ); ?>
<br />
</div>
<?php
}
?>
</div>
</div>

View File

@@ -12,12 +12,16 @@
?>
<div id="sidebar-right">
<div class="sidebar">
<?php
do_action( 'comicpress-sidebar-right' );
if ( ! dynamic_sidebar( 'sidebar-right-sidebar' ) ) {
?>
<?php
do_action( 'comicpress-sidebar-right' );
if ( ! dynamic_sidebar( 'sidebar-right-sidebar' ) ) {
?>
<div class="sidebar-no-widgets">
<?php _e( 'There are currently no widgets assigned to the right-sidebar, place some!', 'comicpress' ); ?>
<br />
<br />
@@ -26,9 +30,13 @@
<br />
<?php _e( 'Widgets can be added by going to your dashboard (wp-admin) &#10132; Appearance &#10132; Widgets, drag a widget you want to see into one of the appropriate sidebars.', 'comicpress' ); ?>
<br />
</div>
<?php
}
?>
<?php
}
?>
</div>
</div>

View File

@@ -1,8 +1,12 @@
<div id="sidebar-shop">
<div class="sidebar">
<?php
do_action( 'comicpress-sidebar-shop' );
dynamic_sidebar( 'sidebar-shop' );
?>
</div>
</div>

View File

@@ -1,8 +1,12 @@
<div id="sidebar">
<div class="sidebar">
<?php
do_action( 'sidebar' );
dynamic_sidebar();
?>
<?php
do_action( 'sidebar' );
dynamic_sidebar();
?>
</div>
</div>