radishconcepts / WordPress-GitHub-Plugin-Updater

This class is meant to be used with your Github hosted WordPress plugins. The purpose of the class is to allow your WordPress plugin to be updated whenever you push out a new version of your plugin; similarly to the experience users know and love with the WordPress.org plugin repository.
https://github.com/jkudish/WordPress-GitHub-Plugin-Updater
823 stars 195 forks source link

Access token / queries #30

Closed davidmosterd closed 11 years ago

davidmosterd commented 11 years ago
if ( ! empty( $this->config['access_token'] ) )
    $query = add_query_arg( array( 'access_token' => $this->config['access_token'] ), $query );

Why not check for an access token? This can cause bad requests I believe. Also, why not make a function to build your queries? They are redundant now.

Concept:


function do_request( $query ) {

if ( ! empty( $this->config['access_token'] ) )
    $query = add_query_arg( array( 'access_token' => $this->config['access_token'] ), $query );

$request = wp_remote_get( $query, array( 'sslverify' => $this->config['sslverify'] ) );

// check wp_error? or return it directly

return $request

}