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,14 @@
<?php
/**
* Module backend main file
*
* @package AdvancedAds\Pro
* @author Advanced Ads <info@wpadvancedads.com>
*/
// Stop if bbPress isn't activated.
if ( ! class_exists( 'bbPress', false ) ) {
return;
}
( new AdvancedAds\Pro\Modules\bbPress\Admin\Admin() )->hooks();

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,171 @@
<?php
/**
* BBPress module admin
*
* @package AdvancedAds\Pro\Modules\bbPress
* @author Advanced Ads <info@wpadvancedads.com>
*/
namespace AdvancedAds\Pro\Modules\bbPress\Admin;
use AdvancedAds\Utilities\WordPress;
use AdvancedAds\Framework\Interfaces\Integration_Interface;
defined( 'ABSPATH' ) || exit;
/**
* Class Admin
*/
class Admin implements Integration_Interface {
/**
* Hook into WordPress.
*
* @return void
*/
public function hooks(): void {
add_action( 'advanced-ads-placement-options-after', [ $this, 'bbpress_comment' ], 10, 2 );
add_action( 'advanced-ads-placement-options-after', [ $this, 'bbpress_static' ], 10, 2 );
}
/**
* Add position setting for static content placement
*
* @param string $slug the placement slug.
* @param Placement $placement the placement.
*
* @return void
*/
public function bbpress_static( $slug, $placement ): void {
// Early bail!!
if ( ! $placement->is_type( 'bbPress static' ) ) {
return;
}
$hooks = $this->get_bbpress_static_hooks();
ob_start();
?>
<label>
<select name="advads[placements][options][bbPress_static_hook]">
<option>---</option>
<?php foreach ( $hooks as $group => $positions ) : ?>
<optgroup label="<?php echo esc_attr( $group ); ?>">
<?php foreach ( $positions as $position ) : ?>
<option value="<?php echo esc_attr( $position ); ?>" <?php selected( $position, $placement->get_prop( 'bbPress_static_hook' ) ); ?>><?php echo esc_html( $position ); ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</label>
<?php
$content = ob_get_clean();
WordPress::render_option(
'bbpress-static',
__( 'Position', 'advanced-ads-pro' ),
$content
);
}
/**
* Add position setting for bbpress reply placement
*
* @param string $slug the placement slug.
* @param Placement $placement the placement object.
*
* @return void
*/
public function bbpress_comment( $slug, $placement ): void {
// Early bail!!
if ( ! $placement->is_type( 'bbPress comment' ) ) {
return;
}
$comment_hooks = $this->get_bbpress_comment_hooks();
ob_start();
?>
<label>
<?php esc_html_e( 'Position', 'advanced-ads-pro' ); ?>&nbsp;
<select name="advads[placements][options][bbPress_comment_hook]">
<option>---</option>
<?php foreach ( $comment_hooks as $group => $positions ) : ?>
<optgroup label="<?php echo esc_attr( $group ); ?>">
<?php foreach ( $positions as $position ) : ?>
<option value="<?php echo esc_attr( $position ); ?>"<?php selected( $position, $placement->get_prop( 'bbPress_comment_hook' ) ); ?>><?php echo esc_html( $position ); ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</label>
<br>
<br>
<label>
<?php
echo wp_kses(
sprintf(
/* translators: %s: index input field */
__( 'Inject after %s post', 'advanced-ads-pro' ),
sprintf(
'<input type="number" required="required" min="1" step="1" name="advads[placements][options][pro_bbPress_comment_pages_index]" value="%d"/>',
Max( 1, (int) $placement->get_prop( 'pro_bbPress_comment_pages_index' ) )
)
),
[
'input' => [
'type' => [],
'required' => [],
'min' => [],
'step' => [],
'name' => [],
'value' => [],
],
]
);
?>
</label>
<br>
<?php
$content = ob_get_clean();
WordPress::render_option(
'bbpress-comment',
__( 'Position', 'advanced-ads-pro' ),
$content
);
}
/**
* Get bbpress static content hooks
*
* @return array
*/
private function get_bbpress_static_hooks(): array {
return [
__( 'forum topic page', 'advanced-ads-pro' ) => [
'template after replies loop',
'template before replies loop',
],
__( 'single forum page', 'advanced-ads-pro' ) => [
'template after single forum',
'template before single forum',
],
__( 'forums page', 'advanced-ads-pro' ) => [
'template after forums loop',
'template before forums loop',
],
];
}
/**
* Get bbpress comment hooks
*
* @return array
*/
private function get_bbpress_comment_hooks(): array {
return [
__( 'forum topic page', 'advanced-ads-pro' ) => [
'theme after reply content',
'theme before reply content',
'theme after reply author admin details',
],
];
}
}

View File

@@ -0,0 +1,107 @@
<?php
/**
* Main module class
*
* @package AdvancedAds\Pro\Modules\bbPress
* @author Advanced Ads <info@wpadvancedads.com>
*/
namespace AdvancedAds\Pro\Modules\bbPress;
use AdvancedAds\Abstracts\Placement;
use AdvancedAds\Framework\Interfaces\Integration_Interface;
defined( 'ABSPATH' ) || exit;
/**
* Bootstrap the bbPress module
*/
class BBPress implements Integration_Interface {
/**
* Hook into WordPress.
*
* @return void
*/
public function hooks(): void {
add_action( 'init', [ $this, 'init' ], 31 );
}
/**
* Initialize the module.
*
* @return void
*/
public function init(): void {
$placements = wp_advads_get_placements();
foreach ( $placements as $placement ) {
$this->register_hook( $placement, 'bbPress comment', 'bbPress_comment_hook' );
$this->register_hook( $placement, 'bbPress static', 'bbPress_static_hook' );
}
}
/**
* Inject during hooks found in the placement options
*
* @return void
*/
public function execute_hook(): void {
$placements = wp_advads_get_placements();
foreach ( $placements as $id => $placement ) {
if (
( $placement->is_type( 'bbPress comment' ) && $this->is_comment_hook( $placement ) )
|| ( $placement->is_type( 'bbPress static' ) && $this->is_static_content_hook( $placement ) )
) {
the_ad_placement( $id );
}
}
}
/**
* Check if can render static content placement
*
* @param Placement $placement the placement.
*
* @return bool
*/
private function is_static_content_hook( $placement ) {
$hook = current_filter();
$check = str_replace( ' ', '_', 'bbp_' . $placement->get_prop( 'bbPress_static_hook' ) );
return $placement->get_prop( 'bbPress_static_hook' ) && $hook === $check;
}
/**
* Check if can render reply placement
*
* @param Placement $placement the placement.
*
* @return bool
*/
private function is_comment_hook( $placement ) {
$hook = current_filter();
$check = str_replace( ' ', '_', 'bbp_' . $placement->get_prop( 'bbPress_comment_hook' ) );
return $placement->get_prop( 'pro_bbPress_comment_pages_index' )
&& $placement->get_prop( 'bbPress_comment_hook' )
&& $hook === $check
&& (int) $placement->get_prop( 'pro_bbPress_comment_pages_index' ) === did_action( $hook );
}
/**
* Register the bbPress hook.
*
* @param Placement $placement Placement instance.
* @param string $type Type of placement.
* @param string $prop Property name.
*
* @return void
*/
private function register_hook( $placement, $type, $prop ): void {
if ( $placement->is_type( $type ) && $placement->get_prop( $prop ) ) {
$hook = str_replace( ' ', '_', 'bbp_' . $placement->get_prop( $prop ) );
add_action( $hook, [ $this, 'execute_hook' ] );
}
}
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* Module main file
*
* @package AdvancedAds\Pro
* @author Advanced Ads <info@wpadvancedads.com>
*/
// Stop if bbPress isn't activated.
if ( ! class_exists( 'bbPress', false ) ) {
return;
}
( new AdvancedAds\Pro\Modules\bbPress\BBPress() )->hooks();