title */ public function get_sections(): array { return [ 'output' => [ 'title' => __( 'Output', 'adpresso' ), 'description' => '', 'controlled_by' => '', 'initially_open' => true, ], 'admin' => [ 'title' => __( 'Admin', 'adpresso' ), 'description' => '', 'controlled_by' => '', 'initially_open' => true, ], 'disable' => [ 'title' => __( 'Activate Ads', 'adpresso' ), 'description' => __( 'Configure global rules for ad delivery by page type and audience.', 'adpresso' ), 'link' => '', 'controlled_by' => '', 'initially_open' => true, ], 'ad_label' => [ 'title' => __( 'Ad Label', 'adpresso' ), 'description' => '', 'controlled_by' => 'ad_label', 'initially_open' => true, ], ]; } /** * Renders the debug token field with creation/revocation UI. * * @return void */ public static function render_debug_token_field(): void { $token_info = DebugTokenManager::get_token_info(); ?>


get_names(); $wp_debug = defined( 'WP_DEBUG' ) && WP_DEBUG === true; $options = [ 'frontend_prefix' => [ 'section' => 'output', 'label' => __( 'CSS Prefix', 'adpresso' ), 'type' => 'text', 'default' => Util::build_frontend_prefix(), 'description' => __( 'This prefix is added to all class and ID values of all AdPresso elements on your website’s front end. By default, the prefix is based on the first five characters of your website’s domain.', 'adpresso' ), 'required' => true, 'placeholder' => Util::build_frontend_prefix(), ], 'target_blank' => [ 'section' => 'output', 'label' => __( 'Open Ad Links in a New Tab', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '0', 'description' => __( 'Add the target="_blank" attribute to your ad links to open them in a new tab by default. You can adjust this setting for each ad separately.', 'adpresso' ), ], 'add_link_attributes' => [ 'section' => 'output', 'label' => __( 'Add Link Attributes ', 'adpresso' ), 'type' => 'checkbox_button_group', 'sanitize_type' => 'array:key', 'default' => [ 'add_nofollow' ], 'description' => __( 'Append an attribute like rel="nofollow" to your links to control how search engines treat them. You can set a default for all links here, which can be overridden for each ad individually. Use sponsored for all paid or promotional content to follow best practices.', 'adpresso' ), 'link' => 'https://wpadpresso.com/docs/link-attributes/?utm_source=plugin-backend&utm_medium=manual-link&utm_campaign=link-attributes&utm_content=settings-page', 'options' => [ '0' => [ 'key' => 'add_sponsored', 'label' => __( 'Sponsored', 'adpresso' ) ], '1' => [ 'key' => 'add_nofollow', 'label' => __( 'No Follow', 'adpresso' ), 'default' => '1' ], ], ], 'linkbase' => [ 'section' => 'output', 'label' => __( 'Linkbase', 'adpresso' ), 'type' => 'text', 'sanitize_type' => 'text', 'default' => Constants::LINK_MASKING_LINKBASE, 'placeholder' => Constants::LINK_MASKING_LINKBASE, 'premium' => true, 'description' => __( 'Set a base URL for all cloaked links generated by AdPresso. This can be useful for maintaining consistent link structure across your site.', 'adpresso' ), ], 'debug_mode' => [ 'section' => 'admin', 'label' => __( 'Debug Mode', 'adpresso' ), 'type' => 'button_group', 'html_class' => 'adpresso-color-dark', 'sanitize_type' => 'key', 'default' => $wp_debug ? '2' : '1', 'description' => sprintf( /* translators: %s is the hint that WP_DEBUG is active */ __( '%sEnable the AdPresso debug mode and choose the desired level to reveal detailed information and errors.', 'adpresso' ), $wp_debug ? ' ' . __( 'WP_DEBUG is active and therefore forcing debug level 2.
', 'adpresso' ) : '' ), 'options' => [ '0' => [ 'key' => '0', 'label' => __( 'Disabled', 'adpresso' ), 'disabled' => $wp_debug ], '1' => [ 'key' => '1', 'label' => __( 'Level 1: Admin Bar', 'adpresso' ), 'disabled' => $wp_debug ], '2' => [ 'key' => '2', 'label' => __( 'Level 2: Log and Console', 'adpresso' ) ], '3' => [ 'key' => '3', 'label' => __( 'Level 3: Support Token', 'adpresso' ) ], ], ], 'debug_token_management' => [ 'section' => 'admin', 'label' => __( 'Support Access', 'adpresso' ), 'type' => 'callback', 'callback' => [ self::class, 'render_debug_token_field' ], 'depends_on' => [ [ 'field_id' => 'debug_mode', 'operator' => 'is', 'value' => '3', ], ], ], 'debug_mode_user' => [ 'section' => 'admin', 'label' => 'Safe Debugging', 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '1', 'description' => __( 'Technical details will only be visible to you and other logged-in administrators.', 'adpresso' ), 'depends_on' => [ [ 'field_id' => 'debug_mode', 'operator' => 'is_greater_than', 'value' => '0', ], ], ], 'uninstall_keep_data' => [ 'section' => 'admin', 'label' => __( 'Keep Ad Setup Data', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '1', 'description' => __( 'Disable this option if you want all ad setup data to be automatically and irreversibly removed upon uninstall.', 'adpresso' ), ], 'uninstall_keep_media' => [ 'section' => 'admin', 'label' => __( 'Keep Assigned Media', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '1', 'description' => __( 'Disable this option if you want all supplementary ad media (images and HTML5 files) to be automatically and irreversibly removed upon uninstall.', 'adpresso' ), ], 'activate_ads' => [ 'label' => __( 'Activate Ads', 'adpresso' ), 'type' => 'toggle_list', 'link' => 'https://wpadpresso.com/docs/activate-ads/?utm_source=plugin-backend&utm_medium=manual-link&utm_campaign=activate-ads&utm_content=settings-page', 'section' => 'disable', 'sanitize_type' => 'array:key', 'options' => [ 'all_ads' => [ 'label' => __( 'Activate all ads in the frontend', 'adpresso' ), 'default' => 1, 'highlighted' => true, 'description' => __( 'Allow ads to be displayed on the frontend of your website. Disabling this setting can be useful for testing or debugging without deactivating the plugin.', 'adpresso' ), 'children' => [ 'posts' => [ 'label' => 'Posts', 'default' => 1 ], 'static' => [ 'label' => __( 'Pages', 'adpresso' ), 'default' => 1 ], 'pages' => [ 'label' => 'Other Pages', 'default' => 1, 'description' => __( 'Allow ads to be displayed on specific archive and post list pages, such as categories, tags, or authors.', 'adpresso' ), 'children' => [ '404' => [ 'label' => __( '404 Error Pages', 'adpresso' ), 'default' => 0, 'description' => __( 'Allow ads to be displayed on 404 error pages. Excluding ads from these pages is recommended to improve user experience and comply with ad network policies.', 'adpresso' ) ], 'home' => [ 'label' => __( 'Homepage', 'adpresso' ), 'default' => 1 ], 'media' => [ 'label' => __( 'Media Pages', 'adpresso' ), 'default' => 1 ], 'search' => [ 'label' => __( 'Search Pages', 'adpresso' ), 'default' => 1 ], 'archive' => [ 'label' => __( 'Archive Pages', 'adpresso' ), 'default' => 1, 'description' => __( 'Allow ads to be displayed on specific archive and post list pages, such as the blog page, categories, tags, or authors.', 'adpresso' ), ], ], ], 'custom_post_types' => [ 'label' => __( 'Custom Post Types', 'adpresso' ), 'description' => __( 'Allow ads to be displayed on specific post types. This enables you to exclude ads from pages like product listings to maintain a clean layout.', 'adpresso' ), 'default' => 1, 'children' => ( function() { $post_types = get_post_types( [ 'public' => true, 'publicly_queryable' => true, ], 'objects', 'or' ); $post_types = array_filter( $post_types, static function( $pt ) { return empty( $pt->_builtin ) && is_post_type_viewable( $pt ); } ); $post_types = apply_filters( 'adpresso_settings_custom_post_types_objects', $post_types ); $children = array_reduce( $post_types, static function( $carry, $pt ) { $carry[ $pt->name ] = [ 'label' => $pt->label, 'default' => 1, ]; return $carry; }, [] ); return apply_filters( 'adpresso_settings_custom_post_types_children', $children, $post_types ); } )(), ], 'feeds_api' => [ 'label' => __( 'Feeds & API', 'adpresso' ), 'default' => 1, 'children' => [ 'rss' => [ 'label' => __( 'RSS Feeds', 'adpresso' ), 'default' => 0, 'description' => __( 'Allow ads to be displayed in your RSS feeds.', 'adpresso' ) ], 'rest' => [ 'label' => __( 'REST API', 'adpresso' ), 'default' => 1, 'description' => __( 'Allow ads to be served via the REST API. Disabling this setting will prevent ads from being included in your API output.', 'adpresso' ), ], ], ], ], ], ], ], 'enable_for_user_roles' => [ 'section' => 'disable', 'label' => __( 'Show ads for specific user roles', 'adpresso' ), 'type' => 'checkbox_button_group', 'sanitize_type' => 'array:key', 'description' => __( 'Allow ads to be displayed only for specific user roles. This is useful on community sites or multi-author blogs where you want to hide ads from logged-in members. Note that customizing this setting from the default will switch to a dynamic ad serving method, which can have a slight impact on your page speed.', 'adpresso' ), 'default' => array_keys( $user_roles ), 'options' => array_map( fn( $key, $label ) => [ 'key' => $key, 'label' => $label ], array_keys( $user_roles ), $user_roles ), ], 'hide_for_ip_addresses' => [ 'section' => 'disable', 'label' => __( 'Hide ads for IP Addresses', 'adpresso' ), 'type' => 'textarea', 'sanitize_type' => 'text', 'default' => '', 'description' => __( 'Enter one IP address (IPv4 or IPv6) per line to block ads for those users. Note that this feature will switch to a dynamic ad serving method, which can have a slight negative impact on page speed.', 'adpresso' ), 'placeholder' => "127.0.0.1\n192.168.0.1\n2001:0db8:130F:0000:0000:09C0:876A:130B", 'premium' => true, ], 'disable_for_bots' => [ 'section' => 'disable', 'label' => __( 'Disable ads for bots', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '0', 'description' => __( 'Prevent ads from being served to known bots and crawlers, based on their user agent. Useful for saving ad impressions and keeping your traffic and click statistics clean. Note that enabling this feature will switch to a dynamic ad serving method, which can have a slight impact on your page speed.', 'adpresso' ), 'premium' => true, ], // Revision Section // 'revision_' . Constants::POST_TYPE_AD => [ // 'type' => 'select', // 'sanitize_type' => 'key', // 'section' => 'revisions', // 'label' => __( 'Revisionen für Anzeigen', 'adpresso' ), // 'description' => __( 'Steuert, ob und wie Revisionen für Anzeigen gespeichert werden.', 'adpresso' ), // 'default' => 'none', // 'options' => [ // 'none' => __( 'Keine Revisionen speichern', 'adpresso' ), // 'light' => __( 'Nur Titel und Inhalt speichern', 'adpresso' ), // 'full' => __( 'Alle Felder und Metadaten speichern', 'adpresso' ), // ], // ], // 'revision_' . Constants::POST_TYPE_PLACEMENT => [ // 'type' => 'select', // 'sanitize_type' => 'key', // 'section' => 'revisions', // 'label' => __( 'Revisionen für Placements', 'adpresso' ), // 'description' => __( 'Steuert die Revisionen für Platzierungen.', 'adpresso' ), // 'default' => 'none', // 'options' => [ // 'none' => __( 'Keine Revisionen speichern', 'adpresso' ), // 'full' => __( 'Alle Felder und Metadaten speichern', 'adpresso' ), // ], // ], // 'revision_' . Constants::POST_TYPE_GROUP => [ // 'type' => 'select', // 'sanitize_type' => 'key', // 'section' => 'revisions', // 'label' => __( 'Revisionen für Gruppen', 'adpresso' ), // 'description' => __( 'Steuert die Revisionen für Anzeigen-Gruppen.', 'adpresso' ), // 'default' => 'none', // 'options' => [ // 'none' => __( 'Keine Revisionen speichern', 'adpresso' ), // 'full' => __( 'Alle Felder und Metadaten speichern', 'adpresso' ), // ], // ], 'ad_label' => [ 'section' => 'ad_label', 'label' => __( 'Enable Caption', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '0', 'description' => __( 'Add a customizable label above your ad placements, e.g., “Advertisement.”', 'adpresso' ), 'link' => 'https://wpadpresso.com/docs/ad-labels/?utm_source=plugin-backend&utm_medium=manual-link&utm_campaign=ad-labels&utm_content=settings-page', ], 'ad_label_text' => [ 'section' => 'ad_label', 'label' => __( 'Default Text', 'adpresso' ), 'type' => 'text', 'sanitize_type' => 'kses_post', 'default' => 'Advertisement', 'description' => __( 'This text will appear on any ad that doesn’t have a custom label.', 'adpresso' ), 'placeholder' => __( 'Advertisement', 'adpresso' ), 'required' => true, 'depends_on' => [ [ 'field_id' => 'ad_label', 'operator' => 'is', 'value' => '1', ], ], ], 'ad_label_allow_html' => [ 'section' => 'ad_label', 'label' => __( 'Allow HTML', 'adpresso' ), 'type' => 'toggle', 'sanitize_type' => 'uint', 'default' => '0', 'description' => __( 'The ad label can be formatted using HTML tags, e.g., for bold or italic text.', 'adpresso' ), 'depends_on' => [ [ 'field_id' => 'ad_label', 'operator' => 'is', 'value' => '1', ], ], ], ]; return apply_filters( "adpresso_tab_{$this->get_id()}_options", $options, $this ); } }