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,74 @@
<?php
/**
* Template for the Author display condition
*
* @package AdvancedAds
*
* @var string $name Form name attribute.
* @var int $max_authors Number of maximum author entries to show.
*/
?>
<div class="advads-conditions-single advads-buttonset">
<?php
if ( count( $authors ) >= $max_authors ) :
// show active authors.
?>
<div class="advads-conditions-authors-buttons dynamic-search">
<?php
foreach ( $authors as $_author ) :
// dont use strict comparision because $values contains strings.
if ( in_array( $_author->ID, $values ) ) : // phpcs:ignore
$author_name = $_author->display_name;
$field_id = 'advads-conditions-' . absint( $_author->ID ) . $rand;
?>
<label class="button advads-button advads-ui-state-active">
<span class="advads-button-text">
<?php echo esc_attr( $author_name ); ?>
<input type="hidden"
name="<?php echo esc_attr( $name ); ?>[value][]"
value="<?php echo absint( $_author->ID ); ?>">
</span>
</label>
<?php
endif;
endforeach;
?>
</div>
<span class="advads-conditions-authors-show-search button" title="<?php echo esc_html_x( 'add more authors', 'display the authors search field on ad edit page', 'advanced-ads' ); ?>">
+
</span>
<br/>
<input type="text" class="advads-conditions-authors-search"
data-input-name="<?php echo esc_attr( $name ); ?>[value][]"
placeholder="<?php esc_html_e( 'author name or id', 'advanced-ads' ); ?>"/>
<?php
else :
$max_counter = $max_authors;
foreach ( $authors as $_author ) {
if ( $max_counter <= 0 ) {
return false;
}
--$max_counter;
// dont use strict comparision because $values contains strings.
if ( in_array( $_author->ID, $values ) ) { // phpcs:ignore
$_val = 1;
} else {
$_val = 0;
}
$author_name = $_author->display_name;
$field_id = 'advads-conditions-' . absint( $_author->ID ) . $rand;
?>
<label class="button advads-button"
for="<?php echo esc_attr( $field_id ); ?>">
<?php echo esc_attr( $author_name ); ?>
</label><input type="checkbox"
id="<?php echo esc_attr( $field_id ); ?>"
name="<?php echo esc_attr( $name ); ?>[value][]" <?php checked( $_val, 1 ); ?>
value="<?php echo absint( $_author->ID ); ?>">
<?php
}
include ADVADS_ABSPATH . 'admin/views/conditions/not-selected.php';
endif;
?>
</div>

View File

@@ -0,0 +1,35 @@
<?php
/**
* Template for the Device visitor condition
*
* @package AdvancedAds
*
* @var string $name Form name attribute.
* @var string $operator The operator, should be one of `is` or `is_not`.
* @var array $type_options Array with additional information.
* @var array $options The options for the current condition.
* @var int $index The zero-based index for the current condition.
*/
?>
<input type="hidden" name="<?php echo esc_attr( $name ); ?>[type]" value="<?php echo esc_attr( $options['type'] ); ?>"/>
<div class="advads-conditions-single advads-buttonset">
<?php
$rand = uniqid();
foreach ( $type_options[ $options['type'] ]['device_types'] as $device_type ) :
$input_id = 'advads-visitor-conditions-device-' . $index . '-' . $device_type['id'] . '-' . $rand;
?>
<label for="<?php echo esc_attr( $input_id ); ?>" class="button advads-button">
<?php echo esc_html( $device_type['label'] ); ?>
</label>
<input type="checkbox" id="<?php echo esc_attr( $input_id ); ?>" name="<?php echo esc_attr( $name ); ?>[value][]" value="<?php echo esc_attr( $device_type['id'] ); ?>" <?php checked( $device_type['checked'] ); ?>>
<?php endforeach; ?>
<?php include ADVADS_ABSPATH . 'admin/views/conditions/not-selected.php'; // phpcs:ignore ?>
</div>
<?php
printf(
'<p class="description"><a href="%1$s" class="advads-manual-link" target="_blank">%2$s</a></p>',
esc_url( $type_options[ $options['type'] ]['helplink'] ),
esc_html__( 'Manual', 'advanced-ads' )
);

View File

@@ -0,0 +1,32 @@
<?php
/**
* Template for a condition that only contains of an is/is_not choice.
*
* @package AdvancedAds
*
* @var string $name form field name attribute.
* @var string $operator operator.
* @var array $type_options additional options for the condition.
*/
?>
<input type="hidden" name="<?php echo esc_attr( $name ); ?>[type]" value="<?php echo esc_attr( $options['type'] ); ?>"/>
<?php // Note: placeholder tag so it's not considered empty condition. ?>
<input type="hidden" name="<?php echo esc_attr( $name ); ?>[value]" value="1">
<?php
require ADVADS_ABSPATH . 'admin/views/conditions/condition-operator.php';
?>
<p class="description">
<?php echo esc_html( $type_options[ $options['type'] ]['description'] ); ?>
<?php
if ( isset( $type_options[ $options['type'] ]['helplink'] ) ) {
printf(
'<a href="%1$s" class="advads-manual-link" target="_blank">%2$s</a>',
esc_url( $type_options[ $options['type'] ]['helplink'] ),
esc_html__( 'Manual', 'advanced-ads' )
);
}
?>
</p>

View File

@@ -0,0 +1,26 @@
<?php
/**
* Template to select number-based conditions.
*
* @var string $name form name attribute.
* @var string $operator operator.
* @var array $type_options array with information. We get the description of the condition from here.
*/
?>
<input type="hidden" name="<?php echo esc_attr( $name ); ?>[type]" value="<?php echo esc_attr( $options['type'] ); ?>"/>
<select name="<?php echo esc_attr( $name ); ?>[operator]">
<option
value="is_equal" <?php selected( 'is_equal', $operator ); ?>><?php esc_html_e( 'equal', 'advanced-ads' ); ?></option>
<option
value="is_higher" <?php selected( 'is_higher', $operator ); ?>><?php esc_html_e( 'equal or higher', 'advanced-ads' ); ?></option>
<option
value="is_lower" <?php selected( 'is_lower', $operator ); ?>><?php esc_html_e( 'equal or lower', 'advanced-ads' ); ?></option>
</select><input type="number" name="<?php echo esc_attr( $name ); ?>[value]" value="<?php echo absint( $value ); ?>"/>
<p class="description">
<?php echo esc_html( $type_options[ $options['type'] ]['description'] ); ?>
<?php if ( isset( $type_options[ $options['type'] ]['helplink'] ) ) : ?>
<a href="<?php echo esc_url( $type_options[ $options['type'] ]['helplink'] ); ?>" class="advads-manual-link" target="_blank">
<?php esc_html_e( 'Manual', 'advanced-ads' ); ?>
</a>
<?php endif; ?>
</p>

View File

@@ -0,0 +1,15 @@
<?php
/**
* Template for the is/is_not operator used in many conditions.
*
* @package AdvancedAds
* @var string $name form field name attribute.
* @var string $operator operator value.
*/
?>
<select name="<?php echo esc_attr( $name ); ?>[operator]">
<option value="is" <?php selected( 'is', $operator ); ?>><?php esc_html_e( 'is', 'advanced-ads' ); ?></option>
<option
value="is_not" <?php selected( 'is_not', $operator ); ?>><?php esc_html_e( 'is not', 'advanced-ads' ); ?></option>
</select>

View File

@@ -0,0 +1,11 @@
<input type="hidden" name="<?php echo esc_attr( $name ); ?>[type]" value="<?php echo esc_attr( $options['type'] ); ?>"/>
<div class="advads-condition-line-wrap">
<?php include ADVADS_ABSPATH . 'admin/views/ad-conditions-string-operators.php'; ?>
<input type="text" name="<?php echo esc_attr( $name ); ?>[value]" value="<?php echo esc_attr( $value ); ?>"/>
</div>
<p class="description">
<?php echo esc_html( $type_options[ $options['type'] ]['description'] ); ?>
<?php if ( isset( $type_options[ $options['type'] ]['helplink'] ) ) : ?>
<a href="<?php echo esc_url( $type_options[ $options['type'] ]['helplink'] ); ?>" class="advads-manual-link" target="_blank"><?php esc_html_e( 'Manual', 'advanced-ads' ); ?></a>
<?php endif; ?>
</p>

View File

@@ -0,0 +1,39 @@
<fieldset data-condition-list-target="<?php echo esc_attr( $list_target ); ?>"
data-condition-form-name="<?php echo esc_attr( $form_name ); ?>"
data-condition-action="<?php echo esc_attr( $action ); ?>"
data-condition-connector-default="<?php echo esc_attr( $connector_default ); ?>"
<?php
if ( $empty_options ) :
?> class="advads-hide-in-wizard"<?php
endif;
?>>
<legend><?php esc_attr_e( 'New condition', 'advanced-ads' ); ?></legend>
<input type="hidden" class="advads-conditions-index"
value="<?php echo is_array( $set_conditions ) ? count( $set_conditions ) : 0; ?>"/>
<div class="advads-conditions-new">
<select>
<option value=""><?php esc_attr_e( '-- choose a condition --', 'advanced-ads' ); ?></option>
<?php foreach ( $conditions as $_condition_id => $_condition ) : ?>
<?php if ( empty( $_condition['disabled'] ) ) : ?>
<option value="<?php echo esc_attr( $_condition_id ); ?>"><?php echo esc_html( $_condition['label'] ); ?></option>
<?php endif; ?>
<?php
endforeach;
if ( isset( $pro_conditions ) && count( $pro_conditions ) ) :
?>
<optgroup label="<?php esc_attr_e( 'Add-On features', 'advanced-ads' ); ?>">
<?php
foreach ( $pro_conditions as $_pro_condition ) :
?>
<option disabled="disabled"><?php echo esc_html( $_pro_condition ); ?></option>
<?php
endforeach;
?>
</optgroup>
<?php
endif;
?>
</select>
<span class="advads-loader" style="display: none;"></span>
</div>
</fieldset>

View File

@@ -0,0 +1,100 @@
<?php
/**
* HTML code to show all the conditions in metabox
*
* @package AdvancedAds
*/
?>
<table id="<?php echo esc_attr( $list_target ); ?>" class="advads-conditions-table">
<tbody>
<?php
$last_index = - 1;
$i = 0;
if ( is_array( $set_conditions ) ) :
foreach ( $set_conditions as $_index => $_options ) :
$show_or_force_warning = false;
$show_is_not_or_warning = false;
// get type attribute from previous option format.
$_options['type'] = isset( $_options['type'] ) ? $_options['type'] : $_index;
$connector = ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
$operator = ! isset( $_options['operator'] ) || 'is_not' !== $_options['operator'] ? 'is' : 'is_not';
if ( isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['metabox'] ) ) {
$metabox = $conditions[ $_options['type'] ]['metabox'];
} else {
continue;
}
if ( method_exists( $metabox[0], $metabox[1] ) ) {
/**
* Show warning for connector when
* not set to OR already
* this condition and the previous are on page level and not from the identical type
* they are both set to SHOW
*/
$taxonomy = isset( $_options['type'] ) && isset( $conditions[ $_options['type'] ]['taxonomy'] ) ? $conditions[ $_options['type'] ]['taxonomy'] : false; // phpcs:ignore
$last_tax = isset( $set_conditions[ $last_index ]['type'] ) && isset( $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] ) ? $conditions[ $set_conditions[ $last_index ]['type'] ]['taxonomy'] : false;
if (
$taxonomy && $last_tax && $last_tax === $taxonomy
&& ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] )
&& 'is' === $operator && 'is' === $set_conditions[ $last_index ]['operator']
&& $_options['type'] !== $set_conditions[ $last_index ]['type']
) {
$show_or_force_warning = true;
}
if (
'is_not' === $operator
&& 'or' === $connector
&& isset( $set_conditions[ $last_index ]['operator'] )
&& 'is_not' === $set_conditions[ $last_index ]['operator']
) {
$show_is_not_or_warning = true;
}
if ( $i > 0 ) :
?>
<tr class="advads-conditions-connector advads-conditions-connector-<?php echo esc_attr( $connector ); ?>">
<td colspan="3">
<?php
echo Advanced_Ads_Display_Conditions::render_connector_option( $i, $connector, $form_name ); // phpcs:ignore
if ( $show_or_force_warning || $show_is_not_or_warning ) {
?>
<p class="advads-notice-inline advads-error" style="display: block;">
<?php
if ( $show_or_force_warning ) {
esc_attr_e( 'Forced to OR.', 'advanced-ads' );
echo '&nbsp;<a target="_blank" href="https://wpadvancedads.com/manual/display-conditions#manual-combining-multiple-conditions">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
} else {
esc_attr_e( 'The ad might always show due to OR and "is not". Better use AND.', 'advanced-ads' );
echo '&nbsp;<a target="_blank" href="https://wpadvancedads.com/manual/display-conditions/#Combining_conditions_with_AND_and_OR">' . esc_attr__( 'manual', 'advanced-ads' ) . '</a>';
}
?>
</p>
<?php
}
?>
</td>
</tr>
<?php endif; ?>
<tr>
<td class="advads-conditions-type"
data-condition-type="<?php echo esc_attr( $_options['type'] ); ?>"><?php echo esc_html( $conditions[ $_options['type'] ]['label'] ); ?>
</td>
<td>
<?php
call_user_func( [ $metabox[0], $metabox[1] ], $_options, $i++, $form_name );
?>
</td>
<td>
<button type="button" class="advads-conditions-remove button">x</button>
</td>
</tr>
<?php
}
$last_index = $_index;
endforeach;
endif;
?>
</tbody>
</table>

View File

@@ -0,0 +1,21 @@
<?php
/**
* View to show a notice when no terms are available for a taxonomy.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.2
*
* @var WP_Taxonomy $taxonomy
*/
?>
<p class="advads-conditions-not-selected advads-notice-inline advads-idea">
<?php
printf(
/* translators: %s is a name of a taxonomy. */
esc_html_x( 'No %s found on your site.', 'Error message shown when no terms exists for display condition; placeholder is taxonomy label.', 'advanced-ads' ),
esc_html( $taxonomy->label )
);
?>
</p>

View File

@@ -0,0 +1,3 @@
<p class="advads-conditions-not-selected advads-notice-inline advads-error">
<?php echo esc_html_x( 'Please select some items.', 'Error message shown when no display condition term is selected', 'advanced-ads' ); ?>
</p>

View File

@@ -0,0 +1,54 @@
<?php
/**
* Visitor conditions list template.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.x.x
*
* @var array $conditions Visitor conditions.
* @var string $form_name Form name.
* @var string $list_target Target list.
* @var array $set_conditions Set conditions.
* @var array $conditions Conditions.
* @var array $conditions_types Conditions types.
*/
?>
<table id="<?php echo esc_attr( $list_target ); ?>" class="advads-conditions-table">
<tbody>
<?php
if ( isset( $set_conditions ) ) :
$i = 0;
foreach ( $set_conditions as $_options ) :
if ( isset( $conditions[ $_options['type'] ]['metabox'] ) ) {
$metabox = $conditions[ $_options['type'] ]['metabox'];
} else {
continue;
}
$connector = ( ! isset( $_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
if ( method_exists( $metabox[0], $metabox[1] ) ) {
if ( $i > 0 ) :
?>
<tr class="advads-conditions-connector advads-conditions-connector-<?php echo esc_attr( $connector ); ?>">
<td colspan="3">
<?php echo Advanced_Ads_Visitor_Conditions::render_connector_option( $i, $connector, $form_name ); // phpcs:ignore ?>
</td>
</tr>
<?php endif; ?>
<tr>
<td class="advads-conditions-type"><?php echo esc_html( $conditions[ $_options['type'] ]['label'] ); ?></td>
<td>
<?php call_user_func( [ $metabox[0], $metabox[1] ], $_options, $i ++, $form_name ); // phpcs:ignore ?>
</td>
<td>
<button type="button" class="advads-conditions-remove button">x</button>
</td>
</tr>
<?php
}
endforeach;
endif;
?>
</tbody>
</table>