function amt_metadata_footer()
{
    // Prints full metadata for footer area.
    amt_add_metadata_footer();
}
示例#2
0
function amt_get_metadata_review($options, $add_as_view = false)
{
    // Collect metadata
    //
    // Metadata from head section
    //
    $metadata_block_head = null;
    // Non persistent object cache
    $amtcache_key = amt_get_amtcache_key('amt_metadata_block_head');
    $metadata_block_head = wp_cache_get($amtcache_key, $group = 'add-meta-tags');
    if ($metadata_block_head === false) {
        $metadata_block_head = amt_add_metadata_head();
        // Cache even empty
        wp_cache_add($amtcache_key, $metadata_block_head, $group = 'add-meta-tags');
    }
    //
    // Metadata from footer
    //
    $metadata_block_footer = null;
    // Non persistent object cache
    $amtcache_key = amt_get_amtcache_key('amt_metadata_block_footer');
    $metadata_block_footer = wp_cache_get($amtcache_key, $group = 'add-meta-tags');
    if ($metadata_block_footer === false) {
        $metadata_block_footer = amt_add_metadata_footer();
        // Cache even empty
        wp_cache_add($amtcache_key, $metadata_block_footer, $group = 'add-meta-tags');
    }
    //
    // Metadata from content filter (Schema.org Microdata)
    //
    $metadata_block_content_filter = null;
    if ($options["schemaorg_force_jsonld"] == "0") {
        // What happens here:
        // The Metadata Review mode content filter should have a bigger priority that the Schema.org
        // Microdata filter. There the metadata has been stored in non persistent cache.
        // Here we retrieve it. See the notes there for more info.
        $metadata_block_content_filter = wp_cache_get('amt_cache_metadata_block_content_filter', $group = 'add-meta-tags');
    }
    // Build texts
    if ($add_as_view) {
        // $BR = '<br />';
        $BR = PHP_EOL;
        $enclosure_start = '<div id="amt-metadata-review">' . '<pre id="amt-metadata-review-pre">' . $BR;
        $enclosure_end = '</pre>' . '</div>' . $BR . $BR;
    } else {
        $BR = PHP_EOL;
        $enclosure_start = '<pre id="amt-metadata-review-pre">' . $BR;
        $enclosure_end = '</pre>' . $BR . $BR;
    }
    if ($options['review_mode_omit_notices'] == '0') {
        $text_title = '<span class="amt-ht-title">Add-Meta-Tags &mdash; Metadata Review Mode</span>' . $BR . $BR;
    } else {
        $text_title = '';
    }
    if ($options['review_mode_omit_notices'] == '0') {
        $text_intro = '<span class="amt-ht-notice"><span class="amt-ht-important">NOTE</span>: This menu has been added because <span class="amt-ht-important">Metadata Review Mode</span> has been enabled in';
        $text_intro .= $BR . 'the Add-Meta-Tags settings. Only logged in administrators can see this menu.</span>';
    } else {
        $text_intro = '';
    }
    if ($options['review_mode_omit_notices'] == '0') {
        //$text_head_intro = $BR . $BR . '<span class="amt-ht-notice">The following metadata has been added to the head section.</span>' . $BR . $BR;
        $text_head_intro = $BR . $BR . 'Metadata at the head section' . $BR;
        $text_head_intro .= '============================' . $BR . $BR;
    } else {
        $text_head_intro = '';
    }
    if ($options['review_mode_omit_notices'] == '0') {
        //$text_footer_intro = $BR . $BR . '<span class="amt-ht-notice">The following metadata has been embedded in the body of the page.</span>' . $BR . $BR;
        $text_footer_intro = $BR . $BR . 'Metadata within the body area' . $BR;
        $text_footer_intro .= '=============================' . $BR . $BR;
    } else {
        $text_footer_intro = $BR . $BR;
    }
    if ($options['review_mode_omit_notices'] == '0') {
        //$text_content_filter_intro = $BR . $BR . '<span class="amt-ht-notice">The following metadata has been embedded in the body of the page.</span>' . $BR;
        $text_content_filter_intro = $BR . $BR . 'Metadata within the body area' . $BR;
        $text_content_filter_intro .= '=============================' . $BR;
    } else {
        $text_content_filter_intro = $BR;
    }
    //
    // Build view
    //
    $data = $enclosure_start . $text_title;
    $data .= apply_filters('amt_metadata_review_text_before', $text_intro, $metadata_block_head, $metadata_block_footer, $metadata_block_content_filter);
    //
    // Metadata Overview
    //
    if ($options["review_mode_metadata_report"] == '1') {
        $metadata_overview_default_text = '';
        $data .= amt_metadata_analysis($metadata_overview_default_text, $metadata_block_head, $metadata_block_footer, $metadata_block_content_filter);
    }
    //
    // Metadata from head section
    //
    // Add for review
    if (!empty($metadata_block_head)) {
        // Pretty print JSON+LD
        if (array_key_exists('json+ld_data', $metadata_block_head)) {
            $jsonld_data_arr = json_decode($metadata_block_head['json+ld_data']);
            $metadata_block_head['json+ld_data'] = json_encode($jsonld_data_arr, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        }
        $data .= apply_filters('amt_metadata_review_head', $text_head_intro, $metadata_block_head);
        $data .= amt_metatag_highlighter(implode($BR, $metadata_block_head));
    }
    //
    // Metadata from footer
    //
    // Add for review
    if (!empty($metadata_block_footer)) {
        $data .= apply_filters('amt_metadata_review_footer', $text_footer_intro, $metadata_block_footer);
        $data .= amt_metatag_highlighter(implode($BR, $metadata_block_footer));
    }
    //
    // Metadata from content filter (Schema.org Microdata)
    //
    if ($options["schemaorg_force_jsonld"] == "0") {
        if ($metadata_block_content_filter !== false) {
            // Add for review
            $data .= apply_filters('amt_metadata_review_content_filter', $text_content_filter_intro, $metadata_block_content_filter);
            $data .= amt_metatag_highlighter(implode($BR, $metadata_block_content_filter));
        }
    }
    $data .= apply_filters('amt_metadata_review_text_after', '', $metadata_block_head, $metadata_block_footer, $metadata_block_content_filter);
    // End
    $data .= $BR . $BR . $enclosure_end;
    return $data;
}