Changeset 1998254
- Timestamp:
- 12/19/2018 05:11:08 PM (7 years ago)
- Location:
- currently-reading/trunk
- Files:
-
- 2 edited
-
CurrentlyReading.php (modified) (10 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
currently-reading/trunk/CurrentlyReading.php
r1548961 r1998254 5 5 Description: Display a Currently Reading widget using the Google Books API 6 6 Author: Eugéne Roux 7 Version: 4.0. 57 Version: 4.0.6 8 8 Author URI: http://damn.org.za/ 9 9 */ … … 14 14 class CurrentlyReading extends WP_Widget { 15 15 function CurrentlyReading() { 16 $widget_ops = array( 'classname' => 'widget_reading', 'description' => __( 'Display a Currently Reading widget using the Google Books API' ), 'internalcss' => true);17 $this->WP_Widget( 'reading', __( 'Reading', 'reading_widget' ), $widget_ops);16 $widget_ops = array('classname' => 'widget_reading', 'description' => __('Display a Currently Reading widget using the Google Books API'), 'internalcss' => true); 17 $this->WP_Widget('reading', __('Reading', 'reading_widget'), $widget_ops); 18 18 $this->widget_defaults = array( 19 19 'internalcss' => true, … … 29 29 // @see WP_Widget::widget 30 30 // 31 function widget( $args, $instance) {32 $args = wp_parse_args( $args, $this->widget_defaults);33 extract( $args);34 //$widget_options = wp_parse_args( $instance, $this->widget_defaults);35 36 $title = apply_filters( 'widget_title', $instance[ 'title' ]);31 function widget($args, $instance) { 32 $args = wp_parse_args($args, $this->widget_defaults); 33 extract($args); 34 //$widget_options = wp_parse_args($instance, $this->widget_defaults); 35 36 $title = apply_filters('widget_title', $instance[ 'title' ]); 37 37 $internalcss = $instance[ "internalcss" ] ? true : false; 38 38 $centercover = $instance[ "centercover" ] ? true : false; … … 42 42 $localdomain = $instance[ "domain" ] ? $instance[ "domain" ] : "google.com"; 43 43 44 if ( $instance['isbn'] != "") { // No point in a "Currently Reading" if you aren't, is there?45 46 $spacechars = array( ' ', '-', '_');47 $myisbn = str_replace( $spacechars, "", $instance[ 'isbn' ]);44 if ($instance['isbn'] != "") { // No point in a "Currently Reading" if you aren't, is there? 45 46 $spacechars = array(' ', '-', '_'); 47 $myisbn = str_replace($spacechars, "", $instance[ 'isbn' ]); 48 48 49 49 echo $before_widget; 50 if ( $title)50 if ($title) 51 51 echo $before_title . $title . $after_title; // This way we get to choose a "No Title" scenario... 52 52 53 if ( $booksapi == true) {53 if ($booksapi == true) { 54 54 $preerror = ini_get('display_errors'); 55 ini_set( 'display_errors', '0');56 57 $cache = plugin_dir_path( __FILE__) . "." . $myisbn . ".cache";55 ini_set('display_errors', '0'); 56 57 $cache = plugin_dir_path(__FILE__) . "." . $myisbn . ".cache"; 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 and filesize( $cache ) > 50) {61 $bookdata = file_get_contents( $cache);62 $isbnjson = json_decode( $bookdata, true);60 if (file_exists($cache) and time() - filectime($cache) < $cachedays * 24 * 60 * 60 and filesize($cache) > 50) { 61 $bookdata = file_get_contents($cache); 62 $isbnjson = json_decode($bookdata, true); 63 63 print("\n\t<!-- Cache file read... -->\n"); 64 } elseif (( $bookdata = file_get_contents( "https://www.googleapis.com/books/v1/volumes?q=isbn+" . $myisbn))) {65 $isbnjson = json_decode( $bookdata, true);66 if ( $isbnjson[ "totalItems" ] > 0) {64 } elseif (($bookdata = file_get_contents("https://www.googleapis.com/books/v1/volumes?q=isbn+" . $myisbn))) { 65 $isbnjson = json_decode($bookdata, true); 66 if ($isbnjson[ "totalItems" ] > 0) { 67 67 print("\n\t<!-- Google Books API call successful... Write cache file. -->\n"); 68 if ( !file_put_contents( $cache, $bookdata)) {68 if (!file_put_contents($cache, $bookdata)) { 69 69 print("\n\t<!-- Cache file is not writable... This will end in tears. -->\n"); 70 70 } … … 77 77 } 78 78 79 ini_set( 'display_errors', $preerror);79 ini_set('display_errors', $preerror); 80 80 } 81 81 82 print( "\t\t<div");83 84 if ( $centercover or $internalcss) {85 print( " style='");86 if ( $centercover)87 print( "margin-left:auto;margin-right:auto;width:128px;");88 if ( $internalcss)89 print( "padding:1em 1em 0;" ); // print( " style='margin: 1em; padding: 2ex;'");90 print( "'");82 print("\t\t<div"); 83 84 if ($centercover or $internalcss) { 85 print(" style='"); 86 if ($centercover) 87 print("margin-left:auto;margin-right:auto;width:128px;"); 88 if ($internalcss) 89 print("padding:1em 1em 0;"); // print(" style='margin: 1em; padding: 2ex;'"); 90 print("'"); 91 91 } 92 print( " class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n");92 print(" class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n"); 93 93 94 94 $shadow = ''; 95 if ( $boxshadow)95 if ($boxshadow) 96 96 $shadow = "style='-moz-box-shadow: #CCC 5px 5px 5px; -webkit-box-shadow: #CCC 5px 5px 5px; -khtml-box-shadow: #CCC 5px 5px 5px; box-shadow: #CCC 5px 5px 5px;' "; 97 97 98 if ( $booksapi == true and $isbnjson[ "totalItems" ] > 0) {98 if ($booksapi == true and $isbnjson[ "totalItems" ] > 0) { 99 99 100 100 $googlelink = $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'canonicalVolumeLink' ]; 101 101 102 print( "\t\t\t<a href='" . str_replace( "google.com", $localdomain, $googlelink ) . "'>");103 print( "<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' ");104 print( $shadow);105 print( "src='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'imageLinks' ][ 'thumbnail' ] . "' ");106 print( "alt='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ] . "' ");107 print( "title='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ] . "'/></a>\n");108 109 } else if ( $booksapi == true and $isbnjson[ "totalItems" ] == 0) {110 111 print( "\t\t\t<em>No Google Books Entry Found for ISBN: <em>" . $myisbn . "</em>\n");102 print("\t\t\t<a href='" . str_replace("google.com", $localdomain, $googlelink) . "'>"); 103 print("<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' "); 104 print($shadow); 105 print("src='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'imageLinks' ][ 'thumbnail' ] . "' "); 106 print("alt='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ] . "' "); 107 print("title='" . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ] . "'/></a>\n"); 108 109 } else if ($booksapi == true and $isbnjson[ "totalItems" ] == 0) { 110 111 print("\t\t\t<em>No Google Books Entry Found for ISBN: <em>" . $myisbn . "</em>\n"); 112 112 113 113 } else { 114 114 115 print( "\t\t\t<a href='http://books." . $localdomain . "/books?vid=ISBN$myisbn'>");116 print( "<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' ");117 print( $shadow);118 print( "src='http://books." . $localdomain . "/books?vid=ISBN$myisbn&printsec=frontcover&img=1&zoom=1' ");119 print( "alt='ISBN: " . $instance['isbn'] . "' title='ISBN: " . $instance['isbn'] . "'/></a>\n");115 print("\t\t\t<a href='http://books." . $localdomain . "/books?vid=ISBN$myisbn'>"); 116 print("<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' "); 117 print($shadow); 118 print("src='http://books." . $localdomain . "/books?vid=ISBN$myisbn&printsec=frontcover&img=1&zoom=1' "); 119 print("alt='ISBN: " . $instance['isbn'] . "' title='ISBN: " . $instance['isbn'] . "'/></a>\n"); 120 120 121 121 } 122 122 123 print( "\t\t</div>\n");123 print("\t\t</div>\n"); 124 124 echo $after_widget; 125 125 } … … 131 131 // Populates any unknown fields to ensure a coherent instance 132 132 // 133 function update( $new_instance, $old_instance) {133 function update($new_instance, $old_instance) { 134 134 $instance = $old_instance; 135 $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ]);136 $instance[ 'isbn' ] = strip_tags( $new_instance[ 'isbn' ]);135 $instance[ 'title' ] = strip_tags($new_instance[ 'title' ]); 136 $instance[ 'isbn' ] = strip_tags($new_instance[ 'isbn' ]); 137 137 $instance[ 'internalcss' ] = $new_instance[ 'internalcss' ] ? 1 : 0; 138 138 $instance[ "centercover" ] = $new_instance[ "centercover" ] ? 1 : 0; … … 142 142 $instance[ "domain" ] = $new_instance[ "domain" ] ? $new_instance[ "domain" ] : "google.com"; 143 143 144 if ( filter_var( $instance[ "cachedays" ], FILTER_VALIDATE_INT ) === false) {144 if (filter_var($instance[ "cachedays" ], FILTER_VALIDATE_INT) === false) { 145 145 $instance[ "cachedays" ] = 30; 146 146 } … … 152 152 // @see WP_Widget::form 153 153 // 154 function form( $instance) {155 $instance = wp_parse_args( $instance, $this->widget_defaults);156 extract( $instance);157 158 $title = esc_attr( $instance[ 'title' ]);159 $isbn = esc_attr( strip_tags($instance[ 'isbn' ]));154 function form($instance) { 155 $instance = wp_parse_args($instance, $this->widget_defaults); 156 extract($instance); 157 158 $title = esc_attr($instance[ 'title' ]); 159 $isbn = esc_attr(strip_tags($instance[ 'isbn' ])); 160 160 $internalcss = $instance[ 'internalcss' ] ? "checked='checked'" : ""; 161 161 $centercover = $instance[ 'centercover' ] ? "checked='checked'" : ""; … … 165 165 $activedom = $instance[ 'domain' ]; 166 166 167 $googledomains = array( 'Worldwide' => 'google.com', 'Afghanistan' => 'google.com.af', 'Albania' => 'google.al', 'Algeria' => 'google.dz', 'American Samoa' => 'google.as', 'Andorra' => 'google.ad', 'Angola' => 'google.co.ao', 'Anguilla' => 'google.com.ai', 'Antigua and Barbuda' => 'google.com.ag', 'Argentina' => 'google.com.ar', 'Armenia' => 'google.am', 'Ascension Island' => 'google.ac', 'Australia' => 'google.com.au', 'Austria' => 'google.at', 'Azerbaijan' => 'google.az', 'Bahamas' => 'google.bs', 'Bahrain' => 'google.com.bh', 'Bangladesh' => 'google.com.bd', 'Belarus' => 'google.by', 'Belgium' => 'google.be', 'Belize' => 'google.com.bz', 'Benin' => 'google.bj', 'Bhutan' => 'google.bt', 'Bolivia' => 'google.com.bo', 'Bosnia and Herzegovina' => 'google.ba', 'Botswana' => 'google.co.bw', 'Brazil' => 'google.com.br', 'British Indian Ocean Territory' => 'google.io', 'British Virgin Islands' => 'google.vg', 'Brunei' => 'google.com.bn', 'Bulgaria' => 'google.bg', 'Burkina Faso' => 'google.bf', 'Burma' => 'google.com.mm', 'Burundi' => 'google.bi', 'Cambodia' => 'google.com.kh', 'Cameroon' => 'google.cm', 'Canada' => 'google.ca', 'Cape Verde' => 'google.cv', 'Catalonia Catalan Countries' => 'google.cat', 'Central African Republic' => 'google.cf', 'Chad' => 'google.td', 'Chile' => 'google.cl', 'China' => 'g.cn', 'China' => 'google.cn', 'Cocos (Keeling) Islands' => 'google.cc', 'Colombia' => 'google.com.co', 'Cook Islands' => 'google.co.ck', 'Costa Rica' => 'google.co.cr', 'Croatia' => 'google.hr', 'Cuba' => 'google.com.cu', 'Cyprus' => 'google.com.cy', 'Czech Republic' => 'google.cz', 'Democratic Republic of the Congo' => 'google.cd', 'Denmark' => 'google.dk', 'Djibouti' => 'google.dj', 'Dominica' => 'google.dm', 'Dominican Republic' => 'google.com.do', 'Ecuador' => 'google.com.ec', 'Egypt' => 'google.com.eg', 'El Salvador' => 'google.com.sv', 'Estonia' => 'google.ee', 'Ethiopia' => 'google.com.et', 'Federated States of Micronesia' => 'google.fm', 'Fiji' => 'google.com.fj', 'Finland' => 'google.fi', 'France' => 'google.fr', 'French Guiana' => 'google.gf', 'Gabon' => 'google.ga', 'Gambia' => 'google.gm', 'Georgia' => 'google.ge', 'Germany' => 'google.de', 'Ghana' => 'google.com.gh', 'Gibraltar' => 'google.com.gi', 'Greece' => 'google.gr', 'Greenland' => 'google.gl', 'Guadeloupe' => 'google.gp', 'Guatemala' => 'google.com.gt', 'Guernsey' => 'google.gg', 'Guyana' => 'google.gy', 'Haiti' => 'google.ht', 'Honduras' => 'google.hn', 'Hong Kong' => 'google.com.hk', 'Hungary' => 'google.hu', 'Iceland' => 'google.is', 'India' => 'google.co.in', 'Indonesia' => 'google.co.id', 'Iran' => 'google.ir', 'Iraq' => 'google.iq', 'Ireland' => 'google.ie', 'Isle of Man' => 'google.im', 'Israel' => 'google.co.il', 'Italy' => 'google.it', 'Ivory Coast' => 'google.ci', 'Jamaica' => 'google.com.jm', 'Japan' => 'google.co.jp', 'Jersey' => 'google.je', 'Jordan' => 'google.jo', 'Kazakhstan' => 'google.kz', 'Kenya' => 'google.co.ke', 'Kiribati' => 'google.ki', 'Kuwait' => 'google.com.kw', 'Kyrgyzstan' => 'google.kg', 'Laos' => 'google.la', 'Latvia' => 'google.lv', 'Lebanon' => 'google.com.lb', 'Lesotho' => 'google.co.ls', 'Libya' => 'google.com.ly', 'Liechtenstein' => 'google.li', 'Lithuania' => 'google.lt', 'Luxembourg' => 'google.lu', 'Macedonia' => 'google.mk', 'Madagascar' => 'google.mg', 'Malawi' => 'google.mw', 'Malaysia' => 'google.com.my', 'Maldives' => 'google.mv', 'Mali' => 'google.ml', 'Malta' => 'google.com.mt', 'Mauritius' => 'google.mu', 'Mexico' => 'google.com.mx', 'Moldova' => 'google.md', 'Mongolia' => 'google.mn', 'Montenegro' => 'google.me', 'Montserrat' => 'google.ms', 'Morocco' => 'google.co.ma', 'Mozambique' => 'google.co.mz', 'Namibia' => 'google.com.na', 'Nauru' => 'google.nr', 'Nepal' => 'google.com.np', 'Netherlands' => 'google.nl', 'New Zealand' => 'google.co.nz', 'Nicaragua' => 'google.com.ni', 'Niger' => 'google.ne', 'Nigeria' => 'google.com.ng', 'Niue' => 'google.nu', 'Norfolk Island' => 'google.com.nf', 'Norway' => 'google.no', 'Oman' => 'google.com.om', 'Pakistan' => 'google.com.pk', 'Palestine' => 'google.ps', 'Panama' => 'google.com.pa', 'Papua New Guinea' => 'google.com.pg', 'Paraguay' => 'google.com.py', 'Peru' => 'google.com.pe', 'Philippines' => 'google.com.ph', 'Pitcairn Islands' => 'google.pn', 'Poland' => 'google.pl', 'Portugal' => 'google.pt', 'Puerto Rico' => 'google.com.pr', 'Qatar' => 'google.com.qa', 'Republic of the Congo' => 'google.cg', 'Romania' => 'google.ro', 'Russia' => 'google.ru', 'Rwanda' => 'google.rw', 'Saint Helena, Ascension, Tristan da Cunha' => 'google.sh', 'Saint Lucia' => 'google.com.lc', 'Saint Vincent and the Grenadines' => 'google.com.vc', 'Samoa' => 'google.ws', 'San Marino' => 'google.sm', 'Saudi Arabia' => 'google.com.sa', 'Senegal' => 'google.sn', 'Serbia' => 'google.rs', 'Seychelles' => 'google.sc', 'Sierra Leone' => 'google.com.sl', 'Singapore' => 'google.com.sg', 'Slovakia' => 'google.sk', 'Slovenia' => 'google.si', 'Solomon Islands' => 'google.com.sb', 'Somalia' => 'google.so', 'South Africa' => 'google.co.za', 'South Korea' => 'google.co.kr', 'Spain' => 'google.es', 'Sri Lanka' => 'google.lk', 'Sweden' => 'google.se', 'Switzerland' => 'google.ch', 'São Tomé and Príncipe' => 'google.st', 'Taiwan' => 'google.com.tw', 'Tajikistan' => 'google.com.tj', 'Tanzania' => 'google.co.tz', 'Thailand' => 'google.co.th', 'Timor-Leste' => 'google.tl', 'Togo' => 'google.tg', 'Tokelau' => 'google.tk', 'Tonga' => 'google.to', 'Trinidad and Tobago' => 'google.tt', 'Tunisia' => 'google.com.tn', 'Tunisia' => 'google.tn', 'Turkey' => 'google.com.tr', 'Turkmenistan' => 'google.tm', 'Uganda' => 'google.co.ug', 'Ukraine' => 'google.com.ua', 'United Arab Emirates' => 'google.ae', 'United Kingdom' => 'google.co.uk', 'United States Virgin Islands' => 'google.co.vi', 'United States' => 'google.us', 'Uruguay' => 'google.com.uy', 'Uzbekistan' => 'google.co.uz', 'Vanuatu' => 'google.vu', 'Venezuela' => 'google.co.ve', 'Vietnam' => 'google.com.vn', 'Zambia' => 'google.co.zm', 'Zimbabwe' => 'google.co.zw');168 169 print( "\t<p>\n\t\t<label for='" . $this->get_field_id("title") . "'>" ); _e( "Title:");170 print( "\n\t\t\t<input class='widefat' id='" . $this->get_field_id('title') . "' name='");171 print( $this->get_field_name( 'title' ) . "' type='text' value='" . $title);172 print( "' />\n\t\t</label>\n\t\t<em>Leave blank for no title</em>\n\t</p>\n");173 174 print( "\t<p>\n\t\t<label for='" . $this->get_field_id( "isbn" ) . "'>" ); _e( "ISBN:");175 print( "\n\t\t\t<input class='widefat' id='" . $this->get_field_id( 'isbn' ) . "' name='");176 print( $this->get_field_name( "isbn" ) . "' type='text' value='" . $isbn . "' />\n\t\t</label>\n\t</p>\n");177 178 print( "\t<p>\n");179 print( "\t\t<input class='checkbox' type='checkbox' " . $booksapi);180 print( " id='" . $this->get_field_id( "booksapi" ) . "' name='" . $this->get_field_name( "booksapi" ) . "'/>\n");181 print( "\t\t<label for='" . $this->get_field_id( "booksapi" ) . "'>" ); _e( "Use the Google Books API");182 print( "<title>Deselecting this will attempt to brute-force the Google Books lookup</title></label>\n\t<br />");183 184 print( "\t\t<input class='checkbox' type='checkbox' " . $centercover);185 print( " id='" . $this->get_field_id( "centercover" ) . "' name='" . $this->get_field_name( "centercover" ) . "'/>\n");186 print( "\t\t<label for='" . $this->get_field_id( "centercover" ) . "'>" ); _e( "Center the Book Cover");187 print( "</label>\n\t<br />\n");188 189 print( "\t\t<input class='checkbox' type='checkbox' " . $internalcss);190 print( " id='" . $this->get_field_id( "internalcss" ) . "' name='" . $this->get_field_name( "internalcss" ) . "'/>\n");191 print( "\t\t<label for='" . $this->get_field_id( "internalcss" ) . "'>" ); _e( "Pad the Image");192 print( "</label>\n\t<br />\n");193 194 print( "\t\t<input class='checkbox' type='checkbox' " . $boxshadow);195 print( " id='" . $this->get_field_id( "boxshadow" ) . "' name='" . $this->get_field_name( "boxshadow" ) . "'/>\n");196 197 print( "\t\t<label for='" . $this->get_field_id( "boxshadow" ) . "'>" ); _e( "Display a Box-Shadow");198 print( "</label>\n\t</p>\n");199 200 print( "\t<p>\n\t\t<label for='" . $this->get_field_id( "cachedays" ) . "'>" ); _e( "Cache Data for (days):");201 print( "\n\t\t\t<input class='widefat' id='" . $this->get_field_id( 'cachedays' ) . "' name='");202 print( $this->get_field_name( "cachedays" ) . "' type='text' value='" . $cachedays . "' />\n\t\t</label>\n\t</p>\n");203 204 print( "\t<p>\n");205 _e( "Choose Alternate Google Country");206 print( "\t\t<select class='select' type='select' id='" . $this->get_field_id( "domain" ) . "' name='" . $this->get_field_name( "domain") . "'>\n");207 foreach ( $googledomains as $country => $domain) {208 if ( $domain == $activedom)209 print( "\t\t\t<option value='$domain' selected>$country</option>\n");167 $googledomains = array('Worldwide' => 'google.com', 'Afghanistan' => 'google.com.af', 'Albania' => 'google.al', 'Algeria' => 'google.dz', 'American Samoa' => 'google.as', 'Andorra' => 'google.ad', 'Angola' => 'google.co.ao', 'Anguilla' => 'google.com.ai', 'Antigua and Barbuda' => 'google.com.ag', 'Argentina' => 'google.com.ar', 'Armenia' => 'google.am', 'Ascension Island' => 'google.ac', 'Australia' => 'google.com.au', 'Austria' => 'google.at', 'Azerbaijan' => 'google.az', 'Bahamas' => 'google.bs', 'Bahrain' => 'google.com.bh', 'Bangladesh' => 'google.com.bd', 'Belarus' => 'google.by', 'Belgium' => 'google.be', 'Belize' => 'google.com.bz', 'Benin' => 'google.bj', 'Bhutan' => 'google.bt', 'Bolivia' => 'google.com.bo', 'Bosnia and Herzegovina' => 'google.ba', 'Botswana' => 'google.co.bw', 'Brazil' => 'google.com.br', 'British Indian Ocean Territory' => 'google.io', 'British Virgin Islands' => 'google.vg', 'Brunei' => 'google.com.bn', 'Bulgaria' => 'google.bg', 'Burkina Faso' => 'google.bf', 'Burma' => 'google.com.mm', 'Burundi' => 'google.bi', 'Cambodia' => 'google.com.kh', 'Cameroon' => 'google.cm', 'Canada' => 'google.ca', 'Cape Verde' => 'google.cv', 'Catalonia Catalan Countries' => 'google.cat', 'Central African Republic' => 'google.cf', 'Chad' => 'google.td', 'Chile' => 'google.cl', 'China' => 'g.cn', 'China' => 'google.cn', 'Cocos (Keeling) Islands' => 'google.cc', 'Colombia' => 'google.com.co', 'Cook Islands' => 'google.co.ck', 'Costa Rica' => 'google.co.cr', 'Croatia' => 'google.hr', 'Cuba' => 'google.com.cu', 'Cyprus' => 'google.com.cy', 'Czech Republic' => 'google.cz', 'Democratic Republic of the Congo' => 'google.cd', 'Denmark' => 'google.dk', 'Djibouti' => 'google.dj', 'Dominica' => 'google.dm', 'Dominican Republic' => 'google.com.do', 'Ecuador' => 'google.com.ec', 'Egypt' => 'google.com.eg', 'El Salvador' => 'google.com.sv', 'Estonia' => 'google.ee', 'Ethiopia' => 'google.com.et', 'Federated States of Micronesia' => 'google.fm', 'Fiji' => 'google.com.fj', 'Finland' => 'google.fi', 'France' => 'google.fr', 'French Guiana' => 'google.gf', 'Gabon' => 'google.ga', 'Gambia' => 'google.gm', 'Georgia' => 'google.ge', 'Germany' => 'google.de', 'Ghana' => 'google.com.gh', 'Gibraltar' => 'google.com.gi', 'Greece' => 'google.gr', 'Greenland' => 'google.gl', 'Guadeloupe' => 'google.gp', 'Guatemala' => 'google.com.gt', 'Guernsey' => 'google.gg', 'Guyana' => 'google.gy', 'Haiti' => 'google.ht', 'Honduras' => 'google.hn', 'Hong Kong' => 'google.com.hk', 'Hungary' => 'google.hu', 'Iceland' => 'google.is', 'India' => 'google.co.in', 'Indonesia' => 'google.co.id', 'Iran' => 'google.ir', 'Iraq' => 'google.iq', 'Ireland' => 'google.ie', 'Isle of Man' => 'google.im', 'Israel' => 'google.co.il', 'Italy' => 'google.it', 'Ivory Coast' => 'google.ci', 'Jamaica' => 'google.com.jm', 'Japan' => 'google.co.jp', 'Jersey' => 'google.je', 'Jordan' => 'google.jo', 'Kazakhstan' => 'google.kz', 'Kenya' => 'google.co.ke', 'Kiribati' => 'google.ki', 'Kuwait' => 'google.com.kw', 'Kyrgyzstan' => 'google.kg', 'Laos' => 'google.la', 'Latvia' => 'google.lv', 'Lebanon' => 'google.com.lb', 'Lesotho' => 'google.co.ls', 'Libya' => 'google.com.ly', 'Liechtenstein' => 'google.li', 'Lithuania' => 'google.lt', 'Luxembourg' => 'google.lu', 'Macedonia' => 'google.mk', 'Madagascar' => 'google.mg', 'Malawi' => 'google.mw', 'Malaysia' => 'google.com.my', 'Maldives' => 'google.mv', 'Mali' => 'google.ml', 'Malta' => 'google.com.mt', 'Mauritius' => 'google.mu', 'Mexico' => 'google.com.mx', 'Moldova' => 'google.md', 'Mongolia' => 'google.mn', 'Montenegro' => 'google.me', 'Montserrat' => 'google.ms', 'Morocco' => 'google.co.ma', 'Mozambique' => 'google.co.mz', 'Namibia' => 'google.com.na', 'Nauru' => 'google.nr', 'Nepal' => 'google.com.np', 'Netherlands' => 'google.nl', 'New Zealand' => 'google.co.nz', 'Nicaragua' => 'google.com.ni', 'Niger' => 'google.ne', 'Nigeria' => 'google.com.ng', 'Niue' => 'google.nu', 'Norfolk Island' => 'google.com.nf', 'Norway' => 'google.no', 'Oman' => 'google.com.om', 'Pakistan' => 'google.com.pk', 'Palestine' => 'google.ps', 'Panama' => 'google.com.pa', 'Papua New Guinea' => 'google.com.pg', 'Paraguay' => 'google.com.py', 'Peru' => 'google.com.pe', 'Philippines' => 'google.com.ph', 'Pitcairn Islands' => 'google.pn', 'Poland' => 'google.pl', 'Portugal' => 'google.pt', 'Puerto Rico' => 'google.com.pr', 'Qatar' => 'google.com.qa', 'Republic of the Congo' => 'google.cg', 'Romania' => 'google.ro', 'Russia' => 'google.ru', 'Rwanda' => 'google.rw', 'Saint Helena, Ascension, Tristan da Cunha' => 'google.sh', 'Saint Lucia' => 'google.com.lc', 'Saint Vincent and the Grenadines' => 'google.com.vc', 'Samoa' => 'google.ws', 'San Marino' => 'google.sm', 'Saudi Arabia' => 'google.com.sa', 'Senegal' => 'google.sn', 'Serbia' => 'google.rs', 'Seychelles' => 'google.sc', 'Sierra Leone' => 'google.com.sl', 'Singapore' => 'google.com.sg', 'Slovakia' => 'google.sk', 'Slovenia' => 'google.si', 'Solomon Islands' => 'google.com.sb', 'Somalia' => 'google.so', 'South Africa' => 'google.co.za', 'South Korea' => 'google.co.kr', 'Spain' => 'google.es', 'Sri Lanka' => 'google.lk', 'Sweden' => 'google.se', 'Switzerland' => 'google.ch', 'São Tomé and Príncipe' => 'google.st', 'Taiwan' => 'google.com.tw', 'Tajikistan' => 'google.com.tj', 'Tanzania' => 'google.co.tz', 'Thailand' => 'google.co.th', 'Timor-Leste' => 'google.tl', 'Togo' => 'google.tg', 'Tokelau' => 'google.tk', 'Tonga' => 'google.to', 'Trinidad and Tobago' => 'google.tt', 'Tunisia' => 'google.com.tn', 'Tunisia' => 'google.tn', 'Turkey' => 'google.com.tr', 'Turkmenistan' => 'google.tm', 'Uganda' => 'google.co.ug', 'Ukraine' => 'google.com.ua', 'United Arab Emirates' => 'google.ae', 'United Kingdom' => 'google.co.uk', 'United States Virgin Islands' => 'google.co.vi', 'United States' => 'google.us', 'Uruguay' => 'google.com.uy', 'Uzbekistan' => 'google.co.uz', 'Vanuatu' => 'google.vu', 'Venezuela' => 'google.co.ve', 'Vietnam' => 'google.com.vn', 'Zambia' => 'google.co.zm', 'Zimbabwe' => 'google.co.zw'); 168 169 print("\t<p>\n\t\t<label for='" . $this->get_field_id("title") . "'>"); _e("Title:"); 170 print("\n\t\t\t<input class='widefat' id='" . $this->get_field_id('title') . "' name='"); 171 print($this->get_field_name('title') . "' type='text' value='" . $title); 172 print("' />\n\t\t</label>\n\t\t<em>Leave blank for no title</em>\n\t</p>\n"); 173 174 print("\t<p>\n\t\t<label for='" . $this->get_field_id("isbn") . "'>"); _e("ISBN:"); 175 print("\n\t\t\t<input class='widefat' id='" . $this->get_field_id('isbn') . "' name='"); 176 print($this->get_field_name("isbn") . "' type='text' value='" . $isbn . "' />\n\t\t</label>\n\t</p>\n"); 177 178 print("\t<p>\n"); 179 print("\t\t<input class='checkbox' type='checkbox' " . $booksapi); 180 print(" id='" . $this->get_field_id("booksapi") . "' name='" . $this->get_field_name("booksapi") . "'/>\n"); 181 print("\t\t<label for='" . $this->get_field_id("booksapi") . "'>"); _e("Use the Google Books API"); 182 print("<title>Deselecting this will attempt to brute-force the Google Books lookup</title></label>\n\t<br />"); 183 184 print("\t\t<input class='checkbox' type='checkbox' " . $centercover); 185 print(" id='" . $this->get_field_id("centercover") . "' name='" . $this->get_field_name("centercover") . "'/>\n"); 186 print("\t\t<label for='" . $this->get_field_id("centercover") . "'>"); _e("Center the Book Cover"); 187 print("</label>\n\t<br />\n"); 188 189 print("\t\t<input class='checkbox' type='checkbox' " . $internalcss); 190 print(" id='" . $this->get_field_id("internalcss") . "' name='" . $this->get_field_name("internalcss") . "'/>\n"); 191 print("\t\t<label for='" . $this->get_field_id("internalcss") . "'>"); _e("Pad the Image"); 192 print("</label>\n\t<br />\n"); 193 194 print("\t\t<input class='checkbox' type='checkbox' " . $boxshadow); 195 print(" id='" . $this->get_field_id("boxshadow") . "' name='" . $this->get_field_name("boxshadow") . "'/>\n"); 196 197 print("\t\t<label for='" . $this->get_field_id("boxshadow") . "'>"); _e("Display a Box-Shadow"); 198 print("</label>\n\t</p>\n"); 199 200 print("\t<p>\n\t\t<label for='" . $this->get_field_id("cachedays") . "'>"); _e("Cache Data for (days):"); 201 print("\n\t\t\t<input class='widefat' id='" . $this->get_field_id('cachedays') . "' name='"); 202 print($this->get_field_name("cachedays") . "' type='text' value='" . $cachedays . "' />\n\t\t</label>\n\t</p>\n"); 203 204 print("\t<p>\n"); 205 _e("Choose Alternate Google Country"); 206 print("\t\t<select class='select' type='select' id='" . $this->get_field_id("domain") . "' name='" . $this->get_field_name("domain") . "'>\n"); 207 foreach ($googledomains as $country => $domain) { 208 if ($domain == $activedom) 209 print("\t\t\t<option value='$domain' selected>$country</option>\n"); 210 210 else 211 print( "\t\t\t<option value='$domain'>$country</option>\n");211 print("\t\t\t<option value='$domain'>$country</option>\n"); 212 212 } 213 print( "\t\t</select>\n");214 print( "\t\t<br /><em>Please change if your audience gets a Google '500' error</em>\n\t</p>\n");213 print("\t\t</select>\n"); 214 print("\t\t<br /><em>Please change if your audience gets a Google '500' error</em>\n\t</p>\n"); 215 215 } 216 216 } … … 219 219 // register CurrentlyReading widget 220 220 // 221 add_action( 'widgets_init', create_function( '', 'return register_widget( "CurrentlyReading" );'));221 add_action('widgets_init', create_function('', 'return register_widget("CurrentlyReading");')); 222 222 ?> -
currently-reading/trunk/readme.txt
r1548961 r1998254 4 4 Tags: books, read, reading, admin, administration, jadb 5 5 Requires at least: 3 6 Tested up to: 4.76 Tested up to: 5.1 7 7 Stable tag: trunk 8 8
Note: See TracChangeset
for help on using the changeset viewer.