/**
 * Review mode
 */
function amt_get_metadata_review()
{
    //
    //  TODO: FIX THIS MESS
    //
    //return '<pre>' . amt_metatag_highlighter( htmlspecialchars( amt_add_schemaorg_metadata_content_filter('dzfgdzfdzfdszfzf'), ENT_NOQUOTES) ) . '</pre>';
    // Returns metadata review code
    //return '<pre>' . htmlentities( implode(PHP_EOL, amt_get_metadata_head()) ) . '</pre>';
    $msg = '<span style="text-decoration: underline; color: black;"><span style="font-weight: bold;">NOTE</span>: This box is displayed because <span style="font-weight: bold;">Review Mode</span> has been enabled in' . PHP_EOL . 'the Add-Meta-Tags settings. Only logged in administrators can see this box.</span>' . PHP_EOL . PHP_EOL;
    $msg_body = '<span style="text-decoration: underline; color: black;">The following metadata has been embedded in the body.</span>';
    $metadata = '<pre>';
    $metadata .= $msg . amt_metatag_highlighter(implode(PHP_EOL, amt_get_metadata_head())) . PHP_EOL;
    $metadata .= PHP_EOL . $msg_body . PHP_EOL . PHP_EOL . amt_metatag_highlighter(amt_add_schemaorg_metadata_content_filter('')) . PHP_EOL;
    $metadata .= PHP_EOL . amt_metatag_highlighter(implode(PHP_EOL, amt_get_metadata_footer())) . PHP_EOL;
    $metadata .= '</pre>';
    return $metadata;
    //return '<pre lang="XML" line="1">' . implode(PHP_EOL, amt_get_metadata_head()) . '</pre>';
}
示例#2
0
/**
 * Prints the generated metadata for the head area.
 */
function amt_add_metadata_head()
{
    // For AMT timings
    $t = microtime(true);
    // Get the options the DB
    $options = get_option("add_meta_tags_opts");
    // Get current post object
    $post = amt_get_queried_object();
    // Caching indicator
    $is_cached = 'no';
    // Get the metadata
    if (absint($options['transient_cache_expiration']) > 0 && apply_filters('amt_enable_metadata_cache', true)) {
        $metadata_arr = amt_get_transient_cache($post, $options, $where = 'head');
        if (empty($metadata_arr)) {
            $metadata_arr = amt_get_metadata_head($post, $options);
            // Cache the metadata
            if (!empty($metadata_arr)) {
                amt_set_transient_cache($post, $options, $metadata_arr, $where = 'head');
            }
        } else {
            $is_cached = 'yes';
        }
    } else {
        $metadata_arr = amt_get_metadata_head($post, $options);
    }
    // For AMT timings
    if (!empty($metadata_arr) && $options['enable_timings'] == '1') {
        array_unshift($metadata_arr, sprintf('<!-- Add-Meta-Tags Timings (milliseconds) - Block total time: %.3f msec - Cached: %s -->', (microtime(true) - $t) * 1000, $is_cached));
    }
    // Add our comment
    if ($options["omit_vendor_html_comments"] == "0") {
        if (count($metadata_arr) > 0) {
            array_unshift($metadata_arr, "<!-- BEGIN Metadata added by the Add-Meta-Tags WordPress plugin -->");
            array_push($metadata_arr, "<!-- END Metadata added by the Add-Meta-Tags WordPress plugin -->");
        }
    }
    // Return complete metadata array
    return $metadata_arr;
}