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
/**
* Render the group details column content in the group table.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.0
*
* @var Group $group Group instance.
*/
?>
<ul>
<li>
<?php
/*
* translators: %s is the ID of an ad group
*/
printf( esc_attr__( 'ID: %s', 'advanced-ads' ), absint( $group->get_id() ) );
?>
</li>
<li>
<strong>
<?php
/* translators: %s is the name of a group type */
printf( esc_html__( 'Type: %s', 'advanced-ads' ), esc_html( $group->get_type_object()->get_title() ) );
?>
</strong>
</li>
</ul>

View File

@@ -0,0 +1,21 @@
<?php
/**
* Render the group name column content in the group table.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.0
*
* @var Group $group Group instance.
*/
?>
<div class="advads-table-name">
<a class="row-title" href="#modal-group-edit-<?php echo esc_attr( $group->get_id() ); ?>"><?php echo esc_html( $group->get_name() ); ?></a>
</div>
<?php if ( $this->type_error ) : ?>
<p class="advads-notice-inline advads-error">
<?php echo esc_html( $this->type_error ); ?>
</p>
<?php
endif;

View File

@@ -0,0 +1,16 @@
<?php
/**
* Render the group type column content in the group table.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.0
*
* @var Group $group Group instance.
*/
$group_type = $group->get_type_object();
?>
<div class="advads-form-type">
<img src="<?php echo esc_url( $group_type->get_image() ); ?>" alt="<?php echo esc_attr( $group_type->get_title() ); ?>">
</div>

View File

@@ -0,0 +1,19 @@
<?php
/**
* Render the group usage column content in the group table.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.0
*
* @var Group $group Group instance.
*/
?>
<div class="advads-usage">
<strong><?php esc_html_e( 'shortcode', 'advanced-ads' ); ?></strong>
<code><input type="text" onclick="this.select();" value='[the_ad_group id="<?php echo esc_attr( $group->get_id() ); ?>"]' readonly /></code>
<br/><br/>
<strong><?php esc_html_e( 'template (PHP)', 'advanced-ads' ); ?></strong>
<code><input type="text" onclick="this.select();" value="the_ad_group(<?php echo esc_attr( $group->get_id() ); ?>);" readonly /></code>
</div>

View File

@@ -0,0 +1,118 @@
<?php
/**
* Advanced Ads  form to edit ad groups in the admin
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var AdvancedAds\Abstracts\Group $group Group instance.
* @var string $this ->type_error Contains an error message if the group type is missing.
*/
use AdvancedAds\Admin\Upgrades;
use AdvancedAds\Utilities\WordPress;
$group_types = wp_advads_get_group_types();
$group_id = $group->get_id();
?>
<div class="advads-ad-group-form">
<form name="update-group" method="post">
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'advads-update-group' ) ); ?>">
<?php
echo $group->get_hints_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
ob_start();
?>
<input type="hidden" class="advads-group-id" name="advads-groups[<?php echo esc_attr( $group_id ); ?>][id]" value="<?php echo esc_attr( $group_id ); ?>"/>
<input type="text" name="advads-groups[<?php echo esc_attr( $group_id ); ?>][name]" value="<?php echo esc_attr( $group->get_name() ); ?>"/>
<?php
$option_content = ob_get_clean();
WordPress::render_option(
'group-name static',
__( 'Name', 'advanced-ads' ),
$option_content
);
ob_start();
?>
<div class="advads-ad-group-type">
<?php if ( $this->type_error ) : ?>
<p class="advads-notice-inline advads-error"><?php echo esc_html( $this->type_error ); ?></p>
<?php
endif;
foreach ( $group_types as $group_type ) :
if ( $group_type->is_premium() ) {
continue;
}
?>
<label title="<?php echo esc_html( $group_type->get_description() ); ?>">
<input type="radio" name="advads-groups[<?php echo esc_attr( $group_id ); ?>][type]" value="<?php echo esc_attr( $group_type->get_id() ); ?>" <?php checked( $group->get_type(), $group_type->get_id() ); ?>/>
<?php echo esc_html( $group_type->get_title() ); ?>
</label>
<?php endforeach; ?>
<?php
foreach ( $group_types as $group_type ) :
if ( ! $group_type->is_premium() ) {
continue;
}
?>
<label title="<?php echo esc_html( $group_type->get_description() ); ?>">
<input type="radio" name="advads-groups[<?php echo esc_attr( $group_id ); ?>][type]" value="<?php echo esc_attr( $group_type->get_id() ); ?>" disabled/>
<?php echo esc_html( $group_type->get_title() ); ?>
</label>
<?php endforeach; ?>
<?php if ( wp_advads_get_group_type_manager()->has_premium() ) : ?>
<label>
<?php Upgrades::upgrade_link( __( 'Get all group types with All Access', 'advanced-ads' ), 'https://wpadvancedads.com/add-ons/all-access/', 'upgrades-pro-groups' ); ?>
</label>
<?php endif; ?>
</div>
<?php
$option_content = ob_get_clean();
WordPress::render_option(
'group-type static',
esc_attr__( 'Type', 'advanced-ads' ),
$option_content
);
ob_start();
?>
<select name="advads-groups[<?php echo esc_attr( $group_id ); ?>][ad_count]">
<?php
$sorted_ads_count = count( $group->get_sorted_ads() );
$max_ads = $sorted_ads_count >= 10 ? $sorted_ads_count + 2 : 10;
for ( $i = 1; $i <= $max_ads; $i++ ) :
?>
<option <?php selected( $group->get_ad_count(), $i ); ?>><?php echo esc_html( $i ); ?></option>
<?php
endfor;
?>
<option <?php selected( $group->get_ad_count(), 'all' ); ?> value="all"><?php echo esc_attr_x( 'all', 'option to display all ads in an ad groups', 'advanced-ads' ); ?></option>
</select>
<?php
$option_content = ob_get_clean();
WordPress::render_option(
'group-number advads-group-type-default advads-group-type-ordered',
esc_attr__( 'Visible ads', 'advanced-ads' ),
$option_content,
esc_attr__( 'Number of ads that are visible at the same time', 'advanced-ads' )
);
do_action( 'advanced-ads-group-form-options', $group );
ob_start();
require ADVADS_ABSPATH . 'views/admin/tables/groups/list-row-option-ads.php';
$option_content = ob_get_clean();
WordPress::render_option(
'group-ads static',
esc_attr__( 'Ads', 'advanced-ads' ),
$option_content
);
?>
</form>
</div>

View File

@@ -0,0 +1,45 @@
<?php
/**
* Group Filter
*
* @package AdvancedAds
*
* @var Groups_List_Table $this
*/
use AdvancedAds\Constants;
use AdvancedAds\Admin\Groups_List_Table;
use AdvancedAds\Framework\Utilities\Params;
$group_type = Params::request( 'group_type' );
$group_types = wp_advads_get_group_types();
usort(
$group_types,
function ( $a, $b ) {
return strcasecmp( $a->get_title(), $b->get_title() );
}
);
?>
<form id="advads-group-filter-form" method="get">
<div id="filters">
<input type="hidden" name="page" value="<?php echo esc_attr( Params::get( 'page' ) ); ?>">
<select id="advads-group-filter-type" name="group_type">
<option value="">- <?php esc_html_e( 'all group types', 'advanced-ads' ); ?> -</option>
<?php foreach ( $group_types as $gtype ) : ?>
<option <?php selected( $group_type, $gtype->get_id() ); ?> value="<?php echo esc_attr( $gtype->get_id() ); ?>"><?php echo esc_html( $gtype->get_title() ); ?></option>
<?php endforeach; ?>
</select>
<input type="submit" class="button" value="Filter">
</div>
<div class="search-form">
<?php
$group_taxonomy = get_taxonomy( Constants::TAXONOMY_GROUP );
$this->search_box( $group_taxonomy->labels->search_items, 'tag' );
?>
</div>
</form>

View File

@@ -0,0 +1,19 @@
<?php
/**
* Ads loop in a group.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var Group $group Group instance.
*/
esc_html_e( 'No ads assigned', 'advanced-ads' );
?>
<br/>
<?php if ( ! empty( $this->all_ads ) ) : ?>
<a href="#modal-group-edit-<?php echo esc_attr( $group->get_id() ); ?>">+ <?php esc_html_e( 'Add some', 'advanced-ads' ); ?></a>
<?php else : ?>
<a class="button create-first-ad" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=advanced_ads' ) ); ?>"><?php esc_html_e( 'Create your first ad', 'advanced-ads' ); ?></a>
<?php
endif;

View File

@@ -0,0 +1,85 @@
<?php
/**
* Ads loop in a group.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var Group $group Group instance.
*/
use AdvancedAds\Abstracts\Group;
use AdvancedAds\Utilities\WordPress;
$counter = 1;
$ad_count = $group->get_ads_count();
$weights = $group->get_ad_weights();
$group_ads = $group->get_ads();
usort($group_ads, function ($a, $b) {
return $b->get_weight() <=> $a->get_weight();
});
foreach ( $group_ads as $group_ad ) {
if ( ! $group_ad->is_status( 'publish' ) ) {
unset( $weights[ $group_ad->get_id() ] );
}
}
$weight_sum = array_sum( $weights );
?>
<div class="advads-ad-group-list-ads advads-table-flex">
<?php
foreach ( $group_ads as $ad ) :
$ad_weight_percentage = '';
?>
<div style="display: <?php echo $counter > 3 ? 'none' : 'flex'; ?>">
<div>
<a href="<?php echo esc_url( get_edit_post_link( $ad->get_id() ) ); ?>"><?php echo esc_html( $ad->get_title() ); ?></a>
</div>
<div>
<?php echo $ad->get_ad_schedule_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
if ( 'default' === $group->get_type() && $weight_sum ) :
$weight = $ad->get_weight() ?? Group::MAX_AD_GROUP_DEFAULT_WEIGHT;
$ad_weight_percentage = $ad->is_status( 'publish' ) ? WordPress::calculate_percentage( $weight, $weight_sum ) : '0%';
?>
<div class="advads-ad-group-list-ads-weight">
<span title="<?php esc_attr_e( 'Ad weight', 'advanced-ads' ); ?>"><?php echo esc_html( $ad_weight_percentage ); ?></span>
</div>
<?php endif; ?>
</div>
<?php
++$counter;
endforeach;
?>
</div>
<?php if ( $ad_count > 4 ) : ?>
<p>
<a href="javascript:void(0)" class="advads-group-ads-list-show-more">
<?php
/* translators: %d is a number. */
echo esc_html( sprintf( __( '+ show %d more ads', 'advanced-ads' ), $ad_count - 3 ) );
?>
</a>
</p>
<?php endif; ?>
<?php
if ( $ad_count > 1 ) :
$ad_count = 'all' === $group->get_display_ad_count() ? $ad_count : $group->get_display_ad_count();
/**
* Filters the displayed ad count on the ad groups page.
*
* @param int $ad_count The amount of displayed ads.
* @param Group $group The current ad group.
*/
$ad_count = (int) apply_filters( 'advanced-ads-group-displayed-ad-count', $ad_count, $group );
$ad_count = (int) apply_filters( 'advanced-ads-group-' . $group->get_type() . '-displayed-ad-count', $ad_count, $group );
/* translators: amount of ads displayed */
echo '<p>' . esc_html( sprintf( _n( 'Up to %d ad displayed.', 'Up to %d ads displayed', $ad_count, 'advanced-ads' ), $ad_count ) ) . '</p>';
endif;

View File

@@ -0,0 +1,98 @@
<?php
/**
* Render a list of ads included in an ad group
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var array $ad_form_rows HTML to render ad form.
* @var array $this->all_ads Array with ads that can be chosen from for the group.
* @var Group $group Group instance.
*/
$max_weight = $group->get_max_weight();
$sorted_ads = $group->get_sorted_ads();
?>
<table class="advads-group-ads">
<?php if ( $this->all_ads ) : ?>
<thead>
<tr>
<th class="group-sort group-ad" data-sortby="ad"><?php esc_html_e( 'Ad', 'advanced-ads' ); ?></th>
<th class="group-sort group-status" data-sortby="status"><?php esc_html_e( 'Status', 'advanced-ads' ); ?></th>
<th colspan="2" class="group-sort group-weight" data-sortby="weight"><?php esc_html_e( 'Weight', 'advanced-ads' ); ?></th>
</tr>
</thead>
<?php endif; ?>
<tbody>
<?php
foreach ( $sorted_ads as $ad_id => $ad ) :
$ad_object = wp_advads_get_ad( $ad_id );
$ad_url = add_query_arg(
[
'post' => $ad_id,
'action' => 'edit',
],
admin_url( 'post.php' )
);
/* translators: %s is the title for ad. */
$link_title = sprintf( esc_html__( 'Opens ad %s in a new tab', 'advanced-ads' ), $ad['title'] );
?>
<tr data-ad-id="<?php echo esc_attr( $ad_id ); ?>" data-group-id="<?php echo esc_attr( $group->get_id() ); ?>">
<td>
<a target="_blank" href="<?php echo esc_url( $ad_url ); ?>" title="<?php echo esc_attr( $link_title ); ?>">
<?php echo esc_html( $ad['title'] ); ?>
</a>
</td>
<td>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output is already escaped.
echo $ad_object->get_ad_schedule_html();
?>
</td>
<td>
<select name="advads-groups[<?php echo esc_attr( $group->get_id() ); ?>][ads][<?php echo esc_attr( $ad_id ); ?>]">
<?php for ( $i = 0; $i <= $max_weight; $i++ ) : ?>
<option<?php selected( $ad['weight'], $i ); ?>><?php echo $i; // phpcs:ignore ?></option>
<?php endfor; ?>
</select>
</td>
<td>
<button type="button" class="advads-remove-ad-from-group button">x</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ( $this->all_ads ) : ?>
<fieldset class="advads-group-add-ad">
<legend><?php esc_html_e( 'New Ad', 'advanced-ads' ); ?></legend>
<select class="advads-group-add-ad-list-ads">
<?php
foreach ( $this->all_ads as $ad_id => $ad_title ) {
$ad_status = wp_advads_get_ad( $ad_id )->get_ad_schedule_details();
printf(
'<option value="advads-groups[%1$d][ads][%2$d]" data-status="%3$s" data-status-string="%4$s">%5$s</option>',
absint( $group->get_id() ),
absint( $ad_id ),
esc_html( $ad_status['status_type'] ?? '' ),
esc_html( $ad_status['status_strings'][0] ?? '' ),
esc_html( $ad_title )
);
}
?>
</select>
<select class="advads-group-add-ad-list-weights">
<?php for ( $i = 0; $i <= $max_weight; $i++ ) : ?>
<option<?php selected( 10, $i ); ?>><?php echo absint( $i ); ?></option>
<?php endfor; ?>
</select>
<button type="button" class="button"><?php esc_html_e( 'add', 'advanced-ads' ); ?></button>
</fieldset>
<?php else : ?>
<a class="button" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=advanced_ads' ) ); ?>"><?php esc_html_e( 'Create your first ad', 'advanced-ads' ); ?></a>
<?php
endif;