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 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'] ) : ''; |
$date = ( isset( $book['metadata']['datePublished'] ) ) ? str_replace( '-', '', $book['metadata']['datePublished'] ) : ''; |
||||||
?> |
?> |
||||||
<li class="book" |
<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'] ); ?>"
|
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>
|
<a href="<?php echo $book['link']; ?>"><?php echo maybe_truncate_string( $book['metadata']['name'] ); ?></a>
|
||||||
</p> |
</p> |
||||||
<?php /* <?php if (isset( $book['metadata']['author'] ) ) { ?> |
<?php |
||||||
|
/* <?php if (isset( $book['metadata']['author'] ) ) { ?> |
||||||
<p class="book__author"> |
<p class="book__author"> |
||||||
<?php _e( 'By', 'pressbooks-aldine' ); ?> <?php foreach ( $book['metadata']['author'] as $author ) { |
<?php _e( 'By', 'pressbooks-aldine' ); ?> <?php foreach ( $book['metadata']['author'] as $author ) { |
||||||
echo $author['name']; |
echo $author['name']; |
||||||
} ?> |
} ?> |
||||||
</p> |
</p> |
||||||
<?php } ?> */ ?>
|
<?php } ?> */
|
||||||
|
?> |
||||||
<?php if ( ! empty( $subject ) ) { ?> |
<?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>
|
<a href="<?php echo network_home_url( "/catalog/#$subject" ) ?>"><?php echo \Pressbooks\Metadata\get_subject_from_thema( $book['subject'] ); ?></a>
|
||||||
</p> |
</p> |
||||||
<?php } ?> |
<?php } ?> |
||||||
<p class="book__read-more"> |
<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>
|
<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> |
</li> |
||||||
|
@ -1,41 +1,13 @@ |
|||||||
<?xml version="1.0"?> |
<?xml version="1.0"?> |
||||||
<ruleset> |
<ruleset> |
||||||
<!-- Scan only PHP files --> |
<!-- Use Pressbooks Coding Standards --> |
||||||
<arg name="extensions" value="php"/> |
<rule ref="vendor/pressbooks/coding-standards" /> |
||||||
|
|
||||||
<!-- Show colors in console --> |
<!-- Disable Side Effects and MissingNamespace rules for bootstrapping files: --> |
||||||
<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 --> |
|
||||||
<rule ref="PSR1.Files.SideEffects"> |
<rule ref="PSR1.Files.SideEffects"> |
||||||
<exclude-pattern>functions.php</exclude-pattern> |
<exclude-pattern>/functions.php</exclude-pattern> |
||||||
</rule> |
</rule> |
||||||
|
<rule ref="HM.Functions.NamespacedFunctions.MissingNamespace"> |
||||||
<!-- Disable Namespaced Functions for functions.php --> |
<exclude-pattern>/functions.php</exclude-pattern> |
||||||
<rule ref="HM.Functions.NamespacedFunctions"> |
|
||||||
<exclude-pattern>functions.php</exclude-pattern> |
|
||||||
</rule> |
</rule> |
||||||
</ruleset> |
</ruleset> |
||||||
|
Loading…
Reference in new issue