Browse Source

Fix coding standards error.

pull/3/head
Ned Zimmerman 7 years ago
parent
commit
48779b2d7f
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      README.md
  2. 16
      app/filters.php
  3. 33
      app/widgets/latestbooks.php

2
README.md

@ -1,5 +1,7 @@
# Aldine
[![Build Status](https://travis-ci.org/pressbooks/pressbooks-aldine.svg?branch=master)](https://travis-ci.org/pressbooks/pressbooks-aldine)
Aldine is the new root theme for [Pressbooks](https://github.com/pressbooks/pressbooks), based on [Sage](https://roots.io/sage/).
## Features

16
app/filters.php

@ -81,12 +81,12 @@ add_action('admin_bar_init', function () {
* @see https://wordpress.stackexchange.com/questions/185577/disable-emojicons-introduced-with-wp-4-2
*/
add_action('init', function () {
remove_action('admin_print_styles', 'print_emoji_styles');
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
add_filter( 'emoji_svg_url', '__return_false' );
remove_action('admin_print_styles', 'print_emoji_styles');
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
add_filter('emoji_svg_url', '__return_false');
});

33
app/widgets/latestbooks.php

@ -28,26 +28,31 @@ class LatestBooks extends \WP_Widget
public function widget($args, $instance)
{
$number = (! empty($instance['number'])) ? absint($instance['number']) : 3;
if (!$number)
if (!$number) {
$number = 3;
}
if (empty($instance['title'])) {
$instance['title'] = __('Latest Books', 'aldine');
}
echo $args['before_widget'];
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
$books = wp_remote_get(home_url('/wp-json/pressbooks/v2/books'));
$books = json_decode($books['body'], true); ?>
<div class="books">
<?php for($i = 0; $i < $number; $i++) {
$books = json_decode($books['body'], true);
echo '<div class="books">';
for ($i = 0; $i < $number; $i++) {
printf(
'<div class="book"><a class="subject" href="">TK</a><a class="title" href="%1$s">%2$s</a><a class="read-more" href="%1$s">%3$s</a></div>',
'<div class="book">
<a class="subject" href="">TK</a>
<a class="title" href="%1$s">%2$s</a>
<a class="read-more" href="%1$s">%3$s</a>
</div>',
$books[$i]['link'],
$books[$i]['metadata']['name'],
__('About this book &rarr;', 'aldine')
);
} ?>
</div>
<?php echo $args['after_widget'];
}
echo '</div>';
echo $args['after_widget'];
}
/**
@ -61,18 +66,18 @@ class LatestBooks extends \WP_Widget
{
$title = ! empty($instance['title']) ? $instance['title'] : '';
$number = ! empty($instance['number']) ? absint($instance['number']) : 3; ?>
<p><label for="<?= $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<p><label for="<?= $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input
class="widefat"
id="<?= $this->get_field_id( 'title' ); ?>"
name="<?= $this->get_field_name( 'title' ); ?>"
id="<?= $this->get_field_id('title'); ?>"
name="<?= $this->get_field_name('title'); ?>"
type="text"
value="<?= $title; ?>" /></p>
<p><label for="<?= $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of books to show:' ); ?></label>
<p><label for="<?= $this->get_field_id('number'); ?>"><?php _e('Number of books to show:'); ?></label>
<input
class="tiny-text"
id="<?= $this->get_field_id( 'number' ); ?>"
name="<?= $this->get_field_name( 'number' ); ?>"
id="<?= $this->get_field_id('number'); ?>"
name="<?= $this->get_field_name('number'); ?>"
type="number"
step="1"
min="1"

Loading…
Cancel
Save