本文整理汇总了PHP中DBUtils::toUid方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::toUid方法的具体用法?PHP DBUtils::toUid怎么用?PHP DBUtils::toUid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtils
的用法示例。
在下文中一共展示了DBUtils::toUid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
}
if (isset($mostViewed) && $mostViewed != false && $mostViewed != NULL) {
$weHaveAPick[1] = true;
if ($mostViewed["type"] == _TABLE_TRACK) {
$tp_name[1] = $mostViewed["name"];
$tp_album[1] = $mostViewed["album"];
$urlIdentifier = "/t/";
} else {
$tp_name[1] = $mostViewed["album"];
$tp_album[1] = "";
$urlIdentifier = "/a/";
}
$tp_artist[1] = $mostViewed["artist"];
$tp_image[1] = $mostViewed["image"];
$tp_link[1] = _SITE_URL . $urlIdentifier . DBUtils::toUid(intval($mostViewed["id"]), _BASE_MULTIPLIER);
}
if (isset($lastShared) && $lastShared != false && $lastShared != NULL) {
$weHaveAPick[2] = true;
if ($lastShared["type"] == _TABLE_TRACK) {
$urlIdentifier = "/t/";
$tp_name[2] = $lastShared["name"];
$tp_album[2] = $lastShared["album"];
} else {
$urlIdentifier = "/a/";
$tp_name[2] = $lastShared["album"];
$tp_album[2] = "";
}
$tp_artist[2] = $lastShared["artist"];
$tp_image[2] = $lastShared["image"];
$tp_link[2] = _SITE_URL . $urlIdentifier . DBUtils::toUid(intval($lastShared["id"]), _BASE_MULTIPLIER);
}
示例2: addAPick
public static function addAPick($id)
{
$db = DBConnection::db();
// Latest first
$query = "SELECT id, name, album, artist, image FROM `items` WHERE id=:id AND type=" . _TABLE_TRACK . " LIMIT 1";
$statement = $db->prepare($query);
$statement->bindParam(':id', $id, PDO::PARAM_INT);
// Executes the query
$exe = $statement->execute();
if (!$exe || $exe == false) {
return false;
} else {
// Fetch the info
$row = $statement->fetchAll(PDO::FETCH_ASSOC);
$queryDate = "SELECT MAX(date) AS maxDate FROM `picks`";
$statementDate = $db->prepare($queryDate);
// Executes the query
$exeDate = $statementDate->execute();
if (!$exeDate || $exeDate == false) {
return false;
} else {
$rowDate = $statementDate->fetch(PDO::FETCH_ASSOC);
$maxDate = strftime("%Y-%m-%d", strtotime($rowDate['maxDate'] . " + 1 day"));
}
$queryPick = "INSERT INTO `picks` (name, artist, album, image, link, date) VALUES(:name, :artist, :album, :image, :link, :max_date)";
$statementPick = $db->prepare($queryPick);
$statementPick->bindParam(':name', $row["name"], PDO::PARAM_STR);
$statementPick->bindParam(':artist', $row["artist"], PDO::PARAM_STR);
$statementPick->bindParam(':album', $row["album"], PDO::PARAM_STR);
$statementPick->bindParam(':image', $row["image"], PDO::PARAM_STR);
$statementPick->bindParam(':link', _SITE_URL . '/t/' . DBUtils::toUid($row["id"], _BASE_MULTIPLIER), PDO::PARAM_STR);
$statementPick->bindParam(':max_date', $maxDate, PDO::PARAM_STR);
// Executes the query
$exePick = $statementPick->execute();
if (!$exePick || $exePick == false) {
return false;
} else {
return true;
}
}
}
示例3: while
<ol class="classement">
<?php
while (list($key, $val) = each($mostViewedArtists)) {
echo "<li><span class=\"classement_in\">" . html_entity_decode($key) . " : <span class=\"color\">" . intval($val) . "</span></span></li>";
}
?>
</ol>
</div>
<div class="clear" style="height: 10px"></div>
<h2 class="txtS">Tracks Statistics >> Most Viewed Tracks</h2>
<div class="boxed">
<ol class="classement">
<?php
while (list($key, $val) = each($mostViewedTracks)) {
list($id, $artist, $title) = explode("|", $key);
echo "<li><span class=\"classement_in\">" . html_entity_decode($artist) . " - <span class=\"link\"><a href=\"" . _SITE_URL . "/t/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . html_entity_decode($title) . "</a></span> : <span class=\"color\">" . intval($val) . "</span></span></li>";
}
?>
</ol>
</div>
</div>
</div>
<?php
// == == == == == == SEARCH TRENDS == == == == == == //
?>
<div id="admin_searchTrends" class="bdTop bdBot">
<div class="margins">
<h2 class="txtS">Tracks Statistics >> Latest Searches</h2>
<div class="boxed">
示例4: while
$order = 0;
while (list($key, $val) = each($mostViewedTracks)) {
list($id, $artist, $title) = explode('|', html_entity_decode($key));
$fontSize = 2.3 * (1 - $order / 5) + $order / 5 * 0.6;
echo "<li><span class=\"count bdBot\">";
$i18n->views(intval($mostViewedTracks[$key]));
echo "</span><span class=\"order bdTop bdBot\">" . ++$order . "</span><span class=\"title\"><a style=\"font-size: " . $fontSize . "em\" href=\"" . _SITE_URL . "/t/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . ellipsis($title, 30) . "</a></span><span class=\"artist bdTop\">" . $artist . "</span></li>";
}
?>
</ul>
</div>
<div id="mostViewedAlbums">
<h2 class="color"><?php
echo $i18n->most_viewed_albums($listDisplayLimit);
?>
</h2>
<ul>
<?php
$order = 0;
while (list($key, $val) = each($mostViewedAlbums)) {
list($id, $artist, $title) = explode('|', html_entity_decode($key));
$fontSize = 2.3 * (1 - $order / 5) + $order / 5 * 0.6;
echo "<li><span class=\"count bdBot\">";
$i18n->views(intval($mostViewedAlbums[$key]));
echo "</span><span class=\"order bdTop bdBot\">" . ++$order . "</span><span class=\"title\"><a style=\"font-size: " . $fontSize . "em\" href=\"" . _SITE_URL . "/a/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . ellipsis($title, 30) . "</a></span><span class=\"artist bdTop\">" . $artist . "</span></li>";
}
?>
</ul>
</div>
</div>
示例5: while
<thead>
<tr class="headerTable name">
<th colspan="2" width="20px" class="name">Item</th>
<th class="name">Artist</th>
<th class="name">Album</th>
<th class="name" width="52px"></th>
</tr>
</thead>
<tbody>
<?php
while (list($id, $item) = each($items)) {
echo "<tr><td width=\"35px\" class=\"image\"><img src=\"" . $item['image'] . "\" width=\"30px\" /></td><td class=\"name\">";
if ($type == _TABLE_TRACK) {
echo "<a href=\"" . _SITE_URL . '/t/' . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\" target=\"_blank\">" . html_entity_decode($item['name']) . "</a></td>";
} else {
echo "<a href=\"" . _SITE_URL . '/a/' . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\" target=\"_blank\">" . html_entity_decode($item['album']) . "</a></td>";
}
echo "<td class=\"name\">" . html_entity_decode($item['artist']) . "</td>";
if ($type == _TABLE_TRACK) {
echo "<td class=\"name\">" . ellipsis(html_entity_decode($item['album']), 40) . "</td>";
} else {
echo "<td class=\"name\"></td>";
}
echo "<td class=\"name addAPick\" rel=\"" . $id . "\">pick it</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>