Changeset 1303201
- Timestamp:
- 12/08/2015 07:31:38 PM (10 years ago)
- Location:
- currently-reading/trunk
- Files:
-
- 2 edited
-
CurrentlyReading.php (modified) (2 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
currently-reading/trunk/CurrentlyReading.php
r1157833 r1303201 5 5 Description: Display a Currently Reading widget using the Google Books API 6 6 Author: Eugéne Roux 7 Version: 4.0. 37 Version: 4.0.4 8 8 Author URI: http://damn.org.za/ 9 9 */ … … 58 58 #print("\n\t<!-- Cache file is " . $cache . "... -->\n"); 59 59 60 if ( file_exists( $cache ) and time() - filectime( $cache ) < $cachedays * 24 * 60 * 60 ) {60 if ( file_exists( $cache ) and time() - filectime( $cache ) < $cachedays * 24 * 60 * 60 and filesize( $cache ) > 50 ) { 61 61 $bookdata = file_get_contents( $cache ); 62 62 $isbnjson = json_decode( $bookdata, true ); 63 63 print("\n\t<!-- Cache file read... -->\n"); 64 64 } elseif (( $bookdata = file_get_contents( "https://www.googleapis.com/books/v1/volumes?q=isbn:" . $myisbn ))) { 65 print("\n\t<!-- Google Books API call successful... Write cache file. -->\n"); 66 if ( !file_put_contents( $cache, $bookdata )) { 67 print("\n\t<!-- Cache file is not writable... This will end in tears. -->\n"); 65 $isbnjson = json_decode( $bookdata, true ); 66 if ( $isbnjson[ "totalItems" ] > 0 ) { 67 print("\n\t<!-- Google Books API call successful... Write cache file. -->\n"); 68 if ( !file_put_contents( $cache, $bookdata )) { 69 print("\n\t<!-- Cache file is not writable... This will end in tears. -->\n"); 70 } 71 } else { 72 print("\n\t<!-- Google Books API call to 'https://www.googleapis.com/books/v1/volumes?q=isbn:" . $myisbn . "' failed... -->\n"); 68 73 } 69 $isbnjson = json_decode( $bookdata, true );70 74 } else { 71 75 $booksapi = false; -
currently-reading/trunk/readme.txt
r1157836 r1303201 3 3 Tags: books, read, reading, admin, administration, jadb 4 4 Requires at least: 3 5 Tested up to: 4. 2.25 Tested up to: 4.3 6 6 Stable tag: trunk 7 7 … … 15 15 * Pad the Image (selected by default, uses internal CSS) 16 16 * Display a Box-Shadow (selected by default, uses internal CSS) 17 * Choose Alternate Google Country (defaults to " South Africa" since books.google.com seems to give a "500" error and South Africa seems to work just fine for US clients as well)17 * Choose Alternate Google Country (defaults to "Worldwide") 18 18 19 19 as well as … … 49 49 == Frequently Asked Questions == 50 50 51 **I Get a '*Warning: file_get_contents ... : failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden*' Error on My Blog With No Books Displayed. Why Is This Happening?**51 **I get a '*Warning: file_get_contents ... : failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden*' Error in my logs and no books are displayed. Why is this happening?** 52 52 53 Your web-site has been configure not to allow outgoing HTTP requests and you have 'Use Google API' enabled or Google rejected your connection.53 Your web-site has been configure not to allow outgoing HTTP requests and you have 'Use Google API' enabled. 54 54 55 If the automated fail-back failed, please de-select the 'Use Google API' option to use the direct connection instead nd report this as a bug.55 Please de-select the 'Use Google API' option to use the direct connection instead. 56 56 57 **I Get a '*No Google Books Entry Found for ISBN:NUMBER*' on My Blog... Why?**57 **I get a '*No Google Books Entry Found for ISBN:NUMBER*' on my Blog... Why?** 58 58 59 59 Sometimes Google Books does not return any valid responses on ISBNs. Try the following: … … 63 63 3. Find the eBook on Google's Books Web Page and use its ISBN 64 64 65 **I Get an *Image Not Available* Image on My Blog Instead of the Book Cover, and Clicking It Gives Me a Google 404 Error** 66 67 You will only see this if you are *not* using the Google Books API or, if you are, it failed back to the previous system for some reason. 68 69 Double-check the ISBN you used; it's either wrong or Google does not have an entry for the book referenced. 70 71 **Are You Planning to Insert Other Sources Than Google Books to the Currently Reading Widget?** 65 **Are you planing to insert other sources than Google Books to the Currently Reading widget?** 72 66 73 67 I'll have a look into supporting Amazon, though they do make you jump through hoops to use their API (which is the reason I settled on using Google Books to start with). 74 68 75 **Is There a Way to Get This Plug-In to Do a Library of All of Your Books Into WordPress?**69 **Is there a way to get this plugin to do a library of all of your books into WordPress?** 76 70 77 It's not currently possible with this plug -in, no.71 It's not currently possible with this plugin, no. 78 72 79 73 I'll give it a bit of thought and see if I can extend it to do that; but it will most likely need the creation of an alternate plugin to do that. … … 91 85 == Changelog == 92 86 93 = 4.0. 3=87 = 4.0.4 = 94 88 95 * Allow the centring of the Book Cover within the sidebar (Props Andy Tegala for the suggestion) 96 * Cache Google Books API call (if successful) for (default) 30 days 97 * (Semi-)Gently fall back to previous behaviour if Google Books API call fails 89 * Check cache before using it 90 * Check data validity before writing cache 98 91 99 92 = 4.0.2 = 100 93 101 * Allow *not* using the Google Books API in preference to the older -- direct -- connection94 * Allow (and default to) *not* using the Google Books API in preference to the older -- direct -- connection 102 95 * Since I'm probably the only Saffer using this, default to "books.google.com" 103 96
Note: See TracChangeset
for help on using the changeset viewer.