function fetchPlaylistPage($ytPlaylistId, $start, $authorId, $playlistId)
{
    $url = "http://gdata.youtube.com/feeds/api/playlists/" . $ytPlaylistId . "?v=2&alt=json&start-index=" . $start;
    $data = json_decode(file_get_contents($url), true);
    $info = $data["feed"];
    $video = $info["entry"];
    $nVideo = count($video);
    echo "<br><br>Playlist Name: " . $info["title"]['$t'] . '<br/>';
    echo "Number of Videos (" . $nVideo . "):<br/><br/>";
    for ($i = 0; $i < $nVideo; $i++) {
        $title = $video[$i]['title']['$t'];
        $video = $video[$i]['media$group']['yt$video']['$t'];
        $tags = fetchTags($video);
        $unitId = insertUnitIfNotExists($title, $video, $tags, $authorId);
        //echo 'title=' . $title . " video=" . $video . " tags=" . $tags . " authorId=" . $authorId. "unitId=".$unitId;
        if ($unitId !== false) {
            insertUnitInPlaylist($unitId, $playlistId);
        }
        //echo "Name: " . $title . '<br/>';
        //echo "Link: " . $video . '<br/>';
        //echo "Keywords: " . $tags . "<br><br>";
    }
    return $nVideo;
}
Exemple #2
0
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>';
        }
    }
    //end if count tags
    echo ')';
    echo '</li>' . "\n";
}
//end foreach
echo '</ul>' . "\n";
if ($to < $total) {
    echo '<p><a href="?' . $_SERVER['QUERY_STRING'] . '&amp;start=' . $to . '">More &raquo;</a></p>';
}
Exemple #3
0
<?php

$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>
<a href="/admin/tags/new">Create new Tag</a><br>
<table cellspacing=0>
<?php 
    $color = 1;
    $sortTags = fetchTags();
    foreach ($sortTags as $tag) {
        echo '<tr class="' . ($color > 0 ? "white" : "grey") . '"><td><a target="_blank" href="' . $mainSite . 'blog/tags/' . $tag['id'] . '">' . $tag['name'] . '</a></td>';
        echo '<td>' . $tag['id'] . '</td>';
        echo '<td><a href="/admin/tags/edit/' . $tag['id'] . '">Edit</a></td>';
        echo '<td><a href="/admin/deletetag/' . $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 cellspacing=0>
    <tr><td>Name:</td><td><input type="text" name="name"></td></tr>
    <tr><td>ID:</td><td><input type="text" name="id"></td></tr>
</table>
Exemple #4
0
<?php 
if (!$_REQUEST['id']) {
    die('<b>No ID specified!</b>');
}
require_once 'tagFunctions.php';
require_once 'getSweeties.php';
$setup = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Setup');
$setup = $setup->execute();
$setup = $setup[0];
$file = XN_Content::load(intval($_REQUEST['id']));
$file->focus();
$sweeties = getSweeties($file->id);
echo '<div id="sidebar" style="float:right;width:200px;">' . "\n";
echo '<ul>' . "\n";
echo '   <li>Tags ';
foreach (fetchTags($file) as $tag) {
    echo '<a href="http://' . $_SERVER['HTTP_HOST'] . '/?tag=' . $tag . '" rel="tag">' . $tag . '</a> ';
}
echo '</li>' . "\n";
echo '   <li><address style="font-style:normal;" class="author vcard">User - <a href="http://' . $_SERVER['HTTP_HOST'] . '/?user='******'" class="url fn user">' . $file->contributorName . '</a></address></li>' . "\n";
echo '   <li style="margin-bottom:20px;">Updated - <span class="updated"><abbr title="' . date('c', strtotime($file->updatedDate)) . '">' . date('Y-m-d', strtotime($file->updatedDate)) . '</abbr></span></li>' . "\n";
foreach (unserialize($setup->my->fields) as $field) {
    if (!$file->my->{$field}) {
        continue;
    }
    if (substr($file->my->{$field}, 0, 4) == 'http') {
        echo '   <li><a href="' . $file->my->{$field} . '">' . $field . '</a></li>' . "\n";
    } else {
        echo '   <li>' . $field . ' - ' . $file->my->{$field} . '</li>' . "\n";
    }
}
Exemple #5
0
        }
        echo $grouptag . ' ';
        XNC_Ajax::Link('<img src="http://www.ning.com/xnstatic/icn/cross.gif" alt="[X]" />')->actionUrl('/groupEdit.php?form&delete&return_to=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . '/view.php?id=' . $_REQUEST['id']) . '&grouptag=' . urlencode($grouptag) . '&id=' . $_REQUEST['id'])->htmlElement('group-tags')->callback('Loading', '$(&quot;group-tags&quot;).innerHTML = &quot;<i>Deleting...</i>&quot;;')->confirm('Delete the ' . $grouptag . ' tag?')->make();
    }
    //end foreach grouptags
    echo '</p>';
    $grouptagform = XNC_Ajax::Form()->method('post')->actionUrl('/groupEdit.php?form')->htmlElement('group-tags')->callback('Loading', '$(&quot;group-tags&quot;).innerHTML = &quot;<i>Adding...</i>&quot;;');
    $grouptagform->open();
    echo '<input type="hidden" name="add" value="yes" />';
    echo '<input type="hidden" name="id" value="' . $_REQUEST['id'] . '" />';
    echo '<input type="hidden" name="return_to" value="http://' . $_SERVER['HTTP_HOST'] . '/view.php?id=' . $_REQUEST['id'] . '" />';
    echo '<p>Add a group tag: <input type="text" name="grouptag" /> <input type="submit" value="Add" /></p>';
    $grouptagform->close();
    echo '<p>';
    echo '<b>Related Tags:</b> ';
    foreach (fetchTags($group) as $id => $tag) {
        if ($id > 0) {
            echo ', ';
        }
        echo '<a class="tag" href="/index.php/tag/' . $tag . '" rel="tag">' . $tag . '</a>';
    }
    //end foreach tags
    echo '</p>';
    echo '<p style="font-style:italic;">Add/remove related tags using the sidebar.</p>';
    echo '<h3 id="comments">Discuss TagGroup</h3>';
    include_once 'extComments.php';
    $_SERVER['SCRIPT_URI'] = 'http://' . $_SERVER['HTTP_HOST'] . '/view.php';
    $_SERVER['QUERY_STRING'] = 'id=' . $group->id;
    extComments($group);
}
//end if-else format