Skip to content

Commit

Permalink
PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusborne committed Dec 2, 2017
1 parent 588b2a6 commit c6d307c
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 127 deletions.
4 changes: 2 additions & 2 deletions 404.php
Expand Up @@ -36,7 +36,7 @@
?>

<header class="entry-header">
<h1 class="entry-title" itemprop="headline"><?php echo apply_filters( 'generate_404_title', __( 'Oops! That page can&rsquo;t be found.', 'generatepress' ) ); ?></h1>
<h1 class="entry-title" itemprop="headline"><?php echo apply_filters( 'generate_404_title', __( 'Oops! That page can&rsquo;t be found.', 'generatepress' ) ); // WPCS: XSS OK. ?></h1>
</header><!-- .entry-header -->

<?php
Expand All @@ -52,7 +52,7 @@

<div class="entry-content" itemprop="text">
<?php
echo '<p>' . apply_filters( 'generate_404_text', __( 'It looks like nothing was found at this location. Maybe try searching?', 'generatepress' ) ) . '</p>';
echo '<p>' . apply_filters( 'generate_404_text', __( 'It looks like nothing was found at this location. Maybe try searching?', 'generatepress' ) ) . '</p>'; // WPCS: XSS OK.

get_search_form();
?>
Expand Down
6 changes: 3 additions & 3 deletions comments.php
Expand Up @@ -77,7 +77,7 @@

if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'generatepress' ); ?></h2>
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'generatepress' ); ?></h2>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>
</nav><!-- #comment-nav-above -->
Expand All @@ -100,7 +100,7 @@

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav id="comment-nav-below" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'generatepress' ); ?></h1>
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'generatepress' ); ?></h2>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>
</nav><!-- #comment-nav-below -->
Expand All @@ -110,7 +110,7 @@

// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'generatepress' ); ?></p>
<p class="no-comments"><?php _e( 'Comments are closed.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?php endif;

$commenter = wp_get_current_commenter();
Expand Down
67 changes: 36 additions & 31 deletions inc/dashboard.php
Expand Up @@ -46,14 +46,14 @@ function generate_settings_page() {
<div class="gp-masthead clearfix">
<div class="gp-container">
<div class="gp-title">
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' );?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo GENERATE_VERSION; ?></span>
<a href="<?php echo generate_get_premium_url( 'https://generatepress.com' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank">GeneratePress</a> <span class="gp-version"><?php echo GENERATE_VERSION; // WPCS: XSS ok ?></span>
</div>
<div class="gp-masthead-links">
<?php if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' );?>" target="_blank"><?php _e('Premium','generatepress');?></a>
<a style="font-weight: bold;" href="<?php echo generate_get_premium_url( 'https://generatepress.com/premium/' ); // WPCS: XSS ok, sanitization ok. ?>" target="_blank"><?php esc_html_e( 'Premium', 'generatepress' );?></a>
<?php endif; ?>
<a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php _e( 'Support','generatepress' ); ?></a>
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php _e('Documentation','generatepress');?></a>
<a href="<?php echo esc_url( 'https://generatepress.com/support' ); ?>" target="_blank"><?php esc_html_e( 'Support', 'generatepress' ); ?></a>
<a href="<?php echo esc_url( 'https://docs.generatepress.com' ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'generatepress' );?></a>
</div>
</div>
</div>
Expand Down Expand Up @@ -87,10 +87,8 @@ function generate_settings_page() {
<div class="customize-button hide-on-desktop">
<?php
printf( '<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
esc_url( add_query_arg( array(
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
), admin_url( 'customize.php' ) ) ),
__( 'Customize', 'generatepress' )
esc_url( admin_url( 'customize.php' ) ),
esc_html__( 'Customize', 'generatepress' )
);
?>
</div>
Expand Down Expand Up @@ -150,16 +148,16 @@ function generate_settings_page() {

if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<div class="postbox generate-metabox">
<h3 class="hndle"><?php _e( 'Premium Modules', 'generatepress' ); ?></h3>
<h3 class="hndle"><?php esc_html_e( 'Premium Modules', 'generatepress' ); ?></h3>
<div class="inside" style="margin:0;padding:0;">
<div class="premium-addons">
<?php foreach( $modules as $module => $info ) { ?>
<div class="add-on activated gp-clear addon-container grid-parent">
<div class="addon-name column-addon-name" style="">
<a href="<?php echo esc_url( $info[ 'url' ] ); ?>" target="_blank"><?php echo $module; ?></a>
<a href="<?php echo esc_url( $info[ 'url' ] ); ?>" target="_blank"><?php echo esc_html( $module ); ?></a>
</div>
<div class="addon-action addon-addon-action" style="text-align:right;">
<a href="<?php echo esc_url( $info[ 'url' ] ); ?>" target="_blank"><?php _e( 'Learn more','generatepress' ); ?></a>
<a href="<?php echo esc_url( $info[ 'url' ] ); ?>" target="_blank"><?php esc_html_e( 'Learn more', 'generatepress' ); ?></a>
</div>
</div>
<div class="gp-clear"></div>
Expand All @@ -183,10 +181,8 @@ function generate_settings_page() {
<div class="customize-button hide-on-mobile">
<?php
printf( '<a id="generate_customize_button" class="button button-primary" href="%1$s">%2$s</a>',
esc_url( add_query_arg( array(
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
), admin_url( 'customize.php' ) ) ),
__( 'Customize', 'generatepress' )
esc_url( admin_url( 'customize.php' ) ),
esc_html__( 'Customize', 'generatepress' )
);
?>
</div>
Expand All @@ -201,31 +197,30 @@ function generate_settings_page() {

if ( ! defined( 'GP_PREMIUM_VERSION' ) ) : ?>
<div class="postbox generate-metabox popular-articles">
<h3 class="hndle"><a href="https://docs.generatepress.com" target="_blank"><?php _e( 'View all', 'generatepress' ); ?></a><?php _e( 'Documentation', 'generatepress' ); ?></h3>
<h3 class="hndle"><a href="https://docs.generatepress.com" target="_blank"><?php esc_html_e( 'View all', 'generatepress' ); ?></a><?php esc_html_e( 'Documentation', 'generatepress' ); ?></h3>
<div class="inside">
<ul>
<li><a href="https://docs.generatepress.com/article/adding-header-logo/" target="_blank"><?php _e( 'Adding a Logo', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/sidebar-layout/" target="_blank"><?php _e( 'Sidebar Layout', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/container-width/" target="_blank"><?php _e( 'Container Width', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/navigation-location/" target="_blank"><?php _e( 'Navigation Location', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/footer-widgets/" target="_blank"><?php _e( 'Footer Widgets', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/adding-header-logo/" target="_blank"><?php esc_html_e( 'Adding a Logo', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/sidebar-layout/" target="_blank"><?php esc_html_e( 'Sidebar Layout', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/container-width/" target="_blank"><?php esc_html_e( 'Container Width', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/navigation-location/" target="_blank"><?php esc_html_e( 'Navigation Location', 'generatepress' ); ?></a></li>
<li><a href="https://docs.generatepress.com/article/footer-widgets/" target="_blank"><?php esc_html_e( 'Footer Widgets', 'generatepress' ); ?></a></li>
</ul>
</div>
</div>
<?php endif; ?>

<div class="postbox generate-metabox" id="gen-delete">
<h3 class="hndle"><?php _e( 'Delete Customizer Settings', 'generatepress' );?></h3>
<h3 class="hndle"><?php esc_html_e( 'Delete Customizer Settings', 'generatepress' );?></h3>
<div class="inside">
<p><?php printf( __( '<strong>Warning:</strong> Deleting your <a href="%1$s">Customizer</a> settings can not be undone.','generatepress' ), admin_url('customize.php') ); ?></p>
<p><?php _e( 'Consider using our Import/Export add-on to export your settings before deleting them.','generatepress');?></p>
<p><?php esc_html_e( 'Deleting your settings can not be undone.', 'generatepress' ); ?></p>
<form method="post">
<p><input type="hidden" name="generate_reset_customizer" value="generate_reset_customizer_settings" /></p>
<p>
<?php
$warning = 'return confirm("' . __( 'Warning: This will delete your settings.','generatepress' ) . '")';
$warning = 'return confirm("' . esc_html__( 'Warning: This will delete your settings.', 'generatepress' ) . '")';
wp_nonce_field( 'generate_reset_customizer_nonce', 'generate_reset_customizer_nonce' );
submit_button( __( 'Delete Default Settings', 'generatepress' ), 'button', 'submit', false, array( 'onclick' => esc_js( $warning ) ) );
submit_button( esc_attr__( 'Delete Default Settings', 'generatepress' ), 'button', 'submit', false, array( 'onclick' => esc_js( $warning ) ) );
?>
</p>

Expand All @@ -244,7 +239,15 @@ function generate_settings_page() {
</div>
</div>
<div class="gp-options-footer">
<span><?php printf( _x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ), '<span style="color:#D04848" class="dashicons dashicons-heart"></span>' ); ?></span>
<span>
<?php
printf( // WPCS: XSS ok
/* translators: %s: Heart icon */
_x( 'Made with %s by Tom Usborne', 'made with love', 'generatepress' ),
'<span style="color:#D04848" class="dashicons dashicons-heart"></span>'
);
?>
</span>
</div>
</div>
</div>
Expand All @@ -265,7 +268,9 @@ function generate_reset_customizer_settings() {
return;
}

if ( ! wp_verify_nonce( sanitize_key( $_POST['generate_reset_customizer_nonce'] ), 'generate_reset_customizer_nonce' ) ) {
$nonce = isset( $_POST['generate_reset_customizer_nonce'] ) ? sanitize_key( $_POST['generate_reset_customizer_nonce'] ) : '';

if ( ! wp_verify_nonce( $nonce, 'generate_reset_customizer_nonce' ) ) {
return;
}

Expand Down Expand Up @@ -299,15 +304,15 @@ function generate_admin_errors() {
}

if ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ) {
add_settings_error( 'generate-notices', 'true', __( 'Settings saved.', 'generatepress' ), 'updated' );
add_settings_error( 'generate-notices', 'true', esc_html__( 'Settings saved.', 'generatepress' ), 'updated' );
}

if ( isset( $_GET['status'] ) && 'imported' == $_GET['status'] ) {
add_settings_error( 'generate-notices', 'imported', __( 'Import successful.', 'generatepress' ), 'updated' );
add_settings_error( 'generate-notices', 'imported', esc_html__( 'Import successful.', 'generatepress' ), 'updated' );
}

if ( isset( $_GET['status'] ) && 'reset' == $_GET['status'] ) {
add_settings_error( 'generate-notices', 'reset', __( 'Settings removed.', 'generatepress' ), 'updated' );
add_settings_error( 'generate-notices', 'reset', esc_html__( 'Settings removed.', 'generatepress' ), 'updated' );
}

settings_errors( 'generate-notices' );
Expand Down
26 changes: 13 additions & 13 deletions inc/element-classes.php
Expand Up @@ -18,7 +18,7 @@
*/
function generate_right_sidebar_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_right_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -55,7 +55,7 @@ function generate_get_right_sidebar_class( $class = '' ) {
*/
function generate_left_sidebar_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_left_sidebar_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -92,7 +92,7 @@ function generate_get_left_sidebar_class( $class = '' ) {
*/
function generate_content_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_content_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -129,7 +129,7 @@ function generate_get_content_class( $class = '' ) {
*/
function generate_header_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -166,7 +166,7 @@ function generate_get_header_class( $class = '' ) {
*/
function generate_inside_header_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_inside_header_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -203,7 +203,7 @@ function generate_get_inside_header_class( $class = '' ) {
*/
function generate_container_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_container_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -240,7 +240,7 @@ function generate_get_container_class( $class = '' ) {
*/
function generate_navigation_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_navigation_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ function generate_inside_navigation_class( $class = '' ) {
$return = apply_filters('generate_inside_navigation_class', $classes, $class);

// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"';
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand All @@ -302,7 +302,7 @@ function generate_inside_navigation_class( $class = '' ) {
*/
function generate_menu_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_menu_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -339,7 +339,7 @@ function generate_get_menu_class( $class = '' ) {
*/
function generate_main_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_main_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -376,7 +376,7 @@ function generate_get_main_class( $class = '' ) {
*/
function generate_footer_class( $class = '' ) {
// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"';
echo 'class="' . join( ' ', generate_get_footer_class( $class ) ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down Expand Up @@ -425,7 +425,7 @@ function generate_inside_footer_class( $class = '' ) {
$return = apply_filters( 'generate_inside_footer_class', $classes, $class );

// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"';
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}

Expand All @@ -450,6 +450,6 @@ function generate_top_bar_class( $class = '' ) {
$return = apply_filters( 'generate_top_bar_class', $classes, $class );

// Separates classes with a single space, collates classes for post DIV
echo 'class="' . join( ' ', $return ) . '"';
echo 'class="' . join( ' ', $return ) . '"'; // WPCS: XSS ok, sanitization ok.
}
}
8 changes: 4 additions & 4 deletions inc/markup.php
Expand Up @@ -29,10 +29,10 @@ function generate_body_schema() {
$itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype;

// Get the result
$result = apply_filters( 'generate_body_itemtype', $itemtype );
$result = esc_html( apply_filters( 'generate_body_itemtype', $itemtype ) );

// Return our HTML
echo "itemtype='http://schema.org/$result' itemscope='itemscope'";
echo "itemtype='http://schema.org/$result' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
}
}

Expand All @@ -44,10 +44,10 @@ function generate_body_schema() {
*/
function generate_article_schema( $type = 'CreativeWork' ) {
// Get the itemtype
$itemtype = apply_filters( 'generate_article_itemtype', $type );
$itemtype = esc_html( apply_filters( 'generate_article_itemtype', $type ) );

// Print the results
echo "itemtype='http://schema.org/$itemtype' itemscope='itemscope'";
echo "itemtype='http://schema.org/$itemtype' itemscope='itemscope'"; // WPCS: XSS ok, sanitization ok.
}
}

Expand Down

0 comments on commit c6d307c

Please sign in to comment.