Plugin Directory

Changeset 1998254


Ignore:
Timestamp:
12/19/2018 05:11:08 PM (7 years ago)
Author:
eroux
Message:

Updated to Wordpress 5

Location:
currently-reading/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • currently-reading/trunk/CurrentlyReading.php

    r1548961 r1998254  
    55    Description: Display a Currently Reading widget using the Google Books API
    66    Author: Eugéne Roux
    7     Version: 4.0.5
     7    Version: 4.0.6
    88    Author URI: http://damn.org.za/
    99 */
     
    1414class CurrentlyReading extends WP_Widget {
    1515    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);
    1818        $this->widget_defaults = array(
    1919            'internalcss' => true,
     
    2929    //  @see WP_Widget::widget
    3030    //
    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' ]);
    3737        $internalcss = $instance[ "internalcss" ] ? true : false;
    3838        $centercover = $instance[ "centercover" ] ? true : false;
     
    4242        $localdomain = $instance[ "domain" ]      ? $instance[ "domain" ] : "google.com";
    4343
    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' ]);
    4848
    4949            echo $before_widget;
    50             if ( $title )
     50            if ($title)
    5151                echo $before_title . $title . $after_title; // This way we get to choose a "No Title" scenario...
    5252
    53             if ( $booksapi == true ) {
     53            if ($booksapi == true) {
    5454                $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";
    5858                #print("\n\t<!-- Cache file is " . $cache . "... -->\n");
    5959
    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);
    6363                    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) {
    6767                        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)) {
    6969                            print("\n\t<!-- Cache file is not writable... This will end in tears. -->\n");
    7070                        }
     
    7777                }
    7878
    79                 ini_set( 'display_errors', $preerror );
     79                ini_set('display_errors', $preerror);
    8080            }
    8181
    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("'");
    9191            }
    92             print( " class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n");
     92            print(" class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n");
    9393
    9494            $shadow = '';
    95             if ( $boxshadow )
     95            if ($boxshadow)
    9696                $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;' ";
    9797
    98             if ( $booksapi == true and $isbnjson[ "totalItems" ] > 0 ) {
     98            if ($booksapi == true and $isbnjson[ "totalItems" ] > 0) {
    9999
    100100                $googlelink = $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'canonicalVolumeLink' ];
    101101
    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");
    112112
    113113            } else {
    114114
    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");
    120120
    121121            }
    122122
    123             print( "\t\t</div>\n");
     123            print("\t\t</div>\n");
    124124            echo $after_widget;
    125125        }
     
    131131    //  Populates any unknown fields to ensure a coherent instance
    132132    //
    133     function update( $new_instance, $old_instance ) {
     133    function update($new_instance, $old_instance) {
    134134        $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' ]);
    137137        $instance[ 'internalcss' ]  = $new_instance[ 'internalcss' ] ? 1 : 0;
    138138        $instance[ "centercover" ]  = $new_instance[ "centercover" ] ? 1 : 0;
     
    142142        $instance[ "domain" ]       = $new_instance[ "domain" ]      ? $new_instance[ "domain" ] : "google.com";
    143143
    144         if ( filter_var( $instance[ "cachedays" ], FILTER_VALIDATE_INT ) === false ) {
     144        if (filter_var($instance[ "cachedays" ], FILTER_VALIDATE_INT) === false) {
    145145            $instance[ "cachedays" ] = 30;
    146146        }
     
    152152    //  @see WP_Widget::form
    153153    //
    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' ]));
    160160        $internalcss = $instance[ 'internalcss' ] ? "checked='checked'" : "";
    161161        $centercover = $instance[ 'centercover' ] ? "checked='checked'" : "";
     
    165165        $activedom   = $instance[ 'domain' ];
    166166
    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");
    210210            else
    211                 print( "\t\t\t<option value='$domain'>$country</option>\n" );
     211                print("\t\t\t<option value='$domain'>$country</option>\n");
    212212        }
    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");
    215215    }
    216216}
     
    219219//  register CurrentlyReading widget
    220220//
    221 add_action( 'widgets_init', create_function( '', 'return register_widget( "CurrentlyReading" );' ));
     221add_action('widgets_init', create_function('', 'return register_widget("CurrentlyReading");'));
    222222?>
  • currently-reading/trunk/readme.txt

    r1548961 r1998254  
    44Tags: books, read, reading, admin, administration, jadb
    55Requires at least: 3
    6 Tested up to: 4.7
     6Tested up to: 5.1
    77Stable tag: trunk
    88
Note: See TracChangeset for help on using the changeset viewer.