Plugin Directory

Changeset 1227384


Ignore:
Timestamp:
08/21/2015 04:06:45 PM (11 years ago)
Author:
road2nowhere
Message:

Tested to 4.3 & switch to use wp_remote_get() rather than curl

Location:
kivaorg-widget/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kivaorg-widget/trunk/kiva.php

    r1181464 r1227384  
    22/*
    33Plugin Name: Kiva Widget
    4 Plugin URI: http://brahminacreations.com/kiva-wordpress-widget/
     4Plugin URI: http://wp.brahminacreations.com/kiva-wordpress-widget/
    55Description: Kiva widget, display your investments on the sidebar
    6 Version: 4.0
     6Version: 4.1
    77Author: Brahmina Burgess
    88Author URI: http://brahminacreations.com
     
    3939
    4040global $kiva_api_app_id;
    41 $kiva_api_app_id = "com.urpidream.wpwidget";
     41$kiva_api_app_id = "com.brahminacreations.kivawpwidget";
    4242
    4343function widget_kiva_loan_init() {
     
    4646        return;
    4747    }
     48   
     49    wp_register_style( 'kww', plugins_url( 'style.css', __FILE__ ) );
     50    wp_enqueue_style( 'kww' );
    4851
    4952    // Print the sidebar widget
     
    7780        }
    7881        $size = $options['image_size'];
    79         if($size > 200){
    80             $size = 200;
     82        if( preg_match('/^\d+$/', $size) ){
     83            $size = $size . 'px';
    8184        }
    8285        $username = $options['kiva_username'];
     
    102105                    flush();
    103106                }
    104                 $ch = curl_init();
    105                 curl_setopt($ch, CURLOPT_URL, $url);
    106                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    107                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
    108                 $response = curl_exec ($ch);
    109                 curl_close ($ch);
    110 
     107                $return = wp_remote_get($url);
     108                $response = $return['body'];
    111109                if($response != ""){
    112110                    $results = json_decode($response);
     
    289287        global $kiva_cache_path;
    290288
    291         $html = "<link rel='stylesheet' href='". get_option('siteurl') . "/wp-content/plugins/kivaorg-widget/style.css' type='text/css' media='screen' />";
    292289        $html .= "<div class='loan'>";
    293290        $html .= "<h3>" . $loan->{name}. "</h3><br />";
     
    343340       
    344341        global $kiva_api_app_id;
    345         $style = "max-height:".$size."px;max-width:".$size."px;width:expression(this.width > ".$size." ? \"".$size."px\" : this.width); height:expression(this.height > ".$size." ? \"".$size."px\" : this.height);";
     342        $style = "width: $size;";
    346343        $html .= "<a href='http://www.kiva.org/lend/" . $loan->{id} . "' target='_new'><img src='$image_src' alt='". $loan->{name} . "' style='".$style."' /></a><br />";
    347344        $html .= "<table>";
     
    361358            $newoptions['number_of_loans'] = strip_tags(stripslashes($_POST['number_of_loans']));
    362359            $newoptions['image_size'] = strip_tags(stripslashes($_POST['image_size']));
     360           
     361            if($newoptions['image_size'] == ''){
     362                $newoptions['image_size'] = '100%';
     363            }
    363364
    364365            if ( $options != $newoptions ) {
     
    376377?>
    377378        <div>
    378         <label for="kiva_username" style="line-height:35px;display:block;">Kiva Lender Name: <input type="text" id="kiva_username" name="kiva_username" value="<?php echo $username ?>" /></label>
    379         <label for="number_of_loans" style="line-height:35px;display:block;">Number of loans (Min. 1): <input type="text" id="number_of_loans" name="number_of_loans" value="<?php echo $number_of_loans; ?>" /></label>
    380         <label for="image_size" style="line-height:35px;display:block;">Image size (Max. 200): <br /><input type="text" id="image_size" name="image_size" value="<?php echo $image_size; ?>" /></label>
     379            <p id="kiva_username_input">
     380                <label for="kiva_username">Kiva Lender Name:</label>
     381                <input id="kiva_username" name="kiva_username" type="text" value="<?php echo $username; ?>">
     382            </p>
     383            <p id="number_of_loans_input">
     384                <label for="number_of_loans">Number of loans (Min. 1):</label>
     385                <input id="number_of_loans" name="number_of_loans" type="text" value="<?php echo $number_of_loans; ?>">
     386            </p>
     387            <p id="number_of_loans_input">
     388                <label for="image_size">Image size (px or %):</label>
     389                <input id="image_size" name="image_size" type="text" value="<?php echo $image_size; ?>">
     390            </p>
    381391        <input type="hidden" name="kiva_loan_submit" id="kiva_loan_submit" value="1" />
    382392        </div>
  • kivaorg-widget/trunk/readme.txt

    r1181464 r1227384  
    11=== Kiva.org Loans Widget ===
    22Contributors: brahmina
    3 Donate link: http://brahminacreations.com/kiva-wordpress-widget/
     3Donate link: http://wp.brahminacreations.com
    44Tags: kiva, widget, microloans
    55Requires at least: 2.8
    66Tested up to: 4.2.2
    7 Stable tag: 4.0
     7Stable tag: 4.1
    88
    99Displays rotating entrepreneurs the blogger has invested in publicly, with pictures and links back to Kiva.org.
     
    1818
    1919The Kiva.org Loans Widget includes caching of the data collected from Kiva.org to prevent a call to Kiva on every page load. This cache clears once a day.
     20
     21Version 4.1 includes text updates and aesthetic fixes
    2022
    2123Version 4.0 includes text updates and testing up to Wordpress 4.2.2.
  • kivaorg-widget/trunk/style.css

    r1181464 r1227384  
    11#kiva_loans div{
    2         font-size: 10px;
    32        padding-left:0px;
    43}
    54#kiva_loans h3{
    6         font-size: 12px;
    7     margin: 0;
     5        margin: 0;
    86}
    97#kiva_loans img {
    10         border: #272727 3px solid;
     8        border: #272727 1px solid;
     9        margin: 0 auto;
    1110}
    1211
    1312#kiva_loans img.kiva_logo {
    14         border: #272727 0px solid;
     13        border: none;
    1514        width: 120px;
    1615}
     
    2322#kiva_loans table td {
    2423        vertical-align: top;
     24        border: none;
    2525}
    2626#loans {
Note: See TracChangeset for help on using the changeset viewer.