function get_opengraphprotocoltools_tag($property, $content)
{
    if (empty($property) || empty($content)) {
        return;
    }
    // array of property values or structured property
    if (is_array($content)) {
        $meta_tags = array();
        foreach ($content as $structured_property => $content_value) {
            // handle numeric keys from regular arrays
            // account for the special structured property of url which is equivalent to the root tag and sets up the structure
            if (!is_string($structured_property) || $structured_property === 'url') {
                $meta_tags[] = get_opengraphprotocoltools_tag($property, $content_value);
            } else {
                $meta_tags[] = get_opengraphprotocoltools_tag($property . ':' . $structured_property, $content_value);
            }
        }
        return implode("\n", $meta_tags);
    } else {
        if (strstr($property, 'twitter:')) {
            return "<meta name=\"{$property}\" content=\"" . esc_attr($content) . "\" />";
        }
        return "<meta property=\"{$property}\" content=\"" . esc_attr($content) . "\" />";
    }
}
function get_opengraphprotocoltools_headers($data)
{
    if (!count($data)) {
        return;
    }
    $out = array();
    $out[] = "\n<!-- BEGIN: Open Graph Protocol Tools: http://opengraphprotocol.org/ for more info -->";
    foreach ($data as $property => $content) {
        if ($content != '') {
            $out[] = get_opengraphprotocoltools_tag($property, $content);
        } else {
            $out[] = "<!--{$property} value was blank-->";
        }
    }
    $out[] = "<!-- End: Open Graph Protocol Tools-->\n";
    return implode("\n", $out);
}