From 17c9a2a4634cc72ccc87f18e1bf12e5e08b19aac Mon Sep 17 00:00:00 2001 From: Maximilian Walter Date: Thu, 4 Dec 2014 20:12:55 +0100 Subject: [PATCH] Added possibility to use unfiltered-search Added additional argument $unfiltered to BCMAPI::search(). If true the unfiltered method is used and inactive videos can be found. --- bc-mapi.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bc-mapi.php b/bc-mapi.php index d68817b..1beac36 100644 --- a/bc-mapi.php +++ b/bc-mapi.php @@ -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)) { @@ -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);