ignored_shortcodes = \apply_filters( 'embed_privacy_ignored_shortcodes', $this->ignored_shortcodes );
return $this->ignored_shortcodes;
}
/**
* Display an Opt-out shortcode.
*
* @param array|string $attributes Shortcode attributes
* @return string The shortcode output
*/
public static function opt_out( $attributes ) {
$attributes = \shortcode_atts( [
'headline' => \__( 'Embed providers', 'embed-privacy' ),
'show_all' => 0,
'subline' => \__( 'Enable or disable embed providers globally. By enabling a provider, its embedded content will be displayed directly on every page without asking you anymore.', 'embed-privacy' ),
], $attributes );
$cookie = Embed_Privacy::get_instance()->get_cookie();
$embed_providers = Providers::get_instance()->get_list();
$enabled_providers = \array_keys( (array) $cookie );
$is_javascript_detection = \get_option( 'embed_privacy_javascript_detection' ) === 'yes';
if ( empty( $embed_providers ) ) {
return '';
}
if ( ! $is_javascript_detection && ! $attributes['show_all'] && ! $enabled_providers ) {
return '';
}
$headline = '
' . \esc_html( $attributes['headline'] ) . '
' . \PHP_EOL;
/**
* Filter the opt-out headline.
*
* @param string $headline Current headline HTML
* @param array $attributes Shortcode attributes
*/
$headline = \apply_filters( 'embed_privacy_opt_out_headline', $headline, $attributes );
/**
* Filter the opt-out subline.
*
* @param string $subline Current subline HTML
* @param array $attributes Shortcode attributes
*/
$subline = \apply_filters( 'embed_privacy_opt_out_subline', '' . \esc_html( $attributes['subline'] ) . '
' . \PHP_EOL, $attributes );
$output = '' . \PHP_EOL . $headline . $subline;
foreach ( $embed_providers as $provider ) {
if ( $is_javascript_detection ) {
$is_checked = false;
}
else if ( $attributes['show_all'] ) {
$is_checked = \in_array( $provider->get_name(), $enabled_providers, true );
}
else {
$is_checked = true;
}
$is_hidden = ! $is_javascript_detection && ! $attributes['show_all'] && ! \in_array( $provider->get_name(), $enabled_providers, true );
$microtime = \str_replace( '.', '', \microtime( true ) );
$output .= '' . \PHP_EOL;
$output .= '
' . \PHP_EOL;
$output .= '' . \PHP_EOL;
}
$output .= '
' . \PHP_EOL;
return $output;
}
}