/**
* Class constructor
*
* @param array $options Associative array of options
*
* @since 1.7.0
*/
public function __construct($options = array())
{
parent::__construct($options);
// Set document type
$this->_type = 'opensearch';
// Set mime type
$this->_mime = 'application/opensearchdescription+xml';
// Add the URL for self updating
$update = new OpensearchUrl();
$update->type = 'application/opensearchdescription+xml';
$update->rel = 'self';
$update->template = Route::_(Uri::getInstance());
$this->addUrl($update);
// Add the favicon as the default image
// Try to find a favicon by checking the template and root folder
$app = Factory::getApplication();
$dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
foreach ($dirs as $dir) {
if (is_file($dir . '/favicon.ico')) {
$path = str_replace(JPATH_BASE, '', $dir);
$path = str_replace('\\', '/', $path);
$favicon = new OpensearchImage();
if ($path == '') {
$favicon->data = Uri::base() . 'favicon.ico';
} else {
if ($path[0] == '/') {
$path = substr($path, 1);
}
$favicon->data = Uri::base() . $path . '/favicon.ico';
}
$favicon->height = '16';
$favicon->width = '16';
$favicon->type = 'image/vnd.microsoft.icon';
$this->addImage($favicon);
break;
}
}
}