本文整理汇总了PHP中indexOf函数的典型用法代码示例。如果您正苦于以下问题:PHP indexOf函数的具体用法?PHP indexOf怎么用?PHP indexOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了indexOf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirmAction
public function confirmAction($invitee)
{
$posSpecialChar = strpos($invitee, "<");
$substremail = substr($invitee, $posSpecialChar);
$email = substr($substremail, 1);
$indexPosSpecialChar = indexOf("<");
$searchCode = substr($invitee, $indexPosSpecialChar);
$query = $em->createQueryBuilder()->select('e')->from('meetmeBundle\\Entity\\Event', 'e')->where('e.searchCode = ?1')->setParameter(1, $searchCode)->getQuery()->getResult();
$events = $query->getResult();
$query = $em->createQueryBuilder()->select('ip')->from('meetmeBundle\\Entity\\InvitedPerson', 'ip')->where('ip.email = ?1')->setParameter(1, $email)->getQuery();
$invitedPersons = $query->getResult();
foreach ($events as $event) {
$invitedEvent = $InvitedEvent();
foreach ($invitedPersons as $invitedPerson) {
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder();
$q = $qb->update('meetmeBundle\\Entity\\InvitedEvent', 'ie')->set('ie.acceptedInvitDate', '?1')->where('ie.idinvited = ?2')->andWhere('ie.idevent = ?3')->setParameter(1, new \DateTime("now"))->setParameter(2, $invitedPerson->getId())->setParameter(2, $event->getId())->getQuery();
$p = $q->execute();
}
//$em->persist($invitedEvent);
//$em->flush();
}
/*
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder();
$q = $qb->update('meetmeBundle\Entity\InvitedPerson', 'p')
->set('p.acceptedInvitationDate', '?1')
->where('p.email = ?2')
->setParameter(1, new \DateTime("now"))
->setParameter(2, $substremail)
->getQuery();
$p = $q->execute();
*/
return $this->render('meetmeBundle:twig_html:login.html.twig');
}
示例2: index2Of
function index2Of($str1, $str2)
{
if (indexOf($str1, $str2) || indexOf($str2, $str1)) {
return true;
} else {
return false;
}
}
示例3: ForceResponse
public static function ForceResponse($method, $url, $requestData)
{
UrlUtils::$_method = strtolower($method);
UrlUtils::$_requestData = json_encode($requestData);
UrlUtils::$_mainUrl = UrlUtils::CurrentUrl(Settings::$SiteRoot);
UrlUtils::$_query = array();
$queryIndex = indexOf($url, "?");
if ($queryIndex > 0) {
$query = substr($url, $queryIndex + 1);
UrlUtils::$_query = parse_str($query);
}
UrlUtils::$_fake = true;
}
示例4: LCAudioFileStatus
function LCAudioFileStatus($currentRecord, $authToken)
{
$this->setStatus($this->getKeyValue($currentRecord, ATTRIB_AUDIO_FILE_STATUS));
if ($this->getStatus() == VALUE_STATUS_EXISTS) {
$audioUrl = $this->getKeyValue($currentRecord, ATTRIB_AUDIO_FILE_DOWNLOAD_URI);
if ($authToken != null && strlen($authToken) > 0 && indexOf(strtolower($audioUrl), "hza=") == -1) {
if (indexOf($audioUrl, "?") == -1) {
$audioUrl .= "?";
} else {
if (!endsWith($audioUrl, "&")) {
$audioUrl .= "&";
}
}
$audioUrl .= "hzA=" . urlencode(utf8_encode($authToken));
}
$this->setUri($audioUrl);
}
}
示例5: verifyPath
/**
* Verifies that the specified path is within valid root paths.
*
* @param String $path Path to verify.
* @return Bool true if the path is valid, false if it's invalid.
*/
function verifyPath($path)
{
$fs = "file";
$valid = false;
// Parse out FS
if (preg_match('/([a-z]+):\\/\\/(.+)/', $path, $matches)) {
$fs = $matches[1];
$path = $matches[2];
}
// Filesystem wasn't found
if (!isset($this->_fileSystems[$fs])) {
trigger_error($this->getLangItem("error", "no_filesystem", array("path" => $path)), FATAL);
die;
}
$path = $this->decryptPath($path);
// /../ is never valid
if (indexOf($this->addTrailingSlash($path), "/../") != -1) {
return false;
}
if ($fs != 'file') {
return true;
}
foreach ($this->_rootPaths as $rootPath) {
if ($this->isChildPath($rootPath, $path)) {
$valid = true;
}
}
return $valid;
}
示例6: IsPreRelease
public static function IsPreRelease($version)
{
$version = strtolower($version);
$tmp = indexOf($version, "-");
return $tmp > 0;
}
示例7: replaceVariables
/**
* Replaces the variables in the expression with the values of the variables
* for this instance of the evaluator.
* @param $expression
* The expression being processed.
*
* @return mixed A new expression with the variables replaced with their values.
*
* @throws EvaluationException
* Thrown is an error is encountered while processing the
* expression.
*/
public function replaceVariables($expression)
{
$openIndex = $expression->indexOf(EvaluationConstants::OPEN_VARIABLE);
if ($openIndex < 0) {
return $expression;
}
$replacedExpression = $expression;
while ($openIndex >= 0) {
$closedIndex = -1;
if ($openIndex >= 0) {
$closedIndex = $replacedExpression->indexOf(EvaluationConstants::CLOSED_VARIABLE, $openIndex + 1);
if ($closedIndex > $openIndex) {
$variableName = $replacedExpression->substring($openIndex + strlen(EvaluationConstants::OPEN_VARIABLE), $closedIndex);
// Validate that the variable name is valid.
try {
$this->isValidName($variableName);
} catch (InvalidArgumentException $iae) {
throw new EvaluationException("Invalid variable name of '" . $variableName + "'.", $iae);
}
$variableValue = $this->getVariableValue($variableName);
$variableString = EvaluationConstants::OPEN_VARIABLE . $variableName . EvaluationConstants::CLOSED_VARIABLE;
$replacedExpression = EvaluationHelper::replaceAll($replacedExpression, $variableString, $variableValue);
} else {
break;
}
}
// Start looking at the beginning of the string, since
// the length string has changed and characters have moved
// positions.
$openIndex = $replacedExpression . indexOf(EvaluationConstants::OPEN_VARIABLE);
}
// If an open brace is left over, then a variable could not be replaced.
$openBraceIndex = $replacedExpression->indexOf(EvaluationConstants::OPEN_VARIABLE);
if ($openBraceIndex > -1) {
throw new EvaluationException("A variable has not been closed (index=" . $openBraceIndex . ").");
}
return $replacedExpression;
}
示例8: defaultInfo
function defaultInfo($ip, $tPort, $port)
{
$out = "";
$html = "";
$fp = fsockopen($ip, $tPort, $errno, $errstr, 30);
if ($fp) {
fputs($fp, "sel " . $port . "\n");
fputs($fp, "si\n");
fputs($fp, "quit\n");
while (!feof($fp)) {
$out .= fgets($fp, 1024);
}
$out = str_replace("[TS]", "", $out);
$out = str_replace("OK", "", $out);
$out = trim($out);
$name = substr($out, indexOf($out, "server_name="), strlen($out));
$name = substr($name, 0, indexOf($name, "server_platform=") - strlen("server_platform="));
$os = substr($out, indexOf($out, "server_platform="), strlen($out));
$os = substr($os, 0, indexOf($os, "server_welcomemessage=") - strlen("server_welcomemessage="));
$tsType = substr($out, indexOf($out, "server_clan_server="), strlen($out));
$tsType = substr($tsType, 0, indexOf($tsType, "server_udpport=") - strlen("server_udpport="));
$welcomeMsg = substr($out, indexOf($out, "server_welcomemessage="), strlen($out));
$welcomeMsg = substr($welcomeMsg, 0, indexOf($welcomeMsg, "server_webpost_linkurl=") - strlen("server_webpost_linkurl="));
if ($tsType[0] == 1) {
$tsTypeText = "Freeware Clan Server";
} else {
$tsTypeText = "Freeware Public Server";
}
$html = "<tr><td class=\"boldbread\">Server:</td></tr>\n";
$html .= "<tr><td class=\"bread\">" . $name . "<br><br></td></tr>\n";
$html .= "<tr><td class=\"boldbread\">Server IP:</td></tr>\n";
$html .= "<tr><td class=\"bread\">" . $ip . ":" . $port . "<br><br></td></tr>\n";
$html .= "<tr><td class=\"boldbread\">Version:</td></tr>\n";
$html .= "<tr><td class=\"bread\">" . @getTSVersion($ip, $tPort, $port) . "<br><br></td></tr>\n";
$html .= "<tr><td class=\"boldbread\">Type:</td></tr>\n";
$html .= "<tr><td class=\"bread\">" . $tsTypeText . "<br><br></td></tr>\n";
$html .= "<tr><td class=\"boldbread\">Welcome Message:</td></tr>\n";
$html .= "<tr><td class=\"bread\">" . $welcomeMsg . "<br><br></td></tr>";
fclose($fp);
}
return $html;
}
示例9: str_replace
}
$out = str_replace('[TS]', '', $out);
$out = str_replace('OK', '', $out);
$out = trim($out);
$name = substr($out, indexOf($out, 'server_name='), strlen($out));
$name = substr($name, 0, indexOf($name, 'server_platform=') - strlen('server_platform='));
$os = substr($out, indexOf($out, 'server_platform='), strlen($out));
$os = substr($os, 0, indexOf($os, 'server_welcomemessage=') - strlen('server_welcomemessage='));
$uptime = substr($out, indexOf($out, 'server_uptime='), strlen($out));
$uptime = substr($uptime, 0, indexOf($uptime, 'server_currrentusers=') - strlen('server_currrentusers='));
$cAmount = substr($out, indexOf($out, 'server_currentchannels='), strlen($out));
$cAmount = substr($cAmount, 0, indexOf($cAmount, 'server_bwinlastsec=') - strlen('server_bwinlastsec='));
$user = substr($out, indexOf($out, 'server_currentusers='), strlen($out));
$user = substr($user, 0, indexOf($user, 'server_currentchannels=') - strlen('server_currentchannels='));
$max = substr($out, indexOf($out, 'server_maxusers='), strlen($out));
$max = substr($max, 0, indexOf($max, 'server_allow_codec_celp51=') - strlen('server_allow_codec_celp51='));
fclose($fp);
}
$uArray = array();
$innerArray = array();
$out = "";
$j = 0;
$k = 0;
$fp = fsockopen($uip, $tPort, $errno, $errstr, 30);
if ($fp) {
fputs($fp, "pl " . $port . "\n");
fputs($fp, "quit\n");
while (!feof($fp)) {
$out .= fgets($fp, 1024);
}
$out = str_replace('[TS]', '', $out);
示例10: defaultInfo
function defaultInfo($ip, $tPort, $port)
{
$out = '';
$html = '';
$fp = fsockopen($ip, $tPort, $errno, $errstr, 30);
if ($fp) {
fputs($fp, "sel " . $port . "\n");
fputs($fp, "si\n");
fputs($fp, "quit\n");
while (!feof($fp)) {
$out .= fgets($fp, 1024);
}
$out = str_replace('[TS]', '', $out);
$out = str_replace('OK', '', $out);
$out = trim($out);
$name = substr($out, indexOf($out, "server_name="), strlen($out));
$name = convertCharset(substr($name, 0, indexOf($name, "server_platform=") - strlen("server_platform=")));
$os = substr($out, indexOf($out, "server_platform="), strlen($out));
$os = convertCharset(substr($os, 0, indexOf($os, "server_welcomemessage=") - strlen("server_welcomemessage=")));
$tsType = substr($out, indexOf($out, "server_clan_server="), strlen($out));
$tsType = substr($tsType, 0, indexOf($tsType, "server_udpport=") - strlen("server_udpport="));
$welcomeMsg = substr($out, indexOf($out, "server_welcomemessage="), strlen($out));
$welcomeMsg = convertCharset(substr($welcomeMsg, 0, indexOf($welcomeMsg, "server_webpost_linkurl=") - strlen("server_webpost_linkurl=")));
if ($tsType[0] == 1) {
$tsTypeText = "Freeware Clan Server";
} else {
$tsTypeText = "Freeware Public Server";
}
$html = "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\" class=\"fHeading\">Server:</td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\">{$name}<br /><br /></td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\" class=\"fHeading\">Server IP:</td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\">{$ip}:{$port}<br /><br /></td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\" class=\"fHeading\">Version:</td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\">" . getTSVersion($ip, $tPort, $port) . "<br /><br /></td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\" class=\"fHeading\">Type:</td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\">{$tsTypeText}<br /><br /></td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\" class=\"fHeading\">Welcome Message:</td></tr>\n";
$html .= "<tr class=\"bg1\"><td id=\"contentMainFirst\" style=\"border:0\">{$welcomeMsg}<br /><br /></td></tr>";
fclose($fp);
}
return $html;
}
示例11: str_replace
}
$out = str_replace("[TS]", "", $out);
$out = str_replace("OK", "", $out);
$out = trim($out);
$name = substr($out, indexOf($out, "server_name="), strlen($out));
$name = substr($name, 0, indexOf($name, "server_platform=") - strlen("server_platform="));
$os = substr($out, indexOf($out, "server_platform="), strlen($out));
$os = substr($os, 0, indexOf($os, "server_welcomemessage=") - strlen("server_welcomemessage="));
$uptime = substr($out, indexOf($out, "server_uptime="), strlen($out));
$uptime = substr($uptime, 0, indexOf($uptime, "server_currrentusers=") - strlen("server_currrentusers="));
$cAmount = substr($out, indexOf($out, "server_currentchannels="), strlen($out));
$cAmount = substr($cAmount, 0, indexOf($cAmount, "server_bwinlastsec=") - strlen("server_bwinlastsec="));
$user = substr($out, indexOf($out, "server_currentusers="), strlen($out));
$user = substr($user, 0, indexOf($user, "server_currentchannels=") - strlen("server_currentchannels="));
$max = substr($out, indexOf($out, "server_maxusers="), strlen($out));
$max = substr($max, 0, indexOf($max, "server_allow_codec_celp51=") - strlen("server_allow_codec_celp51="));
fclose($fp);
}
$uArray = array();
$innerArray = array();
$out = "";
$j = 0;
$k = 0;
$fp = fsockopen($uip, $tPort, $errno, $errstr, 30);
if ($fp) {
fputs($fp, "pl " . $port . "\n");
fputs($fp, "quit\n");
while (!feof($fp)) {
$out .= fgets($fp, 1024);
}
$out = str_replace("[TS]", "", $out);
示例12: BuildSubBatch
public function BuildSubBatch($src)
{
global $v2BatchDebug;
$res = new SubBatch();
$i = 0;
$res->Action = null;
$res->ContentId = null;
for (; $i < sizeof($src); $i++) {
$li = $src[$i];
if (starts_with($li, "Content-ID")) {
$res->ContentId = substr($li, strlen("Content-ID:") + 1);
} else {
if (starts_with($li, "POST")) {
$res->Action = substr($li, strlen("POST") + 1);
$res->Method = "post";
} else {
if (starts_with($li, "GET")) {
$res->Action = substr($li, strlen("GET") + 1);
$res->Method = "get";
break;
} else {
if (starts_with($li, "PUT")) {
$res->Action = substr($li, strlen("PUT") + 1);
$res->Method = "put";
} else {
if (starts_with($li, "DELETE")) {
$res->Action = substr($li, strlen("DELETE") + 1);
$res->Method = "delete";
} else {
if (starts_with($li, "Content-Length")) {
$res->ContentLength = substr($li, strlen("Content-Length:") + 1);
$i += 2;
break;
}
}
}
}
}
}
}
if ($res->Action != null) {
$http = indexOf($res->Action, " HTTP");
if ($http > 0) {
$res->Action = substr($res->Action, 0, $http);
}
if (indexOf($res->Action, "http") != 0) {
$res->Action = UrlUtils::CurrentUrl($res->Action);
}
}
//Add the space after the method
$res->Data = "";
while ($i < sizeof($src) && $res->Method != "get") {
if ($res->Data != "") {
$res->Data .= "\n" . $src[$i];
} else {
$res->Data .= $src[$i];
}
$i++;
}
return $res;
}
示例13: error_reporting
******************************************************************************/
/* $Id: view.php 76014 2009-08-25 20:30:43Z trollinger $ */
error_reporting(E_ERROR);
require_once '../../config.php';
require_once 'lib.php';
//Wimba Library
require_once "lib/php/common/WimbaLib.php";
require_once "lib/php/common/DatabaseManagement.php";
require_once 'lib/php/vt/WimbaVoicetools.php';
require_once 'lib/php/vt/WimbaVoicetoolsAPI.php';
require_once 'lib/php/common/WimbaCommons.php';
require_once 'lib/php/vt/VtAction.php';
$id = optional_param('id', 0, PARAM_INT);
// Course Module ID, or
$action = optional_param('action', PARAM_ACTION);
if (indexOf($_SERVER['HTTP_REFERER'], "/grader/") != -1) {
//we come from the gradebook
if (!($cm = get_record("course_modules", "id", $id))) {
error("Course Module ID was incorrect");
}
if (!($course = get_record("course", "id", $cm->course))) {
error("Course is misconfigured");
}
if (!($voicetool = get_record("voicepodcaster", "id", $cm->instance))) {
error("Course module is incorrect");
}
redirection("index.php?id=" . $voicetool->course . "&action=displayGrade&gradeId=" . $voicetool->id . "&resource_id=" . $voicetool->rid);
exit;
} else {
if (isset($action) && $action != "launchCalendar" && $id || !isset($action)) {
if (!($cm = get_record("course_modules", "id", $id))) {
示例14: array
echo '<td class="header" id="pubPlace"> Place Published </td>';
echo '</tr>';
$highlight = false;
$sentence_ids = array();
$counter = 0;
while ($row = mysql_fetch_array($result)) {
$counter += 1;
if ($counter <= (1 + $page) * $pageLength && $counter > $pageLength * $page) {
echo '<tr class="search-result">';
echo '<td class="hidden-id">';
echo '<a href="view.php?id=' . $row['id'] . '_' . $row['sent_id'] . '"><img class="view" src="img/view.png" value="' . $row['id'] . '_' . $row['sent_id'] . '">';
echo '</a></td>';
if ($fulltext) {
echo '<td>';
foreach (explode(' ', $row['sentence']) as $word) {
$highlight = indexOf(strtolower($word), $toHighlight);
if ($highlight >= 0) {
echo '<span class="highlight' . $highlight % 10 . '">' . $word . ' </span>';
} else {
echo $word . ' ';
}
}
echo '</td>';
echo '<td>' . $row['type'] . '</td>';
}
echo '<td>' . $row['title'] . '</td>';
echo '<td>' . $row['full'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
echo '<td>' . $row['publisher'] . '</td>';
echo '<td>' . $row['pubPlace'] . '</td>';
echo '</tr>';
示例15: guiComboBox
function guiComboBox($name, $options, $values, $ix_selected = 0)
{
echo '<select name="' . $name . '" size="1' . "\">\n";
if ($ix_selected == null) {
$ix_selected = !isset($_POST[$name]) ? -1 : indexOf($options, $_POST[$name]);
}
foreach ($options as $ix => $text) {
echo '<option' . ($ix == $ix_selected ? ' selected' : '') . ($values ? ' value="' . $values[$ix] . '"' : '') . '>' . htmlentities($text) . "\n";
}
echo "</select>\n";
}