Skip to content

Commit

Permalink
Merge pull request #15 from donnapep/chore/release-2.3.1
Browse files Browse the repository at this point in the history
Release 2.3.1
  • Loading branch information
Donna Peplinskie committed Jan 1, 2016
2 parents bee88db + cf5a0c6 commit 85fe066
Show file tree
Hide file tree
Showing 12 changed files with 401 additions and 135 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log #

## 2.3.1 ##
* New: Add new `book_review_links_meta` filter for returning links meta used in the *Book Info* meta box.
* Fix: Change `book_review_links` filter to return links HTML.

## 2.3.0 ##
* New: Add support for custom fields.
* Tweak: Improved validation when saving settings and post meta.
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Book Review #

## Review More Than Just Books ##
One of the most powerful features of Book Review is the ability to add custom fields to each of your reviews. Custom fields enable you to review movies, music, TV shows and so much more!

## Save Time ##
Book Review saves you time when writing your reviews. No more copying and pasting or manually entering the details of a book. Instead, you provide the ISBN, and Book Review will automatically populate information like title, author, and even the cover photo for you.

Expand Down Expand Up @@ -56,18 +59,26 @@ OR

## Screenshots ##

###Book Review Settings###
![Book Review Settings](https://cloud.githubusercontent.com/assets/1190420/5692227/a2c1d80c-98ba-11e4-865d-4667943fed02.png)
###Book Info###
![Book Info](https://cloud.githubusercontent.com/assets/1190420/5692230/a2c64090-98ba-11e4-8326-d111d87c7f1a.png)
###Sample Post###
![Book Info on a Sample Post](https://cloud.githubusercontent.com/assets/1190420/5692229/a2c5fae0-98ba-11e4-9323-e690aa648fea.png)
###Archives by Title###
### Settings - Appearance ###
![Settings - Appearance](https://cloud.githubusercontent.com/assets/1190420/12072461/aa3c6d16-b0ad-11e5-85b9-efb284f44328.png)
### Settings - Rating Images ###
![Settings - Rating Images](https://cloud.githubusercontent.com/assets/1190420/12072467/aa474812-b0ad-11e5-86c8-3ca31844f9c5.png)
### Settings - Links ###
![Settings - Links](https://cloud.githubusercontent.com/assets/1190420/12072466/aa40fcb4-b0ad-11e5-8324-df75ae1db768.png)
### Settings - Custom Fields ###
![Settings - Custom Fields](https://cloud.githubusercontent.com/assets/1190420/12072463/aa400cb4-b0ad-11e5-8eda-821050ed8371.png)
### Settings - Advanced ###
![Settings - Advanced](https://cloud.githubusercontent.com/assets/1190420/12072464/aa406b8c-b0ad-11e5-9106-98ac8fa9e791.png)
### Book Info ###
![Book Info](https://cloud.githubusercontent.com/assets/1190420/12072462/aa3efa40-b0ad-11e5-9845-62aa7de7c1e8.png)
### Sample Post ###
![Sample Post](https://cloud.githubusercontent.com/assets/1190420/12072465/aa409134-b0ad-11e5-8323-ecf0365d5274.png)
### Archives by Title ###
![Archives by Title](https://cloud.githubusercontent.com/assets/1190420/5692228/a2c37a0e-98ba-11e4-9f34-789dac88c24b.png)
###Archives by Genre###
### Archives by Genre ###
![Archives by Genre](https://cloud.githubusercontent.com/assets/1190420/5692231/a2c73978-98ba-11e4-8534-1a140584bfec.png)
###Google Search Results Page###
![Google Search Results Page](https://cloud.githubusercontent.com/assets/1190420/5770126/1a086cd6-9cf4-11e4-9881-fc517d73b29e.png)
### Google Search Result ###
![Google Search Result](https://cloud.githubusercontent.com/assets/1190420/5770126/1a086cd6-9cf4-11e4-9881-fc517d73b29e.png)

## Contributions ##
Anyone is welcome to contribute to the WordPress Book Review Plugin, but please read the [contribution guidelines](https://github.com/donnapep/book-review/blob/master/CONTRIBUTING.md) first.
Expand All @@ -86,6 +97,6 @@ There are various ways to get involved:
* Follow me on [Google+](https://plus.google.com/u/0/+DonnaPeplinskie/posts), [Twitter](https://twitter.com/donnapep) or [LinkedIn](http://www.linkedin.com/in/donnapeplinskie).

## About Me ##
* I’m the founder of [WP Review Plugins](http://wpreviewplugins.com/).
* I’m the founder of [WP Review Plugins](http://wpreviewplugins.com/), a company specializing in creating review plugins for WordPress.
* I blog about web and professional development at [donnapeplinskie.com](http://donnapeplinskie.com/).
* I'm an avid reader and a fan of young adult fiction.
2 changes: 1 addition & 1 deletion admin/partials/book-review-admin-meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

<!-- Links -->
<?php
$links = $this->book_info->get_book_review_links( $post->ID );
$links = $this->book_info->get_book_review_links_meta( $post->ID );

foreach ( $links as $link ):
?>
Expand Down
2 changes: 1 addition & 1 deletion book-review.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: Book Review
* Plugin URI: http://wpreviewplugins.com/downloads/book-review/
* Description: Add book information such as title, author, publisher and cover photo to enhance your review posts.
* Version: 2.3.0
* Version: 2.3.1
* Author: Donna Peplinskie
* Author URI: http://donnapeplinskie.com/
* Text Domain: book-review
Expand Down
2 changes: 1 addition & 1 deletion includes/class-book-review-activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Book_Review_Activator {
* @access protected
* @var string
*/
const VERSION = '2.3.0';
const VERSION = '2.3.1';

/**
* Fired when the plugin is activated.
Expand Down
60 changes: 54 additions & 6 deletions includes/class-book-review-book-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,73 @@ public function get_book_review_field( $post_id, $field_id ) {
}

/**
* Retrieve the links.
* Retrieve the links meta that displays in the Book Info meta box.
*
* @since 2.3.0
* @since 2.3.1
*
* @param string $post_id ID of the current post.
*/
public function get_book_review_links( $post_id ) {
public function get_book_review_links_meta( $post_id ) {
global $wpdb;

// Get the link text and link URLs.
$sql = "SELECT links.custom_link_id, links.text, links.image_url, urls.url
FROM {$wpdb->book_review_custom_links} AS links
LEFT OUTER JOIN {$wpdb->book_review_custom_link_urls} AS urls ON links.custom_link_id = urls.custom_link_id
AND urls.post_id = $post_id
WHERE links.active = 1";

$links = $wpdb->get_results( $sql );
$links_meta = $wpdb->get_results( $sql );

return apply_filters( 'book_review_links_meta', $links_meta, $post_id );
}

/**
* Retrieve the links.
*
* @since 2.3.0
*
* @param string $post_id ID of the current post.
*/
public function get_book_review_links_html( $post_id ) {
global $wpdb;

$html = array();
$links_option = $this->settings->get_book_review_links_option();
$links = $this->get_book_review_links_meta( $post_id );

// Construct the HTML for each link.
foreach ( $links as $link ) {
if ( !empty( $link->url ) ) {
if ( !empty( $link->image_url ) ) {
array_push( $html, '<li><a class="custom-link" href="' . esc_url( $link->url ) . '"' .
$this->get_link_target() . '>' . '<img src="' . esc_url( $link->image_url ) .'" alt="' .
esc_attr( $link->text ) . '">' . '</a></li>' );
}
elseif ( !empty( $link->text ) ) {
array_push( $html, '<li><a class="custom-link" href="' . esc_url( $link->url ) . '"' .
$this->get_link_target() . '>' . esc_html( $link->text ) . '</a></li>' );
}
}
}

return apply_filters( 'book_review_links', $html, $post_id, $links_option );
}

/**
* Retrieve the target attribute of a link.
*
* @since 2.3.1
*
* @return string Target attribute or empty string if none.
*/
private function get_link_target() {
$links_option = $this->settings->get_book_review_links_option();

if ( $links_option['book_review_target'] == '1' ) {
return ' target="_blank"';
}

return apply_filters( 'book_review_links', $links, $post_id );
return '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/class-book-review.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function get_instance() {
*/
private function __construct() {
$this->plugin_name = 'book-review';
$this->version = '2.3.0';
$this->version = '2.3.1';

if ( !defined( 'BOOK_REVIEW_PLUGIN_DIR' ) ) {
define( 'BOOK_REVIEW_PLUGIN_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
Expand Down
28 changes: 14 additions & 14 deletions languages/book-review.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (C) 2015 Book Review
# Copyright (C) 2016 Book Review
# This file is distributed under the same license as the Book Review package.
msgid ""
msgstr ""
"Project-Id-Version: Book Review 2.3.0\n"
"Project-Id-Version: Book Review 2.3.1\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/book-review\n"
"POT-Creation-Date: 2015-12-20 18:23:09+00:00\n"
"POT-Creation-Date: 2016-01-01 16:37:03+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"

Expand Down Expand Up @@ -1280,47 +1280,47 @@ msgid "Get Book Info"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:32
#: public/partials/book-review-public.php:36
#: public/partials/book-review-public.php:42
msgid "Title"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:41
#: public/partials/book-review-public.php:47
#: public/partials/book-review-public.php:56
msgid "Series"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:50
#: public/partials/book-review-public.php:58
#: public/partials/book-review-public.php:70
msgid "Author"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:59
#: public/partials/book-review-public.php:71
#: public/partials/book-review-public.php:86
msgid "Genre"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:68
#: public/partials/book-review-public.php:82
#: public/partials/book-review-public.php:100
msgid "Publisher"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:78
#: public/partials/book-review-public.php:93
#: public/partials/book-review-public.php:114
msgid "Release Date"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:87
#: public/partials/book-review-public.php:104
#: public/partials/book-review-public.php:128
msgid "Format"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:96
#: public/partials/book-review-public.php:115
#: public/partials/book-review-public.php:142
msgid "Pages"
msgstr ""

#: admin/partials/book-review-admin-meta-box.php:105
#: public/partials/book-review-public.php:126
#: public/partials/book-review-public.php:156
msgid "Source"
msgstr ""

Expand Down Expand Up @@ -1356,7 +1356,7 @@ msgstr ""
msgid "<a href=\"%1$s\" class=\"dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></a>"
msgstr ""

#: public/partials/book-review-public.php:30
#: public/partials/book-review-public.php:33
msgid "Book Cover"
msgstr ""

Expand Down
17 changes: 0 additions & 17 deletions public/class-book-review-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,6 @@ public function get_review_box_style() {
return '';
}

/**
* Retrieve the target attribute of a link.
*
* @since 2.3.0
*
* @return string Target attribute or empty string if none.
*/
public function get_link_target() {
$links_option = $this->settings->get_book_review_links_option();

if ( $links_option['book_review_target'] == '1' ) {
return 'target="_blank"';
}

return '';
}

/**
* Add rating to the excerpt.
*
Expand Down
24 changes: 4 additions & 20 deletions public/partials/book-review-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,11 @@
<!-- Links -->
<ul id="book-review-links" class="links">
<?php
$links = $this->book_info->get_book_review_links( $post_id );
$links = $this->book_info->get_book_review_links_html( $post_id );

foreach ( $links as $link ):
if ( !empty( $link->url ) ) :
if ( !empty( $link->image_url ) ):
?>
<li>
<a class="custom-link" href="<?php echo esc_attr( $link->url ); ?>" <?php echo $this->get_link_target(); ?>>
<img src="<?php echo esc_attr( $link->image_url ); ?>" alt="<?php echo esc_attr( $link->text ); ?>">
</a>
</li>
<?php elseif ( !empty( $link->text ) ) : ?>
<li>
<a class="custom-link" href="<?php echo esc_attr( $link->url ); ?>" <?php echo $this->get_link_target(); ?>>
<?php esc_html_e( $link->text ); ?>
</a>
</li>
<?php
endif;
endif;
endforeach;
foreach ( $links as $link ) {
echo $link;
}
?>
</ul>
</div>
Loading

0 comments on commit 85fe066

Please sign in to comment.