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,219 @@
<?php
/**
* Ads edit screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use DateTimeImmutable;
use AdvancedAds\Constants;
use AdvancedAds\Utilities\WordPress;
use AdvancedAds\Framework\Utilities\Params;
defined( 'ABSPATH' ) || exit;
/**
* Ads.
*/
class Ads_Editing extends Ads {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'ads-editing';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$this->set_hook( Constants::POST_TYPE_AD );
add_action( 'dbx_post_sidebar', [ $this, 'edit_form_end' ] );
add_action( 'edit_form_top', [ $this, 'edit_form_above_title' ] );
add_action( 'post_submitbox_misc_actions', [ $this, 'add_submit_box_meta' ] );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
$wp_screen = get_current_screen();
if ( 'post' === $wp_screen->base && 'add' !== $wp_screen->action ) {
add_action( 'advanced-ads-admin-header-actions', [ $this, 'add_new_ad_button' ] );
}
if ( 'post' === $wp_screen->base && Constants::POST_TYPE_AD === $wp_screen->post_type ) {
wp_advads()->registry->enqueue_script( 'screen-ads-editing' );
wp_advads()->registry->enqueue_style( 'screen-ads-editing' );
}
}
/**
* Define header args.
*
* @return array
*/
public function define_header_args(): array {
return [
'manual_url' => 'https://wpadvancedads.com/manual/first-ad/',
'show_filter_button' => false,
];
}
/**
* Add information below the ad edit form
*
* @since 1.7.3
*
* @param WP_Post $post WordPress Post object.
*
* @return void
*/
public function edit_form_end( $post ): void {
if ( Constants::POST_TYPE_AD !== $post->post_type ) {
return;
}
include_once ADVADS_ABSPATH . 'views/admin/ads/info-bottom.php';
}
/**
* Add information above the ad title
*
* @since 1.5.6
*
* @param object $post WordPress post type object.
*
* @return void
*/
public function edit_form_above_title( $post ): void {
if ( ! isset( $post->post_type ) || Constants::POST_TYPE_AD !== $post->post_type ) {
return;
}
// Highlight Dummy ad if this is the first ad.
if ( ! WordPress::get_count_ads() ) {
?>
<style>.advanced-ads-type-list-dummy {
font-weight: bold;
}</style>
<?php
}
// Display general and wizard information.
include_once ADVADS_ABSPATH . 'views/admin/ads/info-top.php';
// Dont show placement options if this is an ad translated with WPML since the placement might exist already.
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
$trid = apply_filters( 'wpml_element_trid', null, $post->ID );
$translations = apply_filters( 'wpml_get_element_translations', null, $trid, 'Advanced_Ads' );
if ( count( $translations ) > 1 ) {
return;
}
}
$ad = wp_advads_get_ad( $post->ID );
$placements = wp_advads_get_placements();
/**
* Display ad injection information after ad is created.
*
* Set `advanced-ads-ad-edit-show-placement-injection` to false if you want to prevent the box from appearing
*/
if ( 6 === Params::get( 'message', 0, FILTER_VALIDATE_INT ) && apply_filters( 'advanced-ads-ad-edit-show-placement-injection', true ) ) {
$latest_post = $this->get_latest_post();
include_once ADVADS_ABSPATH . 'admin/views/placement-injection-top.php';
}
}
/**
* Add meta values below submit box
*
* @since 1.3.15
*
* @param WP_Post $post WordPress post type object.
*
* @return void
*/
public function add_submit_box_meta( $post ): void {
global $wp_locale;
// Early bail!!
if ( Constants::POST_TYPE_AD !== $post->post_type ) {
return;
}
$ad = wp_advads_get_ad( $post->ID );
// Get time set for ad or current timestamp (both GMT).
$utc_ts = $ad->get_expiry_date() ?: current_time( 'timestamp', true ); // phpcs:ignore
$local_time = ( new \DateTimeImmutable( '@' . $utc_ts ) )->setTimezone( WordPress::get_timezone() );
[ $curr_year, $curr_month, $curr_day, $curr_hour, $curr_minute ] = explode( '-', $local_time->format( 'Y-m-d-H-i' ) );
$enabled = (int) ! empty( $ad->get_expiry_date() );
include ADVADS_ABSPATH . 'views/admin/ads/submitbox-meta.php';
}
/**
* Whether to start the wizard by default or not
*
* @since 1.7.4
*
* @return bool true, if wizard should start automatically
*/
private function start_wizard_automatically(): bool {
global $post;
$user_id = get_current_user_id();
if ( ! $user_id ) {
return true;
}
$hide_wizard = get_user_meta( $user_id, 'advanced-ads-hide-wizard', true );
// true the ad already exists, if the wizard was never started or closed.
return ( 'edit' !== $post->filter && ( ! $hide_wizard || 'false' === $hide_wizard ) ) ? true : false;
}
/**
* Whether to show the wizard welcome message or not
*
* @since 1.7.4
*
* @return bool true, if wizard welcome message should be displayed
*/
private function show_wizard_welcome(): bool {
global $post;
$user_id = get_current_user_id();
if ( ! $user_id ) {
return true;
}
$hide_wizard = get_user_meta( $user_id, 'advanced-ads-hide-wizard', true );
return ( ! $hide_wizard && 'edit' !== $post->filter ) ? true : false;
}
/**
* Load latest blog post
*
* @return WP_POST|null
*/
private function get_latest_post() {
$posts = wp_get_recent_posts( [ 'numberposts' => 1 ] );
return $posts ? $posts[0] : null;
}
}

View File

@@ -0,0 +1,78 @@
<?php
/**
* Ads screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use WP_Screen;
use AdvancedAds\Constants;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Admin\Ad_List_Table;
use AdvancedAds\Utilities\WordPress;
use AdvancedAds\Utilities\Conditional;
defined( 'ABSPATH' ) || exit;
/**
* Ads.
*/
class Ads extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'ads';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$has_ads = WordPress::get_count_ads();
// Forward Ads link to new-ad page when there is no ad existing yet.
add_submenu_page(
ADVADS_SLUG,
__( 'Ads', 'advanced-ads' ),
__( 'Ads', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_edit_ads' ),
! $has_ads ? 'post-new.php?post_type=' . Constants::POST_TYPE_AD . '&new=new' : 'edit.php?post_type=' . Constants::POST_TYPE_AD
);
$this->set_hook( 'edit-' . Constants::POST_TYPE_AD );
add_action( 'current_screen', [ $this, 'load_placement_ui' ] );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'screen-ads-listing' );
wp_advads()->registry->enqueue_script( 'screen-ads-listing' );
}
/**
* Load list table
*
* @param WP_Screen $screen Current screen instance.
*
* @return void
*/
public function load_placement_ui( WP_Screen $screen ): void {
if ( 'edit-' . Constants::POST_TYPE_AD === $screen->id ) {
( new Ad_List_Table() )->hooks();
}
}
}

View File

@@ -0,0 +1,89 @@
<?php
/**
* Dashboard screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\WordPress;
use AdvancedAds\Utilities\Conditional;
defined( 'ABSPATH' ) || exit;
/**
* Dashboard.
*/
class Dashboard extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'dashboard';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$has_ads = WordPress::get_count_ads();
add_menu_page(
__( 'Dashboard', 'advanced-ads' ),
'Advanced Ads',
Conditional::user_cap( 'advanced_ads_see_interface' ),
ADVADS_SLUG,
[ $this, 'display' ],
$this->get_icon_svg(),
'58.74'
);
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Dashboard', 'advanced-ads' ),
__( 'Dashboard', 'advanced-ads' ),
Conditional::user_cap( $has_ads ? 'advanced_ads_edit_ads' : 'advanced_ads_see_interface' ),
ADVADS_SLUG,
$has_ads ? '' : [ $this, 'display' ]
);
$this->set_hook( $hook );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'screen-dashboard' );
wp_advads()->registry->enqueue_script( 'screen-dashboard' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
include ADVADS_ABSPATH . 'views/admin/screens/dashboard.php';
}
/**
* Return Advanced Ads logo in base64 format for use in WP Admin menu. * Highlights the 'Advanced Ads->Ads' item in the menu when an ad edit page is open
*
* @return string
*/
private function get_icon_svg(): string {
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE4LjEuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJFYmVuZV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDY0Ljk5MyA2NS4wMjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDY0Ljk5MyA2NS4wMjQ7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIHN0eWxlPSJmaWxsOiNFNEU0RTQ7IiBkPSJNNDYuNTcxLDI3LjY0MXYyMy4xMzNIMTQuMjVWMTguNDUzaDIzLjExOGMtMC45NTYtMi4xODMtMS40OTQtNC41OS0xLjQ5NC03LjEyNg0KCWMwLTIuNTM1LDAuNTM4LTQuOTQyLDEuNDk0LTcuMTI0aC02Ljk1N0gwdjQ5LjQ5M2wxLjYxOCwxLjYxOEwwLDUzLjY5NmMwLDYuMjU2LDUuMDY4LDExLjMyNiwxMS4zMjQsMTEuMzI4djBoMTkuMDg3aDMwLjQxMlYyNy42MTENCgljLTIuMTkxLDAuOTY0LTQuNjA5LDEuNTA5LTcuMTU3LDEuNTA5QzUxLjE0MiwyOS4xMiw0OC43NDYsMjguNTg4LDQ2LjU3MSwyNy42NDF6Ii8+DQo8Y2lyY2xlIHN0eWxlPSJmaWxsOiM5ODk4OTg7IiBjeD0iNTMuNjY2IiBjeT0iMTEuMzI4IiByPSIxMS4zMjgiLz4NCjwvc3ZnPg0K';
}
}

View File

@@ -0,0 +1,96 @@
<?php
/**
* Groups screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Constants;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\Conditional;
use AdvancedAds\Admin\Groups_List_Table;
defined( 'ABSPATH' ) || exit;
/**
* Groups.
*/
class Groups extends Screen {
/**
* Hold table object.
*
* @var null|Groups_List_Table
*/
private $list_table = null;
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'groups';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Ad Groups & Rotations', 'advanced-ads' ),
__( 'Groups & Rotation', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_edit_ads' ),
ADVADS_SLUG . '-groups',
[ $this, 'display' ]
);
$this->set_hook( $hook );
add_action( 'in_admin_header', [ $this, 'get_list_table' ] );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'screen-groups-listing' );
wp_advads()->registry->enqueue_script( 'screen-groups-listing' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
$wp_list_table = $this->get_list_table();
include_once ADVADS_ABSPATH . 'views/admin/screens/groups.php';
}
/**
* Get list table object
*
* @return null|Groups_List_Table
*/
public function get_list_table() {
$screen = get_current_screen();
if ( 'advanced-ads_page_advanced-ads-groups' === $screen->id && null === $this->list_table ) {
wp_advads()->registry->enqueue_script( 'groups' );
$screen->taxonomy = Constants::TAXONOMY_GROUP;
$screen->post_type = Constants::POST_TYPE_AD;
$this->list_table = new Groups_List_Table();
}
return $this->list_table;
}
}

View File

@@ -0,0 +1,266 @@
<?php
/**
* Onboarding wizard screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Constants;
use Advanced_Ads_AdSense_Data;
use Advanced_Ads_AdSense_MAPI;
use Advanced_Ads_AdSense_Admin;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\Conditional;
defined( 'ABSPATH' ) || exit;
/**
* Onboarding Wizard.
*/
class Onboarding extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'onboarding';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
Constants::HIDDEN_PAGE_SLUG,
__( 'Onboarding Wizard', 'advanced-ads' ),
__( 'Onboarding Wizard', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_manage_options' ),
ADVADS_SLUG . '-onboarding',
[ $this, 'display' ]
);
$this->set_hook( $hook );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
$this->i18n();
$this->adsense_data();
wp_enqueue_media();
wp_advads()->registry->enqueue_style( 'screen-onboarding' );
wp_advads()->registry->enqueue_script( 'screen-onboarding' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
include ADVADS_ABSPATH . 'views/admin/screens/onboarding.php';
}
/**
* Add Adsense data
*
* @return void
*/
private function adsense_data(): void {
if ( current_user_can( Conditional::user_cap( 'advanced_ads_manage_options' ) ) ) {
$nonce = wp_create_nonce( 'advanced_ads_wizard' );
wp_advads()->json->add(
'wizard',
[
'nonce' => $nonce,
'authUrl' => 'https://accounts.google.com/o/oauth2/v2/auth?scope=' . rawurlencode( 'https://www.googleapis.com/auth/adsense.readonly' ),
'clientId' => Advanced_Ads_AdSense_MAPI::CID,
'state' => base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
wp_json_encode(
[
'api' => 'adsense',
'nonce' => $nonce,
'return_url' => admin_url( 'admin.php?page=advanced-ads-onboarding&route=adsense#wizard#adsense' ),
]
)
),
'redirectUri' => Advanced_Ads_AdSense_MAPI::REDIRECT_URI,
'adsenseData' => array_merge(
Advanced_Ads_AdSense_Data::get_instance()->get_options(),
[ 'accounts' => Advanced_Ads_AdSense_MAPI::get_option()['accounts'] ]
),
'newAccountLink' => Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK,
]
);
}
}
/**
* Add wizard internationalization
*
* @return void
*/
private function i18n(): void {
wp_advads_json_add(
'i18n',
[
'wizard' => [
'loading' => __( 'Loading...', 'advanced-ads' ),
'processing' => __( 'Processing authorization...', 'advanced-ads' ),
'selectAccount' => [
'optionZero' => __( 'Select an account', 'advanced-ads' ),
'title' => __( 'Please select an account to use', 'advanced-ads' ),
],
'exitLabel' => __( 'Exit the wizard without saving', 'advanced-ads' ),
'btnGoBack' => __( 'Go back', 'advanced-ads' ),
'newsletter' => [
'title' => __( 'Subscribe to our newsletter and get 2 add-ons for free', 'advanced-ads' ),
'btnLabel' => __( 'Subscribe now', 'advanced-ads' ),
'inputPlaceholder' => __( 'Enter your email address', 'advanced-ads' ),
],
'stepTitles' => [
'adImage' => __( 'Please select your image', 'advanced-ads' ),
'adCode' => __( 'Please paste your ad code', 'advanced-ads' ),
'congrats' => [
'default' => __( 'Congratulations, your ad is now published!', 'advanced-ads' ),
'adsenseManual' => __( 'Your ad is almost ready!', 'advanced-ads' ),
'adsenseAuto' => __( 'Congratulations, AdSense Auto Ads are now set up!', 'advanced-ads' ),
],
],
'firstStep' => [
'taskAdSense' => __( 'I want to use mostly Google AdSense or Google Auto Ads', 'advanced-ads' ),
'taskImage' => __( 'I want to add a banner ad with an image', 'advanced-ads' ),
'taskCode' => __( 'I want to insert an ad code from an ad network', 'advanced-ads' ),
'stepHeading' => __( 'Welcome! To kick things off, and to simplify your journey, answer a few questions and let Advanced Ads tailor the perfect ad for your site\'s needs.', 'advanced-ads' ),
'agreementText' => __( 'I agree to share usage data to <strong>help the developers</strong> improve the plugin. Read more in our <a href="https://wpadvancedads.com/privacy-policy/" target="_blank">privacy policy</a>.', 'advanced-ads' ),
'inputTitle' => __( 'What\'s your task?', 'advanced-ads' ),
],
'bannerAd' => [
'mediaFrameTitle' => __( 'Select an image to upload', 'advanced-ads' ),
'mediaFrameButton' => __( 'Use this image', 'advanced-ads' ),
'mediaBtnUpload' => __( 'Upload', 'advanced-ads' ),
'mediaBtnReplace' => __( 'Replace', 'advanced-ads' ),
'stepHeading' => __( 'Would you like to set a target URL for your image ad?', 'advanced-ads' ),
'inputPlaceholder' => __( 'Enter an optional target URL for your image ad', 'advanced-ads' ),
'footerEnableText' => __( 'Create placement and ad', 'advanced-ads' ),
'footerDisableText' => __( 'Please select an image', 'advanced-ads' ),
],
'codeAd' => [
'inputPlaceholder' => __( 'Paste the ad code that your advertising network has provided to you', 'advanced-ads' ),
'footerEnableText' => __( 'Insert the ad code into my site', 'advanced-ads' ),
'footerDisableText' => __( 'Please paste your ad code', 'advanced-ads' ),
],
'googleAd' => [
'adsPlacement' => [
[
'label' => __( 'I will place ad units manually', 'advanced-ads' ),
'value' => 'manual',
],
[
'label' => __( 'I will use Auto Ads and let Google place the ads automatically', 'advanced-ads' ),
'value' => 'auto_ads',
],
],
'autoAdsOptions' => [
[
'label' => __( 'Enable Auto Ads on my site', 'advanced-ads' ),
'value' => 'enable',
],
[
'label' => __( 'Enable Accelerated Mobile Pages (AMP) Auto Ads', 'advanced-ads' ),
'value' => 'enableAmp',
],
],
'errors' => [
'notSaved' => __( 'Unknown error while saving account information.', 'advanced-ads' ),
'notFetched' => __( 'Unknown error while fetching AdSense account information.', 'advanced-ads' ),
'notAuthorized' => __( 'Unknown error while submitting the authorization code.', 'advanced-ads' ),
],
'stepHeading' => __( 'Do you have a Google AdSense account?', 'advanced-ads' ),
'btnSignup' => __( 'No, Id like to sign up for free now', 'advanced-ads' ),
'btnConnect' => __( 'Yes, connect to AdSense now', 'advanced-ads' ),
'labelAccount' => __( 'Account holder name:', 'advanced-ads' ),
'labelConnected' => __( 'You are connected to Google AdSense. Publisher ID:', 'advanced-ads' ),
'labelAdsPlacement' => __( 'Will you place ad units manually or use Google Auto Ads?', 'advanced-ads' ),
'labelAutoAds' => __( 'Please confirm these Auto Ads options', 'advanced-ads' ),
'footerProcessText' => __( 'Process', 'advanced-ads' ),
'footerEnableText' => [
'manual' => __( 'Create placement and ad', 'advanced-ads' ),
'autoAds' => __( 'Confirm Auto Ads options', 'advanced-ads' ),
],
'footerDisableText' => __( 'Please select an option', 'advanced-ads' ),
],
'congrats' => [
'adsenseManual' => [
'stepHeading' => __( "For the last step, import the desired ad unit from AdSense. Visit the ad's edit screen to make your selection.", 'advanced-ads' ),
'btnEditItem' => __( 'Select ad unit', 'advanced-ads' ),
'liveHeading' => sprintf(
/* translators: 1: opening strong tag, 2: closing strong tag, 3: opening italic tag, 4: closing italic tag. */
esc_html__( 'We have created a placement for your ad that will display %1$safter the 3rd paragraph on every post%2$s. Go to %3$sAdvanced Ads > Placements%4$s and edit the placement to change this.', 'advanced-ads' ),
'<strong>',
'</strong>',
'<i>',
'</i>'
),
],
'adsenseAuto' => [
'stepHeading' => __( "Everything's ready for AdSense to populate your site with Auto Ads. Make sure your site is verified, <strong>enable Auto Ads in your AdSense account</strong>, and, optionally, fine-tune their settings further.", 'advanced-ads' ),
'btnAccount' => __( 'Go to AdSense account', 'advanced-ads' ),
],
'stepHeading' => __( 'We have created a placement for your ad that will display <strong>after the 3rd paragraph on every post</strong>. You may edit the placement to change this.', 'advanced-ads' ),
'liveHeading' => __( 'See the live ad in your website\'s frontend.', 'advanced-ads' ),
'btnEditItem' => __( 'Edit the placement', 'advanced-ads' ),
'btnLiveAd' => __( 'See the live ad', 'advanced-ads' ),
'upgradeHeading' => __( 'Upgrade to all features and full support today', 'advanced-ads' ),
'upgradeText' => __( 'Our All Access deal offers every drop of ad expertise that we\'ve acquired in more than ten years, distilled into one jam-packed plugin bundle, supported by a dedicated team of real persons eager to help you.', 'advanced-ads' ),
'btnUpgrade' => __( 'Upgrade now', 'advanced-ads' ),
'btnDashboard' => __( 'Go to the Dashboard', 'advanced-ads' ),
'upgradePoints' => [
[
'title' => __( 'More placements', 'advanced-ads' ),
'text' => __( 'to embed in high-converting spots', 'advanced-ads' ),
'icon' => true,
],
[
'title' => __( 'More conditions', 'advanced-ads' ),
'text' => __( 'for advanced targeting', 'advanced-ads' ),
'icon' => true,
],
[
'title' => __( 'Ad Tracking', 'advanced-ads' ),
'text' => __( 'to optimize performance', 'advanced-ads' ),
'icon' => true,
],
[
'title' => __( 'Click Fraud Protection', 'advanced-ads' ),
'text' => __( 'to safeguard your accounts', 'advanced-ads' ),
'icon' => true,
],
[
'title' => __( 'Lazy Loading', 'advanced-ads' ),
'text' => __( 'to speed up your website', 'advanced-ads' ),
'icon' => true,
],
[
'text' => '…' . __( 'and much more!', 'advanced-ads' ),
'icon' => false,
],
],
],
],
]
);
}
}

View File

@@ -0,0 +1,123 @@
<?php
/**
* Placements screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use WP_Screen;
use AdvancedAds\Constants;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\Conditional;
use AdvancedAds\Admin\Placement_List_Table;
use AdvancedAds\Admin\Placement_Create_Modal;
defined( 'ABSPATH' ) || exit;
/**
* Placements.
*/
class Placements extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'placements';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Ad Placements', 'advanced-ads' ),
__( 'Placements', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_manage_placements' ),
'edit.php?post_type=' . Constants::POST_TYPE_PLACEMENT
);
// Keep the manual placements page around, but redirect it to the custom post type.
$old_placements_hook = add_submenu_page(
'',
'',
'',
Conditional::user_cap( 'advanced_ads_manage_placements' ),
ADVADS_SLUG . '-placements',
'__return_true'
);
$this->set_hook( 'edit-' . Constants::POST_TYPE_PLACEMENT );
add_action( 'current_screen', [ $this, 'load_placement_ui' ] );
add_action( 'load-' . $old_placements_hook, [ $this, 'redirect_to_post_type' ] );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'screen-placements-listing' );
wp_advads()->registry->enqueue_script( 'screen-placements-listing' );
wp_advads_json_add( 'content_placement_picker_url', $this->get_content_placement_picker_url() );
}
/**
* Redirect old placement page to custom post type.
*
* @return void
*/
public function redirect_to_post_type(): void {
wp_safe_redirect( 'edit.php?post_type=' . Constants::POST_TYPE_PLACEMENT );
}
/**
* Load list table
*
* @param WP_Screen $screen Current screen instance.
*
* @return void
*/
public function load_placement_ui( WP_Screen $screen ): void {
if ( 'edit-' . Constants::POST_TYPE_PLACEMENT === $screen->id ) {
( new Placement_List_Table() )->hooks();
( new Placement_Create_Modal() )->hooks();
}
}
/**
* Get the URL where the user is redirected after activating the frontend picker for a "Content" placement.
*
* @return string
*/
private function get_content_placement_picker_url() {
$location = false;
if ( get_option( 'show_on_front' ) === 'posts' ) {
$recent_posts = wp_get_recent_posts(
[
'numberposts' => 1,
'post_type' => 'post',
'post_status' => 'publish',
],
'OBJECT'
);
if ( $recent_posts ) {
$location = get_permalink( $recent_posts[0] );
}
}
return $location ?? home_url();
}
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* Admin Pages Settings.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\Conditional;
defined( 'ABSPATH' ) || exit;
/**
* Admin Pages Settings.
*/
class Settings extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'settings';
}
/**
* Get the order number of the screen.
*
* @return int
*/
public function get_order(): int {
return 20;
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Advanced Ads Settings', 'advanced-ads' ),
__( 'Settings', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_manage_options' ),
ADVADS_SLUG . '-settings',
[ $this, 'display' ]
);
$this->set_hook( $hook );
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'screen-settings' );
wp_advads()->registry->enqueue_script( 'screen-settings' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
include_once ADVADS_ABSPATH . 'views/admin/screens/settings.php';
}
}

View File

@@ -0,0 +1,80 @@
<?php
/**
* Tools screen.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.47.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Abstracts\Screen;
use AdvancedAds\Utilities\Conditional;
defined( 'ABSPATH' ) || exit;
/**
* Tools.
*/
class Tools extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'tools';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Tools', 'advanced-ads' ),
__( 'Tools', 'advanced-ads' ),
Conditional::user_cap( 'advanced_ads_manage_options' ),
ADVADS_SLUG . '-tools',
[ $this, 'display' ]
);
$this->set_hook( $hook );
$this->set_tabs(
[
'importers' => [
'label' => __( 'Import & Export', 'advanced-ads' ),
'filename' => 'views/admin/tools/importers.php',
],
'version' => [
'label' => __( 'Version Control', 'advanced-ads' ),
'filename' => 'views/admin/tools/version.php',
],
]
);
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_script( 'admin-common' );
wp_advads()->registry->enqueue_style( 'screen-tools' );
wp_advads()->registry->enqueue_script( 'screen-tools' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
include_once ADVADS_ABSPATH . 'views/admin/screens/tools.php';
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* Admin Pages UI Toolkit.
*
* @package AdvancedAds
* @author Advanced Ads <info@wpadvancedads.com>
* @since 1.50.0
*/
namespace AdvancedAds\Admin\Pages;
use AdvancedAds\Abstracts\Screen;
defined( 'ABSPATH' ) || exit;
/**
* UI Toolkit Screen.
*/
class Ui_Toolkit extends Screen {
/**
* Screen unique id.
*
* @return string
*/
public function get_id(): string {
return 'ui-toolkit';
}
/**
* Register screen into WordPress admin area.
*
* @return void
*/
public function register_screen(): void {
$hook = add_submenu_page(
ADVADS_SLUG,
__( 'Advanced Ads Ui Toolkit', 'advanced-ads' ),
__( 'Ui Toolkit', 'advanced-ads' ),
'manage_options',
ADVADS_SLUG . '-ui-toolkit',
[ $this, 'display' ]
);
$this->set_hook( $hook );
$this->set_tabs(
[
'basic' => [
'label' => __( 'Basic', 'advanced-ads' ),
'filename' => 'views/ui-toolkit/basic.php',
],
'forms' => [
'label' => __( 'Forms', 'advanced-ads' ),
'filename' => 'views/ui-toolkit/forms.php',
],
'advanced' => [
'label' => __( 'Advanced', 'advanced-ads' ),
'filename' => 'views/ui-toolkit/advanced.php',
],
]
);
}
/**
* Enqueue assets
*
* @return void
*/
public function enqueue_assets(): void {
wp_advads()->registry->enqueue_style( 'common' );
}
/**
* Display screen content.
*
* @return void
*/
public function display(): void {
include_once ADVADS_ABSPATH . 'views/admin/screens/ui-toolkit.php';
}
}