'boolean', 'document_server_url' => 'text', 'jwt_secret' => 'text', 'jwt_header' => 'text', 'document_server_internal' => 'text', 'storage_url' => 'text', ] ); } /** * Create OnlyofficePlugin object. */ public static function create(): OnlyofficePlugin { static $result = null; return $result ?: $result = new self(); } /** * This method install the plugin tables. */ public function install() { $this->installHook(); } /** * This method drops the plugin tables. */ public function uninstall() { $this->uninstallHook(); } /** * Install the "create" hooks. */ public function installHook() { $itemActionObserver = OnlyofficeItemActionObserver::create(); HookDocumentItemAction::create()->attach($itemActionObserver); $actionObserver = OnlyofficeActionObserver::create(); HookDocumentAction::create()->attach($actionObserver); $viewObserver = OnlyofficeItemViewObserver::create(); HookDocumentItemView::create()->attach($viewObserver); } /** * Uninstall the "create" hooks. */ public function uninstallHook() { $itemActionObserver = OnlyofficeItemActionObserver::create(); HookDocumentItemAction::create()->detach($itemActionObserver); $actionObserver = OnlyofficeActionObserver::create(); HookDocumentAction::create()->detach($actionObserver); $viewObserver = OnlyofficeItemViewObserver::create(); HookDocumentItemView::create()->detach($viewObserver); } /** * Get link to plugin settings. * * @return string */ public function getConfigLink() { return api_get_path(WEB_PATH).'main/admin/configure_plugin.php?name='.$this->pluginName; } /** * Get plugin name. * * @return string */ public function getPluginName() { return $this->pluginName; } public static function isExtensionAllowed(string $extension): bool { $officeExtensions = [ 'ppt', 'pptx', 'odp', 'xls', 'xlsx', 'ods', 'csv', 'doc', 'docx', 'odt', 'pdf', ]; return in_array($extension, $officeExtensions); } }