WordPress.org

Plugin Directory

Changeset 465343


Ignore:
Timestamp:
11/20/11 19:06:05 (6 years ago)
Author:
RaymondDesign
Message:

Updated to use the Wordpress HTTP API instead of cURL. Ready for vrsion 0.3.3

Location:
advanced-xml-reader
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • advanced-xml-reader/branches/no_curl/advanced-xml-reader.php

    r390213 r465343  
    44Plugin URI: http://dev.raymonddesign.nl/wordpress-plugins/advanced-xml-reader/ 
    55Description: Use the content of every XML file in your posts. 
    6 Version: 0.3.2 
     6Version: 0.3.3 
    77Author: RaymondDesign 
    88Author URI: http://www.raymonddesign.nl/ 
     
    1010*/ 
    1111 
    12 /*  Copyright 2010  RaymondDesign  (email : webmaster@raymonddesign.nl) 
     12/*  Copyright 2011  RaymondDesign  (email : webmaster@raymonddesign.nl) 
    1313 
    1414    This program is free software; you can redistribute it and/or modify 
     
    2626*/ 
    2727 
    28  
    29 // Include a curl library, this lib caches the data, so it's much faster 
    30 // Author: Mike Purvis, http://uwmike.com/maps/curl.php.source 
    31     require_once('curl.php'); 
    3228 
    3329// Define some plugin variables 
     
    3733    $plugindata['shortname']    = 'Advanced XML'; 
    3834    $plugindata['shortnicename']= 'advanced-xml'; 
    39     $plugindata['versionhash']  = 'dgt3kSr2tf'; // This hash represent the current version 
     35    $plugindata['versionhash']  = '8JsxEUxZBc'; // This hash represents the current version 
    4036     
    4137    $pluginvars['remove_tag']   = array(); // Contains the tags that has to be hidden 
     
    189185                </div>'; 
    190186            if($feed = get_option($plugindata['nicename'].'_feed')){ 
    191                 $curl = new CURL(); 
    192                 //$curl->enableCache(); 
    193                 $data = $curl->get($feed); 
    194                 $xml = new SimpleXmlElement($data, LIBXML_NOCDATA); 
    195                 $taglist = aXMLreader_show_data($xml); 
    196                 echo '<table> 
    197                         <tr><td><strong>'.__('XML tag', 'advanced-xml-reader').'</strong></td><td><strong>'.__('Value', 'advanced-xml-reader').'</strong></td><td><strong>'.__('How to use in a post', 'advanced-xml-reader').'</strong></td></tr>'; 
    198                     foreach($taglist as $key => $value){ 
    199                         $tmpvalue = '<em>This is a list containing multiple values.</em>'; 
    200                         if(isset($value[0])){ 
    201                             $tmpvalue = aXMLreader_cutstr($value[0],30); 
    202                         } 
    203                         echo '<tr><td>'.$key.'</td><td>'.$tmpvalue.'</td><td>['.$plugindata['shortnicename'].':'.$key.']</td></tr>'; 
    204                     }   
    205                 echo '</table>'; 
     187                $data = wp_remote_get($feed); 
     188                if(array_key_exists('errors', $data)){ 
     189                    echo __('Unable to load XML file!', 'advanced-xml-reader'); 
     190                }else{ 
     191                    $xml = new SimpleXmlElement($data['body'], LIBXML_NOCDATA); 
     192                    $taglist = aXMLreader_show_data($xml); 
     193                    echo '<table> 
     194                            <tr><td><strong>'.__('XML tag', 'advanced-xml-reader').'</strong></td><td><strong>'.__('Value', 'advanced-xml-reader').'</strong></td><td><strong>'.__('How to use in a post', 'advanced-xml-reader').'</strong></td></tr>'; 
     195                        foreach($taglist as $key => $value){ 
     196                            $tmpvalue = '<em>This is a list containing multiple values.</em>'; 
     197                            if(isset($value[0])){ 
     198                                $tmpvalue = aXMLreader_cutstr($value[0],30); 
     199                            } 
     200                            echo '<tr><td>'.$key.'</td><td>'.$tmpvalue.'</td><td>['.$plugindata['shortnicename'].':'.$key.']</td></tr>'; 
     201                        }   
     202                    echo '</table>'; 
     203                } 
    206204            } 
    207205            echo '<div style="border: 1px solid #ccc; background-color: #EEEEEE; padding: 5px;padding-bottom:13px; width: 700px;margin-top:30px;"> 
     
    228226        global $plugindata, $patterns, $replacements, $pluginvars; 
    229227        if($feed = get_option($plugindata['nicename'].'_feed')){ 
    230             $curl = new CURL(); 
    231             //$curl->enableCache(); 
    232             $data = $curl->get($feed); 
    233             $xml = new SimpleXmlElement($data, LIBXML_NOCDATA); 
    234             $pluginvars['remove_tag'] = explode(',',str_replace(' ','',get_option($plugindata['nicename'].'_hidetag'))); 
    235             $taglist = aXMLreader_create_replace_arrays(aXMLreader_show_data($xml),get_option($plugindata['nicename'].'_rowdel'),get_option($plugindata['nicename'].'_itemdel')); 
    236             //aXMLreader_multiarray_walk($xml,'aXMLreader_fill_replace_arrays'); 
    237             $text = str_replace($taglist['pattern'], $taglist['replace'], $text); 
     228            $data = wp_remote_get($feed); 
     229            if(!array_key_exists('errors', $data)){ 
     230                $xml = new SimpleXmlElement($data['body'], LIBXML_NOCDATA); 
     231                $pluginvars['remove_tag'] = explode(',',str_replace(' ','',get_option($plugindata['nicename'].'_hidetag'))); 
     232                $taglist = aXMLreader_create_replace_arrays(aXMLreader_show_data($xml),get_option($plugindata['nicename'].'_rowdel'),get_option($plugindata['nicename'].'_itemdel')); 
     233                //aXMLreader_multiarray_walk($xml,'aXMLreader_fill_replace_arrays'); 
     234                $text = str_replace($taglist['pattern'], $taglist['replace'], $text); 
     235            } 
     236            // Do nothing on error, we don't want visitors to see errors. 
    238237        } 
    239238        return $text; 
  • advanced-xml-reader/branches/no_curl/readme.txt

    r390213 r465343  
    44Tags: xml, reader, curl, post, page 
    55Requires at least: 2.5 
    6 Tested up to: 3.1.3 
    7 Stable tag: 0.3.2 
     6Tested up to: 3.2.1 
     7Stable tag: 0.3.3 
    88 
    99Use the content of every XML file in your posts. Simply use every xml tag in a post. 
     
    5555* Bugfix: this fixes issues with cURL `followlocation` and PHP in safe mode. It's recommended to update when your server is running PHP in safe mode. 
    5656 
     57= 0.3.3 =  
     58* Now using the Wordpress HTTP API instead of cURL. cURL isn't necessary anymore. 
     59 
    5760== Upgrade Notice == 
    5861 
     
    7477= 0.3.2 = 
    7578This is a bug fix affecting all setups using PHP in safe mode. It's strongly recommended to update. 
     79 
     80= 0.3.3 = 
     81* Now using the Wordpress HTTP API instead of cURL. cURL isn't necessary anymore. Please update when you do not want to use cURL. 
  • advanced-xml-reader/trunk/readme.txt

    r390213 r465343  
    44Tags: xml, reader, curl, post, page 
    55Requires at least: 2.5 
    6 Tested up to: 3.1.3 
    7 Stable tag: 0.3.2 
     6Tested up to: 3.2.1 
     7Stable tag: 0.3.3 
    88 
    99Use the content of every XML file in your posts. Simply use every xml tag in a post. 
     
    5555* Bugfix: this fixes issues with cURL `followlocation` and PHP in safe mode. It's recommended to update when your server is running PHP in safe mode. 
    5656 
     57= 0.3.3 =  
     58* Now using the Wordpress HTTP API instead of cURL. cURL isn't necessary anymore. 
     59 
    5760== Upgrade Notice == 
    5861 
     
    7477= 0.3.2 = 
    7578This is a bug fix affecting all setups using PHP in safe mode. It's strongly recommended to update. 
     79 
     80= 0.3.3 = 
     81* Now using the Wordpress HTTP API instead of cURL. cURL isn't necessary anymore. Please update when you do not want to use cURL. 
Note: See TracChangeset for help on using the changeset viewer.