/** * Adds meta links to the plugin in the WP Admin > Plugins screen * * @param array $links * @param string $slug * * @return array */ public function add_plugin_meta_links($links, $slug) { if ($slug !== $this->plugin->slug()) { return $links; } $links[] = '<a href="https://scrolltriggeredboxes.com/kb#utm_source=wp-plugin&utm_medium=scroll-triggered-boxes&utm_campaign=plugins-page">Documentation</a>'; return $links; }
/** * @param iPlugin $plugin * @param $response * * @return mixed */ protected function format_response(iPlugin $plugin, $response) { $response->new_version = $response->version; $response->slug = dirname($plugin->slug()); $response->plugin = $plugin->slug(); // load license $this->license->load(); // add some notices if license is inactive if (!$this->license->activated) { $response->upgrade_notice = sprintf('You will need to <a href="%s">activate your license</a> to install this plugin update.', admin_url('edit.php?post_type=scroll-triggered-box&page=stb-settings')); $response->sections->changelog = '<p>' . sprintf('You will need to <a href="%s" target="_top">activate your license</a> to install this plugin update.', admin_url('edit.php?post_type=scroll-triggered-box&page=stb-settings')) . '</p>' . $response->sections->changelog; $response->package = null; } // cast subkey objects to array as that is what WP expects $response->sections = get_object_vars($response->sections); $response->banners = get_object_vars($response->banners); return $response; }
/** * @param iPlugin $plugin * @return object */ public function get_plugin(iPlugin $plugin) { $endpoint = sprintf('/plugins/%d?format=wp', $plugin->id()); return $this->call($endpoint); }