/** * Returns class instance * * @return HINT_CLASS_UheaderBridge */ public static function getInstance() { if (!isset(self::$classInstance)) { self::$classInstance = new self(); } return self::$classInstance; }
public function getCover() { $bridge = HINT_CLASS_UheaderBridge::getInstance(); if (!$bridge->isActive() || !$bridge->isEnabled()) { return null; } $cover = $bridge->getCoverForUser($this->userId); if ($cover === null) { return null; } $settings = $cover["data"]; $coverUrl = $cover["src"]; $canvasHeight = $settings['canvas']['height']; $canvasWidth = $settings['canvas']['width']; $imageHeight = $settings['dimensions']['height']; $imageWidth = $settings['dimensions']['width']; $itemCanvasHeight = $canvasHeight * self::COVER_WIDTH / $canvasWidth; $tmp = $canvasWidth * $imageHeight / $imageWidth; $css = $settings['css']; if ($css["width"] == "100%") { $css["width"] = self::COVER_WIDTH + self::CORNER_OFFSET . "px"; } $topOffset = 0; if ($tmp >= $canvasHeight) { $itemHeight = $this->scale($imageWidth, $imageHeight, self::COVER_WIDTH); $coverHeight = $this->scale($settings['dimensions']['width'], $settings['dimensions']['height'], $canvasWidth); $k = $coverHeight / $itemHeight; $topOffset = $settings['position']['top'] / $k; } else { $itemWidth = $this->scale($imageHeight, $imageWidth, $itemCanvasHeight); $coverWidth = $this->scale($imageHeight, $imageWidth, $canvasHeight); $k = $coverWidth / $itemWidth; $css['left'] = $settings['position']['left'] / $k . 'px'; } if ($css["height"] == "100%") { $css["height"] = $itemCanvasHeight . "px"; } if (abs($topOffset) <= self::CORNER_OFFSET) { $itemCanvasHeight = $itemCanvasHeight - (self::CORNER_OFFSET - $topOffset); $topOffset = -self::CORNER_OFFSET; } if ($topOffset) { $css['top'] = $topOffset . 'px'; } $cssStr = ''; foreach ($css as $k => $v) { $cssStr .= $k . ': ' . $v . '; '; } return array('url' => $coverUrl, 'height' => $itemCanvasHeight, 'imageCss' => $cssStr); }
public function process() { $service = HINT_BOL_Service::getInstance(); $values = $this->getValues(); foreach ($this->actions as $action) { $service->setActionActive($this->entityType, $action["key"], !empty($values["action-" . $action["key"]])); } HINT_CLASS_UheaderBridge::getInstance()->setEnabled($values["uheader_enabled"]); $this->saveInfoLine(HINT_BOL_Service::INFO_LINE0, $values); $this->saveInfoLine(HINT_BOL_Service::INFO_LINE1, $values); $this->saveInfoLine(HINT_BOL_Service::INFO_LINE2, $values); }
/** * Copyright (c) 2012, Sergey Kambalin * All rights reserved. * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ * and is licensed under Oxwall Store Commercial License. * Full text of this license can be found at http://www.oxwall.org/store/oscl */ OW::getRouter()->addRoute(new OW_Route('hint-configuration', 'admin/plugins/hint', 'HINT_CTRL_Admin', 'index')); HINT_CLASS_ParseManager::getInstance()->init(); HINT_CLASS_ParseManager::getInstance()->addParser(new HINT_CLASS_UserParser()); HINT_CLASS_FriendsBridge::getInstance()->init(); HINT_CLASS_NewsfeedBridge::getInstance()->init(); HINT_CLASS_BaseBridge::getInstance()->init(); HINT_CLASS_GiftBridge::getInstance()->init(); HINT_CLASS_McomposeBridge::getInstance()->init(); HINT_CLASS_UheaderBridge::getInstance()->init(); HINT_CLASS_UserCreditsBridge::getInstance()->init(); HINT_CLASS_PhotoBridge::getInstance()->init(); HINT_CLASS_VideoBridge::getInstance()->init(); function hint_add_admin_notification(BASE_CLASS_EventCollector $e) { if (HINT_BOL_Service::getInstance()->getConfig("admin_notified")) { return; } $pluginTitle = OW::getPluginManager()->getPlugin("hint")->getDto()->title; $pluginUrl = OW::getRouter()->urlForRoute('hint-configuration'); $pluginEmbed = '<a href="' . $pluginUrl . '">' . $pluginTitle . '</a>'; $language = OW::getLanguage(); $e->add($language->text('hint', 'admin_notification', array('plugin' => $pluginEmbed, "settingsUrl" => $pluginUrl))); } OW::getEventManager()->bind('admin.add_admin_notification', 'hint_add_admin_notification');