WordPress.org

Plugin Directory

Changeset 626341


Ignore:
Timestamp:
11/17/12 01:36:29 (17 months ago)
Author:
dllh
Message:

Tumblr Importer: Use a filter to get the consumer key so it's pluggable. Also add an action before we do the fetch in case we'd like to do anything fun there (hint: on wpcom, we would).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tumblr-importer/branches/newapi/tumblr-importer.php

    r626309 r626341  
    5050        add_action( 'tumblr_importer_metadata', array( $this, 'tumblr_importer_metadata' ) ); 
    5151        add_filter( 'tumblr_importer_format_post', array( $this, 'filter_format_post' ) ); 
     52        add_filter( 'tumblr_importer_get_consumer_key', array( $this, 'get_consumer_key' ) ); 
    5253        add_filter( 'wp_insert_post_empty_content', array( $this, 'filter_allow_empty_content' ), 10, 2 ); 
    5354        parent::__construct(); 
     
    494495        } 
    495496    } 
    496      
     497 
    497498    function do_pages_import($url) { 
    498499        $start = $this->blog[$url]['pages_complete']; 
     
    550551            $filename = basename($path); 
    551552        } 
    552          
    553553        // Download file to temp location 
    554554        $tmp = download_url( $source ); 
     
    617617            break; 
    618618         
    619             case 'audio': 
     619        case 'audio': 
    620620            // Handle Tumblr Hosted Audio 
    621621            if ( isset( $post['media']['audio'] ) ) { 
     
    733733    } 
    734734 
     735    function get_consumer_key() { 
     736        return $this->consumerkey; 
     737    } 
     738 
    735739    /** 
    736740     * Fetch a subset of posts from a tumblr blog 
     
    746750        $url = trailingslashit( "http://api.tumblr.com/v2/blog/$url/posts/$post_type" ); 
    747751 
     752        do_action( 'tumblr_importer_pre_fetch_posts' ); 
     753 
    748754        $params = array( 
    749755            'offset'=>$start, 
    750756            'limit'=>$count, 
    751             'api_key' => $this->consumerkey, 
     757            'api_key' => apply_filters( 'tumblr_importer_get_consumer_key', '' ), 
    752758        ); 
    753759 
Note: See TracChangeset for help on using the changeset viewer.