Permalink
Browse files

prevent error when URL is not provided

  • Loading branch information...
1 parent 20c7499 commit 7b387eca8073b70bcafb76bf54d41ea72faf4a87 @benbalter benbalter committed Jan 5, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 class.csv-to-api.php
@@ -29,7 +29,7 @@ function parse_query( $query = null ) {
// Define a series of configuration variables based on what was requested in the query.
$this->source = isset( $query['source'] ) ? $this->esc_url( $query['source'] ) : null;
- $this->source_format = isset( $query['source_format'] ) ? $query['source_format'] : $this->get_extension( $this->url );
+ $this->source_format = isset( $query['source_format'] ) ? $query['source_format'] : $this->get_extension( $this->source );
$this->format = isset( $query['format'] ) ? $query['format'] : 'json';
$this->callback = isset( $query['callback'] ) ? $this->jsonp_callback_filter( $query['callback'] ) : false;
$this->sort = isset( $query['sort'] ) ? $query['sort'] : null;
@@ -138,7 +138,8 @@ function get_extension( $source = null ) {
$url_parts = parse_url( $source );
$url_parts = pathinfo( $url_parts['path'] );
- return $url_parts['extension'];
+
+ return isset( $url_parts['extension'] ) ? $url_parts['extension'] : '';
}

0 comments on commit 7b387ec

Please sign in to comment.