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,27 @@
<?php
/**
* Render select field for matching-technique of string-based Display Conditions
*
* @package AdvancedAds
* @author Thomas Maier <support@wpadvancedads.com>
* @license GPL-2.0+
* @link https://wpadvancedads.com
* @copyright since 2013 Thomas Maier, Advanced Ads GmbH
*
* @var string $name option name.
* @var string $operator value of the $operator option.
*/
?>
<select name="<?php echo esc_attr( $name ); ?>[operator]">
<option value="contain" <?php selected( 'contain', $operator ); ?>><?php esc_attr_e( 'contains', 'advanced-ads' ); ?></option>
<option value="start" <?php selected( 'start', $operator ); ?>><?php esc_attr_e( 'starts with', 'advanced-ads' ); ?></option>
<option value="end" <?php selected( 'end', $operator ); ?>><?php esc_attr_e( 'ends with', 'advanced-ads' ); ?></option>
<option value="match" <?php selected( 'match', $operator ); ?>><?php esc_attr_e( 'matches', 'advanced-ads' ); ?></option>
<option value="regex" <?php selected( 'regex', $operator ); ?>><?php esc_attr_e( 'matches regex', 'advanced-ads' ); ?></option>
<option value="contain_not" <?php selected( 'contain_not', $operator ); ?>><?php esc_attr_e( 'does not contain', 'advanced-ads' ); ?></option>
<option value="start_not" <?php selected( 'start_not', $operator ); ?>><?php esc_attr_e( 'does not start with', 'advanced-ads' ); ?></option>
<option value="end_not" <?php selected( 'end_not', $operator ); ?>><?php esc_attr_e( 'does not end with', 'advanced-ads' ); ?></option>
<option value="match_not" <?php selected( 'match_not', $operator ); ?>><?php esc_attr_e( 'does not match', 'advanced-ads' ); ?></option>
<option value="regex_not" <?php selected( 'regex_not', $operator ); ?>><?php esc_attr_e( 'does not match regex', 'advanced-ads' ); ?></option>
</select>

View File

@@ -0,0 +1,22 @@
<?php
/**
* Render preview information for the image ad type
*
* @var string $src image source URL.
* @var string $alt alt attribute value.
* @var string $preview_hwstring width and height information for the smaller preview icon.
* @var string $tooltip_hwstring width and height information for the larger version in the tooltip.
*/
?>
<span class="advads-ad-list-tooltip">
<span class="advads-ad-list-tooltip-content">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $hwstring is not something we can escape.
printf( '<img src="%s" alt="%s" %s/>', esc_url( $src ), esc_attr( $alt ), $tooltip_hwstring );
?>
</span>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $hwstring is not something we can escape.
printf( '<img src="%s" alt="%s" %s/>', esc_url( $src ), esc_attr( $alt ), $preview_hwstring );
?>
</span>

View File

@@ -0,0 +1,40 @@
<?php
/**
* A couple of checks to see if there is any critical issue
* listed on support and settings page
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.2
*/
$messages = [];
if ( Advanced_Ads_Ad_Health_Notices::has_visible_problems() ) {
$messages[] = sprintf(
/* translators: %1$s is a starting link tag, %2$s is closing the link tag. */
esc_attr__( 'Advanced Ads detected potential problems with your ad setup. %1$sShow me these errors%2$s', 'advanced-ads' ),
'<a href="' . admin_url( 'admin.php?page=advanced-ads' ) . '">',
'</a>'
);
}
$messages = apply_filters( 'advanced-ads-support-messages', $messages );
if ( count( $messages ) ) :
?><div class="message error">
<?php
foreach ( $messages as $_message ) :
?>
<p>
<?php
// phpcs:ignore
echo $_message;
?>
</p>
<?php
endforeach;
?>
</div>
<?php
endif;

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>

View File

@@ -0,0 +1,80 @@
<script>
jQuery( document ).ready( function(){
// set element from frontend into placement input field
if( localStorage.getItem( 'advads_frontend_element' )){
var placement = localStorage.getItem( 'advads_frontend_picker' );
var id = 'advads-frontend-element-' + placement;
jQuery( '[id="' + id + '"]' ).find( '.advads-frontend-element' ).val( localStorage.getItem( 'advads_frontend_element' ) );
var action = localStorage.getItem( 'advads_frontend_action' );
if (typeof(action) !== 'undefined'){
var show_all_link = jQuery( 'a[data-placement="' + placement + '"]');
var tr = jQuery( show_all_link ).closest( 'tr.advanced-ads-placement-row' )
if ( tr ) {
tr.data( 'touched', true )
}
// Auto-save the placement after selecting an element in the frontend.
var param = {
action: 'advads-update-frontend-element',
nonce: advadsglobal.ajax_nonce,
}
var $form = jQuery( '#advanced-ads-placements-form' );
var query = $form.find( '[id="single-placement-' + placement + '"]' ).find( 'input, select' )
.serialize() + '&' + jQuery.param( param );
$form.find( ':submit' ).attr( 'disabled', true );
jQuery.post( ajaxurl, query ).always( function() {
$form.find( ':submit' ).attr( 'disabled', false );
} );
}
localStorage.removeItem( 'advads_frontend_action' );
localStorage.removeItem( 'advads_frontend_element' );
localStorage.removeItem( 'advads_frontend_picker' );
localStorage.removeItem( 'advads_prev_url' );
localStorage.removeItem( 'advads_frontend_pathtype' );
localStorage.removeItem( 'advads_frontend_boundary' );
localStorage.removeItem( 'advads_frontend_blog_id' );
localStorage.removeItem( 'advads_frontend_starttime' );
window.Advanced_Ads_Admin.set_cookie( 'advads_frontend_picker', '', -1 );
}
jQuery('.advads-activate-frontend-picker').click(function( e ){
localStorage.setItem( 'advads_frontend_picker', jQuery( this ).data('placementid') );
localStorage.setItem( 'advads_frontend_action', jQuery( this ).data('action') );
localStorage.setItem( 'advads_prev_url', window.location );
localStorage.setItem( 'advads_frontend_pathtype', jQuery( this ).data('pathtype') );
localStorage.setItem( 'advads_frontend_boundary', jQuery( this ).data('boundary') );
localStorage.setItem( 'advads_frontend_blog_id', <?php echo get_current_blog_id(); ?> );
localStorage.setItem( 'advads_frontend_starttime', (new Date).getTime() );
window.Advanced_Ads_Admin.set_cookie( 'advads_frontend_picker', jQuery( this ).data('placementid'), null );
if ( jQuery( this ).data( 'boundary' ) ) {
/**
* The boundary is set for the "Content" placement.
* Perhaps ads through `the_content` are disabled on non-singular pages, so use a singular one.
*/
window.location = "<?php echo $this->get_url_for_content_placement_picker(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>";
} else {
window.location = "<?php echo home_url(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>";
}
});
// allow to deactivate frontend picker
if ( localStorage.getItem( 'advads_frontend_picker' ) ) {
var id = 'advads-frontend-element-' + localStorage.getItem( 'advads_frontend_picker' );
jQuery( '[id="' + id + '"]' ).find( '.advads-deactivate-frontend-picker' ).show();
}
jQuery( '.advads-deactivate-frontend-picker' ).click( function( e ) {
localStorage.removeItem( 'advads_frontend_action' );
localStorage.removeItem( 'advads_frontend_element' );
localStorage.removeItem( 'advads_frontend_picker' );
localStorage.removeItem( 'advads_prev_url' );
localStorage.removeItem( 'advads_frontend_pathtype' );
localStorage.removeItem( 'advads_frontend_boundary' );
localStorage.removeItem( 'advads_frontend_blog_id' );
localStorage.removeItem( 'advads_frontend_starttime' );
window.Advanced_Ads_Admin.set_cookie( 'advads_frontend_picker', '', -1 );
jQuery('.advads-deactivate-frontend-picker').hide();
});
});
</script>

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1,77 @@
<?php
/**
* Advanced Ads - Backend modal
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.0.0
*
* @var string $modal_slug Unique slug that can be addressed by a link or button.
* @var string $modal_content The modal content. May contain HTML.
* @var string $modal_title The modal title.
* @var string $cancel_action Show/Hide cancel button.
* @var string $close_action Adds another close button that can trigger an action.
* @var string $close_form Add a form ID. This form will be submitted after clicking the close and action button.
* @var string $close_validation A JavaScript validation function. The function has to return true or the form won't be submitted.
*/
$close_validation_object = [
'function' => $close_validation,
'modal_id' => "#modal-$modal_slug",
];
?>
<script>
document.addEventListener( 'DOMContentLoaded', function () {
document.querySelector( '#modal-<?php echo esc_attr( $modal_slug ); ?>' ).closeValidation = <?php echo wp_json_encode( $close_validation_object ); ?>;
<?php if ( $close_action && $close_form ) : ?>
document.querySelector( '#modal-<?php echo esc_attr( $modal_slug ); ?> .advads-modal-close-action' ).addEventListener( 'click', function ( event ) {
modal_submit_form( event, '<?php echo esc_attr( $close_form ); ?>', '#modal-<?php echo esc_attr( $modal_slug ); ?>', '<?php echo esc_attr( $close_validation ); ?>' );
} );
<?php endif; ?>
} );
</script>
<dialog id="modal-<?php echo esc_attr( $modal_slug ); ?>" class="advads-modal" data-modal-id="<?php echo esc_attr( $modal_slug ); ?>" autofocus>
<a href="#close" class="advads-modal-close-background">Close</a>
<div class="advads-modal-content">
<div class="advads-modal-header">
<a href="#close" class="advads-modal-close" title="<?php esc_html_e( 'Cancel', 'advanced-ads' ); ?>">&times;</a>
<h2>
<?php echo esc_html( $modal_title ); ?>
</h2>
</div>
<div class="advads-modal-body">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- modal content may contain any kind of custom html
echo $modal_content;
?>
</div>
<div class="advads-modal-footer">
<div class="tablenav bottom">
<?php if ( false === $cancel_action ) : ?>
<a href="#close" class="button button-secondary advads-modal-close">
<?php esc_html_e( 'Cancel', 'advanced-ads' ); ?>
</a>
<?php endif; ?>
<?php if ( $close_action ) : ?>
<?php if ( $close_form ) : ?>
<button type="submit" form="<?php echo esc_attr( $close_form ); ?>" class="button button-primary advads-modal-close-action">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
echo $close_action;
?>
</button>
<?php else : ?>
<a href="#close" class="button button-primary advads-modal-close-action">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- close action may contain custom html like button bar, image or span tag e.g.
echo $close_action;
?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
</dialog>

View File

@@ -0,0 +1,13 @@
<?php
/**
* The view to render the option.
*
* @var string $ad_blocker_notice_id Randomised ad blocker id.
*/
?>
<div id="<?php echo esc_attr( $ad_blocker_notice_id ); ?>" class="message error update-message notice notice-alt notice-error" style="display: none;">
<p>
<?php echo wp_kses_post( __( 'Please disable your <strong>AdBlocker</strong>. Otherwise, the features of Advanced Ads and the layout are broken.', 'advanced-ads' ) ); ?>
<a href="https://wpadvancedads.com/manual/ad-blockers/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adblock-enabled#How_do_you_know_if_you_are_using_an_ad_blocker" target="_blank" class="advads-manual-link"><?php esc_html_e( 'Manual', 'advanced-ads' ); ?></a>
</p>
</div>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Error notice template.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.x.x
*
* @var string $_notice Notice ID.
* @var string $text Notice text.
*/
?>
<div class="notice notice-error advads-notice advads-admin-notice is-dismissible" data-notice="<?php echo esc_attr( $_notice ); ?>">
<p>
<?php echo wp_kses_post( $text ); ?>
</p>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* Info notice template
*
* @package AdvancedAds
*
* @var string $text notice text
* @var string $_notice notice id
*/
use AdvancedAds\Framework\Utilities\Params;
?>
<div class="notice notice-info advads-notice advads-admin-notice message is-dismissible" data-notice="<?php echo esc_attr( $_notice ); ?>">
<p><?php echo $text; // phpcs:ignore ?></p>
<a href="
<?php
add_query_arg(
[
'action' => 'advads-close-notice',
'notice' => $_notice,
'nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
'redirect' => Params::server( 'REQUEST_URI' ),
],
admin_url( 'admin-ajax.php' )
);
?>
" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html__( 'Dismiss this notice.', 'advanced-ads' ); ?></span></a>
</div>

View File

@@ -0,0 +1,22 @@
<?php
/**
* Inline notice template.
*
* @package AdvancedAds
*
* @var string $_notice notice ID.
* @var string $text notice text.
* @var array $notice notice data (optional).
* @var string $box_classes additional classes (optional).
*/
?>
<div class="notice notice-info advads-admin-notice is-dismissible inline advads-notice-box <?php echo esc_attr( $box_classes ?? '' ); ?>" data-notice="<?php echo esc_attr( $_notice ); ?>">
<div class="advads-notice-box_wrapper">
<p><?php echo $text; // phpcs:ignore ?></p>
<button type="button" class="button-primary advads-notices-button-subscribe with-icon" data-notice="<?php echo esc_attr( $_notice ); ?>">
<span class="dashicons dashicons-email-alt"></span>
<?php echo esc_html( $notice['confirm_text'] ?? __( 'Subscribe me now', 'advanced-ads' ) ); ?>
</button>
</div>
</div>

View File

@@ -0,0 +1 @@
<div class="notice notice-error advads-admin-notice inline"><p><?php echo wp_kses_post( $text ); ?></p></div>

View File

@@ -0,0 +1,46 @@
<?php
/**
* Template for a promotional banner
*
* @package AdvancedAds
*
* @var string $text content of the notice.
* @var string $_notice internal key of the notice.
*/
use AdvancedAds\Framework\Utilities\Params;
?>
<div class="notice notice-promo advads-notice advads-admin-notice message is-dismissible"
data-notice="<?php echo esc_attr( $_notice ); ?>">
<p>
<?php
echo wp_kses(
$text,
[
'a' => [
'href' => [],
'class' => [],
'target' => [],
],
'span' => [
'style' => [],
],
]
);
?>
</p>
<a href="
<?php
add_query_arg(
[
'action' => 'advads-close-notice',
'notice' => $_notice,
'nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
'redirect' => Params::server( 'REQUEST_URI' ),
],
admin_url( 'admin-ajax.php' )
);
?>
" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html__( 'Dismiss this notice.', 'advanced-ads' ); ?></span></a>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* Success notice for the starter setup.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.x.x
*
* @var string $last_post_link URL to the last created post.
*/
?>
<div class="notice notice-success advads-admin-notice message">
<h2>
<?php esc_html_e( '2 Test Ads successfully added!', 'advanced-ads' ); ?>
</h2>
<p>
<?php esc_html_e( 'Look below for the list of created ads.', 'advanced-ads' ); ?>
</p>
<p>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-placements' ) ); ?>"><?php esc_attr_e( 'Visit list of placements', 'advanced-ads' ); ?></a>
</p>
<?php if ( $last_post_link ) : ?>
<p>
<a href="<?php echo esc_url( $last_post_link ); ?>" target="_blank">
<?php esc_html_e( 'See them in action', 'advanced-ads' ); ?>
</a>
</p>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,20 @@
<?php
/**
* Subscribe notice template.
*
* @package AdvancedAds
*
* @var string $_notice notice ID.
* @var string $text notice text.
* @var array $notice notice data (optional).
*/
?>
<div class="notice notice-info advads-admin-notice is-dismissible" data-notice="<?php echo esc_attr( $_notice ); ?>">
<div class="advads-notice-box_wrapper">
<p><?php echo $text; // phpcs:ignore ?></p>
<button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo esc_attr( $_notice ); ?>">
<?php echo esc_html( $notice['confirm_text'] ?? __( 'Subscribe me now', 'advanced-ads' ) ); ?>
</button>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* Render a row with add-on information on the Advanced Ads overview page
*
* @var array $_addon add-on information.
*/
?>
<tr<?php echo isset( $_addon['class'] ) ? ' class="' . esc_attr( $_addon['class'] ) . '"' : ''; ?>><th>
<?php
// phpcs:ignore
echo $_addon['title'];
?>
</th>
<td>
<?php
// phpcs:ignore
echo $_addon['desc'];
?>
</td>
<td><?php if ( isset( $_addon['link'] ) && $_addon['link'] ) : ?>
<a class="button <?php echo ( isset( $_addon['link_primary'] ) ) ? 'button-primary' : 'button-secondary'; ?>" href="<?php echo esc_url( $_addon['link'] ); ?>" target="_blank">
<?php
echo esc_html( $link_title );
?>
</a>
<?php
endif;
?>
</td>
</tr>

View File

@@ -0,0 +1,35 @@
<?php
/**
* Render a line in the notice meta box on the Advanced Ads overview page
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var string $type type of the notice.
* @var string $_notice_key index of the notice.
* @var bool $is_hidden true if the notice is currently hidden.
* @var bool $can_hide true if the notice can be hidden.
* @var bool $hide true if the notice is hidden.
* @var string $date date string.
* @var string $dashicon the dashicons class to use.
* @var string $text the notice text.
*/
?>
<ul class="advads-ad-health-notices advads-ad-health-notices-<?php echo esc_attr( $type ); ?>">
<li class="advads-notice-inline" data-notice="<?php echo esc_attr( $_notice_key ); ?>" <?php echo $is_hidden ? 'style="display: none;"' : ''; ?>>
<span class="dashicons <?php echo esc_attr( $dashicon ); ?>"></span>
<div class="text">
<?php echo $text; // phpcs:ignore ?>
<?php if ( $date ) : ?>
<br>
<small class="date">(<?php echo esc_attr( $date ); ?>)</small>
<?php endif; ?>
</div>
<?php if ( $can_hide ) : ?>
<button type="button" class="advads-ad-health-notice-hide <?php echo ! $hide ? 'remove' : ''; ?>">
<span class="dashicons dashicons-dismiss"></span>
</button>
<?php endif; ?>
</li>
</ul>

View File

@@ -0,0 +1,16 @@
<div id="<?php echo esc_attr( $id ); ?>" class="postbox position-<?php echo esc_attr( $position ); ?>">
<?php if ( ! empty( $title ) ) : ?>
<h2>
<?php
// phpcs:ignore
echo $title;
?>
</h2>
<?php endif; ?>
<div class="inside">
<?php
// phpcs:ignore
echo $content;
?>
</div>
</div>

View File

@@ -0,0 +1,79 @@
<?php
/**
* Render form to create new placements.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.48.2
*
* @var array $placement_types types of placements.
*/
?>
<form method="POST" class="advads-placements-new-form advads-form" id="advads-placements-new-form">
<h3>1. <?php esc_html_e( 'Choose a placement type', 'advanced-ads' ); ?></h3>
<p class="description">
<?php
printf(
wp_kses(
/* translators: %s is a URL. */
__( 'Placement types define where the ad is going to be displayed. Learn more about the different types from the <a href="%s">manual</a>', 'advanced-ads' ),
[
'a' => [
'href' => [],
],
]
),
'https://wpadvancedads.com/manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements'
);
?>
</p>
<?php require_once 'placement-types.php'; ?>
<?php
// show Pro placements if Pro is not activated.
if ( ! defined( 'AAP_VERSION' ) ) :
include ADVADS_ABSPATH . 'admin/views/upgrades/pro-placements.php';
else :
?>
<div class="clear"></div>
<?php
endif;
?>
<p class="advads-notice-inline advads-error advads-form-type-error"><?php esc_html_e( 'Please select a type.', 'advanced-ads' ); ?></p>
<br/>
<h3>2. <?php esc_html_e( 'Choose a Name', 'advanced-ads' ); ?></h3>
<p>
<input name="advads[placement][name]" class="advads-form-name" type="text" value="" placeholder="<?php esc_html_e( 'Placement Name', 'advanced-ads' ); ?>" />
<span class="advads-help">
<span class="advads-tooltip">
<?php esc_html_e( 'The name of the placement is only visible to you. Tip: choose a descriptive one, e.g. Below Post Headline.', 'advanced-ads' ); ?>
</span>
</span>
</p>
<p class="advads-notice-inline advads-error advads-form-name-error"><?php esc_html_e( 'Please enter a name.', 'advanced-ads' ); ?></p>
<h3>
<label for="advads-placement-item">3. <?php esc_html_e( 'Choose the Ad or Group', 'advanced-ads' ); ?></label>
</h3>
<p>
<select name="advads[placement][item]" id="advads-placement-item" disabled>
<option value=""><?php esc_html_e( '--not selected--', 'advanced-ads' ); ?></option>
</select>
</p>
<?php wp_nonce_field( 'advads-placement', 'advads_placement', true ); ?>
</form>
<script type="text/html" id="tmpl-advads-placement-ad-select">
<select name="advads[placement][item]" id="advads-placement-item">
<option value=""><?php esc_html_e( '--not selected--', 'advanced-ads' ); ?></option>
<# for ( group of data.items ) { #>
<optgroup label="{{ group.label }}">
<# for ( item_id in group.items ) { #>
<option value="{{ item_id }}">
{{ group.items[item_id].name }}
</option>
<# } #>
</optgroup>
<# } #>
</select>
</script>

View File

@@ -0,0 +1,197 @@
<?php
/**
* Render placements after publishing an ad.
*
* @package AdvancedAds
*
* @var Ad $ad Ad instance.
* @var array $placements Placements array.
*/
// show quick injection options.
// check if the ad code contains the AdSense verification and Auto ads code.
$is_page_level_ad_in_code_field = $ad->is_type( 'plain' ) && strpos( $ad->get_content(), 'enable_page_level_ads' ) || preg_match( '/script[^>]+data-ad-client=/', $ad->get_content() ); // phpcs:ignore
?>
<div id="advads-ad-injection-box" class="advads-ad-metabox postbox">
<span class="advads-loader" style="display: none;"></span>
<div id="advads-ad-injection-message-placement-created" class="hidden">
<p><?php esc_html_e( 'Congratulations! Your ad is now visible in the frontend.', 'advanced-ads' ); ?></p>
<?php if ( empty( $ad->get_display_conditions() ) && ! empty( $latest_post ) ) : ?>
<a class="button button-primary" target="_blank" href="<?php echo esc_url( get_permalink( $latest_post['ID'] ) ); ?>"><?php esc_html_e( 'Take a look at your ad', 'advanced-ads' ); ?></a>
<?php endif; ?>
<p class="hide-server-placement">
<?php
printf(
wp_kses(
/* translators: %s is a URL. */
__( 'Ad not showing up? Take a look <a href="%s" target="_blank">here</a>', 'advanced-ads' ),
[
'a' => [
'href' => [],
'target' => [],
],
]
),
'https://wpadvancedads.com/manual/ads-not-showing-up/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-ad-not-visible'
);
?>
</p>
<p class="hide-server-placement">
<?php
printf(
/* translators: %1$s is the opening link tag, %2$s is closing link tag. */
esc_html__( 'Adjust the placement options? Take a look %1$shere.%2$s', 'advanced-ads' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-placements#single-placement-' ) ) . '" target="_blank">',
'</a>'
);
?>
</p>
</div>
<div id="advads-ad-injection-box-placements">
<h2><?php esc_html_e( 'Where do you want to display the ad?', 'advanced-ads' ); ?></h2>
<?php
// show different placements if this is the AdSense Auto ads code.
if ( $is_page_level_ad_in_code_field ) :
if ( Advanced_Ads_AdSense_Data::get_instance()->is_page_level_enabled() ) :
?>
<p>
<?php
sprintf(
wp_kses(
/* translators: %s is a URL. */
__( 'The AdSense verification and Auto ads code is already activated in the <a href="%s">AdSense settings</a>.', 'advanced-ads' ),
[
'a' => [
'href' => [],
],
]
),
admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )
);
?>
</p><p>
<?php
esc_attr_e( 'No need to add the code manually here, unless you want to include it into certain pages only.', 'advanced-ads' );
endif;
?>
<p><?php esc_attr_e( 'Click on the button below to add the Auto ads code to the header of your site.', 'advanced-ads' ); ?></p>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="header" style="background-image: url(
<?php
// phpcs:ignore
echo ADVADS_BASE_URL . 'admin/assets/img/placements/header.png';
?>
)">
<?php
/**
* Translators: this is a label in a button when a user uses an AdSense Auto ads code in a plain code field
* the button has barely space for the original English text, so keep it short
*/
esc_attr_e( 'inject Auto ads', 'advanced-ads' );
?>
</button></div>
<div class="clear"></div>
<?php else : ?>
<p><?php esc_html_e( 'New placement', 'advanced-ads' ); ?></p>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_top" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-before.png'; ?>)"><?php esc_html_e( 'Before Content', 'advanced-ads' ); ?></button></div>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_content" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-within.png'; ?>)"><?php esc_html_e( 'Content', 'advanced-ads' ); ?></button></div>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_bottom" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-after.png'; ?>)"><?php esc_html_e( 'After Content', 'advanced-ads' ); ?></button></div>
<a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/widget.png'; ?>)"><?php esc_html_e( 'Manage Sidebar', 'advanced-ads' ); ?></button></div></a>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="default" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/manual.png'; ?>)"><?php esc_html_e( 'PHP or Shortcode', 'advanced-ads' ); ?></button></div>
<a href="https://wpadvancedads.com/place-ads-in-website-header/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-placements" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/ads-in-header.png'; ?>)"><?php esc_html_e( 'Header (Manual)', 'advanced-ads' ); ?></button></div></a>
<?php
if ( ! defined( 'AAP_VERSION' ) ) :
?>
<a href="https://wpadvancedads.com/manual/custom-position-placement/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-placements" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/custom-position.png'; ?>)"><?php esc_html_e( 'Custom Position', 'advanced-ads' ); ?></button></div></a><a href="https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created-injection-pro" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-random.png'; ?>)"><?php esc_html_e( 'Show Pro Places', 'advanced-ads' ); ?></button></div></a>
<?php
else :
?>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="custom_position" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/custom-position.png'; ?>)"><?php esc_html_e( 'Custom Position', 'advanced-ads' ); ?></button></div>
<?php
endif;
if ( class_exists( 'Advanced_Ads_In_Feed', false ) ) :
?>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="adsense_in_feed" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/adsense-in-feed.png'; ?>)"><?php esc_html_e( 'AdSense In-feed', 'advanced-ads' ); ?></button></div>
<?php
endif;
if ( ! defined( 'AASADS_VERSION' ) ) :
?>
<a href="https://wpadvancedads.com/add-ons/sticky-ads/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created-injection-sticky" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/sticky-sidebar-left.png'; ?>)"><?php esc_html_e( 'Show Sticky Places', 'advanced-ads' ); ?></button></div></a>
<?php
endif;
if ( ! defined( 'AAPLDS_VERSION' ) ) :
?>
<a href="https://wpadvancedads.com/add-ons/popup-and-layer-ads/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created-injection-layer" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/layer.png'; ?>)"><?php esc_html_e( 'Show PopUp', 'advanced-ads' ); ?></button></div></a>
<?php
else :
?>
<div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="layer" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/layer.png'; ?>)"><?php esc_html_e( 'PopUp & Layer', 'advanced-ads' ); ?></button></div>
<?php
endif;
?>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-placements' ) ); ?>">
<div class="advads-ad-injection-box-button-wrap">
<button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/more.png'; ?>)">
<?php esc_html_e( 'see all…', 'advanced-ads' ); ?>
</button>
</div>
</a>
<?php
ob_start();
foreach ( $placements as $placement_id => $placement ) :
// Early bail!!
if ( empty( $placement->get_type() ) || empty( $placement->get_title() ) ) {
continue;
}
?>
<div class="advads-ad-injection-box-button-wrap">
<?php
printf(
'<button type="button" class="advads-ad-injection-button button-primary" data-placement-id="%1$s" data-placement-type="%2$s" %3$s title="%4$s">%5$s</button>',
esc_attr( $placement_id ),
esc_attr( $placement->get_type() ),
'style="background-image: url(' . $placement->get_type_object()->get_image() . ');"', // phpcs:ignore
esc_html( $placement->get_title() ),
esc_html( $placement->get_type_object()->get_title() )
);
echo esc_html( $placement->get_title() );
?>
</div>
<?php
endforeach;
$existing_p_output = ob_get_clean();
if ( $existing_p_output ) :
?>
<div class="clear"></div>
<p><?php esc_html_e( 'Existing placement', 'advanced-ads' ); ?></p>
<?php
// phpcs:ignore
echo $existing_p_output;
endif;
?>
<div class="clear"></div>
<p>
<?php
printf(
/* translators: %s is some HTML. */
__( 'Or use the shortcode %s to insert the ad into the content manually.', 'advanced-ads' ), // phpcs:ignore
'<input id="advads-ad-injection-shortcode" onclick="this.select();" value="[the_ad id=\'' . absint( $post->ID ) . '\']"/>'
);
?>
<?php
printf(
/* translators: %s is a URL. */
__( 'Learn more about your choices to display an ad in the <a href="%s" target="_blank">manual</a>.', 'advanced-ads' ), // phpcs:ignore
'https://wpadvancedads.com/manual/display-ads/?utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created'
);
?>
</p>
<?php endif; ?>
</div>
</div>
<?php

View File

@@ -0,0 +1,29 @@
<?php
/**
* Render all placement types for forms.
*
* @var array $placement_types
*/
?>
<?php if ( is_array( $placement_types ) ) : ?>
<div class="advads-form-types advads-buttonset">
<?php foreach ( $placement_types as $key => $placement_type ) : ?>
<div class="advads-form-type">
<label for="advads-form-type-<?php echo esc_attr( $key ); ?>">
<?php if ( isset( $placement_type['image'] ) ) : ?>
<img src="<?php echo esc_attr( $placement_type['image'] ); ?>" alt="<?php echo esc_attr( $placement_type['title'] ); ?>"/>
<?php else : ?>
<strong><?php echo esc_html( $placement_type['title'] ); ?></strong><br/>
<p class="description"><?php echo esc_html( $placement_type['description'] ); ?></p>
<?php endif; ?>
</label>
<input type="radio" id="advads-form-type-<?php echo esc_attr( $key ); ?>" name="advads[placement][type]" value="<?php echo esc_attr( $key ); ?>"/>
<div class="advads-form-description">
<h4><?php echo esc_html( $placement_type['title'] ); ?></h4>
<?php echo esc_html( $placement_type['description'] ); ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Render ad label option for placements.
*
* @deprecated
*
* @var string $_placement_slug slug of the current placement.
* @var string $_label value of the label option.
* @package AdvancedAds
*/
?>
<label title="<?php esc_html_e( 'default', 'advanced-ads' ); ?>">
<input type="radio" name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][options][ad_label]" value="default" <?php checked( $_label, 'default' ); ?>/>
<?php esc_html_e( 'default', 'advanced-ads' ); ?>
</label>
<label title="<?php esc_html_e( 'enabled', 'advanced-ads' ); ?>">
<input type="radio" name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][options][ad_label]" value="enabled" <?php checked( $_label, 'enabled' ); ?>/>
<?php esc_html_e( 'enabled', 'advanced-ads' ); ?>
</label>
<label title="<?php esc_html_e( 'disabled', 'advanced-ads' ); ?>">
<input type="radio" name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][options][ad_label]" value="disabled" <?php checked( $_label, 'disabled' ); ?>/>
<?php esc_html_e( 'disabled', 'advanced-ads' ); ?>
</label>

View File

@@ -0,0 +1,52 @@
<?php
/**
* Render content index option for placements.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*
* @var Placement $placement information of the current placement.
* @var string $option_xpath xpath option.
* @var string $option_tag tag option.
* @var string $option_index index option.
* @var array $positions positions option.
*/
use AdvancedAds\Utilities\Content_Injection;
$tags = Content_Injection::get_tags();
?>
<select name="advads[placements][<?php echo esc_attr( $placement->get_slug() ); ?>][options][position]">
<?php foreach ( $positions as $_pos_key => $_pos ) : ?>
<option value="<?php echo esc_attr( $_pos_key ); ?>"<?php selected( $placement->get_prop( 'position' ), $_pos_key ); ?>>
<?php echo esc_html( $_pos ); ?>
</option>
<?php endforeach; ?>
</select>
<input type="number" name="advads[placements][<?php echo esc_attr( $placement->get_slug() ); ?>][options][index]" value="<?php echo absint( $option_index ); ?>" min="1"/>.
<select class="advads-placements-content-tag" name="advads[placements][<?php echo esc_attr( $placement->get_slug() ); ?>][options][tag]">
<?php foreach ( $tags as $_tag_key => $_tag ) : ?>
<option value="<?php echo esc_attr( $_tag_key ); ?>"<?php selected( $option_tag, $_tag_key ); ?>>
<?php echo esc_html( $_tag ); ?>
</option>
<?php endforeach; ?>
</select>
<div id="advads-frontend-element-<?php echo esc_attr( $placement->get_slug() ); ?>" class="advads-placements-content-custom-xpath<?php echo 'custom' !== $option_tag ? ' hidden' : ''; ?>">
<input name="advads[placements][<?php echo esc_attr( $placement->get_slug() ); ?>][options][xpath]"
class="advads-frontend-element "
type="text"
value="<?php echo esc_html( $option_xpath ); ?>"
placeholder="<?php esc_html_e( 'use xpath, e.g. `p[not(parent::blockquote)]`', 'advanced-ads' ); ?>"/>
<button style="display:none; color: red;" type="button" class="advads-deactivate-frontend-picker button "><?php echo esc_html_x( 'stop selection', 'frontend picker', 'advanced-ads' ); ?></button>
<button type="button" class="advads-activate-frontend-picker button " data-placementid="<?php echo esc_attr( $placement->get_slug() ); ?>" data-pathtype="xpath" data-boundary="true"><?php esc_html_e( 'select position', 'advanced-ads' ); ?></button>
</div>
<p>
<label>
<input type="checkbox" name="advads[placements][<?php echo esc_attr( $placement->get_slug() ); ?>][options][start_from_bottom]" value="1"<?php checked( $placement->get_prop( 'start_from_bottom' ), 1 ); ?> />
<?php esc_html_e( 'start counting from bottom', 'advanced-ads' ); ?>
</label>
</p>

View File

@@ -0,0 +1,15 @@
<?php
/**
* Render inline css option for placements.
*
* @var string $_placement_slug slug of the current placement.
* @var string $_placement Placement with all options.
* @package AdvancedAds
*/
$inline_css = isset( $_placement['options']['inline-css'] ) ? $_placement['options']['inline-css'] : '';
?>
<input
type="text"
value="<?php echo esc_attr( $inline_css ); ?>"
name="advads[placements][<?php echo esc_attr( $_placement_slug ); ?>][options][inline-css]"/>

View File

@@ -0,0 +1,70 @@
<?php
/**
* Render item option for placements.
*
* @var array $items Array of available items.
* @var string $slug slug of the current placement.
* @var array $placement information of the current placement.
* @var string $placement_item_type type of the item currently selected for the placement
* @var int $placement_item_id ID of the item currently selected for the placement
* @package AdvancedAds
*/
?>
<select id="advads-placements-item-<?php echo esc_attr( $slug ); ?>" name="advads[placements][<?php echo esc_attr( $slug ); ?>][item]">
<option value=""><?php esc_html_e( '--not selected--', 'advanced-ads' ); ?></option>
<?php foreach ( $items as $item_group ) : ?>
<optgroup label="<?php echo esc_attr( $item_group['label'] ); ?>">
<?php foreach ( $item_group['items'] as $item_id => $item ) : ?>
<option value="<?php echo esc_attr( $item_id ); ?>" <?php selected( $item['selected'] ); ?> <?php disabled( $item['disabled'] ); ?>>
<?php echo esc_html( $item['name'] ); ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
<?php
// link to item.
if ( $placement_item_type ) :
$link_to_item = false;
switch ( $placement_item_type ) :
case 'ad':
/**
* Deliver the translated version of an ad if set up with WPML.
*
* @source https://wpml.org/wpml-hook/wpml_object_id/
*/
$placement_item_id = apply_filters( 'wpml_object_id', $placement_item_id, 'advanced_ads' );
$link_to_item = get_edit_post_link( $placement_item_id );
break;
case 'group':
$link_to_item = admin_url( 'admin.php?page=advanced-ads-groups#modal-group-edit-' . $placement_item_id );
break;
endswitch;
if ( $link_to_item ) {
?>
<a href="<?php echo esc_url( $link_to_item ); ?>"><span class="dashicons dashicons-external"></span></span></a>
<?php
} elseif ( 'ad' === $placement_item_type && defined( 'ICL_LANGUAGE_NAME' ) ) {
// translation missing notice.
?>
<p>
<?php
printf(
/* translators: %s is the name of a language in English. */
esc_html__( 'The ad is not translated into %s', 'advanced-ads' ),
esc_html( ICL_LANGUAGE_NAME )
);
?>
</p>
<?php
}
endif;
// show a button when no ads exist, yet.
if ( empty( $items ) ) :
?>
<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;

View File

@@ -0,0 +1,24 @@
<?php
/**
* Filter for the ad visibility on post and page list pages.
*
* @var string $viewability selected ad viewability by which posts are filtered.
*/
?>
<select name="ad-viewability">
<option value="">
<?php esc_html_e( 'All ad states', 'advanced-ads' ); ?>
</option>
<option value="disable_ads" <?php selected( 'disable_ads', $viewability ); ?>>
<?php esc_html_e( 'All ads disabled', 'advanced-ads' ); ?>
</option>
<option
value="disable_the_content"
<?php selected( 'disable_the_content', $viewability ); ?>
<?php disabled( defined( 'AAP_VERSION' ), false ); ?>>
<?php
esc_html_e( 'Ads in content disabled', 'advanced-ads' );
echo ! defined( 'AAP_VERSION' ) ? ' (Pro)' : '';
?>
</option>
</select>

View File

@@ -0,0 +1,102 @@
<?php // phpcs:ignoreFile
/**
* Template for license fields.
*
* Do not move since it could be used by add-ons.
*
* @var string $index internal name of the add-on.
* @var string $plugin_name name of the add-on.
* @var string $options_slug slug of the add-on.
* @var string $license_status status code of the license.
*/
$errortext = false;
$expires = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $options_slug );
$expired = false;
$expired_error = __( 'Your license expired.', 'advanced-ads' );
ob_start();
?>
<button type="button" class="button-secondary advads-license-activate"
data-addon="<?php echo esc_attr( $index ); ?>"
data-pluginname="<?php echo esc_attr( $plugin_name ); ?>"
data-optionslug="<?php echo esc_attr( $options_slug ); ?>"
name="advads_license_activate"><?php esc_html_e( 'Update expiry date', 'advanced-ads' ); ?></button>
<?php
$update_button = ob_get_clean();
$license_key_for_expired_link = $license_key ? $license_key : '%LICENSE_KEY%';
//phpcs:ignore
$expired_error .= $expired_renew_link = ' ' . sprintf(
/* translators: 1: is a URL, 2: is HTML of a button. */
__( 'Click on %2$s if you renewed it or have a subscription or <a href="%1$s" class="advads-renewal-link" target="_blank">renew your license</a>.', 'advanced-ads' ), // phpcs:ignore
'https://wpadvancedads.com/checkout/?edd_license_key=' . esc_attr( $license_key_for_expired_link ) . '&utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses',
$update_button
);
if ( 'lifetime' !== $expires ) {
$expires_time = strtotime( $expires );
$days_left = ( $expires_time - time() ) / DAY_IN_SECONDS;
}
// phpcs:ignore
if ( 'lifetime' === $expires ) {
// do nothing.
} elseif ( $expired && $days_left <= 0 ) {
$plugin_url = isset( $plugin_url ) ? $plugin_url : 'https://wpadvancedads.com/';
$errortext = $expired_error;
$expired = true;
} elseif ( 0 < $days_left && 31 > $days_left ) {
$errortext = sprintf(
/* translators: %d is a number of days. */
esc_html__( '(%d days left)', 'advanced-ads' ),
$days_left
);
}
$show_active = ( false !== $license_status && 'valid' === $license_status && ! $expired ) ? true : false;
?>
<input type="text" class="regular-text advads-license-key" placeholder="<?php esc_html_e( 'License key', 'advanced-ads' ); ?>"
name="<?php echo esc_attr( ADVADS_SLUG ) . '-licenses'; ?>[<?php echo esc_attr( $index ); ?>]"
value="<?php echo esc_attr( $license_key ); ?>"
<?php
if ( false !== $license_status && 'valid' === $license_status && ! $expired ) :
?>
readonly="readonly"<?php endif; ?>/>
<button type="button" class="button-secondary advads-license-deactivate"
<?php
if ( 'valid' !== $license_status ) {
echo ' style="display: none;" ';
}
?>
data-addon="<?php echo esc_attr( $index ); ?>"
data-pluginname="<?php echo esc_attr( $plugin_name ); ?>"
data-optionslug="<?php echo esc_attr( $options_slug ); ?>"
name="advads_license_activate"><?php esc_html_e( 'Deactivate License', 'advanced-ads' ); ?></button>
<button type="button" class="button-primary advads-license-activate"
data-addon="<?php echo esc_attr( $index ); ?>"
data-pluginname="<?php echo esc_attr( $plugin_name ); ?>"
data-optionslug="<?php echo esc_attr( $options_slug ); ?>"
name="advads_license_activate">
<?php
// phpcs:ignore
echo ( 'valid' === $license_status && ! $expired ) ? esc_html__( 'Update License', 'advanced-ads' ) : esc_html__( 'Activate License', 'advanced-ads' ); ?></button>
<?php
if ( '' === trim( $license_key ) ) {
$errortext = __( 'Please enter a valid license key', 'advanced-ads' );
} elseif ( ! $expired && ! $errortext ) {
$errortext = ( 'invalid' === $license_status ) ? esc_html__( 'License key invalid', 'advanced-ads' ) : '';
}
?>
&nbsp;
<span class="advads-license-activate-active advads-notice-inline advads-check" <?php echo ( ! $show_active ) ? 'style="display: none;"' : ''; ?>><?php esc_html_e( 'active', 'advanced-ads' ); ?></span>
<span class="advads-license-activate-error advads-notice-inline advads-error" <?php echo ( ! $errortext ) ? 'style="display: none;"' : ''; ?>>
<?php
// phpcs:ignore
echo $errortext;
?>
</span>
<span class="advads-license-expired-error advads-notice-inline advads-error" style="display: none;">
<?php
// phpcs:ignore
echo $expired_error;
?>
</span>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Support callout.
*
* @package Advanced_Ads
* @since 1.0.0
*/
use AdvancedAds\Utilities\Data;
?>
<div id="advads-support-callout">
<p class="advads-notice-inline advads-idea">
<a href="<?php echo esc_url( Data::support_url( '/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-notices-support' ) ); ?>" target="_blank"><strong><?php esc_html_e( 'Problems or questions?', 'advanced-ads' ); ?></strong>
<?php esc_html_e( 'Save time and get personal support.', 'advanced-ads' ); ?>&nbsp;<strong style="text-decoration: underline;"><?php esc_html_e( 'Ask your question!', 'advanced-ads' ); ?></strong>
</a>
</p>
</div>

View File

@@ -0,0 +1,97 @@
<?php
/**
* The view for the support page
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
*/
use AdvancedAds\Utilities\Conditional;
?>
<div class="wrap">
<?php if ( Advanced_Ads_Admin_Notices::get_instance()->can_display( 'nl_first_steps' ) && Conditional::user_can_subscribe( 'nl_first_steps' ) ) : ?>
<div class="notice notice-info advads-admin-notice inline is-dismissible" data-notice="nl_first_steps">
<p>
<?php
printf(
/* translators: %s: number of free add-ons. */
esc_html__(
'Subscribe to our free First Steps email course, receive our newsletter for periodic tutorials, and get %s for Advanced Ads.',
'advanced-ads'
),
'<strong>' . esc_html__( '2 free add-ons', 'advanced-ads' ) . '</strong>'
);
?>
<button type="button" class="button-primary advads-notices-button-subscribe" data-notice="nl_first_steps"><?php esc_html_e( 'Subscribe me now', 'advanced-ads' ); ?></button>
</p>
</div>
<?php endif; ?>
<p><?php esc_html_e( 'Please fix the red highlighted issues on this page or try to understand their consequences before contacting support.', 'advanced-ads' ); ?></p>
<h2><?php esc_html_e( 'Possible Issues', 'advanced-ads' ); ?></h2>
<ul>
<li><a href="https://wpadvancedads.com/manual/ads-not-showing-up/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Ads not showing up', 'advanced-ads' ); ?></a></li>
<li><a href="https://wpadvancedads.com/manual/purchase-licenses/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Purchase & Licenses', 'advanced-ads' ); ?></a></li>
<li><a href="https://wpadvancedads.com/manual/issues-after-updates/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Issues after updating', 'advanced-ads' ); ?></a></li>
<li><a href="https://wpadvancedads.com/manual-category/troubleshooting/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'General Issues', 'advanced-ads' ); ?></a></li>
<li><a href="https://wpadvancedads.com/manual-category/add-on-issues/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support"><?php esc_html_e( 'Issues with Add-Ons', 'advanced-ads' ); ?></a></li>
</ul>
<p><?php esc_html_e( 'Use the following form to search for solutions in the manual on wpadvancedads.com', 'advanced-ads' ); ?></p>
<form action="https://wpadvancedads.com/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support-form" method="get" class="advads-support-form">
<input type="search" name="s"/>
<input type="submit" class="button button-primary" value="<?php esc_html_e( 'search', 'advanced-ads' ); ?>">
</form>
<?php if ( Advanced_Ads_Admin_Licenses::any_license_valid() ) : ?>
<p>
<?php
printf(
wp_kses(
/* translators: %s is a URL. */
__( 'Take a look at more common issues or contact us directly through the <a href="%s" target="_blank">support page</a>.', 'advanced-ads' ),
[
'a' => [
'href' => [],
'target' => [],
],
]
),
'https://wpadvancedads.com/support/?utm_source=advanced-ads&utm_medium=link&utm_campaign=support'
);
?>
</p>
<?php else : ?>
<p>
<?php
printf(
wp_kses(
/* translators: %s is a URL. */
__( 'Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href="%s" target="_blank">support forum</a> for individual help.', 'advanced-ads' ),
[
'a' => [
'href' => [],
'target' => [],
],
]
),
'https://wordpress.org/support/plugin/advanced-ads'
);
?>
</p>
<?php endif; ?>
<?php $constants = Advanced_Ads_Checks::get_defined_constants(); ?>
<?php if ( $constants ) : ?>
<h2><?php esc_html_e( 'Advanced Ads related constants enabled', 'advanced-ads' ); ?></h2>
<ul>
<li>
<?php
echo wp_kses(
implode( '</li><li>', $constants ),
[ 'li' => [] ]
);
?>
</li>
</ul>
<?php endif; ?>
</div>
<?php AdvancedAds\Modules\ProductExperimentationFramework\Module::get_instance()->render( 'support' ); ?>

View File

@@ -0,0 +1,16 @@
<?php
/**
* AdSense AMP upgrade notice.
*
* @package Advanced_Ads
*/
use AdvancedAds\Admin\Upgrades;
?>
<label class="label">AMP</label>
<div id="advads-adsense-responsive-amp-inputs">
<?php esc_html_e( 'Automatically convert AdSense ads into their AMP format', 'advanced-ads' ); ?>
<p><?php Upgrades::upgrade_link( null, 'https://wpadvancedads.com/add-ons/responsive-ads/', 'upgrade-ad-edit-adsense-amp' ); ?></p>
</div>
<hr />

View File

@@ -0,0 +1,96 @@
<?php
/**
* Pro placements upgrade notice.
*
* @package Advanced_Ads
* TODO: move the array somewhere else.
*/
use AdvancedAds\Admin\Upgrades;
$pro_placements = [
// ad injection on random position.
'post_content_random' => [
'title' => __( 'Random Paragraph', 'advanced-ads' ),
'description' => __( 'After a random paragraph in the main content.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-random.png',
],
// ad injection above the post headline.
'post_above_headline' => [
'title' => __( 'Above Headline', 'advanced-ads' ),
'description' => __( 'Above the main headline on the page (&lt;h1&gt;).', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-above-headline.png',
],
// ad injection in the middle of a post.
'post_content_middle' => [
'title' => __( 'Content Middle', 'advanced-ads' ),
'description' => __( 'In the middle of the main content based on the number of paragraphs.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-middle.png',
],
// ad injection at a hand selected element in the frontend.
'custom_position' => [
'title' => __( 'Custom Position', 'advanced-ads' ),
'description' => __( 'Attach the ad to any element in the frontend.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/custom-position.png',
],
// ad injection between posts on archive and category pages.
'archive_pages' => [
'title' => __( 'Post Lists', 'advanced-ads' ),
'description' => __( 'Display the ad between posts on post lists, e.g. home, archives, search etc.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/post-list.png',
],
'background' => [
'title' => __( 'Background Ad', 'advanced-ads' ),
'description' => __( 'Background of the website behind the main wrapper.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/background.png',
],
];
// BuddyBoss & BuddyPress.
if ( defined( 'BP_PLATFORM_VERSION' ) ) { // BuddyBoss.
$pro_placements['buddypress'] = [
'title' => __( 'BuddyBoss Content', 'advanced-ads' ),
'description' => __( 'Display ads on BuddyBoss related pages.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/buddyboss-icon.png',
];
} elseif ( class_exists( 'BuddyPress', false ) ) { // BuddyPress.
$pro_placements['buddypress'] = [
'title' => __( 'BuddyPress Content', 'advanced-ads' ),
'description' => __( 'Display ads on BuddyPress related pages.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/buddypress-icon.png',
];
}
// bbPress.
if ( class_exists( 'bbPress', false ) ) {
$pro_placements['bbpress'] = [
'title' => __( 'bbPress Content', 'advanced-ads' ),
'description' => __( 'Display ads in content created with bbPress.', 'advanced-ads' ),
'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/bbpress-reply.png',
];
}
?>
<?php
if ( is_array( $pro_placements ) ) :
foreach ( $pro_placements as $key => $placement ) :
?>
<div class="advads-form-type">
<label class="advads-button advads-pro-link">
<span class="advads-button-text">
<?php
if ( isset( $placement['image'] ) ) {
echo '<img src="' . esc_attr( $placement['image'] ) . '" alt="' . esc_attr( $placement['title'] ) . '"/>';
} else {
echo '<strong>' . esc_html( $placement['title'] ) . '</strong><br/><p class="description">' . esc_html( $placement['description'] ) . '</p>';
}
?>
</span>
</label>
<p class="advads-form-description">
<strong><?php echo esc_html( $placement['title'] ); ?></strong>
<br/><?php echo esc_html( $placement['description'] ); ?>
</p>
</div>
<?php endforeach; ?>
<div class="clear"></div>
<h4><?php Upgrades::upgrade_link( __( 'Get all placements with All Access', 'advanced-ads' ), 'https://wpadvancedads.com/add-ons/all-access/', 'upgrades-pro-placements' ); ?></h4>
<?php endif; ?>

View File

@@ -0,0 +1,13 @@
<?php
/**
* Repeat the position upgrade notice.
*
* @package Advanced_Ads
*/
use AdvancedAds\Admin\Upgrades;
?>
<p><label><input type="checkbox" disabled="disabled"/><?php esc_html_e( 'repeat the position', 'advanced-ads' ); ?></label>
<?php Upgrades::upgrade_link( null, 'https://wpadvancedads.com/add-ons/advanced-ads-pro/', 'upgrade-content-repeat' ); ?>
</p>

View File

@@ -0,0 +1 @@
<a href="<?php echo esc_url( $url ); ?>" target="_blank"><?php echo esc_html( $title ); ?></a>