Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Added possibility to use unfiltered-search #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions bc-mapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ public function findAll($type = 'video', $params = NULL)
* @param string [$type] The type of objects to retrieve
* @param array [$terms] The terms to use for the search
* @param mixed [$params] A key-value array of API parameters
* @param bool [$unfiltered] Use unfiltered search-method
* @return object An object containing all API return data
*/
public function search($type = 'video', $terms = NULL, $params = NULL)
public function search($type = 'video', $terms = NULL, $params = NULL, $unfiltered = FALSE)
{
if(!isset($terms) || !is_array($terms))
{
Expand Down Expand Up @@ -419,8 +420,13 @@ public function search($type = 'video', $terms = NULL, $params = NULL)
unset($params['sort_order']);
}

$url = str_replace(array('%2526', '%253D'), array('&', '='), $this->appendParams('search_' . $type . 's', $params));

$method = 'search_' . $type . 's';
if($unfiltered) {
$method .= '_unfiltered';
}

$url = str_replace(array('%2526', '%253D'), array('&', '='), $this->appendParams($method, $params));

$this->timeout_current = 0;

return $this->getData($url);
Expand Down