. * * @package Acknowledgify */ namespace Acknowledgify\Includes; // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Outputs acknowledgment meta tags. */ class Meta_Tags { /** * Setting key => meta name attribute. * * None of these names are emitted by Yoast SEO, Rank Math, All in One SEO * or SEOPress in a stock configuration, so there is no duplicate-tag * conflict. If a particular setup ever does collide, drop the offending * key with the acknowledgify_meta_tags filter rather than editing here. * * @return array */ public static function get_tag_map() { $map = array( 'meta_author' => 'author', 'meta_designer' => 'designer', 'meta_developer' => 'developer', 'meta_copyright' => 'copyright', 'meta_owner' => 'owner', 'meta_publisher' => 'publisher', 'meta_manage' => 'managed-by', 'meta_power' => 'powered-by', 'meta_acknowledgment' => 'acknowledgment', ); /** * Filters the acknowledgment meta tags that may be output. * * Unset a key to suppress that tag entirely, for example to avoid a * clash with another plugin. * * @param array $map Setting key => meta name attribute. */ return (array) apply_filters( 'acknowledgify_meta_tags', $map ); } /** * Print the tags. Only settings with a value produce a tag. * * @return void */ public static function add_meta_tags() { if ( 1 !== (int) Helper::get_setting( 'enable_meta_tags', 0 ) ) { return; } $output = ''; foreach ( self::get_tag_map() as $key => $meta_name ) { $output .= Helper::generate_meta_tag( $key, $meta_name ); } if ( '' === $output ) { return; } // Each tag was built with esc_attr() on both attributes in // Helper::generate_meta_tag(); the allow-list here is a second gate // that guarantees nothing but meta name/content can ever be emitted. echo wp_kses( $output, array( 'meta' => array( 'name' => array(), 'content' => array(), ), ) ); } }