Skip to content
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
22 changes: 16 additions & 6 deletions src/Engine/GoogleSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,24 @@ private function prepare_url($query, $page){
);

if(isset($this->preferences['date_range'])){

$str = substr($this->preferences['date_range'], 0, 1);

if(in_array($str, array('h', 'd', 'w', 'm', 'y'))){
$vars['tbs'] = 'qdr:'.$str;
if(!is_array($this->preferences['date_range'])){ //check the value is array or not
$str = substr($this->preferences['date_range'], 0, 1);

if(in_array($str, array('h', 'd', 'w', 'm', 'y'))){
$vars['tbs'] = 'qdr:'.$str;
}
}else{
//we add filter custom date range
//functional : for example we want to serp search result in 9/1/2007 until 7/1/2013
//For example the value $this->preferences['date_range'] is :
//array('minDate' => 'm/d/Y','maxDate' => 'm/d/Y');
$dateRangeValue = $this->preferences['date_range'];
$daterange_parse = "cdr:1,cd_min:" . $dateRangeValue['minDate'] . ",cd_max:" .$dateRangeValue['maxDate'];
$vars['tbs'] = $daterange_parse;
}
}


// do query building ourselves to get the url
$url = 'http://www.'.$google_domain.'/search?'.http_build_query($vars, '', '&');

Expand Down Expand Up @@ -200,4 +210,4 @@ public function solveCaptcha(CaptchaSolver $solver){
}
}

?>
?>