' . esc_html__( 'Upgrade to WPConsent PRO today and easily manage content in multiple languages. Automatic AI-powered translations get you set up with a new language in minutes.', 'wpconsent-cookies-banner-privacy-suite' ) . '',
array(
'text' => esc_html__( 'Upgrade to PRO and Unlock Languages', 'wpconsent-cookies-banner-privacy-suite' ),
'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'languages-page', 'main' ) ),
),
array(
'text' => esc_html__( 'Learn more about all the features', 'wpconsent-cookies-banner-privacy-suite' ),
'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'languages-page', 'features' ) ),
)
);
?>
'en_US',
'english_name' => 'English (United States)',
'native_name' => 'English (United States)',
);
// Get WordPress default language.
$default_language = get_locale();
$enabled_languages = array( $default_language );
// Sort languages into selected and unselected.
$selected_languages = array();
$unselected_languages = array();
foreach ( $available_languages as $locale => $language ) {
if ( in_array( $locale, $enabled_languages, true ) ) {
$selected_languages[ $locale ] = $language;
} else {
$unselected_languages[ $locale ] = $language;
}
}
// Sort both arrays alphabetically by English name.
uasort( $selected_languages, function ( $a, $b ) {
return strcmp( $a['english_name'], $b['english_name'] );
} );
uasort( $unselected_languages, function ( $a, $b ) {
return strcmp( $a['english_name'], $b['english_name'] );
} );
?>
metabox_row(
esc_html__( 'Language Picker', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
true,
'show_language_picker',
esc_html__( 'Show a language picker in the consent banner', 'wpconsent-cookies-banner-privacy-suite' )
),
'show_language_picker',
'',
'',
esc_html__( 'This will show a globe icon in the header of the consent banner, allowing users to switch between languages just for the banner/preferences panel even if you do not use a translation plugin. If you are using a translation plugin the banner should automatically display the content in the selected language, if available.', 'wpconsent-cookies-banner-privacy-suite' )
);
return ob_get_clean();
}
/**
* The input to choose which content to be blocked.
*
* @return string
*/
public function get_content_blocking_input() {
$content_blocking_services = wpconsent()->script_blocker->get_content_blocking_providers();
$currently_blocking = wpconsent()->settings->get_option( 'content_blocking_services', array() );
ob_start();
?>
metabox_row(
esc_html__( 'Clarity Consent Mode', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
wpconsent()->settings->get_option( 'clarity_consent_mode', true ),
'clarity_consent_mode',
sprintf(
// translators: %1$s is an opening link tag, %2$s is a closing link tag.
esc_html__( 'Use Microsoft Clarity without cookies until consent is given. %1$sLearn More%2$s', 'wpconsent-cookies-banner-privacy-suite' ),
'',
''
)
) . $this->help_icon( __( 'Clarity Consent Mode will not be loaded if the banner is disabled.', 'wpconsent-cookies-banner-privacy-suite' ), false ),
'clarity_consent_mode'
);
$this->metabox_row(
esc_html__( 'Shared Consent', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
wpconsent()->settings->get_option( 'enable_shared_consent' ),
'enable_shared_consent',
esc_html__( 'Share cookie preferences across all subdomains. MUST be enabled on all subdomain sites using WPConsent.', 'wpconsent-cookies-banner-privacy-suite' )
) . $this->help_icon( __( 'Preferences set on example.com will automatically apply to blog.example.com, shop.example.com, and any other subdomain. All subdomain sites must have this setting enabled.', 'wpconsent-cookies-banner-privacy-suite' ), false ),
'enable_shared_consent'
);
$this->metabox_row(
esc_html__( 'Respect Global Privacy Controls', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
wpconsent()->settings->get_option( 'respect_gpc', false ),
'respect_gpc',
esc_html__( 'Automatically respect Global Privacy Control (GPC) signals from user browsers.', 'wpconsent-cookies-banner-privacy-suite' )
) . $this->help_icon( __( 'When enabled, users with GPC enabled in their browser will automatically have non-essential cookies declined and will not see the consent banner. This helps comply with privacy regulations by respecting user-set privacy preferences.', 'wpconsent-cookies-banner-privacy-suite' ), false ),
'respect_gpc'
);
$this->usage_tracking_input();
$this->metabox_row(
esc_html__( 'Reset to Defaults', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_reset_banner_content_button(),
'',
'',
'',
'',
false,
'reset-banner-content'
);
$this->metabox_row(
esc_html__( 'Remove all data', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
wpconsent()->settings->get_option( 'uninstall_data', false ),
'uninstall_data',
esc_html__( 'Remove all data when uninstalling the plugin.', 'wpconsent-cookies-banner-privacy-suite' )
) . $this->help_icon( __( 'All cookie data and configuration will be unrecoverable.', 'wpconsent-cookies-banner-privacy-suite' ), false ),
'uninstall_data'
);
return ob_get_clean();
}
/**
* Get the reset banner content button.
*
* @return string
*/
public function get_reset_banner_content_button() {
ob_start();
?>
metabox_row(
esc_html__( 'Allow Usage Tracking', 'wpconsent-cookies-banner-privacy-suite' ),
$this->get_checkbox_toggle(
wpconsent()->settings->get_option( 'usage_tracking' ),
'usage_tracking',
esc_html__( 'By allowing us to track usage data, we can better help you, as we will know which WordPress configurations, themes, and plugins we should test.', 'wpconsent-cookies-banner-privacy-suite' )
),
'usage_tracking'
);
}
/**
* Output the IAB TCF view.
*
* @return void
*/
public function output_view_iabtcf() {
// Get dummy data for preview.
$dummy_data = $this->get_iab_tcf_dummy_data();
?>
output_iab_tcf_preview( $dummy_data ); ?>
' . esc_html__( 'Upgrade to WPConsent PRO today to enable IAB Transparency & Consent Framework v2.2 support. Manage vendor consents, publisher restrictions, and ensure compliance with the TCF specification.', 'wpconsent-cookies-banner-privacy-suite' ) . '',
array(
'text' => esc_html__( 'Upgrade to PRO and Unlock IAB TCF', 'wpconsent-cookies-banner-privacy-suite' ),
'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'iab-tcf-page', 'main' ) ),
),
array(
'text' => esc_html__( 'Learn more about all the features', 'wpconsent-cookies-banner-privacy-suite' ),
'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'iab-tcf-page', 'features' ) ),
)
);
?>
array(
1 => array( 'name' => 'Store and/or access information on a device' ),
2 => array( 'name' => 'Select basic ads' ),
3 => array( 'name' => 'Create a personalised ads profile' ),
4 => array( 'name' => 'Select personalised ads' ),
5 => array( 'name' => 'Create a personalised content profile' ),
6 => array( 'name' => 'Select personalised content' ),
7 => array( 'name' => 'Measure ad performance' ),
8 => array( 'name' => 'Measure content performance' ),
9 => array( 'name' => 'Apply market research to generate audience insights' ),
10 => array( 'name' => 'Develop and improve products' ),
),
'special_purposes' => array(
1 => array( 'name' => 'Ensure security, prevent fraud, and debug' ),
2 => array( 'name' => 'Technically deliver ads or content' ),
),
);
}
/**
* Output IAB TCF preview with dummy data for lite version.
*
* @param array $dummy_data Dummy data for preview.
*
* @return void
*/
protected function output_iab_tcf_preview( $dummy_data ) {
$purposes = $dummy_data['purposes'];
?>
';
$li_select .= '';
$li_select .= '';
$li_select .= '';
$li_select .= '';
$this->metabox_row(
__( 'Legitimate Interest', 'wpconsent-cookies-banner-privacy-suite' ),
$li_select,
'global_disallow_li',
'',
'',
__( 'Control whether vendors can use legitimate interest as a legal basis for data processing.', 'wpconsent-cookies-banner-privacy-suite' )
);
?>
$purpose ) : ?>
metabox(
__( 'Global Vendor Restrictions', 'wpconsent-cookies-banner-privacy-suite' ),
$content,
__( 'Apply restrictions to all vendors at once. These settings allow you to enforce stricter data policies across all selected vendors.', 'wpconsent-cookies-banner-privacy-suite' )
);
}
/**
* Output publisher data processing declarations section for preview.
*
* @param array $purposes The purposes array.
*
* @return void
*/
protected function output_publisher_declarations_preview( $purposes ) {
// Default all purposes to enabled for preview.
$purposes_consent = array_keys( $purposes );
// Default legitimate interest purposes to enabled (only 2, 7, 9, 10 are allowed per TCF policy).
$li_allowed_purposes = array( 2, 7, 9, 10 );
$purposes_li = $li_allowed_purposes;
// Buffer the metabox content.
ob_start();
?>
metabox(
__( 'Publisher Data Processing Declarations', 'wpconsent-cookies-banner-privacy-suite' ),
$content,
__( 'Declare which TCF purposes your website uses for its own data processing. These declarations are encoded in the TC String and communicated to vendors.', 'wpconsent-cookies-banner-privacy-suite' )
);
}
/**
* Output vendor controls (search, filters, sorting) for preview.
*
* @param int $total_vendors Total number of vendors.
*
* @return void
*/
protected function output_vendor_controls_preview( $total_vendors ) {
?>
metabox(
__( 'Publisher Data Processing Declarations', 'wpconsent-cookies-banner-privacy-suite' ),
$content,
__( 'Declare which TCF purposes your website uses for its own data processing. These declarations are encoded in the TC String and communicated to vendors.', 'wpconsent-cookies-banner-privacy-suite' )
);
}
}