本文整理汇总了PHP中Format::cut_string方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::cut_string方法的具体用法?PHP Format::cut_string怎么用?PHP Format::cut_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::cut_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: class_list
function class_list($Selected = 0)
{
global $Classes, $LoggedUser;
$Return = '';
foreach ($Classes as $ID => $Class) {
if ($Class['Level'] <= $LoggedUser['EffectiveClass']) {
$Return .= '<option value="' . $Class['Level'] . '"';
if ($Selected == $Class['Level']) {
$Return .= ' selected="selected"';
}
$Return .= '>' . Format::cut_string($Class['Name'], 20, 1) . '</option>' . "\n";
}
}
reset($Classes);
return $Return;
}
示例2: class_list
function class_list($Selected = 0)
{
global $Classes;
$Return = '';
foreach ($Classes as $ID => $Class) {
if ($Class['Secondary']) {
continue;
}
$Name = $Class['Name'];
$Level = $Class['Level'];
$Return .= "<option value=\"{$Level}\"";
if ($Selected == $Level) {
$Return .= ' selected="selected"';
}
$Return .= '>' . Format::cut_string($Name, 20, 1) . "</option>\n";
}
reset($Classes);
return $Return;
}
示例3: render_events_day
private static function render_events_day($Day, $Events)
{
$Events = self::get_events_on($Day, $Events);
foreach ($Events as $Event) {
$Color = Calendar::$Colors[Calendar::$Importances[$Event['Importance']]];
$Category = Calendar::$Categories[$Event['Category']];
$Tooltip = $Event['Title'] . " - " . Calendar::$Categories[$Event['Category']] . " - " . Calendar::$Importances[$Event['Importance']];
?>
<p><a href="#" class="event_day tooltip" title="<?php
echo $Tooltip;
?>
" data-gazelle-id="<?php
echo $Event['ID'];
?>
" style="color: <?php
echo $Color;
?>
;"><?php
echo Format::cut_string($Event['Title'], 8, true);
?>
</a></p>
<?php
}
}
示例4: count
<span style="float: left;" class="last_topic">
<?php
$TopicLength = 75 - 2 * count($PageLinks);
unset($PageLinks);
$Title = display_str($Title);
$DisplayTitle = $Title;
?>
<strong>
<a href="forums.php?action=viewthread&threadid=<?php
echo $TopicID;
?>
" class="tooltip" data-title-plain="<?php
echo $Title;
?>
"><?php
echo Format::cut_string($DisplayTitle, $TopicLength);
?>
</a>
</strong>
<?php
echo $PagesText;
?>
</span>
<?php
if (!empty($LastRead[$TopicID])) {
?>
<span style="float: left;" class="<?php
echo $Tooltip;
?>
last_read" title="Jump to last read">
<a href="forums.php?action=viewthread&threadid=<?php
示例5: display_str
</td>
<td class="number_column">0</td>
<td class="number_column">0</td>
<?php
} else {
?>
<td>
<span style="float: left;" class="last_topic">
<a href="forums.php?action=viewthread&threadid=<?php
echo $LastTopicID;
?>
" class="tooltip" data-title-plain="<?php
echo display_str($LastTopic);
?>
"><?php
echo display_str(Format::cut_string($LastTopic, 50, 1));
?>
</a>
</span>
<?php
if (!empty($LastRead[$LastTopicID])) {
?>
<span style="float: left;" class="<?php
echo $Tooltip;
?>
last_read" title="Jump to last read">
<a href="forums.php?action=viewthread&threadid=<?php
echo $LastTopicID;
?>
&page=<?php
echo $LastRead[$LastTopicID]['Page'];
示例6: foreach
<?php
if (!$NumResults) {
?>
<div class="center">No<?php
echo $UnreadSQL ? ' new' : '';
?>
quotes.</div>
<?php
}
?>
<br />
<?php
foreach ($Results as $Result) {
switch ($Result['Page']) {
case 'forums':
$Links = 'Forums: <a href="forums.php?action=viewforum&forumid=' . $Result['ForumID'] . '">' . display_str($Result['ForumName']) . '</a> > ' . '<a href="forums.php?action=viewthread&threadid=' . $Result['PageID'] . '" class="tooltip" title="' . display_str($Result['ForumTitle']) . '">' . Format::cut_string($Result['ForumTitle'], 75) . '</a>';
$JumpLink = 'forums.php?action=viewthread&threadid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'artist':
$Links = 'Artist: <a href="artist.php?id=' . $Result['PageID'] . '">' . display_str($Result['ArtistName']) . '</a>';
$JumpLink = 'artist.php?id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'collages':
$Links = 'Collage: <a href="collages.php?id=' . $Result['PageID'] . '">' . display_str($Result['CollageName']) . '</a>';
$JumpLink = 'collages.php?action=comments&collageid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'requests':
if (!isset($Requests[$Result['PageID']])) {
// Deleted request
continue 2;
}
示例7: usort
}
$Secondaries[] = $Class;
}
usort($Secondaries, $fnc);
foreach ($Secondaries as $Class) {
?>
<option value="<?php
echo $Class['ID'];
?>
"<?php
if ($_GET['secclass'] === $Class['ID']) {
echo ' selected="selected"';
}
?>
><?php
echo Format::cut_string($Class['Name'], 20, 1, 1);
?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label nobr">Extra:</td>
<td>
<ul class="options_list nobullet">
<li>
<input type="checkbox" name="ip_history" id="ip_history"<?php
if ($_GET['ip_history']) {
示例8: render_recent_sidebar
public static function render_recent_sidebar($Events)
{
?>
<div class="box">
<div class="head colhead_dark">
<strong><a href="sitehistory.php">Latest site history</a></strong>
</div>
<ul class="stats nobullet">
<?php
$Categories = SiteHistory::get_categories();
foreach ($Events as $Event) {
?>
<li>
<a href="sitehistory.php?action=search&category=<?php
echo $Event['Category'];
?>
" class="brackets"><?php
echo $Categories[$Event['Category']];
?>
</a>
<?php
if (!empty($Event['Url'])) {
?>
<a href="<?php
echo $Event['Url'];
?>
"><?php
echo Format::cut_string($Event['Title'], 20);
?>
</a>
<?php
} else {
?>
<?php
echo Format::cut_string($Event['Title'], 20);
}
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
示例9:
<td>
<?php
if (empty($ThreadID)) {
?>
<a href="forums.php?action=viewthread&threadid=<?php
echo $ID;
?>
"><?php
echo Format::cut_string($Title, 80);
?>
</a>
<?php
} else {
?>
<?php
echo Format::cut_string($Title, 80);
}
if ($Type == 'body') {
?>
<a href="#" onclick="$('#post_<?php
echo $PostID;
?>
_text').gtoggle(); return false;">(Show)</a> <span style="float: right;" class="tooltip last_read" title="Jump to post"><a href="forums.php?action=viewthread&threadid=<?php
echo $ID;
if (!empty($PostID)) {
echo "&postid={$PostID}#post{$PostID}";
}
?>
"></a></span>
<?php
}
示例10: add
public function add($Label, $Data)
{
if ($Label !== false) {
$this->Labels[] = Format::cut_string($Label, 35);
}
$this->Data[] = $Data;
}
示例11: explode
<ul>
<?php
if ($Aliases != $Title) {
$AliasArray = explode(',', $Aliases);
$UserArray = explode(',', $UserIDs);
$i = 0;
foreach ($AliasArray as $AliasItem) {
?>
<li id="alias_<?php
echo $AliasItem;
?>
"><a href="wiki.php?action=article&name=<?php
echo $AliasItem;
?>
"><?php
echo Format::cut_string($AliasItem, 20, 1);
?>
</a><?php
if (check_perms('admin_manage_wiki')) {
?>
<a href="#" onclick="Remove_Alias('<?php
echo $AliasItem;
?>
'); return false;" class="brackets tooltip" title="Delete alias">X</a> <a href="user.php?id=<?php
echo $UserArray[$i];
?>
" class="brackets tooltip" title="View user">U</a><?php
}
?>
</li>
<?php
示例12: time_diff
echo time_diff($AddedTime);
?>
in <a href="forums.php?action=viewthread&threadid=<?php
echo $TopicID;
?>
&postid=<?php
echo $PostID;
?>
#post<?php
echo $PostID;
?>
" class="tooltip" title="<?php
echo display_str($ThreadTitle);
?>
"><?php
echo Format::cut_string($ThreadTitle, 75);
?>
</a>
<?php
if ($ViewingOwn) {
if ((!$Locked || $Sticky) && (!$LastRead || $LastRead < $LastPostID)) {
?>
<span class="new">(New!)</span>
<?php
}
?>
</span>
<?php
if (!empty($LastRead)) {
?>
<span style="float: left;" class="tooltip last_read" title="Jump to last read">
示例13: construct_file_name
/**
* Combine a bunch of torrent info into a standardized file name
*
* @params most input variables are self-explanatory
* @param int $TorrentID if given, append "-TorrentID" to torrent name
* @param bool $Txt whether to use .txt or .torrent as file extension
* @param int $MaxLength maximum file name length
* @return file name with at most $MaxLength characters
*/
public static function construct_file_name($Artist, $Album, $Year, $Media, $Format, $Encoding, $TorrentID = false, $Txt = false, $MaxLength = self::MaxPathLength)
{
$MaxLength -= $Txt ? 4 : 8;
if ($TorrentID !== false) {
$MaxLength -= strlen($TorrentID) + 1;
}
$TorrentArtist = Misc::file_string($Artist);
$TorrentName = Misc::file_string($Album);
if ($Year > 0) {
$TorrentName .= " - {$Year}";
}
$TorrentInfo = array();
if ($Media != '') {
$TorrentInfo[] = $Media;
}
if ($Format != '') {
$TorrentInfo[] = $Format;
}
if ($Encoding != '') {
$TorrentInfo[] = $Encoding;
}
if (!empty($TorrentInfo)) {
$TorrentInfo = ' (' . Misc::file_string(implode(' - ', $TorrentInfo)) . ')';
} else {
$TorrentInfo = '';
}
if (!$TorrentName) {
$TorrentName = 'No Name';
} elseif (mb_strlen($TorrentArtist . $TorrentName . $TorrentInfo, 'UTF-8') <= $MaxLength) {
$TorrentName = $TorrentArtist . $TorrentName;
}
$TorrentName = Format::cut_string($TorrentName . $TorrentInfo, $MaxLength, true, false);
if ($TorrentID !== false) {
$TorrentName .= "-{$TorrentID}";
}
if ($Txt) {
return "{$TorrentName}.txt";
}
return "{$TorrentName}.torrent";
}
示例14: header
$Cache->delete_value("thread_{$TopicID}_info");
// subscriptions
Subscriptions::move_subscriptions('forums', $TopicID, null);
// quote notifications
Subscriptions::flush_quote_notifications('forums', $TopicID);
$DB->query("\n\t\tDELETE FROM users_notify_quoted\n\t\tWHERE Page = 'forums'\n\t\t\tAND PageID = '{$TopicID}'");
header("Location: forums.php?action=viewforum&forumid={$ForumID}");
} else {
// If we're just editing it
$Action = 'editing';
if (isset($_POST['trash'])) {
$ForumID = TRASH_FORUM_ID;
$Action = 'trashing';
}
$Cache->begin_transaction("thread_{$TopicID}_info");
$UpdateArray = array('IsSticky' => $Sticky, 'Ranking' => $Ranking, 'IsLocked' => $Locked, 'Title' => Format::cut_string($RawTitle, 150, 1, 0), 'ForumID' => $ForumID);
$Cache->update_row(false, $UpdateArray);
$Cache->commit_transaction(0);
$DB->query("\n\t\tUPDATE forums_topics\n\t\tSET\n\t\t\tIsSticky = '{$Sticky}',\n\t\t\tRanking = '{$Ranking}',\n\t\t\tIsLocked = '{$Locked}',\n\t\t\tTitle = '{$Title}',\n\t\t\tForumID = '{$ForumID}'\n\t\tWHERE ID = '{$TopicID}'");
// always clear cache when editing a thread.
// if a thread title, etc. is changed, this cache key must be cleared so the thread listing
// properly shows the new thread title.
$Cache->delete_value("forums_{$ForumID}");
if ($ForumID != $OldForumID) {
// If we're moving a thread, change the forum stats
$Cache->delete_value("forums_{$OldForumID}");
$DB->query("\n\t\t\tSELECT MinClassRead, MinClassWrite, Name\n\t\t\tFROM forums\n\t\t\tWHERE ID = '{$ForumID}'");
list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record(MYSQLI_NUM, false);
$Cache->begin_transaction("thread_{$TopicID}_info");
$UpdateArray = array('ForumName' => $ForumName, 'MinClassRead' => $MinClassRead, 'MinClassWrite' => $MinClassWrite);
$Cache->update_row(false, $UpdateArray);
示例15: error
if (isset($_POST['thread']) && !is_number($_POST['thread'])) {
error(0);
}
if (isset($_POST['forum']) && !is_number($_POST['forum'])) {
error(0);
}
// If you're not sending anything, go back
if (empty($_POST['body']) || empty($_POST['title'])) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
die;
}
$Body = $_POST['body'];
if ($LoggedUser['DisablePosting']) {
error('Your posting privileges have been removed.');
}
$Title = Format::cut_string(trim($_POST['title']), 150, 1, 0);
$ForumID = $_POST['forum'];
if (!isset($Forums[$ForumID])) {
error(404);
}
if (!Forums::check_forumperm($ForumID, 'Write') || !Forums::check_forumperm($ForumID, 'Create')) {
error(403);
}
if (empty($_POST['question']) || empty($_POST['answers']) || !check_perms('forums_polls_create')) {
$NoPoll = 1;
} else {
$NoPoll = 0;
$Question = trim($_POST['question']);
$Answers = array();
$Votes = array();
//This can cause polls to have answer IDs of 1 3 4 if the second box is empty