Plugin Directory

Changeset 532865


Ignore:
Timestamp:
04/18/2012 02:04:17 PM (14 years ago)
Author:
rgubby
Message:

fixed issue when user does not have curl

Location:
bing-maps-for-wordpress
Files:
13 added
4 edited

Legend:

Unmodified
Added
Removed
  • bing-maps-for-wordpress/readme.txt

    r324317 r532865  
    44Tags: bing maps, wordpress, mapping
    55Requires at least: 3.0
    6 Tested up to: 3.0.3
    7 Stable tag: 1.5
     6Tested up to: 3.3.1
     7Stable tag: 1.6
    88
    99Bing Maps for WordPress allows you to place either a static or dynamic Bing map on your blog post with a simple shortcode
     
    108108== Changelog ==
    109109
     110= 1.6 =
     111* Tested compatibility for WordPress 3.3.1
     112* Fixed issue when user does not have curl installed
     113
    110114= 1.5 =
    111115* Added compatibility for WordPress 3.0.3
  • bing-maps-for-wordpress/trunk/bing-maps-for-wordpress.php

    r324317 r532865  
    55Description: Use a shortcode to create a Bing map on your site
    66Author: Rich Gubby
    7 Version: 1.5
     7Version: 1.6
    88Author URI: http://redyellow.co.uk/
    99*/
  • bing-maps-for-wordpress/trunk/content.php

    r324317 r532865  
    197197            $url = 'http://dev.virtualearth.net/REST/v1/Locations?q='.$location.'&o=xml&key='.$this->apiKey;
    198198           
    199             $curl = curl_init($url);
    200             curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    201             $contents = curl_exec($curl);
    202             curl_close($curl);
     199            if(function_exists('curl_init'))
     200            {
     201                $curl = curl_init($url);
     202                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     203                $contents = curl_exec($curl);
     204                curl_close($curl);
     205            } else
     206            {
     207                $response = wp_remote_get( $url );
     208                $contents = wp_remote_retrieve_body( $response );
     209            }
    203210           
    204211            // Build XML
    205             $xml = simplexml_load_string($contents);
    206            
    207             // If we have a location, return it
    208             if(isset($xml->ResourceSets->ResourceSet->Resources->Location->Point))
    209             {
    210                 return array(
    211                     'lat' => trim($xml->ResourceSets->ResourceSet->Resources->Location->Point->Latitude),
    212                     'long' => trim($xml->ResourceSets->ResourceSet->Resources->Location->Point->Longitude)
    213                 );
     212            if(function_exists('simplexml_load_string'))
     213            {
     214                $xml = simplexml_load_string($contents);
     215               
     216                // If we have a location, return it
     217                if(isset($xml->ResourceSets->ResourceSet->Resources->Location->Point))
     218                {
     219                    return array(
     220                        'lat' => trim($xml->ResourceSets->ResourceSet->Resources->Location->Point->Latitude),
     221                        'long' => trim($xml->ResourceSets->ResourceSet->Resources->Location->Point->Longitude)
     222                    );
     223                }
    214224            }
    215225            return false;
  • bing-maps-for-wordpress/trunk/readme.txt

    r324317 r532865  
    44Tags: bing maps, wordpress, mapping
    55Requires at least: 3.0
    6 Tested up to: 3.0.3
    7 Stable tag: 1.5
     6Tested up to: 3.3.1
     7Stable tag: 1.6
    88
    99Bing Maps for WordPress allows you to place either a static or dynamic Bing map on your blog post with a simple shortcode
     
    108108== Changelog ==
    109109
     110= 1.6 =
     111* Tested compatibility for WordPress 3.3.1
     112* Fixed issue when user does not have curl installed
     113
    110114= 1.5 =
    111115* Added compatibility for WordPress 3.0.3
Note: See TracChangeset for help on using the changeset viewer.