Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example functions clean up #866

Merged
merged 4 commits into from
Feb 24, 2017

Conversation

PavelK27
Copy link
Contributor

Some PHPCS fixes for example-functions file

// Don't show this metabox if it's not the front page template
if ( $cmb->object_id !== get_option( 'page_on_front' ) ) {
// Don't show this metabox if it's not the front page template.
if ( get_option( 'page_on_front' !== $cmb->object_id ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct (and is broken)

<p class="description"><?php echo $description; ?></p>
<div class="custom-field-row <?php echo esc_attr( $classes ); ?>">
<p><label for="<?php echo esc_attr( $id ); ?>"><?php echo esc_html( $label ); ?></label></p>
<p><input id="<?php echo esc_attr( $id ); ?>" type="text" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $value ); ?>"/></p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$value is already escaped, as it's taken from $field->escaped_value()

<p><?php echo $field->escaped_value(); ?></p>
<p class="description"><?php echo $field->args( 'description' ); ?></p>
<div class="custom-column-display <?php echo esc_attr( $field->row_classes() ); ?>">
<p><?php echo esc_html( $field->escaped_value() ); ?></p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esc_html is not needed on a call to $field->escaped_value()

Copy link
Member

@jtsternberg jtsternberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the requested lines.

@PavelK27
Copy link
Contributor Author

The update was corrected

Copy link
Contributor Author

@PavelK27 PavelK27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtsternberg jtsternberg merged commit 58eb32a into CMB2:trunk Feb 24, 2017
@jtsternberg
Copy link
Member

It works, thanks!

jtsternberg added a commit that referenced this pull request Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants