本文整理汇总了PHP中my_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP my_substr函数的具体用法?PHP my_substr怎么用?PHP my_substr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_substr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: asb_strip_url
function asb_strip_url($message)
{
$message = ' ' . $message;
$message = preg_replace("#([\\>\\s\\(\\)])(http|https|ftp|news){1}://([^\\/\"\\s\\<\\[\\.]+\\.([^\\/\"\\s\\<\\[\\.]+\\.)*[\\w]+(:[0-9]+)?(/[^\"\\s<\\[]*)?)#i", '', $message);
$message = preg_replace("#([\\>\\s\\(\\)])(www|ftp)\\.(([^\\/\"\\s\\<\\[\\.]+\\.)*[\\w]+(:[0-9]+)?(/[^\"\\s<\\[]*)?)#i", '', $message);
return my_substr($message, 1);
}
示例2: create_action
public function create_action($id, $type)
{
checkObject();
checkObjectModule('documents');
object_set_visit_module('documents');
if (!$GLOBALS['rechte']) {
throw new AccessDeniedException();
}
PageLayout::setTitle(_('Neuen Ordner erstellen'));
$options = array();
$options[md5('new_top_folder')] = _('Namen auswählen oder wie Eingabe') . ' -->';
$query = "SELECT SUM(1) FROM folder WHERE range_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($id));
if ($statement->fetchColumn() == 0) {
$options[$id] = _('Allgemeiner Dateiordner');
}
if ($type === 'sem') {
$query = "SELECT statusgruppe_id AS id, statusgruppen.name AS name\n FROM statusgruppen\n LEFT JOIN folder ON (statusgruppe_id = folder.range_id)\n WHERE statusgruppen.range_id = ? AND folder_id IS NULL\n ORDER BY position";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($id));
$statement->setFetchMode(PDO::FETCH_ASSOC);
foreach ($statement as $row) {
$options[$row['id']] = sprintf(_('Dateiordner der Gruppe: %s'), $row['name']);
}
$issues = array();
$shown_dates = array();
$query = "SELECT themen_termine.issue_id, termine.date, folder.name, termine.termin_id, date_typ\n FROM termine\n LEFT JOIN themen_termine USING (termin_id)\n LEFT JOIN folder ON (themen_termine.issue_id = folder.range_id)\n WHERE termine.range_id = ? AND folder.folder_id IS NULL\n ORDER BY termine.date, name";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($id));
$statement->setFetchMode(PDO::FETCH_ASSOC);
foreach ($statement as $row) {
if ($row['name']) {
continue;
}
$name = sprintf(_('Ordner für %s [%s]'), date('d.m.Y', $row['date']), $GLOBALS['TERMIN_TYP'][$row['date_typ']]['name']);
if ($row['issue_id']) {
if (!$issues[$row['issue_id']]) {
$issues[$row['issue_id']] = new Issue(array('issue_id' => $row['issue_id']));
}
$name .= ', ' . my_substr($issues[$row['issue_id']]->toString(), 0, 20);
$option_id = $row['issue_id'];
} else {
$option_id = $row['termin_id'];
}
$options[$option_id] = $name;
}
}
$this->options = $options;
$this->id = $id;
}
示例3: google_seo_meta_description
/**
* Clean up a description and append it to google_seo_meta.
*
* @param string The unfiltered description that should be used.
*/
function google_seo_meta_description($description)
{
global $settings, $plugins, $google_seo_meta;
if ($settings['google_seo_meta_length'] > 0) {
$description = strip_tags($description);
$description = str_replace(" ", " ", $description);
$description = preg_replace("/\\[[^\\]]+\\]/u", "", $description);
$description = preg_replace("/\\s+/u", " ", $description);
$description = trim($description);
$description = my_substr($description, 0, $settings['google_seo_meta_length'], true);
$description = trim($description);
if ($description) {
$plugins->add_hook('pre_output_page', 'google_seo_meta_output');
$google_seo_meta = "<meta name=\"description\" content=\"{$description}\" />\n{$google_seo_meta}";
}
}
}
示例4: build_profile_link
$memban['adminuser'] = build_profile_link($memban['adminuser'], $memban['admin']);
// Display a nice warning to the user
eval('$bannedbit = "' . $templates->get('member_profile_banned') . '";');
}
$adminoptions = '';
if ($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1) {
eval("\$adminoptions = \"" . $templates->get("member_profile_adminoptions") . "\";");
}
$modoptions = $viewnotes = $editnotes = $editprofile = $banuser = $manageuser = '';
$can_purge_spammer = purgespammer_show($memprofile['postnum'], $memprofile['usergroup'], $memprofile['uid']);
if ($mybb->usergroup['canmodcp'] == 1 || $can_purge_spammer) {
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));
if (!empty($memprofile['usernotes'])) {
if (strlen($memprofile['usernotes']) > 100) {
eval("\$viewnotes = \"" . $templates->get("member_profile_modoptions_viewnotes") . "\";");
$memprofile['usernotes'] = my_substr($memprofile['usernotes'], 0, 100) . "... {$viewnotes}";
}
} else {
$memprofile['usernotes'] = $lang->no_usernotes;
}
if ($mybb->usergroup['caneditprofiles'] == 1) {
eval("\$editprofile = \"" . $templates->get("member_profile_modoptions_editprofile") . "\";");
eval("\$editnotes = \"" . $templates->get("member_profile_modoptions_editnotes") . "\";");
}
if ($mybb->usergroup['canbanusers'] == 1 && (!$memban['uid'] || $memban['uid'] && $mybb->user['uid'] == $memban['admin'] || $mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['cancp'] == 1)) {
eval("\$banuser = \"" . $templates->get("member_profile_modoptions_banuser") . "\";");
}
if ($can_purge_spammer) {
eval("\$purgespammer = \"" . $templates->get('member_profile_modoptions_purgespammer') . "\";");
}
if (!empty($editprofile) || !empty($banuser) || !empty($purgespammer)) {
示例5: getSearchResults
<tr>
<td valign="top">
<?
$search_exp = Request::get('search_exp');
if ($search_exp):
$users = getSearchResults(trim($search_exp), $range_id, 'sem');
if ($users): ?>
<select name="searchPersons[]" size="5" multiple style="width: 90%;">
<? if (is_array($users)) foreach ($users as $user) : ?>
<option value="<?php
echo htmlReady($user['username']);
?>
">
<?php
echo htmlReady(my_substr($user['fullname'], 0, 35));
?>
(<?php
echo $user['username'];
?>
), <?php
echo $user['perms'];
?>
</option>
<? endforeach; ?>
</select>
<?php
echo Icon::create('refresh', ['title' => _('Personen suchen')])->asInput(['valign' => 'bottom', 'name' => 'search', 'value' => _('Personen suchen')]);
?>
<br>
<? else : // no users there ?>
示例6: get_user
}
}
$loginhandler->set_data(array('username' => $mybb->input['username'], 'password' => $mybb->input['password']));
if ($loginhandler->validate_login() == true) {
$mybb->user = get_user($loginhandler->login_data['uid']);
}
if ($mybb->user['uid']) {
if (login_attempt_check_acp($mybb->user['uid']) == true) {
log_admin_action(array('type' => 'admin_locked_out', 'uid' => (int) $mybb->user['uid'], 'username' => $mybb->user['username']));
$default_page->show_lockedout();
}
$db->delete_query("adminsessions", "uid='{$mybb->user['uid']}'");
$sid = md5(uniqid(microtime(true), true));
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (my_strlen($useragent) > 200) {
$useragent = my_substr($useragent, 0, 200);
}
// Create a new admin session for this user
$admin_session = array("sid" => $sid, "uid" => $mybb->user['uid'], "loginkey" => $mybb->user['loginkey'], "ip" => $db->escape_binary(my_inet_pton(get_ip())), "dateline" => TIME_NOW, "lastactive" => TIME_NOW, "data" => my_serialize(array()), "useragent" => $db->escape_string($useragent));
$db->insert_query("adminsessions", $admin_session);
$admin_session['data'] = array();
// Only reset the loginattempts when we're really logged in and the user doesn't need to enter a 2fa code
$query = $db->simple_select("adminoptions", "authsecret", "uid='{$mybb->user['uid']}'");
$admin_options = $db->fetch_array($query);
if (empty($admin_options['authsecret'])) {
$db->update_query("adminoptions", array("loginattempts" => 0, "loginlockoutexpiry" => 0), "uid='{$mybb->user['uid']}'");
}
my_setcookie("adminsid", $sid, '', true);
my_setcookie('acploginattempts', 0);
$post_verify = false;
$mybb->request_method = "get";
示例7: eval
eval("\$latest_post = \"" . $templates->get("modcp_awaitingmoderation_none") . "\";");
}
eval("\$awaitingposts = \"" . $templates->get("modcp_awaitingposts") . "\";");
}
if ($nummodqueuethreads > 0 || $mybb->usergroup['issupermod'] == 1) {
$query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible='0' {$flist_queue_threads}");
$unapproved_threads = $db->fetch_field($query, "unapprovedthreads");
if ($unapproved_threads > 0) {
$query = $db->simple_select("threads", "tid, subject, uid, username, dateline", "visible='0' {$flist_queue_threads}", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => 1));
$thread = $db->fetch_array($query);
$thread['date'] = my_date('relative', $thread['dateline']);
$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
$thread['link'] = get_thread_link($thread['tid']);
$thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
if (my_strlen($thread['subject']) > 25) {
$post['subject'] = my_substr($thread['subject'], 0, 25) . "...";
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);
$unapproved_threads = my_number_format($unapproved_threads);
eval("\$latest_thread = \"" . $templates->get("modcp_lastthread") . "\";");
} else {
eval("\$latest_thread = \"" . $templates->get("modcp_awaitingmoderation_none") . "\";");
}
eval("\$awaitingthreads = \"" . $templates->get("modcp_awaitingthreads") . "\";");
}
if (!empty($awaitingattachments) || !empty($awaitingposts) || !empty($awaitingthreads)) {
eval("\$awaitingmoderation = \"" . $templates->get("modcp_awaitingmoderation") . "\";");
}
}
$latestfivemodactions = '';
示例8: if
echo $institute_id;
?>
"
<? if ($institute_id == $resObject->getInstitutId()) echo 'selected'; ?>>
<?php
echo htmlReady(my_substr($faculty['Name'], 0, 50));
?>
</option>
<? foreach ($faculty['institutes'] as $institute_id => $name): ?>
<option style="padding-left: 1.5em;" value="<?php
echo $institute_id;
?>
"
<? if ($institute_id == $resObject->getInstitutId()) echo 'selected'; ?>>
<?php
echo htmlReady(my_substr($name, 0, 50));
?>
</option>
<? endforeach; ?>
<? endforeach; ?>
</select>
<? else : ?>
<?php
echo MessageBox::info(_('Sie können die Einordnung in die Orga-Struktur nicht ändern.'));
?>
<? endif; ?>
</td>
</tr>
<? endif; ?>
<? if ($resObject->getCategoryId()) : ?>
<? foreach ($EditResourceData->selectProperties() as $property): ?>
示例9: foreach
foreach ($faculties as $faculty) {
$export_pagecontent .= "<option style=\"font-weight:bold;\" ";
if ($range_id == $faculty['fakultaets_id']) {
$export_pagecontent .= " selected";
}
$export_pagecontent .= " value=\"" . $faculty['Institut_id'] . "\">" . htmlReady(my_substr($faculty['Name'], 0, 60)) . "</option>";
$inst_statement->execute(array($faculty['Institut_id']));
while ($institute = $inst_statement->fetch(PDO::FETCH_ASSOC)) {
$export_pagecontent .= sprintf("<option value=\"%s\"", $institute['Institut_id']);
if ($range_id == $institute['Institut_id'] && $range_id != $faculty['Institut_id']) {
$export_pagecontent .= " selected";
}
$export_pagecontent .= sprintf("> %s </option>\n", htmlReady(my_substr($institute['Name'], 0, 60)));
}
$inst_statement->closeCursor();
}
if ($perm->have_perm("root")) {
$export_pagecontent .= "<option style=\"font-weight:bold;\" value=\"root\">Alle Einrichtungen";
}
$export_pagecontent .= "</select><br><br>";
$export_pagecontent .= "<b>"._("Art der auszugebenden Daten: ") . "</b><br><select name=\"ex_type\">";
$export_pagecontent .= "<option";
if ($ex_type=="veranstaltung")
$export_pagecontent .= " selected";
示例10: error
error($lang->no_attachments_selected);
}
$aids = implode(',', array_map('intval', $mybb->input['attachments']));
$query = $db->simple_select("attachments", "*", "aid IN ({$aids}) AND uid='" . $mybb->user['uid'] . "'");
while ($attachment = $db->fetch_array($query)) {
remove_attachment($attachment['pid'], '', $attachment['aid']);
}
$plugins->run_hooks("usercp_do_attachments_end");
redirect("usercp.php?action=attachments", $lang->attachments_deleted);
}
if ($mybb->input['action'] == "do_notepad" && $mybb->request_method == "post") {
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));
// Cap at 60,000 chars; text will allow up to 65535?
if (my_strlen($mybb->get_input('notepad')) > 60000) {
$mybb->input['notepad'] = my_substr($mybb->get_input('notepad'), 0, 60000);
}
$plugins->run_hooks("usercp_do_notepad_start");
$db->update_query("users", array('notepad' => $db->escape_string($mybb->get_input('notepad'))), "uid='" . $mybb->user['uid'] . "'");
$plugins->run_hooks("usercp_do_notepad_end");
redirect("usercp.php", $lang->redirect_notepadupdated);
}
if (!$mybb->input['action']) {
// Get posts per day
$daysreg = (TIME_NOW - $mybb->user['regdate']) / (24 * 3600);
if ($daysreg < 1) {
$daysreg = 1;
}
$perday = $mybb->user['postnum'] / $daysreg;
$perday = round($perday, 2);
if ($perday > $mybb->user['postnum']) {
示例11: process_short_content
function process_short_content($post_text, $parser = null, $length = 200)
{
global $parser, $mybb;
require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/emoji/emoji.class.php';
$post_text = tapatalkEmoji::covertNameToEmpty($post_text);
if ($parser === null) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
$array_reg = array(array('reg' => '/\\[color=(.*?)\\](.*?)\\[\\/color\\]/sei', 'replace' => "mobi_color_convert('\$1','\$2' ,false)"), array('reg' => '/\\[php\\](.*?)\\[\\/php\\]/si', 'replace' => '[php]'), array('reg' => '/\\[align=(.*?)\\](.*?)\\[\\/align\\]/si', replace => " \$2 "), array('reg' => '/\\[email\\](.*?)\\[\\/email\\]/si', replace => "[url]"), array('reg' => '/\\[quote(.*?)\\](.*?)\\[\\/quote\\]/si', 'replace' => '[quote]'), array('reg' => '/\\[code\\](.*?)\\[\\/code\\]/si', 'replace' => ''), array('reg' => '/\\[url=(.*?)\\](.*?)\\[\\/url\\]/sei', 'replace' => "mobi_url_convert('\$1','\$2')"), array('reg' => '/\\[img(.*?)\\](.*?)\\[\\/img\\]/si', 'replace' => '[img]'), array('reg' => '/\\[video=(.*?)\\](.*?)\\[\\/video\\]/si', 'replace' => '[V]'), array('reg' => '/\\[attachment=(.*?)\\]/si', 'replace' => '[attach]'));
foreach ($array_reg as $arr) {
$post_text = preg_replace($arr['reg'], $arr['replace'], $post_text);
}
//$post_text = tt_covert_list($post_text, '/\[list=1\](.*?)\[\/list\]/si', '2');
//$post_text = tt_covert_list($post_text, '/\[list\](.*?)\[\/list\]/si', '1');
$parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
$post_text = strip_tags($parser->parse_message($post_text, $parser_options));
$post_text = preg_replace('/\\s+/', ' ', $post_text);
$post_text = html_entity_decode($post_text);
if (my_strlen($post_text) > $length) {
$post_text = my_substr(trim($post_text), 0, $length);
}
return $post_text;
}
示例12: build_forumbits
//.........这里部分代码省略.........
// Fetch the template and append it to the list
eval("\$forum_list .= \"" . $templates->get("forumbit_depth3", 1, 0) . "\";");
$comma = ', ';
}
// Have we reached our max visible subforums? put a nice message and break out of the loop
++$donecount;
if ($donecount == $mybb->settings['subforumsindex']) {
if (subforums_count($fcache[$pid]) > $donecount) {
$forum_list .= $comma . $lang->sprintf($lang->more_subforums, subforums_count($fcache[$pid]) - $donecount);
}
}
continue;
}
}
// Forum is a category, set template type
if ($forum['type'] == 'c') {
$forumcat = '_cat';
} else {
$forumcat = '_forum';
}
if ($forum['linkto'] == '') {
// No posts have been made in this forum - show never text
if (($lastpost_data['lastpost'] == 0 || $lastpost_data['lastposter'] == '') && $hideinfo != true) {
$lastpost = "<div style=\"text-align: center;\">{$lang->lastpost_never}</div>";
} elseif ($hideinfo != true) {
// Format lastpost date and time
$lastpost_date = my_date($mybb->settings['dateformat'], $lastpost_data['lastpost']);
$lastpost_time = my_date($mybb->settings['timeformat'], $lastpost_data['lastpost']);
// Set up the last poster, last post thread id, last post subject and format appropriately
$lastpost_profilelink = build_profile_link($lastpost_data['lastposter'], $lastpost_data['lastposteruid']);
$lastpost_link = get_thread_link($lastpost_data['lastposttid'], 0, "lastpost");
$lastpost_subject = $full_lastpost_subject = $parser->parse_badwords($lastpost_data['lastpostsubject']);
if (my_strlen($lastpost_subject) > 25) {
$lastpost_subject = my_substr($lastpost_subject, 0, 25) . "...";
}
$lastpost_subject = htmlspecialchars_uni($lastpost_subject);
$full_lastpost_subject = htmlspecialchars_uni($full_lastpost_subject);
// Call lastpost template
if ($depth != 1) {
eval("\$lastpost = \"" . $templates->get("forumbit_depth{$depth}_forum_lastpost") . "\";");
}
}
if ($mybb->settings['showforumviewing'] != 0 && $forum['viewers'] > 0) {
if ($forum['viewers'] == 1) {
$forum_viewers_text = $lang->viewing_one;
} else {
$forum_viewers_text = $lang->sprintf($lang->viewing_multiple, $forum['viewers']);
}
$forum_viewers_text_plain = $forum_viewers_text;
$forum_viewers_text = "<span class=\"smalltext\">{$forum_viewers_text}</span>";
}
}
// If this forum is a link or is password protected and the user isn't authenticated, set lastpost and counters to "-"
if ($forum['linkto'] != '' || $hideinfo == true) {
$lastpost = "<div style=\"text-align: center;\">-</div>";
$posts = "-";
$threads = "-";
} else {
$posts = my_number_format($forum['posts']);
$threads = my_number_format($forum['threads']);
}
// Moderator column is not off
if ($mybb->settings['modlist'] != 0) {
$done_moderators = array();
$moderators = '';
// Fetch list of moderators from this forum and its parents
示例13: create_session
/**
* Create a new session.
*
* @param int The user id to bind the session to.
*/
function create_session($uid = 0)
{
global $db;
$speciallocs = $this->get_special_locations();
// If there is a proper uid, delete by uid.
if ($uid > 0) {
$db->delete_query("sessions", "uid='{$uid}'");
$onlinedata['uid'] = $uid;
} else {
if ($this->is_spider == true) {
$db->delete_query("sessions", "sid='{$this->sid}'");
} else {
$db->delete_query("sessions", "ip=" . $db->escape_binary($this->packedip));
$onlinedata['uid'] = 0;
}
}
// If the user is a search enginge spider, ...
if ($this->is_spider == true) {
$onlinedata['sid'] = $this->sid;
} else {
$onlinedata['sid'] = md5(uniqid(microtime(true), true));
}
$onlinedata['time'] = TIME_NOW;
$onlinedata['ip'] = $db->escape_binary($this->packedip);
$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));
$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));
$onlinedata['location1'] = (int) $speciallocs['1'];
$onlinedata['location2'] = (int) $speciallocs['2'];
$onlinedata['nopermission'] = 0;
$db->replace_query("sessions", $onlinedata, "sid", false);
$this->sid = $onlinedata['sid'];
$this->uid = $onlinedata['uid'];
}
示例14: foreach
foreach ($message as $key => $v) {
?>
<span class="message_box">
<div class="row">
<div class="col-xs-9">
<a class="read_message" message_id="<?php
echo $v["message_id"];
?>
" target="_blank" href="<?php
echo U('Comment/index', array('post_id' => $v['post_id']));
?>
"><?php
echo $v["send_user"]["username"];
?>
:<?php
echo my_substr(strip_tags(htmlspecialchars_decode($v['body'])), 100);
?>
</a>
</div>
<div class="col-xs-1">
<?php
if (!$v['is_read']) {
?>
<a class="read_message" message_id="<?php
echo $v["message_id"];
?>
" target="_blank" href="<?php
echo U('Comment/index', array('post_id' => $v['post_id']));
?>
"><span message_id="<?php
echo $v["message_id"];
示例15: foreach
<? foreach ($members as $member): ?>
<tr>
<td class="gruppe<?php
echo $seminars[$member['seminar_id']]['gruppe'];
?>
"> </td>
<td>
<a href="<?php
echo URLHelper::getLink('seminar_main.php', array('auswahl' => $member['seminar_id']));
?>
">
<?php
echo Config::get()->IMPORTANT_SEMNUMBER ? htmlReady($seminars[$member['seminar_id']]['sem_nr']) : '';
?>
<?php
echo htmlReady(my_substr($seminars[$member['seminar_id']]['name'], 0, 70));
?>
</a>
<? if (!$seminars[$member['seminar_id']]['visible']): ?>
<?php
echo _('(versteckt)');
?>
<? endif; ?>
<input type="hidden" name="m_checked[<?php
echo $member['seminar_id'];
?>
][33]" value="0">
</td>
<? foreach (array_values($modules) as $index => $data): ?>
<td>
<input type="checkbox" name="m_checked[<?php