From 83a0bda3f1472ce3acea51269534dec8b09f954a Mon Sep 17 00:00:00 2001 From: Kniebremser Date: Sat, 6 Jul 2019 14:41:55 +0200 Subject: [PATCH] make missed texte translatable - reduce WPCS messages - make code better readeble --- content-comic.php | 4 +- content.php | 4 +- footer.php | 2 +- functions.php | 77 +++++++++++++++----- functions/avatars.php | 4 +- functions/comment-functions.php | 6 +- functions/displaypost.php | 4 +- functions/page-options.php | 2 +- image.php | 76 ++++++++++++++++++-- options.php | 123 ++++++++++++++++---------------- options/postspages.php | 9 +-- sidebar-left.php | 8 +++ sidebar-right.php | 22 ++++-- sidebar-shop.php | 4 ++ sidebar.php | 12 ++-- 15 files changed, 249 insertions(+), 108 deletions(-) diff --git a/content-comic.php b/content-comic.php index b5df396..e3bee67 100644 --- a/content-comic.php +++ b/content-comic.php @@ -15,7 +15,9 @@ ?>
- Featured Post + + +
- Featured Post + + +
queries. 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' => "\r\n
\r\n\r\n", 'before_title' => "

", 'after_title' => "

\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 ) ) { + ?> + + +

- - queries. - Memory usage . seconds .

+ + queries. + + Memory usage. + + seconds. +

+ ' . __( '↓ Read the rest of this entry...', 'comicpress' ) . ''; } } 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' ); } diff --git a/functions/avatars.php b/functions/avatars.php index 03c6ad6..045988c 100644 --- a/functions/avatars.php +++ b/functions/avatars.php @@ -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 ) { diff --git a/functions/comment-functions.php b/functions/comment-functions.php index 04979c8..010a9ae 100644 --- a/functions/comment-functions.php +++ b/functions/comment-functions.php @@ -150,7 +150,7 @@ function comicpress_comments_callback( $comment, $args, $depth ) { __( 'Reply', 'comicpress' ), @@ -163,9 +163,9 @@ function comicpress_comments_callback( $comment, $args, $depth ) { ); endif; - edit_comment_link( '' . __( 'Edit', 'comicpress' ) . '',' | ','' ); + edit_comment_link( '' . __( 'Edit', 'comicpress' ) . '', ' | ', '' ); - if ( $comment->comment_approved == '0' ) : + if ( $comment->comment_approved == '0' ) : ?>
diff --git a/functions/displaypost.php b/functions/displaypost.php index cfeb65b..bf1675f 100644 --- a/functions/displaypost.php +++ b/functions/displaypost.php @@ -289,7 +289,9 @@ if ( ! function_exists( 'comicpress_display_post' ) ) { ?>
- Featured Post + + +
/> - Disable Sidebars + diff --git a/image.php b/image.php index 5dc5e3b..592dc57 100644 --- a/image.php +++ b/image.php @@ -4,73 +4,135 @@ if ( have_posts() ) : while ( have_posts() ) : the_post() ?> +
> + +
+
+
+
+
+ +
+
- ‹ + + +
+ +
+
-
- + + + + +
+ + + +
+
+
+ +
+
- › + + +
+ +
+
+
+
+ + + +
+
+
+
+ comment_status ) { comments_template( '', true ); } endwhile; else : ?> +
> +
+
+

+
+
+
+
+
@@ -330,70 +332,71 @@ function comicpress_admin_options() { + diff --git a/options/postspages.php b/options/postspages.php index b7699d5..5bdad6a 100644 --- a/options/postspages.php +++ b/options/postspages.php @@ -49,12 +49,13 @@ /> - Gravatar.com.', 'comicpress' ), + Gravatar.com.', 'comicpress' ), esc_url( 'https://gravatar.com/' ), 'target="_blank" rel="noopener noreferrer"' - ) + ); ?> diff --git a/sidebar-left.php b/sidebar-left.php index 551a053..83fd45f 100644 --- a/sidebar-left.php +++ b/sidebar-left.php @@ -12,12 +12,16 @@ ?> diff --git a/sidebar-right.php b/sidebar-right.php index bebc643..ab73c08 100644 --- a/sidebar-right.php +++ b/sidebar-right.php @@ -12,12 +12,16 @@ ?> diff --git a/sidebar-shop.php b/sidebar-shop.php index 43bf3c4..a760ab7 100644 --- a/sidebar-shop.php +++ b/sidebar-shop.php @@ -1,8 +1,12 @@ diff --git a/sidebar.php b/sidebar.php index 8ab4e72..cb79caa 100644 --- a/sidebar.php +++ b/sidebar.php @@ -1,8 +1,12 @@