-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1810 from ampproject/fix/phpcs-violations
Update coding standards and fix all violations
- Loading branch information
Showing
116 changed files
with
4,270 additions
and
2,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
<?php | ||
/** | ||
* Functions for managing legacy templates | ||
* | ||
* @package AMP | ||
*/ | ||
|
||
// If you want to use the template that shipped with v0.3 and earlier, you can use this to force that. | ||
// Note that this may not stick around forever, so use caution and `function_exists`. | ||
/** | ||
* Adds hooks to use legacy templates. | ||
* | ||
* If you want to use the template that shipped with v0.3 and earlier, you can use this to force that. | ||
* Note that this may not stick around forever, so use caution and `function_exists`. | ||
*/ | ||
function amp_backcompat_use_v03_templates() { | ||
add_filter( 'amp_customizer_is_enabled', '__return_false' ); | ||
add_filter( 'amp_post_template_dir', '_amp_backcompat_use_v03_templates_callback', 0 ); // early in case there are other overrides | ||
add_filter( 'amp_post_template_dir', '_amp_backcompat_use_v03_templates_callback', 0 ); // Early in case there are other overrides. | ||
} | ||
|
||
/** | ||
* Callback for getting the legacy templates directory. | ||
* | ||
* @access private | ||
* | ||
* @param string $templates Template directory. | ||
* @return string Legacy template directory. | ||
*/ | ||
function _amp_backcompat_use_v03_templates_callback( $templates ) { | ||
return AMP__DIR__ . '/back-compat/templates-v0-3'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php $post_author = $this->get( 'post_author' ); ?> | ||
<?php | ||
/** | ||
* Legacy template for the AMP author byline. | ||
* | ||
* @package AMP | ||
*/ | ||
|
||
$post_author = $this->get( 'post_author' ); | ||
$avatar_url = get_avatar_url( | ||
$post_author->user_email, | ||
array( | ||
'size' => 24, | ||
) | ||
); | ||
?> | ||
<li class="amp-wp-byline"> | ||
<?php if ( function_exists( 'get_avatar_url' ) ) : ?> | ||
<amp-img src="<?php echo esc_url( get_avatar_url( $post_author->user_email, array( | ||
'size' => 24, | ||
) ) ); ?>" width="24" height="24" layout="fixed"></amp-img> | ||
<amp-img src="<?php echo esc_url( $avatar_url ); ?>" width="24" height="24" layout="fixed"></amp-img> | ||
<?php endif; ?> | ||
<span class="amp-wp-author"><?php echo esc_html( $post_author->display_name ); ?></span> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
<?php $categories = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'amp' ) ); ?> | ||
<?php | ||
/** | ||
* Legacy template for the AMP post taxonomy term lists. | ||
* | ||
* @package AMP | ||
*/ | ||
|
||
$categories = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'amp' ) ); | ||
?> | ||
<?php if ( $categories ) : ?> | ||
<li class="amp-wp-tax-category"> | ||
<span class="screen-reader-text">Categories:</span> | ||
<?php echo $categories; ?> | ||
<?php echo $categories; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | ||
</li> | ||
<?php endif; ?> | ||
|
||
<?php $tags = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'amp' ) ); ?> | ||
<?php if ( $tags && ! is_wp_error( $tags ) ) : ?> | ||
<li class="amp-wp-tax-tag"> | ||
<span class="screen-reader-text">Tags:</span> | ||
<?php echo $tags; ?> | ||
<?php echo $tags; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | ||
</li> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.