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>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
/**
* Factory Metaboxes
*
* Factory is an internal professional framework developed by OnePress Ltd
* for own needs. Please don't use it to create your own independent plugins.
* In future the one will be documentated and released for public.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package core
* @since 1.0.0
*/
// module provides function only for the admin area
if ( !is_admin() ) return;
if (defined('FACTORY_METABOXES_321_LOADED')) return;
define('FACTORY_METABOXES_321_LOADED', true);
define('FACTORY_METABOXES_321_DIR', dirname(__FILE__));
define('FACTORY_METABOXES_321_URL', plugins_url(null, __FILE__ ));
#comp merge
require(FACTORY_METABOXES_321_DIR . '/metaboxes.php');
require(FACTORY_METABOXES_321_DIR . '/metabox.class.php');
require(FACTORY_METABOXES_321_DIR . '/includes/form-metabox.class.php');
require(FACTORY_METABOXES_321_DIR . '/includes/publish-metabox.class.php');
#endcomp

View File

@@ -0,0 +1,119 @@
<?php
/**
* The file contains a class for creating metaboxes with forms based on the Factory Forms module.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package factory-metaboxes
* @since 1.0.0
*/
/**
* A class extending FactoryMetaboxes_Metabox and adding ability to create and save forms.
*
* @since 1.0.0
*/
abstract class FactoryMetaboxes321_FormMetabox extends FactoryMetaboxes321_Metabox {
/**
* A scope of metadata. By default the current class name used.
*
* @since 1.0.0
* @var string
*/
public $scope;
/**
* CSS class that addes to the form.
*
* @since 3.0.6
* @var string
*/
public $cssClass;
public function __construct( $plugin ) {
parent::__construct( $plugin );
$this->scope = ( !$this->scope ) ? $this->formatCamelCase( get_class($this) ) : $this->scope;
}
private function getForm( $post_id = null ) {
// creating a value provider
$this->provider = new FactoryForms328_MetaValueProvider( array(
'scope' => $this->scope
));
$this->provider->init( $post_id );
// creating a form
$form = new FactoryForms328_Form( array(
'scope' => $this->scope,
'name' => $this->id
), $this->plugin );
$form->setProvider( $this->provider );
$this->form( $form );
return $form;
}
/**
* Renders a form.
*/
public function html() {
$form = $this->getForm();
echo '<div class="factory-form-metabox">';
$this->beforeForm( $form );
$form->html( array(
'cssClass' => $this->cssClass
));
$this->afterForm( $form );
echo '</div>';
}
public function save( $post_id ) {
$form = $this->getForm( $post_id );
$this->onSavingForm( $post_id );
$form->save();
}
/**
* Extra custom actions after the form is saved.
*/
public function onSavingForm( $post_id ) {
return;
}
/**
* Form method that must be overridden in the derived classes.
*/
public abstract function form($form);
/**
* Method executed before rendering the form.
*/
public function beforeForm(FactoryForms328_Form $form) {
return;
}
/**
* Method executed after rendering the form.
*/
public function afterForm(FactoryForms328_Form $form) {
return;
}
private function formatCamelCase( $string ) {
$output = "";
foreach( str_split( $string ) as $char ) {
strtoupper( $char ) == $char and $output and $output .= "_";
$output .= $char;
}
$output = strtolower($output);
return $output;
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* The file contains a class for standard metabox that contains only the Publish/Update button.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package factory-metaboxes
* @since 1.0.0
*/
/**
* A metabox containing the standart Publish/Update button.
*
* @since 1.0.0
*/
class FactoryMetaboxes321_PublishMetabox extends FactoryMetaboxes321_Metabox
{
public function __construct( $plugin = null ) {
$this->title = __('Control');
$this->context = 'side';
$this->priority = 'high';
parent::__construct($plugin);
}
public function html() {
global $action, $post;
$post_type = $post->post_type;
$post_type_object = get_post_type_object($post_type);
$can_publish = current_user_can($post_type_object->cap->publish_posts);
?>
<div class="submitbox" id="submitpost">
<div id="minor-publishing">
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
<div style="display:none;">
<?php submit_button( __( 'Save', 'factory' ), 'button', 'save' ); ?>
</div>
<div id="misc-publishing-actions">
<?php
// translators: Publish box date format, see http://php.net/date
$datef = __( 'M j, Y @ G:i' );
if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
$stamp = __('Scheduled for: <b>%1$s</b>');
} else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
$stamp = __('Created on: <b>%1$s</b>');
} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
$stamp = __('Created <b>immediately</b>');
} else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
$stamp = __('Schedule for: <b>%1$s</b>');
} else { // draft, 1 or more saves, date specified
$stamp = __('Created on: <b>%1$s</b>');
}
$date = date_i18n( $datef, strtotime( $post->post_date ) );
} else { // draft (no saves, and thus no date specified)
$stamp = __('Created <b>immediately</b>');
$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
}
if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="misc-pub-section curtime">
<span id="timestamp">
<?php printf($stamp, $date); ?></span>
</div><?php // /misc-pub-section ?>
<?php endif; ?>
</div>
<div class="clear"></div>
</div>
<div id="major-publishing-actions">
<div id="delete-action">
<?php
if ( current_user_can( "delete_post", $post->ID ) ) {
if ( !EMPTY_TRASH_DAYS )
$delete_text = __('Delete Permanently');
else
$delete_text = __('Move to Trash');
?>
<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
} ?>
</div>
<div id="publishing-action">
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading" id="ajax-loading" alt="" />
<?php
if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
if ( $can_publish ) :
if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
<?php submit_button( __( 'Schedule' ), 'primary', 'publish', false, array( 'tabindex' => '5', 'accesskey' => 'p' ) ); ?>
<?php else : ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
<?php submit_button( __( 'Create' ), 'primary', 'publish', false, array( 'tabindex' => '5', 'accesskey' => 'p' ) ); ?>
<?php endif;
else : ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
<?php submit_button( __( 'Submit for Review' ), 'primary', 'publish', false, array( 'tabindex' => '5', 'accesskey' => 'p' ) ); ?>
<?php
endif;
} else { ?>
<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update') ?>" />
<input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
<?php
} ?>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,227 @@
<?php
/**
* The file contains a base class for all metaboxe.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package factory-metaboxes
* @since 1.0.0
*/
/**
* The base class for all metaboxes.
*
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
* @since 1.0.0
*/
abstract class FactoryMetaboxes321_Metabox {
/**
* Id of the metabox.
* Be default, the current class name is used.
*
* @since 1.0.0
* @var string
*/
public $id = null;
/**
* A visible title of the metabox.
*
* @since 1.0.0
* @var string
*/
public $title = '';
/**
* The part of the page where the edit screen
* section should be shown ('normal', 'advanced', or 'side').
*
* @since 1.0.0
* @var string
*/
public $context = 'normal';
/**
* The priority within the context where the boxes
* should show ('high', 'core', 'default' or 'low')
*
* @since 1.0.0
* @var string
*/
public $priority = 'default';
/**
* Post types for which a metabox should be shown.
*
* @since 1.0.0
* @var array
*/
public $postTypes = array();
/**
* Scripts that should be include on the page where the metabox will be shown.
*
* @since 1.0.0
* @var Factory325_ScriptList
*/
public $scripts;
/**
* Styles that should be include on the page where the metabox will be shown.
*
* @since 1.0.0
* @var Factory325_StyleList
*/
public $styles;
/**
* Stores a state of assets (connected of not).
*
* @since 1.0.0
* @var bool
*/
protected $isConnected = false;
/**
* Creates a new instance of a metabox.
*
* @since 1.0.0
*/
public function __construct( $plugin ) {
$this->plugin = $plugin;
$this->id = empty($this->id) ? get_class($this) : $this->id;
}
/**
* Adds a new post type where the metabox should appear.
*
* @since 1.0.0
* @param string $typeName
*/
public function addPostType( $typeName ) {
if ( !in_array($typeName, $this->postTypes) ) {
$this->postTypes[] = $typeName;
}
}
/**
* Configures a metabox.
*
* @since 1.0.0
* @param Factory325_ScriptList $scripts A set of scripts to include.
* @param Factory325_StyleList $styles A set of style to include.
* @return void
*/
public function configure( $scripts, $styles) {
// method must be overriden in the derived classed.
}
/**
* Registers this metabox to show.
*
* @since 1.0.0
* @return void
*/
public function connect() {
if ( $this->isConnected ) return;
$this->isConnected = true;
$this->scripts = $this->plugin->newScriptList();
$this->styles = $this->plugin->newStyleList();
$this->configure( $this->scripts, $this->styles );
$this->includeScriptsAndStyles();
}
/**
* Includes scripts and styles for a metabox.
*
* @since 1.0.0
* @return void
*/
public function includeScriptsAndStyles() {
global $post;
if ( $this->scripts->isEmpty() && $this->styles->isEmpty() ) return;
if ( !in_array( $post->post_type, $this->postTypes)) return;
$this->scripts->connect();
$this->styles->connect();
}
/**
* Saves metabox data.
*
* @since 1.0.0
* @param int $post_id
* @return integer A post id.
*/
public function actionSavePost( $post_id ) {
$post_type = $_POST['post_type'];
if ( !in_array( $post_type, $this->postTypes ) ) return $post_id;
// verify the nonce before proceeding
$className = strtolower( get_class($this) );
$nonceName = $className . '_factory_nonce';
$nonceValue = $className . '_factory';
if ( !isset( $_POST[$nonceName] ) || !wp_verify_nonce( $_POST[$nonceName], $nonceValue ) )
return $post_id;
if ( wp_is_post_revision( $post_id ) ) return $post_id;
// get the post type object.
$post_type = get_post_type_object( $post_type );
// check if the current user has permission to edit the post.
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id;
// all right, save data.
$this->save( $post_id );
}
/**
* Shows content of a metabox.
*
* @since 1.0.0
* @return void
*/
public function show() {
// security nonce
$className = strtolower( get_class($this) );
wp_nonce_field( $className . '_factory', $className . '_factory_nonce' );
ob_start();
$this->html();
$content = ob_get_clean();
echo $content;
}
/**
* [virtual] Prints html content of a metabox.
*
* The method must be overridden in the derived classes.
*
* @since 1.0.0
* @return void
*/
public function html() {
echo 'Define the method "html" in your metabox class.';
}
/**
* [virtual] Saves metabox data.
*
* The method must be overridden in the derived classes.
*
* @since 1.0.0
* @param $postId A post id.
* @return void
*/
public function save( $postId ) {}
}

View File

@@ -0,0 +1,151 @@
<?php
/**
* A group of classes and methods to create and manage metaboxes.
*
* @author Paul Kashtanoff <paul@byonepress.com>
* @copyright (c) 2013, OnePress Ltd
*
* @package factory-metaboxes
* @since 1.0.0
*/
add_action('add_meta_boxes', 'FactoryMetaboxes321::actionAddMetaboxes');
add_action('admin_enqueue_scripts', 'FactoryMetaboxes321::actionAdminEnqueueScripts');
add_action('save_post', 'FactoryMetaboxes321::actionSavePost');
/**
* A base class to manage metaboxes.
*
* The main tasks of the manager is:
* - to register metaboxes for custom posts
* - to process data on post saving
*
* @since 1.0.0
*/
class FactoryMetaboxes321 {
/**
* A variable to store metaboxes per type they defined for.
*
* @since 1.0.0
* @var FactoryMetaboxes321_Metabox[]
*/
public static $metaboxes = array();
/**
* A variable storing post types for which there're metaboxes registered.
*
* @since 1.0.0
* @var string[]
*/
public static $postTypes = array();
protected static $_existingMetaboxes = array();
/**
* Registers a metabox by its class name.
*
* @since 1.0.0
* @param type $className A metabox class name.
* @return FactoryMetaboxes321_Metabox
*/
public static function register( $classNameOrObject, $plugin ) {
if ( is_string( $classNameOrObject )) {
$className = $classNameOrObject;
if ( !isset( self::$_existingMetaboxes[$className] ) ) {
self::$_existingMetaboxes[$className] = new $className( $plugin );
}
} else {
$className = get_class( $classNameOrObject );
if ( !isset( self::$_existingMetaboxes[$className] ) ) {
self::$_existingMetaboxes[$className] = $classNameOrObject;
}
}
$metabox =self::$_existingMetaboxes[$className];
self::$metaboxes[$metabox->id] = $metabox;
if ( empty( $metabox->postTypes ) ) return $metabox;
foreach($metabox->postTypes as $type) {
self::$postTypes[$type][$metabox->id] = $metabox;
}
return $metabox;
}
/**
* Registers a metabox for a given post type.
*
* @since 1.0.0
* @param type $classNameOrObject A metabox class name.
* @param type $postType A post type for which a given metabox should be registered.
* @return FactoryMetaboxes321_Metabox
*/
public static function registerFor( $classNameOrObject, $postType, $plugin ) {
$metabox = self::register( $classNameOrObject, $plugin );
self::$metaboxes[$metabox->id]->addPostType($postType);
self::$postTypes[$postType][$metabox->id] = $metabox;
return $metabox;
}
/**
* On calling the action "add_meta_boxes".
*
* Registering metaboxes via Wordpress API.
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
*
* @since 1.0.0
* @return void
*/
public static function actionAddMetaboxes() {
foreach(self::$postTypes as $type => $metaboxes) {
foreach($metaboxes as $metabox) {
add_meta_box(
$metabox->id,
$metabox->title,
array($metabox, 'show'),
$type,
$metabox->context,
$metabox->priority
);
}
}
}
/**
* On calling the action "admin_enqueue_scripts".
*
* Adding scripts and styles for registered metaboxes for respective pages.
*
* @since 1.0.0
* @return void
*/
public static function actionAdminEnqueueScripts( $hook ) {
if ( !in_array( $hook, array('post.php', 'post-new.php'))) return;
foreach(self::$metaboxes as $metabox) $metabox->connect();
}
/**
* On calling the action "save_post".
*
* @since 1.0.0
* @return void
*/
public static function actionSavePost( $post_id ) {
// verify the post type
if ( !isset( $_POST['post_type'] ) ) return $post_id;
foreach(self::$metaboxes as $metabox) {
$metabox->actionSavePost( $post_id );
}
}
}