예제 #1
0
/**
 * Get detailed info for tags used in an entry
 *
 * @param string $template
 * @return string
 */
function snippet_ttaglist($template = '')
{
    global $PIVOTX;
    $aTagsList = getTags(false);
    if (sizeof($aTagsList) > 0) {
        $output = "<div id='tagpage'>\n";
        $output .= "<h3>" . __('Tags used in this posting') . "</h3>\n";
        $tagLinks = array();
        foreach ($aTagsList as $sTag) {
            makeRelatedTags($sTag, $aTagsList);
            $tagLinks[] = sprintf('<a rel="tag" href="%s" title="tag: %s">%s</a>', tagLink($sTag, $template), $sTag, $sTag);
        }
        $output .= "<p>" . implode(", ", $tagLinks) . "</p>\n";
        reset($aTagsList);
        foreach ($aTagsList as $sRelated) {
            $sTheRelatedLinks = getEntriesWithTag($sRelated, $PIVOTX['db']->entry["code"]);
            if (!strlen($sTheRelatedLinks) == 0) {
                $output .= "\n<h3>";
                $output .= __('Other entries about') . " '" . $sRelated . "'</h3>\n";
                $output .= $sTheRelatedLinks;
            }
        }
        $output .= "\n</div>\n";
    } else {
        $output = '';
    }
    return $output;
}
예제 #2
0
/**
 * Print out the tag page for any given tag. Returns the output as HTML.
 *
 * @param string $tag
 * @return string
 */
function printTag($tag)
{
    global $PIVOTX;
    $tag = normalizeTag($tag);
    // If the hook for the thickbox includes in the header was not yet
    // installed, do so now..
    $PIVOTX['extensions']->addHook('after_parse', 'callback', 'jqueryIncludeCallback');
    if ($PIVOTX['config']->get('tag_fetcher_enabled') == 1) {
        //$para_weblog = "?w=".para_weblog($Current_weblog);
        $output = '            <script type="text/javascript">
            /*<![CDATA[ */
            function doList(type, tag)  {
                jQuery("#tgrrsslist").html(\'<img src="' . $PIVOTX['paths']['pivotx_url'] . 'pics/loadingAnimation.gif" alt=""/>\');
                var url = "' . $PIVOTX['paths']['pivotx_url'] . 'ajaxhelper.php?function=getTagFeed";
                jQuery.get( url, { type: type, tag: tag }, function(output) { jQuery("#tgrrsslist").html(output); } );
            }
            /* ]]> */
            </script>
        ';
    }
    $output .= "<div id='tagpage'>\n<h2>" . __('Tag overview for: ') . " '" . str_replace("+", " ", $tag) . "'</h2>\n\n";
    $output .= "<h3>" . __('Entries on this site with ') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
    $output .= getEntriesWithTag($tag);
    $output .= "<h3>" . __('Related tags') . "</h3>\n\n";
    $output .= getRelatedTags($tag);
    if ($PIVOTX['config']->get('tag_fetcher_enabled') == 1) {
        $output .= "\n<div id='feedfetcher'>\n";
        $output .= "<h3>" . __('External feeds for') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
        $output .= "<p>\n" . __('Click icon for a list of links on') . " '" . str_replace("+", " ", $tag) . "'</p>\n<p id='tagbuttons'>\n";
        $sites = array('delicious' => 'Delicious ', 'google' => 'Google', 'icerocket' => 'Icerocket', 'tagzania' => 'TagZania', '43things' => '43 Things');
        foreach ($sites as $key => $value) {
            $output .= sprintf("<a href=\"javascript:doList('%s','%s');\"><img src=\"%spics/taggerati/%s.png\" alt=\"%s\" /></a>\n", $key, str_replace('/', '', $tag), $PIVOTX['paths']['pivotx_url'], $key, $value);
        }
        $output .= "</p>";
        $output .= "<div id=\"tgrrsslist\"></div>";
        $output .= "</div>\n";
    }
    if ($PIVOTX['config']->get('tag_flickr_enabled')) {
        $output .= "<h3>" . __('Flickr images for') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
        $output .= '

    <!-- Start of Flickr Badge -->
    <div id="flickrpics">
    <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&amp;count=' . $PIVOTX['config']->get('tag_flickr_amount') . '&amp;display=latest&amp;size=s&amp;layout=h&amp;source=all_tag&amp;tag=' . $tag . '"></script>
    </div>

    ';
    }
    $output .= "</div>\n";
    return $output;
}