Files
roi-theme/wp-content/plugins/wp-database-tools/includes/data/class-wp-database-tools-database-data-marketplace.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

127 lines
2.7 KiB
PHP
Executable File

<?php
/**
* Marketplace class file
*
* @link https://raiolanetworks.es
* @since 1.0.0
*
* @package Wp_Database_Tools
* @subpackage Wp_Database_Tools/includes/data
*/
/**
* Marketplace.
*
* This class defines all code necessary to manage the Marketplace.
*
* @since 1.0.0
* @package Wp_Database_Tools
* @subpackage Wp_Database_Tools/includes/data
* @author Raiola Networks <info@raiolanetworks.es>
*/
class Wp_Database_Tools_Database_Data_Marketplace {
/**
* The id of the marketplace.
*
* @since 1.0.0
* @access protected
* @var string $id Id of the marketplace.
*/
protected $id;
/**
* The name of the marketplace.
*
* @since 1.0.0
* @access protected
* @var string $name The name of the marketplace.
*/
protected $name;
/**
* The slug of the marketplace.
*
* @since 1.0.0
* @access protected
* @var string $slug The slug of the marketplace.
*/
protected $slug;
/**
* The url of marketplace.
*
* @since 1.0.0
* @access protected
* @var string $homepage The url of marketplace.
*/
protected $homepage;
/**
* The image of marketplace.
*
* @since 1.0.0
* @access protected
* @var string $image The image of marketplace.
*/
protected $image;
/**
* Constructor
*
* Create the instance of a Marketplace.
*
* @access public
* @since 1.0.0
*/
public function __construct() {
$this->id = str_shuffle( 'abcdefABCDEF' ) . '-' . rand( 1000, 2000 );
$this->name = 'Unknown';
$this->slug = 'unknown-marketplace';
$this->homepage = null;
$this->image = null;
}
/**
* Set object attributes via API information
*
* @access public
* @since 1.0.0
*
* @param Object $api_data Object obtained from API information.
*/
public function set_marketplace_by_api( $api_data ) {
$this->id = $api_data->id ?? $this->id;
$this->name = $api_data->name ?? $this->name;
$this->slug = $api_data->slug;
$this->homepage = $api_data->homepage;
$this->image = $api_data->image;
}
/**
* Set object attributes via algorithm
*
* @access public
* @since 1.0.0
*
* @param Array $algorithm_data Array returning the identification algorithm.
*/
public function set_marketplace_by_algorithm( $algorithm_data ) {
$this->name = $data_algorithm['marketplace'] ?? 'Unknown';
$this->url = sanitize_title( $algorithm_data['marketplace'] ) ?? 'unknown-marketplace';
}
/**
* Return attributes as an array
*
* @access public
* @since 1.0.0
*
* @return Array Array attributes.
*/
public function return_object_vars() {
return get_object_vars( $this );
}
}