Ned Zimmerman
7 years ago
committed by
GitHub
27 changed files with 650 additions and 449 deletions
@ -1,29 +1,38 @@
|
||||
<?php use function \Aldine\Helpers\maybe_truncate_string; ?> |
||||
|
||||
<?php $subject = ( isset( $book['subject'] ) ) ? substr( $book['subject'], 0, 2 ) : ''; |
||||
<?php |
||||
$subject = ( isset( $book['subject'] ) ) ? substr( $book['subject'], 0, 2 ) : ''; |
||||
$date = ( isset( $book['metadata']['datePublished'] ) ) ? str_replace( '-', '', $book['metadata']['datePublished'] ) : ''; |
||||
?> |
||||
<li class="book" |
||||
<?php if ( $date ) { ?>data-date-published="<?php echo $date; ?>"<?php } ?> |
||||
<?php |
||||
if ( $date ) { |
||||
?> |
||||
data-date-published="<?php echo $date; ?>"<?php } ?> |
||||
data-license="<?php echo ( new \Pressbooks\Licensing() )->getLicenseFromUrl( $book['metadata']['license']['url'] ); ?>"
|
||||
<?php if ( ! empty( $subject ) ) { ?> data-subject="<?php echo $subject ?>"<?php } ?> |
||||
<?php |
||||
if ( ! empty( $subject ) ) { |
||||
?> |
||||
data-subject="<?php echo $subject ?>"<?php } ?> |
||||
> |
||||
<p class="book__title"> |
||||
<p class="book__title"> |
||||
<a href="<?php echo $book['link']; ?>"><?php echo maybe_truncate_string( $book['metadata']['name'] ); ?></a>
|
||||
</p> |
||||
<?php /* <?php if (isset( $book['metadata']['author'] ) ) { ?> |
||||
<?php |
||||
/* <?php if (isset( $book['metadata']['author'] ) ) { ?> |
||||
<p class="book__author"> |
||||
<?php _e( 'By', 'pressbooks-aldine' ); ?> <?php foreach ( $book['metadata']['author'] as $author ) { |
||||
echo $author['name']; |
||||
} ?> |
||||
</p> |
||||
<?php } ?> */ ?>
|
||||
<?php } ?> */
|
||||
?> |
||||
<?php if ( ! empty( $subject ) ) { ?> |
||||
<p class="book__subject"> |
||||
<p class="book__subject"> |
||||
<a href="<?php echo network_home_url( "/catalog/#$subject" ) ?>"><?php echo \Pressbooks\Metadata\get_subject_from_thema( $book['subject'] ); ?></a>
|
||||
</p> |
||||
</p> |
||||
<?php } ?> |
||||
<p class="book__read-more"> |
||||
<a href="<?php echo $book['link']; ?>"><?php _e( 'About this book', 'pressbooks-aldine' ); ?> <svg aria-hidden="true"><use xlink:href="#arrow-right" /></svg></a>
|
||||
</p> |
||||
</p> |
||||
</li> |
||||
|
@ -1,41 +1,13 @@
|
||||
<?xml version="1.0"?> |
||||
<ruleset> |
||||
<!-- Scan only PHP files --> |
||||
<arg name="extensions" value="php"/> |
||||
<!-- Use Pressbooks Coding Standards --> |
||||
<rule ref="vendor/pressbooks/coding-standards" /> |
||||
|
||||
<!-- Show colors in console --> |
||||
<arg value="-colors"/> |
||||
|
||||
<!-- Show progress --> |
||||
<arg value="p"/> |
||||
|
||||
<!-- Be quiet --> |
||||
<arg value="q"/> |
||||
|
||||
<!-- Use HM Coding Standards --> |
||||
<rule ref="vendor/humanmade/coding-standards"> |
||||
<!-- Disable all ESLint checks --> |
||||
<exclude name="HM.Debug.ESLint"/> |
||||
<!-- Disable rules Pressbooks disagrees with --> |
||||
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/> |
||||
<exclude name="WordPress.NamingConventions.ValidVariableName.MemberNotSnakeCase"/> |
||||
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar"/> |
||||
<exclude name="WordPress.VIP.SessionVariableUsage"/> |
||||
<exclude name="WordPress.VIP.SessionFunctionsUsage"/> |
||||
<!-- Disable LayoutOrder until humanmade/coding-standards#5 is fixed --> |
||||
<exclude name="HM.Layout.Order.WrongOrder"/> |
||||
</rule> |
||||
|
||||
<!-- Re-enable rules Pressbooks agrees with --> |
||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/> |
||||
|
||||
<!-- Disable Side Effects rule for functions.php --> |
||||
<!-- Disable Side Effects and MissingNamespace rules for bootstrapping files: --> |
||||
<rule ref="PSR1.Files.SideEffects"> |
||||
<exclude-pattern>functions.php</exclude-pattern> |
||||
<exclude-pattern>/functions.php</exclude-pattern> |
||||
</rule> |
||||
|
||||
<!-- Disable Namespaced Functions for functions.php --> |
||||
<rule ref="HM.Functions.NamespacedFunctions"> |
||||
<exclude-pattern>functions.php</exclude-pattern> |
||||
<rule ref="HM.Functions.NamespacedFunctions.MissingNamespace"> |
||||
<exclude-pattern>/functions.php</exclude-pattern> |
||||
</rule> |
||||
</ruleset> |
||||
|
Loading…
Reference in new issue