diff --git a/Puc/v4/Metadata.php b/Puc/v4/Metadata.php index 7391e70..7bb5082 100644 --- a/Puc/v4/Metadata.php +++ b/Puc/v4/Metadata.php @@ -103,7 +103,7 @@ if ( !class_exists('Puc_v4_Metadata', false) ): if ( property_exists($from, 'slug') && !empty($from->slug) ) { //Let plugins add extra fields without having to create subclasses. - $fields = apply_filters($this->getPrefixedFilter('retain_fields') . $from->slug, $fields); + $fields = apply_filters($this->getPrefixedFilter('retain_fields') . '-' . $from->slug, $fields); } foreach ($fields as $field) { @@ -121,10 +121,11 @@ if ( !class_exists('Puc_v4_Metadata', false) ): } /** + * @param string $tag * @return string */ protected function getPrefixedFilter($tag) { - return 'puc_' . $tag . '-'; + return 'puc_' . $tag; } } diff --git a/Puc/v4/Plugin/UpdateChecker.php b/Puc/v4/Plugin/UpdateChecker.php index 3c085a7..3035a34 100644 --- a/Puc/v4/Plugin/UpdateChecker.php +++ b/Puc/v4/Plugin/UpdateChecker.php @@ -106,16 +106,16 @@ if ( !class_exists('Puc_v4_Plugin_UpdateChecker', false) ): //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()). $installedVersion = $this->getInstalledVersion(); $queryArgs['installed_version'] = ($installedVersion !== null) ? $installedVersion : ''; - $queryArgs = apply_filters('puc_request_info_query_args-'.$this->slug, $queryArgs); + $queryArgs = apply_filters($this->getUniqueName('request_info_query_args'), $queryArgs); //Various options for the wp_remote_get() call. Plugins can filter these, too. $options = array( 'timeout' => 10, //seconds 'headers' => array( - 'Accept' => 'application/json' + 'Accept' => 'application/json', ), ); - $options = apply_filters('puc_request_info_options-'.$this->slug, $options); + $options = apply_filters($this->getUniqueName('request_info_options'), $options); //The plugin info should be at 'http://your-api.com/url/here/$slug/info.json' $url = $this->metadataUrl; @@ -145,7 +145,7 @@ if ( !class_exists('Puc_v4_Plugin_UpdateChecker', false) ): ); } - $pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result); + $pluginInfo = apply_filters($this->getUniqueName('request_info_result'), $pluginInfo, $result); return $pluginInfo; } @@ -388,7 +388,10 @@ if ( !class_exists('Puc_v4_Plugin_UpdateChecker', false) ): 'puc_check_for_updates' ); - $linkText = apply_filters('puc_manual_check_link-' . $this->slug, __('Check for updates', 'plugin-update-checker')); + $linkText = apply_filters( + $this->getUniqueName('manual_check_link'), + __('Check for updates', 'plugin-update-checker') + ); if ( !empty($linkText) ) { /** @noinspection HtmlUnknownTarget */ $pluginMeta[] = sprintf('%s', esc_attr($linkUrl), $linkText); @@ -441,7 +444,7 @@ if ( !class_exists('Puc_v4_Plugin_UpdateChecker', false) ): } printf( '
%s