public function onFilter_PucRequestInfoResultTubePress(tubepress_api_event_EventInterface $event) { $pluginInfo = $event->getSubject(); if ($pluginInfo && $this->_environment->isPro()) { $apiKey = $this->_context->get(tubepress_api_options_Names::TUBEPRESS_API_KEY); if (!$apiKey) { /* * We don't want to downgrade Pro users that haven't entered an API key. */ $pluginInfo->download_url = null; } if (property_exists($pluginInfo, 'download_url') && strpos($pluginInfo->download_url, 'free') !== false) { /* * Extra assurance that we don't downgrade Pro users */ $pluginInfo->download_url = null; } if (property_exists($pluginInfo, 'download_url') && $pluginInfo->download_url && $apiKey) { $url = $this->_urlFactory->fromString($pluginInfo->download_url); $url->getQuery()->set('key', $apiKey)->set('pid', 2); $pluginInfo->download_url = $url->toString(); } $event->setSubject($pluginInfo); } }
private function _addTemplateVariableIsPro(array &$templateVariables) { $templateVariables[self::$_TEMPLATE_VAR_IS_PRO] = $this->_environment->isPro(); }