/** * @param $updateData * @return mixed */ public function getUpdateData($updateData) { $plugin_slug = $this->_pm->getSlug(); if (!is_plugin_active($this->_pm->getSlugFilenamePath()) || !$this->_pm->isPremium() || !property_exists($updateData, 'checked') || empty($updateData->checked)) { return $updateData; } if (!empty($this->_pm->getConfig()->debug->update)) { $this->_pm->getLogger()->debug(' --- Update check data ' . $plugin_slug . ' --- '); $this->_pm->getLogger()->debug(var_export($updateData, true)); } // create request $request = $this->_getRequest(); $request->addData('action', 'plugin_update_check')->addData('slug', $plugin_slug)->addData('version', $updateData->checked[$this->_pm->getPathinfo()->getFilenamePath()])->addData('lang', IfwPsn_Wp_Proxy_Blog::getLanguage()); if ($this->_pm->isPremium()) { $license = $this->_getLicenseCode(); $request->addData('license', $license); } $response = $request->send(); if ($this->_pm->isPremium() && $response->isSuccess()) { $responseBody = $response->getBody(); $responseBody = unserialize($responseBody); if (!empty($this->_pm->getConfig()->debug->update)) { $this->_pm->getLogger()->debug('Update check response:'); $this->_pm->getLogger()->debug(var_export($responseBody, true)); } if (is_object($responseBody) && !empty($responseBody)) { // Feed the update data into WP updater $updateData->response[$this->_pm->getPathinfo()->getFilenamePath()] = $responseBody; } } return $updateData; }
/** * @return boolean */ public function isActivation() { $requestInfo = parse_url($this->_requestUri); if (strstr($requestInfo['path'], 'plugins.php') !== false && isset($_GET['action']) && $_GET['action'] == 'activate' && isset($_GET['plugin']) && $_GET['plugin'] == $this->_pm->getSlugFilenamePath()) { return true; } return false; }
/** * Fires at the end of the update message container in each row of the plugins list table. * * @param array $plugin_data An array of plugin data. * @param $meta_data */ public function getUpdateInlineMessage($plugin_data, $meta_data) { // slug $pluginSlug = $this->_pm->getSlugFilenamePath(); if ($this->_pm->isPremium()) { if (!apply_filters('ifw_woocommerce_is_slug_activated-' . $pluginSlug, false)) { if ($this->_pm->getAccess()->isNetworkAdmin()) { $licensePage = network_admin_url($this->_pm->getConfig()->plugin->licensePageNetwork); } else { $licensePage = admin_url($this->_pm->getConfig()->plugin->licensePage); } printf('<div style="padding: 5px 10px; border: 1px dashed red; margin-top: 10px;"><span class="dashicons dashicons-info"></span> %s</div>', sprintf(__('<b>License issue:</b> You have to <a href="%s">active your license</a> to be able to receive updates.', 'ifw'), $licensePage)); } } }