private function processAttachment($userId, $attachment, $text) { switch ($attachment['type']) { case 'photo': $filePath = empty($attachment['url']) ? null : $attachment['url']; if (empty($filePath)) { return; } $title = empty($attachment['title']) ? null : $attachment['title']; ATTACHMENTS_CLASS_PhotoBridge::getInstance()->addPhoto($userId, $filePath, $title, $text, false); break; case 'video': $thumbnailUrl = empty($attachment['thumbnail_url']) ? null : $attachment['thumbnail_url']; $title = empty($attachment['title']) ? null : $attachment['title']; $description = empty($attachment['description']) ? null : $attachment['description']; $embed = $attachment['html']; ATTACHMENTS_CLASS_VideoBridge::getInstance()->addVideo($userId, $embed, $title, $description, $thumbnailUrl, $text, false); break; case 'link': $thumbnailUrl = empty($attachment['thumbnail_url']) ? null : $attachment['thumbnail_url']; $title = empty($attachment['title']) ? null : $attachment['title']; $description = empty($attachment['description']) ? null : $attachment['description']; $href = $attachment['href']; ATTACHMENTS_CLASS_LinksBridge::getInstance()->addLink($userId, $href, $title, $description, $thumbnailUrl, $text, false); break; } }
/** * Returns class instance * * @return ATTACHMENTS_CLASS_PhotoBridge */ public static function getInstance() { if (!isset(self::$classInstance)) { self::$classInstance = new self(); } return self::$classInstance; }
<?php require_once dirname(__FILE__) . DS . 'plugin.php'; $plugin = OW::getPluginManager()->getPlugin('attachments'); OW::getRouter()->addRoute(new OW_Route('attachments-settings-page', 'admin/plugins/attachments', 'ATTACHMENTS_CTRL_Admin', 'index')); if (!class_exists('BASE_CMP_CommentsForm', false)) { include_once $plugin->getCmpDir() . 'comments_form.php'; } if (!class_exists('BASE_CMP_OembedAttachment', false)) { include_once $plugin->getCmpDir() . 'oembed_attachmet.php'; } if (OW::getPluginManager()->isPluginActive('newsfeed') && !class_exists('NEWSFEED_CMP_UpdateStatus', false)) { include_once $plugin->getCmpDir() . 'newsfeed_status.php'; } ATTACHMENTS_CLASS_EventHandler::getInstance()->init(); ATTACHMENTS_CLASS_LinksBridge::getInstance()->init(); ATTACHMENTS_CLASS_PhotoBridge::getInstance()->init(); ATTACHMENTS_CLASS_VideoBridge::getInstance()->init(); ATTACHMENTS_CLASS_NewsfeedBridge::getInstance()->init();