本文整理汇总了PHP中spliti函数的典型用法代码示例。如果您正苦于以下问题:PHP spliti函数的具体用法?PHP spliti怎么用?PHP spliti使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spliti函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddFeed
/**
* 增加一条feed
* @param $ArrData 表单内容
* @param $StrTag tags
*/
function AddFeed($ArrData, $StrTag)
{
$ArrData = $this->ArrRebuild($ArrData);
$query = 'INSERT INTO .`feeds` (' . $ArrData['key'] . ') VALUES (' . $ArrData['value'] . ');';
// print_r($query);
$result = mysql_query($query, $this->ObDb) or die(mysql_error());
$result = mysql_query('SELECT LAST_INSERT_ID( )', $this->ObDb) or die(mysql_error());
$LastId = mysql_fetch_array($result);
$LastId = $LastId[0];
$StrTag = spliti(',', $StrTag);
$ArrTag = array();
foreach ($StrTag as $value) {
!in_array($value, $ArrTag) ? $ArrTag[] = $value : true;
}
foreach ($ArrTag as $value) {
if (trim($value)) {
$Str .= "('{$LastId}' , '{$value}'),";
}
}
$Str = rtrim($Str, ',');
$query = 'INSERT INTO `feeds-tags` (fid,tag) VALUES ' . $Str . ';';
// print_r($query);
$result = mysql_query($query, $this->ObDb) or die(mysql_error());
return true;
}
示例2: getQuery
/**
* Function returns the Query for the relationhips
* @param <Vtiger_Record_Model> $recordModel
* @param type $actions
* @return <String>
*/
public function getQuery($recordModel, $actions = false)
{
$parentModuleModel = $this->getParentModuleModel();
$relatedModuleModel = $this->getRelationModuleModel();
$relatedModuleName = $relatedModuleModel->get('name');
$parentModuleName = $parentModuleModel->get('name');
$functionName = $this->get('name');
$focus = CRMEntity::getInstance($parentModuleName);
$focus->id = $recordModel->getId();
if (method_exists($parentModuleModel, $functionName)) {
$query = $parentModuleModel->{$functionName}($recordModel, $relatedModuleModel);
} else {
$result = $focus->{$functionName}($recordModel->getId(), $parentModuleModel->getId(), $relatedModuleModel->getId(), $actions);
$query = $result['query'];
}
//modify query if any module has summary fields, those fields we are displayed in related list of that module
$relatedListFields = $relatedModuleModel->getConfigureRelatedListFields();
if (count($relatedListFields) > 0) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($relatedModuleName, $currentUser);
$queryGenerator->setFields($relatedListFields);
$selectColumnSql = $queryGenerator->getSelectClauseColumnSQL();
$newQuery = spliti('FROM', $query);
$selectColumnSql = 'SELECT DISTINCT vtiger_crmentity.crmid,' . $selectColumnSql;
}
if ($functionName == ('get_pricebook_products' || 'get_pricebook_services')) {
$selectColumnSql = $selectColumnSql . ', vtiger_pricebookproductrel.listprice';
}
$query = $selectColumnSql . ' FROM ' . $newQuery[1];
return $query;
}
示例3: efGroupPortal_MediaWikiPerformAction
function efGroupPortal_MediaWikiPerformAction($output, $article, $title, $user, $request)
{
$action = $request->getVal('action', 'view');
$redirect = $request->getVal('redirect');
if ($action === 'view' && $redirect === null) {
if ($title->equals(Title::newMainPage())) {
$groupPortals = spliti("\n", wfMsgForContentNoTrans('groupportal'));
$groups = $user->getGroups();
$targetPortal = '';
foreach ($groupPortals as $groupPortal) {
$mcount = preg_match('/^(.+)\\|(.+)$/', $groupPortal, $matches);
if ($mcount > 0) {
if (in_array($matches[1], $groups) || $matches[1] == '*' && empty($targetPortal)) {
$targetPortal = $matches[2];
}
}
}
if (!empty($targetPortal)) {
$target = Title::newFromText($targetPortal);
if (is_object($target)) {
$output->redirect($target->getLocalURL());
return false;
}
}
}
}
return true;
}
示例4: parsePlaylist
function parsePlaylist($txt, $type = false)
{
$txt = explode("\n", $txt);
// trim will remove the \r
$res = array();
if ($type == "pls" || $type === false) {
foreach ($txt as $t) {
$t = trim($t);
if (stripos($t, "file") !== false) {
$pos = spliti("^file[0-9]*=", $t);
if (count($pos) == 2 && strlen($pos[1]) > 0) {
$res[] = $pos[1];
}
}
}
} else {
if ($type == "m3u" || $type === false && count($res) == 0) {
foreach ($txt as $t) {
$t = trim($t);
if (strpos($t, "#") !== false || strlen($t) == 0) {
echo "skipping: {$t}\n";
continue;
}
$res[] = $t;
}
}
}
return $res;
}
示例5: getQueryByModuleField
/**
* Function to get list view query for popup window
* @param <String> $sourceModule Parent module
* @param <String> $field parent fieldname
* @param <Integer> $record parent id
* @param <String> $listQuery
* @return <String> Listview Query
*/
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
if (in_array($sourceModule, array('Leads', 'Accounts', 'Contacts'))) {
switch ($sourceModule) {
case 'Leads':
$tableName = 'vtiger_campaignleadrel';
$relatedFieldName = 'leadid';
break;
case 'Accounts':
$tableName = 'vtiger_campaignaccountrel';
$relatedFieldName = 'accountid';
break;
case 'Contacts':
$tableName = 'vtiger_campaigncontrel';
$relatedFieldName = 'contactid';
break;
}
$condition = " vtiger_campaign.campaignid NOT IN (SELECT campaignid FROM {$tableName} WHERE {$relatedFieldName} = '{$record}')";
$pos = stripos($listQuery, 'where');
if ($pos) {
$split = spliti('where', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
}
return $overRideQuery;
}
}
示例6: getQueryByModuleField
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
$bmqdivx = "sourceModule";
$zlolzuy = "sourceModule";
${${"GLOBALS"}["qrqojbhxesaz"]} = array("Leads", "Accounts", "HelpDesk", "Potentials");
if (${$bmqdivx} == "PriceBooks" && ${${"GLOBALS"}["tebjrruj"]} == "priceBookRelatedList" || in_array(${$zlolzuy}, ${${"GLOBALS"}["qrqojbhxesaz"]}) || in_array(${${"GLOBALS"}["smtqzdj"]}, getInventoryModules())) {
${${"GLOBALS"}["vdridpr"]} = " vtiger_service.discontinued = 1 ";
$csusxhsru = "field";
$hxsdmdnrcwm = "sourceModule";
$hxnvgeuqzxj = "supportedModulesList";
if (${$hxsdmdnrcwm} == "PriceBooks" && ${$csusxhsru} == "priceBookRelatedList") {
${${"GLOBALS"}["vdridpr"]} .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
} elseif (in_array(${${"GLOBALS"}["smtqzdj"]}, ${$hxnvgeuqzxj})) {
$hcfqbvtwpxs = "condition";
${$hcfqbvtwpxs} .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
}
${${"GLOBALS"}["myxgfagm"]} = stripos(${${"GLOBALS"}["texkhgc"]}, "where");
if (${${"GLOBALS"}["myxgfagm"]}) {
${"GLOBALS"}["jstyvedywb"] = "overRideQuery";
${"GLOBALS"}["duyhsdq"] = "split";
${"GLOBALS"}["tarygvij"] = "condition";
$ahusbk = "listQuery";
$lxqmuyuxd = "split";
${${"GLOBALS"}["duyhsdq"]} = spliti("where", ${$ahusbk});
${${"GLOBALS"}["jstyvedywb"]} = ${${"GLOBALS"}["wdrbrwcxv"]}[0] . " WHERE " . ${$lxqmuyuxd}[1] . " AND " . ${${"GLOBALS"}["tarygvij"]};
} else {
$arzttzsxki = "overRideQuery";
${$arzttzsxki} = ${${"GLOBALS"}["texkhgc"]} . " WHERE " . ${${"GLOBALS"}["vdridpr"]};
}
return ${${"GLOBALS"}["mvklfvtelnt"]};
}
}
示例7: PHPruDirs
function PHPruDirs()
{
global $HOME_DIR, $STOP_DIR, $STOP_FILE, $CONFIG, $input, $sizetotal;
$dir = opendir('.');
$ff = readdir($dir);
while ($ff != '')
{
$flag = 0;
if (is_dir($ff))
{
foreach($STOP_DIR as $VALUE)
{
if (strtolower($ff) == strtolower(trim($VALUE)))
$flag = 1;
}
if (($ff != '.') && ($ff != '..') && ($flag != 1))
{ chdir($ff); PHPruDirs(); chdir('..'); }
}
$ff = readdir($dir);
if ($ff != '..' && !is_dir($ff))
{
$hlam = str_replace($STOP_FILE, "!", $ff);
if ($hlam != $ff)
continue;
else
{
$NOW_DIR = getcwd();
$LINK = str_replace($HOME_DIR, trim($CONFIG[0]), $NOW_DIR);
$LINK = str_replace('\\', '/', $LINK);
$mtime = date("d.m.Yг.",filemtime($ff));
$size = round(filesize($ff)/1024);
$sizetotal += $size;
$ff = trim($ff);
$FILE = file($ff);
$text = implode(' ',$FILE);
unset ($FIND);
if($CONFIG[3] == 1)
{
@list($start,$end) = spliti('</TITLE>',$text,2);
@list($recycle,$FIND) = spliti('<TITLE>',$start,2);
}
if (!isset($FIND))
$FIND = $LINK.'/'.$ff;
$clear = PHPruClear($text);
$text = wordwrap ($clear, 100, "%^%");
$input .= '<A HREF=\''.$LINK.'/'.$ff.'\' TARGET=_new>'.$FIND.'</A>';
$input .= '^!^'.$size.'^!^'.$text.'^!^'.$mtime."\r\n";
}
}
}
closedir($dir);
}
示例8: getQueryByModuleField
/**
* Function to get list view query for popup window
* @param <String> $sourceModule Parent module
* @param <String> $field parent fieldname
* @param <Integer> $record parent id
* @param <String> $listQuery
* @return <String> Listview Query
*/
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
if ($sourceModule === 'Emails' && $field === 'composeEmail') {
$condition = ' (( vtiger_notes.filelocationtype LIKE "%I%")) AND vtiger_notes.filename != "" AND vtiger_notes.filestatus = 1';
} else {
$condition = " vtiger_notes.notesid NOT IN (SELECT notesid FROM vtiger_senotesrel WHERE crmid = '{$record}') AND vtiger_notes.filestatus = 1";
}
$pos = stripos($listQuery, 'where');
if ($pos) {
$split = spliti('where', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
}
return $overRideQuery;
}
示例9: getQueryByModuleField
/**
* Function to get list view query for popup window
* @param <String> $sourceModule Parent module
* @param <String> $field parent fieldname
* @param <Integer> $record parent id
* @param <String> $listQuery
* @return <String> Listview Query
*/
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery, $currencyId = false)
{
$relatedModulesList = array('Products', 'Services');
if (in_array($sourceModule, $relatedModulesList)) {
$pos = stripos($listQuery, ' where ');
if ($currencyId && in_array($field, array('productid', 'serviceid'))) {
$condition = " vtiger_pricebook.pricebookid IN (SELECT pricebookid FROM vtiger_pricebookproductrel WHERE productid = {$record})\n\t\t\t\t\t\t\t\tAND vtiger_pricebook.currency_id = {$currencyId} AND vtiger_pricebook.active = 1";
if ($pos) {
$split = spliti(' where ', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
}
}
return $overRideQuery;
}
}
示例10: smarty_block_sortlinks
/**
* Smarty plugin
* -------------------------------------------------------------
* File: block.sortlinks.php
* Type: block
* Name: sortlinks
* -------------------------------------------------------------
*/
function smarty_block_sortlinks($params, $content, &$gBitSmarty)
{
if ($content) {
$links = spliti("\n", $content);
$links2 = array();
foreach ($links as $value) {
$splitted = preg_split("/[<>]/", $value, -1, PREG_SPLIT_NO_EMPTY);
$links2[$splitted[2]] = $value;
}
if (isset($params['order']) && $params['order'] == 'reverse') {
krsort($links2);
} else {
ksort($links2);
}
foreach ($links2 as $value) {
echo $value;
}
}
}
示例11: initdirectory
/**
* INIT DIRECTORY.
* @param: none
*/
private function initdirectory()
{
# no need to urldecode => $_GET already do this!
if (isset($_GET['p']) && $_GET['p'] != '') {
$url = $_GET['p'];
$tabParams = spliti($this->slash, $url);
$this->url_params = $tabParams;
} else {
$this->url_params = NULL;
}
# get params from url
$directory = $this->userDataPath;
if (!empty($this->url_params)) {
foreach ($this->url_params as $id) {
$directory .= $id . $this->slash;
}
}
$this->absoluteDirectoryPath = $directory;
}
示例12: reply
/**
* Reply to the operation.
* @param $event event that triggered the operation.
* @return BotMessage with magic 8's answer.
*/
public function reply(BotEvent $event)
{
$sender = $event->getSender();
$message = $event->getMessage();
if (preg_match("/([^\\s]+)\\s+ou\\s+([^\\s?]+)/i", $message)) {
$responses = spliti(" ou ", $message);
} else {
$responses = $this->responses;
}
$response = mt_rand(0, count($responses) - 1);
$reply = $responses[$response];
$reply = trim(str_replace("?", "", $reply));
if ($event->isPrivate()) {
$destination = $sender;
} else {
$reply = "{$sender}: {$reply}";
$destination = $event->getDestination();
}
return new BotMessage($destination, $reply);
}
示例13: getQueryByModuleField
/**
* Function to get list view query for popup window
* @param <String> $sourceModule Parent module
* @param <String> $field parent fieldname
* @param <Integer> $record parent id
* @param <String> $listQuery
* @return <String> Listview Query
*/
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
$supportedModulesList = array('Leads', 'Accounts', 'HelpDesk', 'Potentials');
if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList' || in_array($sourceModule, $supportedModulesList) || in_array($sourceModule, getInventoryModules())) {
$condition = " vtiger_service.discontinued = 1 ";
if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList') {
$condition .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
} elseif (in_array($sourceModule, $supportedModulesList)) {
$condition .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
}
$pos = stripos($listQuery, 'where');
if ($pos) {
$split = spliti('where', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
}
return $overRideQuery;
}
}
示例14: html2cell
function html2cell($html)
{
#Parse what's inside the table in $html into a nice PHP array
#Helena F Deus
if (eregi('<TABLE>(.*)</TABLE>', $html, $table_contents)) {
#parse teh lines
if (eregi('<TR>(.*)</TR>', $table_contents[1], $row_contents)) {
#$row = explode('<TR>', $row_contents[0]);
$row = spliti('<TR>', $row_contents[0]);
$row = array_filter($row);
#explode has this annoying habit of adding empty values
foreach ($row as $rowi => $a_row) {
#remove </tr>
$a_row = str_ireplace('</TR>', '', $a_row);
#parse teh cells
if (eregi('<TD>(.*)</TD>', $a_row, $cell_contents)) {
$cells[$rowi] = spliti('<TD>', $cell_contents[1]);
#remove emptyes
$cells[$rowi] = array_filter($cells[$rowi]);
#remove the /td
$cells[$rowi] = array_filter($cells[$rowi]);
foreach ($cells[$rowi] as $col => $a_cell) {
$a_cell = str_ireplace('</TD>', '', $a_cell);
$cells[$rowi][$col] = $a_cell;
if ($rowi > 1) {
$cells[$rowi][trim($cells[1][$col])] = $a_cell;
}
}
} else {
return 'No cells';
}
}
} else {
return 'No rows';
}
} else {
'No html tables found';
}
return $cells;
}
示例15: wmv_bot
function wmv_bot($url, $ext)
{
foreach (url_bot($url) as $url) {
$file = file($url);
$file[-1] = "";
$file = implode("\n", $file);
$file = spliti("http://", $file);
//print_r($file);
$urlz[-1] = "";
$i = 0;
foreach ($file as $url) {
$url = explode(">", $url);
$url = $url[0];
if (eregi(".com", $url) && eregi($ext, $url) && !eregi(" |\"", $url)) {
$urlz[$i] = "http://" . $url;
$i++;
}
}
print_r($urlz);
}
return $urlz;
}