Plugin Directory

Changeset 972774


Ignore:
Timestamp:
08/26/2014 12:29:16 AM (12 years ago)
Author:
f6s
Message:

added support for deal categories, tagged ver 0.5

Location:
f6s
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • f6s/tags/0.5/f6s.php

    r642398 r972774  
    44Plugin URI: http://www.f6s.com
    55Description: Integrate f6s data into your WordPress Site
    6 Version: 0.4
     6Version: 0.5
    77Author: f6s.com
    88License: GPL2
     
    135135}
    136136
    137 function f6s_get_data( $type, $param ) {
     137function f6s_get_data( $type, $param, $args = array() ) {
    138138    global $f6s_shortcodes, $f6s_transient_pref, $f6s_transient_time;
    139139   
     
    158158                break;
    159159        }
    160         $raw_data = wp_remote_fopen( $api_url );
     160        if ($args) {
     161            $api_url .= '&'.http_build_query($args);
     162        }
     163        $raw_data = file_get_contents( $api_url );
    161164    }
    162165
     
    237240        $param = $f6s_shortcodes[ $tag ][0];
    238241        if( ! isset( $$param ) || ! is_numeric( $$param ) ) return '';
    239 
    240         $data = f6s_get_data( $tag, $$param );
     242       
     243        $args = array();
     244        foreach ($f6s_shortcodes[ $tag ] as $key => $shortcode) {
     245            if ($key == 0) continue;
     246           
     247            if (isset($$shortcode) && !empty($$shortcode))
     248                $args[$shortcode] = $$shortcode;
     249        }
     250
     251        $data = f6s_get_data( $tag, $$param, $args );
    241252    }
    242253
     
    333344        $param = $f6s_shortcodes[ $tag ][0];
    334345        if( ! isset( $$param ) || ! is_numeric( $$param ) ) return '';
    335 
    336         $data = f6s_get_data( $tag, $$param );
     346       
     347        $args = array();
     348        foreach ($f6s_shortcodes[ $tag ] as $key => $shortcode) {
     349            if ($key == 0) continue;
     350           
     351            if (isset($$shortcode) && !empty($$shortcode))
     352                $args[$shortcode] = $$shortcode;
     353        }
     354
     355        $data = f6s_get_data( $tag, $$param, $args );
    337356        $objects = $tag . 's';
    338357        if ( is_object( $data ) && property_exists( $data, $objects ) ) {
  • f6s/trunk/f6s.php

    r642398 r972774  
    44Plugin URI: http://www.f6s.com
    55Description: Integrate f6s data into your WordPress Site
    6 Version: 0.4
     6Version: 0.5
    77Author: f6s.com
    88License: GPL2
     
    135135}
    136136
    137 function f6s_get_data( $type, $param ) {
     137function f6s_get_data( $type, $param, $args = array() ) {
    138138    global $f6s_shortcodes, $f6s_transient_pref, $f6s_transient_time;
    139139   
     
    158158                break;
    159159        }
    160         $raw_data = wp_remote_fopen( $api_url );
     160        if ($args) {
     161            $api_url .= '&'.http_build_query($args);
     162        }
     163        $raw_data = file_get_contents( $api_url );
    161164    }
    162165
     
    237240        $param = $f6s_shortcodes[ $tag ][0];
    238241        if( ! isset( $$param ) || ! is_numeric( $$param ) ) return '';
    239 
    240         $data = f6s_get_data( $tag, $$param );
     242       
     243        $args = array();
     244        foreach ($f6s_shortcodes[ $tag ] as $key => $shortcode) {
     245            if ($key == 0) continue;
     246           
     247            if (isset($$shortcode) && !empty($$shortcode))
     248                $args[$shortcode] = $$shortcode;
     249        }
     250
     251        $data = f6s_get_data( $tag, $$param, $args );
    241252    }
    242253
     
    333344        $param = $f6s_shortcodes[ $tag ][0];
    334345        if( ! isset( $$param ) || ! is_numeric( $$param ) ) return '';
    335 
    336         $data = f6s_get_data( $tag, $$param );
     346       
     347        $args = array();
     348        foreach ($f6s_shortcodes[ $tag ] as $key => $shortcode) {
     349            if ($key == 0) continue;
     350           
     351            if (isset($$shortcode) && !empty($$shortcode))
     352                $args[$shortcode] = $$shortcode;
     353        }
     354
     355        $data = f6s_get_data( $tag, $$param, $args );
    337356        $objects = $tag . 's';
    338357        if ( is_object( $data ) && property_exists( $data, $objects ) ) {
Note: See TracChangeset for help on using the changeset viewer.