Пример #1
0
function tagSort($a, $b)
{
    if (getTagCount($a['tag_id']) == getTagCount($b['tag_id'])) {
        return 0;
    }
    return getTagCount($a['tag_id']) < getTagCount($b['tag_id']) ? 1 : -1;
}
Пример #2
0
function fetchTagsWithCount($content)
{
    try {
        $results = XN_Query::create('Tag')->filter('content', '=', $content)->order('count(value)', 'desc')->order('value', 'asc');
        $results = $results->execute();
        // Put all the tags into an array
        $tagcounts = getTagCount();
        $tagArray = array();
        foreach ($results as $tag) {
            $tagArray[$tag->value] = $tagcounts[$tag->value];
        }
    } catch (XN_Exception $e) {
        echo 'Whoops! Something\'s Gone Wrong';
        echo 'There was an error in this page and I can\'t fetch the list of tags. The error is: ' . $e->getMessage();
    }
    return $tagArray;
}
Пример #3
0
$second_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
$third_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
if ($second_resource === "") {
    ?>

<a href="/admin/menu">&lt;&lt;&lt; Back to Menu</a><br><br>
<a href="/admin/tags/new">Create new Tag</a><br><br>
<table cellspacing=0>
<?php 
    $color = 1;
    $sortTags = getTags();
    usort($sortTags, "tagSort");
    foreach ($sortTags as $tag) {
        echo '<tr class="' . ($color > 0 ? "white" : "grey") . '"><td><a target="_blank" href="' . $mainSite . 'blog/tag/' . $tag['tag_id'] . '">' . $tag['tag_name'] . '</a></td>';
        echo '<td>' . $tag['tag_id'] . '</td>';
        echo '<td>' . getTagCount($tag['tag_id']) . ' Posts</td>';
        echo '<td><a href="/admin/tags/edit/' . $tag['tag_id'] . '">Edit</a></td>';
        echo '<td><a href="/admin/deletetag/' . $tag['tag_id'] . '" onclick="return confirm(\'are you sure?\')">Delete</a></td>';
        $color *= -1;
    }
    ?>

</table>
<?php 
} else {
    if ($second_resource === "new") {
        ?>

<a href="/admin/tags">&lt;&lt;&lt; Back to Tag Management</a><br><br>
<form action="/admin/newtag" method="post">
<table>
Пример #4
0
$to = $query->getResultTo();
$title = 'Sites ';
if ($_REQUEST['tag']) {
    $title .= ' in ' . $_REQUEST['tag'];
}
if ($_REQUEST['user']) {
    $title .= ' from ' . $_REQUEST['user'];
}
echo '<xn:head><title>Wrinks - ' . $title . '</title></xn:head>';
echo '<h2 class="pagetitle">';
echo $title;
echo ' (' . $from . ' - ' . $to . ' of ' . $total . ')</h2>' . "\n";
echo '<div style="float:right;width:150px;" id="sidebar">';
echo '<h2>Top 20 Tags</h2>';
echo '<ul>';
foreach (getTagCount(20, true) as $tag => $count) {
    echo '<li><a href="?tag=' . $tag . '" class="tag">' . $tag . '</a> (' . $count . ')</li>';
}
//end foreach
echo '</ul>';
echo '</div>';
echo '<ul>' . "\n";
foreach ($items as $item) {
    echo '   <li>';
    echo ' <a href="site.php?id=' . $item->id . '" title="' . $item->description . '">' . $item->title . '</a> ';
    echo ' (from <a href="?user='******'" class="user">' . $item->contributorName . '</a>';
    $tags = fetchTags($item);
    if (count($tags)) {
        echo ' in ';
        foreach ($tags as $tag) {
            echo ' <a href="?tag=' . $tag . '" class="tag">' . $tag . '</a>';
Пример #5
0
</wfw:commentRSS>
   </item>
<?php 
    }
    ?>

</channel>
</rss>
   <?php 
    exit;
}
//end if format == rss20 || rss
echo ' <a style="float:right;" href="http://' . $_SERVER['HTTP_HOST'] . '/?xn_auth=no&amp;format=rss20' . ($_REQUEST['user'] ? '&amp;user='******'user'] : '') . ($_REQUEST['tag'] ? '&amp;tag=' . $_REQUEST['tag'] : '') . ($_REQUEST['q'] ? '&amp;q=' . urlencode($_REQUEST['q']) : '') . '" rel="alternate"><img src="http://wrinks.ning.com/feedicon12x12.png" alt="[feed]" /></a>';
echo '<p>' . nl2br($setup->my->homepageblurb) . '</p>';
echo '<h2 class="pagetitle">' . $title . ' (' . $from . ' - ' . $to . ' of ' . $total . ')</h2>';
echo '<xn:head><title>' . XN_Application::load()->name . ' - ' . $title . '</title></xn:head>';
echo '<ul>';
foreach ($items as $item) {
    echo '<li><a href="/xn/detail/' . $item->id . '">' . $item->h('title') . '</a>' . ($item->description ? ' - ' : '') . substr(strip_tags($item->description), 0, 100) . (strlen(strip_tags($item->description)) > 100 ? '...' : '') . '</li>';
}
//end foreach
echo '</ul>';
if ($to < $total) {
    echo '<p><a href="/?' . $_SERVER['QUERY_STRING'] . '&amp;start=' . $to . '">More &raquo;</a></p>';
}
echo '<h2 class="pagetitle">Tags</h2>';
if ($_REQUEST['user']) {
    echo XNC_HTML::buildMap(getTagCount(), '/user/' . $_REQUEST['user'] . '/?tag=%s', '', true, 60, 300);
} else {
    echo XNC_HTML::buildMap(getTagCount(), '/?tag=%s', '', true, 60, 300);
}
Пример #6
0
<?php

$pathvars = array_reverse(explode('/', $_SERVER['SCRIPT_URI']));
if (!$pathvars[0]) {
    $pathvars[0] = $pathvars[1];
    $pathvars[1] = $pathvars[2];
}
$query = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'TagGroup')->alwaysReturnTotalCount(true);
if ($pathvars[1] == 'tag' || $pathvars[0] == 'tag') {
    if (!$pathvars[0] || $pathvars[0] == 'tag') {
        require_once 'tagFunctions.php';
        require_once 'XNC/HTML.php';
        echo '<xn:head><title>tagging / tag</title></xn:head>';
        echo '<h2>Tags</h2>';
        echo XNC_HTML::buildMap(getTagCount(), 'index.php/tag/%s', '', true, 60, 300);
        exit;
    }
    //end if ! pathvars[0]
    if (!isset($_REQUEST['auto']) && !$_REQUEST['format']) {
        echo '<xn:head><title>tagging / tag / ' . htmlspecialchars($pathvars[0]) . '</title></xn:head>';
        echo '<h2>Tag Groups With Related Tag of ' . htmlspecialchars($pathvars[0]) . '</h2>';
    }
    //end if ! isset auto
    $_REQUEST['tag'] = $pathvars[0];
}
//end if pathvars[1] == tag
if ($pathvars[1] == 'tags') {
    if (!isset($_REQUEST['auto']) && !$_REQUEST['format']) {
        echo '<xn:head><title>tagging / tags / ' . htmlspecialchars($pathvars[0]) . '</title></xn:head>';
        echo '<h2>Tag Groups With GroupTag of ' . htmlspecialchars($pathvars[0]) . '</h2>';
    }
Пример #7
0
<?php 
echo '<div id="sidebar"><br><br>';
echo '<div class="sidebar_content"><h4>Recent Posts</h4><br>';
$x = 0;
foreach (getRecentPosts() as $recentPost) {
    if ($x > 0) {
        echo '<br>';
    }
    echo '<a class="recent_post_title" href="/blog/post/' . $recentPost['post_id'] . '">' . $recentPost['post_title'] . '</a><br>';
    echo '<p class="note recent_post_note">' . date("F jS, Y", strtotime($recentPost['post_time'])) . '<br>';
    foreach (getPostTags($recentPost['post_id']) as $recentPostTag) {
        echo '<a class="recent_post_note" href="/blog/tag/' . $recentPostTag . '">' . $recentPostTag . '</a>&nbsp; ';
    }
    echo '</p>';
    $x++;
}
echo '</div><div class="sidebar_content"><h4>All Posts</h4><br>';
echo '<a class="recent_post_title" href="/blog/all">Click Here</a><br>';
echo '<p class="note recent_post_note">to see a full blog post listing.</p>';
echo '</div><div class="sidebar_content"><h4>Tags</h4><br>';
$sortTags = getTags();
usort($sortTags, "tagSort");
foreach ($sortTags as $tag) {
    echo '<p class="note tag_note"><a class="tag_link" href="/blog/tag/' . $tag['tag_id'] . '">' . $tag['tag_name'] . '</a>';
    echo '&nbsp;(' . getTagCount($tag['tag_id']) . ')</p>' . "\n";
}
echo '</div></div>';
?>

Пример #8
0
/**
 * tags
 * @package custom
 */
Typecho_Widget::widget('Widget_Stat')->to($stat);
$this->need('header.php');
?>
    <main id="main" class="main">
        <div class="main-inner">
            <div class="content-wrap">
                <div id="content" class="content">
                    <div id="posts" class="posts-expand">
                        <div class="tag-cloud">
                            <div class="tag-cloud-title">
                                目前共计 <?php 
echo getTagCount();
?>
 个标签
                                <div class="tag-cloud-tags">
                                    <?php 
$this->widget('Widget_Metas_Tag_Cloud', 'ignoreZeroCount=1&limit=50')->to($tags);
?>
                                    <?php 
while ($tags->next()) {
    ?>
                                        <a href="<?php 
    $tags->permalink();
    ?>
" rel="tag" class="tag-size-<?php 
    $tags->split(1, 5, 10, 15);
    ?>
Пример #9
0
$second_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
$third_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
if ($second_resource === "") {
    ?>

<a href="/admin/menu">&lt;&lt;&lt; Back to Menu</a><br><br>
<a href="/admin/projects/new">Create new Project</a><br><br>
<table cellspacing=0>
<?php 
    $color = 1;
    foreach (getProjects() as $project) {
        echo '<tr class="' . ($color > 0 ? "white" : "grey") . '"><td><a target="_blank" href="' . $mainSite . 'projects/view/' . $project['project_id'] . '">' . $project['project_name'] . '</a></td>';
        echo '<td>' . $project['project_id'] . '</td>';
        echo '<td>' . $project['project_tag'] . '</td>';
        echo '<td>' . getTagCount($project['project_tag']) . ' Posts</td>';
        echo '<td><a href="/admin/projects/edit/' . $project['project_id'] . '">Edit</a></td>';
        echo '<td><a href="/admin/deleteproject/' . $project['project_id'] . '" onclick="return confirm(\'are you sure?\')">Delete</a></td>';
        $color *= -1;
    }
    ?>

</table>
<?php 
} else {
    if ($second_resource === "new") {
        ?>

<a href="/admin/projects">&lt;&lt;&lt; Back to Project Management</a><br><br>
<form action="/admin/newproject" method="post">
<table>
Пример #10
0
function getStatisticsSidebar($db)
{
    $value = "";
    $value .= "<h2>Statistics</h2>";
    $value .= "<p>The Stacks project now consists of</p>";
    $value .= "<ul>";
    $value .= "<li>" . getLineCount($db, "total") . " lines of code";
    $value .= "<li>" . getTagCount($db) . " tags (" . getInactiveTagCount($db) . " inactive tags)";
    $value .= "<li>" . getSectionCount($db) . " sections";
    $value .= "<li>" . getChapterCount($db) . " chapters";
    $value .= "<li>" . getPageCount($db, "book") . " pages";
    $value .= "<li>" . getActiveSloganCount($db) . " slogans";
    // . " slogans (" . getSubmittedSloganCount($db) . " submitted)";
    $value .= "</ul>";
    return $value;
}