Files
roi-theme/wp-content/plugins/wp-database-tools/includes/data/class-wp-database-tools-database-data-author.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

105 lines
2.2 KiB
PHP
Executable File

<?php
/**
* Author class file
*
* @link https://raiolanetworks.es
* @since 1.0.0
*
* @package Wp_Database_Tools
* @subpackage Wp_Database_Tools/includes/data
*/
/**
* Author.
*
* This class defines all code necessary to manage the Author.
*
* @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_Author {
/**
* The id of the Author.
*
* @since 1.0.0
* @access protected
* @var string $id The id of the Author.
*/
protected $id;
/**
* The name of the Author.
*
* @since 1.0.0
* @access protected
* @var string $name The name of the Author.
*/
protected $name;
/**
* The url of the Author.
*
* @since 1.0.0
* @access protected
* @var string $url The name of the Author.
*/
protected $url;
/**
* Constructor
*
* Create the instance of a Author.
*
* @access public
* @since 1.0.0
*/
public function __construct() {
$this->id = str_shuffle( 'abcdefABCDEF' ) . '-' . rand( 1000, 2000 );
$this->name = 'Unknown';
$this->url = 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_author_by_api( $api_data ) {
$this->id = $api_data->id;
$this->name = $api_data->author ?? $api_data->user_nicname ?? null;
$this->url = $api_data->profile ?? $api_data->author_url ?? null;
}
/**
* Set object attributes via algorithm
*
* @access public
* @since 1.0.0
*
* @param Array $algorithm_data Array returning the identification algorithm.
*/
public function set_author_by_algorithm( $algorithm_data ) {
$this->name = $data_algorithm['author'] ?? $data_algorithm['author_name'] ?? null;
$this->url = $data_algorithm['author_url'] ?? null;
}
/**
* 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 );
}
}