. */ require_once 'Compiler/Desktop/W3c.php'; /** * Opera Widgets Compiler. */ final class Compiler_Desktop_Opera extends Compiler_Desktop_W3c { /** * Javascript UWA environment. * * @var string */ protected $_environment = 'Opera2'; /** * Stylesheet. * * @var string */ protected $_stylesheet = 'uwa-dashboard.css'; /** * Width of the widget. * * @var string */ protected $_width = 358; /** * Height of the widget. * * @var string */ protected $_height = 600; /** * Platform Name. * * @var string */ protected $_platform = 'opera'; /** * Extension. * * @var string */ protected $_extension = 'wgt'; /** * Mime Type. * * @var string */ protected $_mimeType = 'application/x-opera-widgets'; protected function buildArchive() { // Add the widget skeleton to the archive $ressourcesDir = Zend_Registry::get('uwaRessourcesDir'); if (!is_readable($ressourcesDir)) { throw new Exception('UWA ressources directory is not readable.'); } $this->addDirToZip($ressourcesDir . 'opera'); // Replace the default icon if a rich icon is given $richIcon = $this->_widget->getRichIcon(); if (!empty($richIcon) && preg_match('/\\.png$/i', $richIcon)) { $this->addDistantFileToZip($richIcon, 'Icon.png'); } $this->_zip->addFromString('index.html', $this->getHtml()); $this->_zip->addFromString('config.xml', $this->_getXmlManifest()); } protected function _getXmlManifest() { $title = $this->_widget->getTitle(); $metas = $this->_widget->getMetas(); $l = array(); $l[] = ''; $l[] = ''; $l[] = '' . htmlspecialchars($title) . ''; $l[] = '' . $this->_width . ''; $l[] = '' . $this->_height . ''; if (isset($this->options['uwaId'])) { $l[] = ''; $l[] = '' . NV_MODULES . ''; $l[] = '' . $this->options['uwaId'] . ''; $l[] = '' . date('Y-m') . ''; $l[] = ''; } if (isset($metas['author'])) { $l[] = ''; $l[] = '' . htmlspecialchars($metas['author']) . ''; if (isset($metas['website'])) { $l[] = '' . htmlspecialchars($metas['website']) . ''; } if (isset($metas['email'])) { $l[] = '' . htmlspecialchars($metas['email']) . ''; } $l[] = ''; } if (isset($metas['description'])) { $l[] = '' . htmlspecialchars($metas['description']) . ''; } $l[] = "" . 'Icon.png' . ""; $l[] = ''; return implode("\n", $l); } }