tKey() { if ( $this->package->isMuPlugin() ) { return $this->muPluginFile; } return $this->pluginFile; } protected function getNoUpdateItemFields() { return array_merge( parent::getNoUpdateItemFields(), array( 'id' => $this->pluginFile, 'slug' => $this->slug, 'plugin' => $this->pluginFile, 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'compatibility' => new stdClass(), ) ); } /** * Alias for isBeingUpgraded(). * * @deprecated * @param WP_Upgrader|null $upgrader The upgrader that's performing the current update. * @return bool */ public function isPluginBeingUpgraded($upgrader = null) { return $this->isBeingUpgraded($upgrader); } /** * Is there an update being installed for this plugin, right now? * * @param WP_Upgrader|null $upgrader * @return bool */ public function isBeingUpgraded($upgrader = null) { return $this->upgraderStatus->isPluginBeingUpgraded($this->pluginFile, $upgrader); } /** * Get the details of the currently available update, if any. * * If no updates are available, or if the last known update version is below or equal * to the currently installed version, this method will return NULL. * * Uses cached update data. To retrieve update information straight from * the metadata URL, call requestUpdate() instead. * * @return Puc_v4p11_Plugin_Update|null */ public function getUpdate() { $update = parent::getUpdate(); if ( isset($update) ) { /** @var Puc_v4p11_Plugin_Update $update */ $update->filename = $this->pluginFile; } return $update; } /** * Get the translated plugin title. * * @deprecated * @return string */ public function getPluginTitle() { return $this->package->getPluginTitle(); } /** * Check if the current user has the required permissions to install updates. * * @return bool */ public function userCanInstallUpdates() { return current_user_can('update_plugins'); } /** * Check if the plugin file is inside the mu-plugins directory. * * @deprecated * @return bool */ protected function isMuPlugin() { return $this->package->isMuPlugin(); } /** * MU plugins are partially supported, but only when we know which file in mu-plugins * corresponds to this plugin. * * @return bool */ protected function isUnknownMuPlugin() { return empty($this->muPluginFile) && $this->package->isMuPlugin(); } /** * Get absolute path to the main plugin file. * * @return string */ public function getAbsolutePath() { return $this->pluginAbsolutePath; } /** * Register a callback for filtering query arguments. * * The callback function should take one argument - an associative array of query arguments. * It should return a modified array of query arguments. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addQueryArgFilter($callback){ $this->addFilter('request_info_query_args', $callback); } /** * Register a callback for filtering arguments passed to wp_remote_get(). * * The callback function should take one argument - an associative array of arguments - * and return a modified array or arguments. See the WP documentation on wp_remote_get() * for details on what arguments are available and how they work. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addHttpRequestArgFilter($callback) { $this->addFilter('request_info_options', $callback); } /** * Register a callback for filtering the plugin info retrieved from the external API. * * The callback function should take two arguments. If the plugin info was retrieved * successfully, the first argument passed will be an instance of PluginInfo. Otherwise, * it will be NULL. The second argument will be the corresponding return value of * wp_remote_get (see WP docs for details). * * The callback function should return a new or modified instance of PluginInfo or NULL. * * @uses add_filter() This method is a convenience wrapper for add_filter(). * * @param callable $callback * @return void */ public function addResultFilter($callback) { $this->addFilter('request_info_result', $callback, 10, 2); } protected function createDebugBarExtension() { return new Puc_v4p11_DebugBar_PluginExtension($this); } /** * Create a package instance that represents this plugin or theme. * * @return Puc_v4p11_InstalledPackage */ protected function createInstalledPackage() { return new Puc_v4p11_Plugin_Package($this->pluginAbsolutePath, $this); } /** * @return Puc_v4p11_Plugin_Package */ public function getInstalledPackage() { return $this->package; } } endif;