File "class-wc-helper-plugin-info.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-plugin-info.php
File
size: 1.24 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
if (!defined('ABSPATH')) {
exit;
}
class WC_Helper_Plugin_Info
{
public static function load()
{
add_filter('plugins_api', array(__CLASS__, 'plugins_api'), 20, 3);
}
public static function plugins_api($response, $action, $args)
{
if ('plugin_information' !== $action) {
return $response;
}
if (empty($args->slug)) {
return $response;
}
if (0 !== strpos($args->slug, 'woocommerce-com-')) {
return $response;
}
$clean_slug = str_replace('woocommerce-com-', '', $args->slug);
$update_data = WC_Helper_Updater::get_update_data();
$products = wp_list_filter($update_data, array('slug' => $clean_slug));
if (empty($products)) {
return $response;
}
$product_id = array_keys($products);
$product_id = array_shift($product_id);
$request = WC_Helper_API::get(add_query_arg(array('product_id' => absint($product_id)), 'info'), array('authenticated' => true));
$results = json_decode(wp_remote_retrieve_body($request), true);
if (!empty($results)) {
$response = (object) $results;
}
return $response;
}
}
WC_Helper_Plugin_Info::load();