本文整理汇总了PHP中simplode函数的典型用法代码示例。如果您正苦于以下问题:PHP simplode函数的具体用法?PHP simplode怎么用?PHP simplode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simplode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_videos_lightbox_selector
/**
* Add lightbox to videos
*
* @param mixed $content
* @return mixed
*/
public function add_videos_lightbox_selector($content)
{
if (Responsive_Lightbox()->options['settings']['videos'] === true) {
preg_match_all('/<a(.*?)href=(?:\'|")((?:http|https|)(?::\\/\\/|)(?:www.|)((?:youtu\\.be\\/|youtube\\.com(?:\\/embed\\/|\\/v\\/|\\/watch\\?v=|\\/ytscreeningroom\\?v=|\\/feeds\\/api\\/videos\\/|\\/user\\S*[^\\w\\-\\s]|\\S*[^\\w\\-\\s]))([\\w\\-]{11})[a-z0-9;:@#?&%=+\\/\\$_.-]*)|((?:http|https|)(?::\\/\\/|)(?:www.|)(?:vimeo\\.com\\/[0-9]*(?:.+))))(?:\'|")(.*?)>/i', $content, $links);
if (isset($links[0])) {
foreach ($links[0] as $id => $link) {
if (preg_match('/<a.*?(?:rel|data-rel)=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result) === 1) {
if (isset($result[1])) {
$new_rels = array();
$rels = explode(' ', $result[1]);
if (in_array(Responsive_Lightbox()->options['settings']['selector'], $rels, true)) {
foreach ($rels as $no => $rel) {
if ($rel !== Responsive_Lightbox()->options['settings']['selector']) {
$new_rels[] = $rel;
}
}
$content = str_replace($link, preg_replace('/(?:rel|data-rel)=(?:\'|")(.*?)(?:\'|")/', 'data-rel="' . (!empty($new_rel) ? simplode(' ', $new_rels) . ' ' : '') . Responsive_Lightbox()->options['settings']['selector'] . '-video-' . $id . '"', $link), $content);
} else {
$content = str_replace($link, preg_replace('/(?:rel|data-rel)=(?:\'|")(.*?)(?:\'|")/', 'data-rel="' . ($result[1] !== '' ? $result[1] . ' ' : '') . Responsive_Lightbox()->options['settings']['selector'] . '-video-' . $id . '"', $link), $content);
}
}
} else {
// swipebox video fix
if (Responsive_Lightbox()->options['settings']['script'] === 'swipebox' && strpos($links[2][$id], 'vimeo') !== false) {
$links[2][$id] = $links[2][$id] . '?width=' . Responsive_Lightbox()->options['configuration']['swipebox']['video_max_width'];
}
$content = str_replace($link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '" data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-video-' . $id . '">', $content);
}
}
}
}
return $content;
}
示例2: setFlag
function setFlag($applications, $flag) {
global $_SGLOBAL;
$flag = ($flag == 'disabled') ? -1 : ($flag == 'default' ? 1 : 0);
$appIds = array();
if ($applications && is_array($applications)) {
foreach($applications as $application) {
$this->refreshApplication($application['appId'], $application['appName'], null, null, null, $flag, null);
$appIds[] = $application['appId'];
}
}
if ($flag == -1) {
$sql = sprintf('DELETE FROM %s WHERE icon IN (%s)', tname('feed'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('userapp'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('userappfield'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE appid IN (%s)', tname('myinvite'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
$sql = sprintf('DELETE FROM %s WHERE type IN (%s)', tname('notification'), simplode($appIds));
$_SGLOBAL['db']->query($sql);
}
$result = true;
return new APIResponse($result);
}
示例3: getUpdatedUsers
function getUpdatedUsers($num)
{
global $_SGLOBAL;
$totalNum = getcount('userlog', '');
$users = array();
if ($totalNum) {
$sql = 'SELECT s.*, sf.*, ul.action, ul.uid
FROM %s ul
LEFT JOIN %s s ON ul.uid = s.uid
LEFT JOIN %s sf ON ul.uid = sf.uid
ORDER BY ul.dateline
LIMIT %d';
$sql = sprintf($sql, tname('userlog'), tname('space'), tname('spacefield'), $num);
$query = $_SGLOBAL['db']->query($sql);
$uIds = array();
while ($space = $_SGLOBAL['db']->fetch_array($query)) {
$user = $this->_space2user($space);
$users[] = $user;
$uIds[] = $space['uid'];
}
if ($uIds) {
$sql = sprintf('DELETE FROM %s WHERE uid IN (%s)', tname('userlog'), simplode($uIds));
$_SGLOBAL['db']->query($sql);
}
}
$result = array('totalNum' => $totalNum, 'users' => $users);
return new APIResponse($result);
}
示例4: deletedoings
function deletedoings($ids)
{
global $_SGLOBAL;
$_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE doid IN (" . simplode($ids) . ")");
//删除评论
$_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($ids) . ")");
//删除feed
$_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE id IN (" . simplode($ids) . ") AND idtype='doid'");
return true;
}
示例5: deleteposts
function deleteposts($tagid, $pids)
{
global $_SGLOBAL;
//整理
$nums = renum($postnums);
foreach ($nums[0] as $pnum) {
$_SGLOBAL['db']->query("UPDATE " . tname('thread') . " SET replynum=replynum-{$pnum} WHERE tid IN (" . simplode($tids) . ")");
}
//删除
$_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE pid IN (" . simplode($pids) . ")");
return true;
}
示例6: getUpdatedUsers
function getUpdatedUsers($num)
{
global $_SGLOBAL;
$totalNum = getcount('userlog', '');
$users = array();
if ($totalNum) {
$sql = sprintf('SELECT uid, action, type FROM %s ORDER BY dateline LIMIT %d', tname('userlog'), $num);
$query = $_SGLOBAL['db']->query($sql);
$deletedUsers = $userLogs = $uIds = array();
$undeletedUserIds = array(0 => array(), 1 => array(), 2 => array());
while ($row = $_SGLOBAL['db']->fetch_array($query)) {
$uIds[] = $row['uid'];
if ($row['action'] == 'delete') {
$deletedUsers[] = array('uId' => $row['uid'], 'action' => $row['action']);
} else {
$undeletedUserIds[$row['type']][] = $row['uid'];
}
$userLogs[$row['uid']] = $row;
}
$updatedUsers2 = $updatedUsers3 = array();
// extra updated
if ($undeletedUserIds[2]) {
$updatedUsers2 = $this->getExtraByUsers($undeletedUserIds[2]);
}
// basic updated + all updated
$uIds3 = array_merge($undeletedUserIds[0], $undeletedUserIds[1]);
$updatedUsers3 = $this->getUsers($uIds3, false, true, true, false);
$updatedUsers = array_merge($updatedUsers2, $updatedUsers3);
foreach ($updatedUsers as $k => $v) {
$updatedUsers[$k]['action'] = $userLogs[$v['uId']]['action'];
switch ($userLogs[$v['uId']]['type']) {
case 2:
$updatedUsers[$k]['updateType'] = 'extra';
break;
case 1:
$updatedUsers[$k]['updateType'] = 'basic';
break;
case 0:
default:
$updatedUsers[$k]['updateType'] = 'all';
}
}
$users = array_merge($updatedUsers, $deletedUsers);
if ($uIds) {
$sql = sprintf('DELETE FROM %s WHERE uid IN (%s)', tname('userlog'), simplode($uIds));
$_SGLOBAL['db']->query($sql);
}
}
$result = array('totalNum' => $totalNum, 'users' => $users);
return new APIResponse($result);
}
示例7: posttag
function posttag($tagnamestr)
{
global $_SGLOBAL, $lang;
$tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array());
if (empty($tagnamestr)) {
return $tagarr;
}
$tagnamearr = array();
$valuearr = explode(' ', str_replace(',', ' ', shtmlspecialchars($tagnamestr)));
foreach ($valuearr as $value) {
if (count($tagnamearr) > 10) {
break;
}
$value = posttagcheck($value);
if ($value) {
$tagnamearr[md5($value)] = $value;
}
}
if (empty($tagnamearr)) {
return $tagarr;
}
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('tags') . ' WHERE tagname IN (' . simplode($tagnamearr) . ')');
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$tagarr['existsid'][] = $value['tagid'];
$tagarr['existsname'][] = $value['tagname'];
if ($value['close']) {
$tagarr['closename'][] = $value['tagname'];
}
}
if (!empty($tagarr['existsname'])) {
foreach ($tagnamearr as $value) {
if (!in_array($value, $tagarr['existsname'])) {
$tagarr['nonename'][] = $value;
}
}
} else {
$tagarr['nonename'] = $tagnamearr;
}
if (!empty($tagarr['closename'])) {
showmessage($lang['not_allowed_to_belong_to_the_following_tag'] . ':<p>' . implode(',', $tagarr['closename']) . '</p>');
}
return $tagarr;
}
示例8: deleteblogs
function deleteblogs($blogids)
{
global $_SGLOBAL;
//获取博客信息
$spaces = $blogs = $newblogids = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('blog') . " WHERE blogid IN (" . simplode($blogids) . ")");
$value = $_SGLOBAL['db']->fetch_array($query);
//数据删除
$_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE blogid IN (" . simplode($blogids) . ")");
$_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE blogid IN (" . simplode($blogids) . ")");
//评论
$_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE id IN (" . simplode($blogids) . ") AND idtype='blogid'");
//删除举报
$_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id IN (" . simplode($blogids) . ") AND idtype='blogid'");
//删除feed
$_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE id IN (" . simplode($blogids) . ") AND idtype='blogid'");
//删除脚印
$_SGLOBAL['db']->query("DELETE FROM " . tname('clickuser') . " WHERE id IN (" . simplode($blogids) . ") AND idtype='blogid'");
return true;
}
示例9: IN
$sql .= ' AND status IN (2,3,4)';
$theurl .= "&type=join";
}
$query = $_SGLOBAL['db']->query($sql);
$count = $_SGLOBAL['db']->num_rows($query);
if($count) {
$sql .= " ORDER BY eventid DESC LIMIT $start, $perpage";
$query = $_SGLOBAL['db']->query($sql);
$ids = array();
while($value = $_SGLOBAL['db']->fetch_array($query)) {
$ids[] = $value['eventid'];
}
$fromsql = tname('event').' e';
$joinsql = 'LEFT JOIN '.tname('userevent').' ue ON e.eventid = ue.eventid';
$wherearr[] = 'e.eventid IN ('.simplode($ids).')';
$orderby = " e.eventid DESC";
$sql = "SELECT e.*, ue.uid as fuid, ue.username as fusername, ue.status FROM $fromsql $joinsql WHERE ".implode(" AND ", $wherearr);
}
$needquery = false;
} elseif($view == "me") {
$fromsql = tname("userevent")." ue";
$joinsql = "LEFT JOIN ".tname('event')." e ON e.eventid=ue.eventid";
$orderby = "ue.dateline DESC";
if($view=="friend" && $space['feedfriend']) {
$wherearr[] = "ue.uid IN ($space[feedfriend])";
} else {
$wherearr[] = "ue.uid = '$space[uid]'";
}
if($type=="follow") {
示例10: note_apply
function note_apply($sqlarr) {
global $_SGLOBAL;
$fieldsql = $comma = '';
if(is_array($sqlarr)) {
$uids = array();
$valsql = '(';
foreach($sqlarr as $key => $value) {
$uids[] = $value['uid'];
foreach($value as $vkey => $val) {
if($key == 0) {
$fieldsql .= $comma.$vkey;
}
$valsql .= $comma.'\''.$val.'\'';
$comma = ', ';
}
if(count($sqlarr)-1 > $key) {
$valsql .= '), (';
$comma = '';
}
}
$valsql .= ')';
$_SGLOBAL['db']->query('insert into '.tname('notification').' ('.$fieldsql.') values '.$valsql);
$_SGLOBAL['db']->query("UPDATE ".tname('space')." SET notenum=notenum+1 WHERE uid IN (".simplode($uids).")");
}
}
示例11: tname
$value['message'] = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT message FROM " . tname('comment') . " WHERE cid='{$n_cid}' "), 0);
$value['do'] = $n_do;
$value[$n_do . 'id'] = $n_do_id;
$value['note'] = strip_tags($value['note']);
$value['name'] = empty($value['name']) ? $value['author'] : $value['name'];
$value['isnew'] = $value['new'];
unset($value['new']);
$value['avatar_url'] = avatar($value['authorid'], 'middle', TRUE);
$list[] = $value;
}
//分页
$multi = multi($count, $perpage, $page, "space.php?do={$do}");
}
//更新状态为已看
if ($newids) {
$_SGLOBAL['db']->query("UPDATE " . tname('notification') . " SET new='0' WHERE id IN (" . simplode($newids) . ")");
//更新未读的
$newcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('notification') . " WHERE uid='{$_SGLOBAL['supe_uid']}' AND new='1'"), 0);
$space['notenum'] = $newcount = intval($newcount);
updatetable('space', array('notenum' => $newcount), array('uid' => $_SGLOBAL['supe_uid']));
}
$newnum = 0;
$space['pmnum'] = $_SGLOBAL['member']['newpm'];
foreach (array('notenum', 'pokenum', 'addfriendnum', 'mtaginvitenum', 'eventinvitenum', 'myinvitenum') as $value) {
$newnum = $newnum + $space[$value];
}
$_SGLOBAL['member']['notenum'] = $space['notenum'];
$_SGLOBAL['member']['allnotenum'] = $newnum;
realname_get();
}
//include_once template("space_notice");
示例12: fopen
if ($lines) {
$fp = fopen(S_ROOT . './data/log/' . $_GET['file'], 'r');
foreach ($lines as $line) {
list($l, $o, $n) = explode('-', $line);
fseek($fp, $o);
$line = $n ? fread($fp, $n) : '';
$loginfo = parselog($line);
$loginfo['line'] = $l;
$uids[] = $loginfo['uid'];
$list[] = $loginfo;
}
fclose($fp);
}
}
if ($uids) {
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('space') . ' WHERE uid IN (' . simplode($uids) . ')');
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'], $value['username']);
}
realname_get();
}
$multi = multi($count, $perpage, $page, $mpurl);
}
function parselog($line, $detail = false)
{
$loginfo = array();
list($tag, $dateline, $type, $ip, $uid, $link, $extra) = explode("\t", $line);
$uid = intval($uid);
$loginfo = array('ip' => $ip, 'uid' => $uid, 'link' => $link, 'dateline' => $dateline, 'type' => $type);
if ($detail) {
$m1 = $m2 = array();
示例13: realname_get
function realname_get()
{
global $_SGLOBAL, $_SCONFIG, $_SN, $space;
if (empty($_SGLOBAL['_realname_get']) && $_SCONFIG['realname'] && $_SGLOBAL['select_realname']) {
//禁止重复调用
$_SGLOBAL['_realname_get'] = 1;
//已经有的
if ($space && isset($_SGLOBAL['select_realname'][$space['uid']])) {
unset($_SGLOBAL['select_realname'][$space['uid']]);
}
if ($_SGLOBAL['member']['uid'] && isset($_SGLOBAL['select_realname'][$_SGLOBAL['member']['uid']])) {
unset($_SGLOBAL['select_realname'][$_SGLOBAL['member']['uid']]);
}
//获得实名
$uids = empty($_SGLOBAL['select_realname']) ? array() : array_keys($_SGLOBAL['select_realname']);
if ($uids) {
$query = $_SGLOBAL['db']->query("SELECT uid, name, namestatus FROM " . tname('space') . " WHERE uid IN (" . simplode($uids) . ")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if ($value['name'] && $value['namestatus']) {
$_SN[$value['uid']] = $value['name'];
}
}
}
}
}
示例14: getrelativeitemids
function getrelativeitemids($itemid, $typearr = array(), $num = 10)
{
global $_SGLOBAL;
$tagidarr = array();
$query = $_SGLOBAL['db']->query("SELECT tagid FROM " . tname('spacetags') . " WHERE itemid='{$itemid}' and status='1'");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$tagidarr[] = $value['tagid'];
}
if (empty($tagidarr)) {
return '';
}
$sqlplus = '';
if (!empty($typearr)) {
$sqlplus = "AND type IN (" . simplode($typearr) . ") AND status='1'";
}
$itemidarr = array();
$query = $_SGLOBAL['db']->query("SELECT itemid FROM " . tname('spacetags') . " WHERE tagid IN (" . simplode($tagidarr) . ") AND itemid<>'{$itemid}' {$sqlplus} ORDER BY itemid DESC LIMIT 0, {$num}");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$itemidarr[] = $value['itemid'];
}
return implode(',', $itemidarr);
}
示例15: showmessage
$wheresql .= " AND catid='{$catid}' ";
}
if (submitcheck('postsubmit')) {
if (!empty($_POST['itemid']) && empty($_SGLOBAL['supe_uid'])) {
showmessage('no_permission');
}
modelpost($cacheinfo, 0);
} elseif (submitcheck('delitemsubmit')) {
$itemarr = array();
$tablename = $do == 'pass' ? $nameid . 'items' : 'modelfolders';
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($tablename) . ' WHERE itemid IN(' . simplode($_POST['item'], ',') . ') AND uid=\'' . $_SGLOBAL['supe_uid'] . '\'');
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$itemarr[] = $value['itemid'];
}
$_SGLOBAL['db']->query('DELETE FROM ' . tname($tablename) . ' WHERE itemid IN(' . simplode($itemarr, ',') . ')');
$_SGLOBAL['db']->query('DELETE FROM ' . tname($tablename) . ' WHERE itemid IN(' . simplode($itemarr, ',') . ')');
showmessage('do_success', 'cp.php?ac=models&op=list&do=' . $do . '&nameid=' . $nameid);
}
if ($itemid) {
if ($do == 'pass') {
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($cacheinfo['models']['modelname'] . 'items') . ' LEFT JOIN ' . tname($cacheinfo['models']['modelname'] . 'message') . " USING (itemid) WHERE itemid='{$itemid}'");
if (!($item = $_SGLOBAL['db']->fetch_array($query))) {
showmessage('no_item', 'cp.php?ac=models&op=list&nameid=' . $nameid);
}
$item['subject'] = shtmlspecialchars($item['subject']);
$item['message'] = jsstrip($item['message']);
} else {
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('modelfolders') . " WHERE mid='" . $cacheinfo['models']['mid'] . "' AND itemid='{$itemid}'");
if (!($item = $_SGLOBAL['db']->fetch_array($query))) {
showmessage('no_item', 'cp.php?ac=models&op=list&nameid=' . $nameid);
}