|
@ -168,32 +168,34 @@ class Setting extends Model |
|
|
$output = ''; |
|
|
$output = ''; |
|
|
$homepage_search = self::fetch('homepage_search'); |
|
|
$homepage_search = self::fetch('homepage_search'); |
|
|
$search_provider = self::where('key', '=', 'search_provider')->first(); |
|
|
$search_provider = self::where('key', '=', 'search_provider')->first(); |
|
|
|
|
|
if((bool)$homepage_search && (bool)$search_provider) { |
|
|
$options = (array)json_decode($search_provider->options); |
|
|
|
|
|
$name = $options[$search_provider->value]; |
|
|
$options = (array)json_decode($search_provider->options); |
|
|
if((bool)$homepage_search && (bool)$search_provider->value) { |
|
|
$name = $options[$search_provider->value]; |
|
|
switch($search_provider->value) { |
|
|
if((bool)$homepage_search && (bool)$search_provider->value) { |
|
|
case 'google': |
|
|
switch($search_provider->value) { |
|
|
$url = 'https://www.google.com/search'; |
|
|
case 'google': |
|
|
$var = 'q'; |
|
|
$url = 'https://www.google.com/search'; |
|
|
break; |
|
|
$var = 'q'; |
|
|
case 'ddg': |
|
|
break; |
|
|
$url = 'https://duckduckgo.com/'; |
|
|
case 'ddg': |
|
|
$var = 'q'; |
|
|
$url = 'https://duckduckgo.com/'; |
|
|
break; |
|
|
$var = 'q'; |
|
|
case 'bing': |
|
|
break; |
|
|
$url = 'https://www.bing.com/search'; |
|
|
case 'bing': |
|
|
$var = 'q'; |
|
|
$url = 'https://www.bing.com/search'; |
|
|
break; |
|
|
$var = 'q'; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
$output .= '<div class="searchform">'; |
|
|
|
|
|
$output .= Form::open(['url' => $url, 'method' => 'get']); |
|
|
|
|
|
$output .= '<div class="input-container">'; |
|
|
|
|
|
$output .= Form::text($var, null, ['class' => 'homesearch', 'placeholder' => $name.' search...']); |
|
|
|
|
|
$output .= '<button type="submit">Search</button>'; |
|
|
|
|
|
$output .= '</div>'; |
|
|
|
|
|
$output .= Form::close(); |
|
|
|
|
|
$output .= '</div>'; |
|
|
} |
|
|
} |
|
|
$output .= '<div class="searchform">'; |
|
|
|
|
|
$output .= Form::open(['url' => $url, 'method' => 'get']); |
|
|
|
|
|
$output .= '<div class="input-container">'; |
|
|
|
|
|
$output .= Form::text($var, null, ['class' => 'homesearch', 'placeholder' => $name.' search...']); |
|
|
|
|
|
$output .= '<button type="submit">Search</button>'; |
|
|
|
|
|
$output .= '</div>'; |
|
|
|
|
|
$output .= Form::close(); |
|
|
|
|
|
$output .= '</div>'; |
|
|
|
|
|
} |
|
|
} |
|
|
return $output; |
|
|
return $output; |
|
|
} |
|
|
} |
|
|