ductData(); if ( ! $result['description'] ) { $result['description'] = array_get_value( $product_data, 'Description', '' ); } if ( ! $result['author'] ) { $result['author'] = array_get_value( $product_data, 'Author', '' ); } return (object) $result; } public function getProductData() { if ( ! $this->product_data ) { $path = $this->path; $data = apply_filters( 'colibri_page_builder/companion/update_remote_data', array( 'url' => '', 'args' => [ 'product' => 'colibri-page-builder' ] ), $this ); $path = array_get_value( $data, 'plugin_path', $path ); $this->product_data = get_plugin_data( $path, false ); } return $this->product_data; } public function getLocalVersion() { $data = $this->getProductData(); return $data['Version']; } public function addTransientData( $transient, $info ) { $plugin_slug = plugin_basename( $this->path ); $transient->response[ $plugin_slug ] = (object) array( 'new_version' => $info->version, 'package' => $info->package_url, 'icons' => (array) $info->icons, 'slug' => $plugin_slug, 'tested' => $info->tested ); return $transient; } /** * A function for the WordPress "plugins_api" filter. Checks if * the user is requesting information about the current plugin and returns * its details if needed. * * This function is called before the Plugins API checks * for plugin information on WordPress.org. * * @param $res bool|object The result object, or false (= default value). * @param $action string The Plugins API action. We're interested in 'plugin_information'. * @param $args array The Plugins API parameters. * * @return bool|object */ public function pluginsApiHandler( $res, $action, $args ) { if ( $action == 'plugin_information' ) { if ( isset( $args->slug ) && $args->slug == plugin_basename( $this->path ) ) { $info = $this->getRemoteInfo(); if ( ! $info ) { return $res; } $res = (object) array( 'name' => $info->name, 'version' => $info->version, 'slug' => $args->slug, 'download_link' => $info->package_url, 'tested' => $info->tested, 'requires' => $info->requires, 'last_updated' => $info->last_updated, 'homepage' => $info->description_url, 'sections' => array( 'description' => $info->description, ), 'banners' => array( 'low' => $info->banner_low, 'high' => $info->banner_high, ), 'external' => true ); // Add change log tab if the server sent it if ( isset( $info->changelog ) ) { $res['sections']['changelog'] = $info->changelog; } return $res; } } return false; } }