Plugin Directory

Changeset 2238411


Ignore:
Timestamp:
02/04/2020 02:57:58 PM (6 years ago)
Author:
eroux
Message:

add (default) option to open in a new tab/page

Location:
currently-reading/trunk
Files:
2 edited

Legend:

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

    r2155735 r2238411  
    55    Description: Display a Currently Reading widget using the Google Books API
    66    Author: Eugéne Roux
    7     Version: 4.0.7
     7    Version: 4.0.8
    88    Author URI: https://damn.org.za/
    99 */
     
    1717        $this->WP_Widget('reading', __('Reading', 'reading_widget'), $widget_ops);
    1818        $this->widget_defaults = array(
     19            'newtab'      => true,
    1920            'internalcss' => true,
    2021            'centercover' => false,
     
    3637
    3738        $title = apply_filters('widget_title', $instance[ 'title' ]);
     39        $newtab      = $instance[ "newtab" ]      ? true : false;
    3840        $internalcss = $instance[ "internalcss" ] ? true : false;
    3941        $centercover = $instance[ "centercover" ] ? true : false;
     
    9597            print(" class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n");
    9698
     99            $tabextra='';
     100            if ($newtab)
     101                $tabextra = ' target="_blank"';
     102
    97103            $shadow = '';
    98104            if ($boxshadow)
     
    104110                $googlelink = $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'canonicalVolumeLink' ];
    105111
    106                 print("\t\t\t<a href='" . str_replace("google.com", $localdomain, $googlelink) . "'>");
     112                print("\t\t\t<a href='" . str_replace("google.com", $localdomain, $googlelink) . "'" . $tabextra . ">");
    107113                print("<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' ");
    108114                print($shadow);
     
    126132                    $uri = 'http';
    127133                }
    128                 print("\t\t\t<a href='" . $uri . "://books." . $localdomain . "/books?vid=ISBN$myisbn'>");
     134                print("\t\t\t<a href='" . $uri . "://books." . $localdomain . "/books?vid=ISBN$myisbn'" . $tabextra . ">");
    129135                print("<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' ");
    130136                print($shadow);
     
    148154        $instance[ 'title' ]        = strip_tags($new_instance[ 'title' ]);
    149155        $instance[ 'isbn' ]         = strip_tags($new_instance[ 'isbn' ]);
     156        $instance[ 'newtab' ]       = $new_instance[ 'newtab' ]      ? 1 : 0;
    150157        $instance[ 'internalcss' ]  = $new_instance[ 'internalcss' ] ? 1 : 0;
    151158        $instance[ "centercover" ]  = $new_instance[ "centercover" ] ? 1 : 0;
     
    172179        $title       = esc_attr($instance[ 'title' ]);
    173180        $isbn        = esc_attr(strip_tags($instance[ 'isbn' ]));
     181        $newtab      = $instance[ 'newtab' ]      ? "checked='checked'" : "";
    174182        $internalcss = $instance[ 'internalcss' ] ? "checked='checked'" : "";
    175183        $centercover = $instance[ 'centercover' ] ? "checked='checked'" : "";
     
    201209        print("\t\t<label for='" . $this->get_field_id("usetls") . "'>"); _e("Force all calls to use 'https'");
    202210        print("<title>Use 'https'. Deselecting this will connect using 'http' and will not force 'https' links when using the API.</title></label>\n\t<br />");
     211
     212        print("\t\t<input class='checkbox' type='checkbox' " . $newtab);
     213        print(" id='" . $this->get_field_id("newtab") . "' name='" . $this->get_field_name("newtab") . "'/>\n");
     214        print("\t\t<label for='" . $this->get_field_id("newtab") . "'>"); _e("Open Link in a New Tab/Window");
     215        print("</label>\n\t<br />\n");
    203216
    204217        print("\t\t<input class='checkbox' type='checkbox' " . $centercover);
  • currently-reading/trunk/readme.txt

    r2155753 r2238411  
    44Tags: books, read, reading, admin, administration, jadb
    55Requires at least: 3
    6 Tested up to: 5.2.3
     6Tested up to: 5.3.2
    77Stable tag: trunk
    88
     
    8888== Changelog ==
    8989
     90= 4.0.8 =
     91
     92* Add option to open Google Books link in a new Tab/Window
     93
    9094= 4.0.7 =
    9195
Note: See TracChangeset for help on using the changeset viewer.