本文整理汇总了PHP中Next函数的典型用法代码示例。如果您正苦于以下问题:PHP Next函数的具体用法?PHP Next怎么用?PHP Next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Next函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ValidateEmailHost
function ValidateEmailHost($email, $hosts = 0)
{
if (!$this->ValidateEmailAddress($email)) {
return 0;
}
//if(strpos(PHP_OS,'WIN') !== false) return(-1);
$user = strtok($email, "@");
$domain = strtok("");
if (getmxrr($domain, &$hosts, &$weights)) {
$mxhosts = array();
for ($host = 0; $host < count($hosts); $host++) {
$mxhosts[$weights[$host]] = $hosts[$host];
}
ksort($mxhosts);
for (reset($mxhosts), $host = 0; $host < count($mxhosts); Next($mxhosts), $host++) {
$hosts[$host] = $mxhosts[Key($mxhosts)];
}
} else {
$hosts = array();
if (strcmp(@gethostbyname($domain), $domain) != 0) {
$hosts[] = $domain;
}
}
return count($hosts) != 0;
}
示例2: PageLoad
function PageLoad(&$form)
{
$tv = $this->template_variables;
$ttv = count($tv);
for ($t = '', Reset($tv), $v = 0; $v < $ttv; Next($tv), ++$v) {
$k = Key($tv);
if ($v > 0) {
$t .= ',';
}
$t .= ' ' . $form->EncodeJavascriptString($k) . ': { preview: ' . $form->EncodeJavascriptString($tv[$k]['Preview']) . ', inline: ' . (isset($tv[$k]['Inline']) && $tv[$k]['Inline'] ? 'true' : 'false') . (isset($tv[$k]['Title']) ? ', title: ' . $form->EncodeJavascriptString($tv[$k]['Title']) : '');
if (isset($tv[$k]['Alternatives'])) {
$t .= ', alternatives: {';
$va = $tv[$k]['Alternatives'];
$tva = count($va);
for (Reset($va), $a = 0; $a < $tva; Next($va), ++$a) {
$ka = Key($va);
if ($a > 0) {
$t .= ',';
}
$t .= ' ' . $form->EncodeJavascriptString($ka) . ': { preview: ' . $form->EncodeJavascriptString($va[$ka]['Preview']) . (isset($va[$ka]['Title']) ? ', title: ' . $form->EncodeJavascriptString($va[$ka]['Title']) : '') . ' }';
}
$t .= ' }';
}
$t .= ' }';
}
$css = $this->external_css;
$tc = count($css);
for ($e = '', $c = 0; $c < $tc; ++$c) {
if ($c > 0) {
$e .= ',';
}
$e .= ' ' . $form->EncodeJavascriptString($css[$c]);
}
return 'var e = new ML.HTMLEditor.Editor();' . "\n" . 'e.debug = ' . ($this->debug ? 'true' : 'false') . ';' . (strlen($t) ? ' e.templateVariables = {' . $t . '};' : '') . (strlen($e) ? ' e.externalCSS = [' . $e . '];' : '') . ' e.insertEditor(' . $form->EncodeJavascriptString($this->input) . ', { id: ' . $form->EncodeJavascriptString($this->textarea['ID']) . ', name: ' . $form->EncodeJavascriptString($this->textarea['NAME']) . (isset($this->textarea['VALUE']) ? ', value: ' . $form->EncodeJavascriptString($this->textarea['VALUE']) : '') . (isset($this->textarea['ROWS']) ? ', rows: ' . $form->EncodeJavascriptString($this->textarea['ROWS']) : '') . (isset($this->textarea['COLS']) ? ', cols: ' . $form->EncodeJavascriptString($this->textarea['COLS']) : '') . (isset($this->textarea['STYLE']) ? ', style: ' . $form->EncodeJavascriptString($this->textarea['STYLE']) . (isset($this->textarea['CLASS']) ? ', className: ' . $form->EncodeJavascriptString($this->textarea['CLASS']) : '') : '') . ' });';
}
示例3: TVL_Create
function TVL_Create($TVL)
{
/****************************************************************************/
$__args_types = array('array');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Result = '';
#-----------------------------------------------------------------------------
foreach (Array_Keys($TVL) as $WordID) {
#---------------------------------------------------------------------------
$Word = $TVL[$WordID];
#---------------------------------------------------------------------------
if (!Is_Array($Word)) {
$Size = StrLen($Word);
} else {
$Word = Bytes_I2B($Size = Next($Word), Prev($Word));
}
#---------------------------------------------------------------------------
$Result .= Bytes_I2B(WORD, HexDec($WordID)) . Bytes_I2B(WORD, $Size) . $Word;
# Значение
}
#-----------------------------------------------------------------------------
return $Result;
}
示例4: SendMail
function SendMail($to, $subject, $body, $headers)
{
$command = $this->sendmail_path . " -t";
if (isset($this->delivery["Headers"])) {
$headers_values = $this->delivery["Headers"];
for ($return_path = "", $header = 0, Reset($headers_values); $header < count($headers_values); $header++, Next($headers_values)) {
if (strtolower(Key($headers_values)) == "return-path") {
$return_path = $headers_values[Key($headers_values)];
break;
}
}
if (strlen($return_path)) {
$command .= " -f {$return_path}";
}
}
if (strlen($this->sendmail_arguments)) {
$command .= " " . $this->sendmail_arguments;
}
if (!($pipe = popen($command, "w"))) {
return $this->OutputError("it was not possible to open sendmail input pipe");
}
if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
return $this->OutputError("it was not possible to write sendmail input pipe");
}
pclose($pipe);
return "";
}
示例5: CheckRequirements
function CheckRequirements()
{
Reset($this->requirements);
$end = GetType($function = Key($this->requirements)) != "string";
for (; !$end;) {
if (!function_exists($function)) {
return $this->requirements[$function];
}
Next($this->requirements);
$end = GetType($function = Key($this->requirements)) != "string";
}
return "";
}
示例6: DumpArray
function DumpArray(&$array, $indent)
{
for (Reset($array), $node = 0; $node < count($array); Next($array), $node++) {
echo $indent . "\"" . Key($array) . "\"=";
$value = $array[Key($array)];
if (GetType($value) == "array") {
echo "\n" . $indent . "[\n";
DumpArray($value, $indent . "\t");
echo $indent . "]\n";
} else {
echo "\"{$value}\"\n";
}
}
}
示例7: SearchCompleteValues
function SearchCompleteValues(&$form, $text, &$found)
{
if (strlen($text) == 0) {
$found = $this->complete_values;
} else {
$t = strtolower($text);
for ($found = array(), Reset($this->complete_values), $v = 0; $v < count($this->complete_values); $v++, Next($this->complete_values)) {
$c = Key($this->complete_values);
if (!strcmp($t, strtolower(substr($c, 0, strlen($t))))) {
$found[$c] = $this->complete_values[$c];
}
}
}
return '';
}
示例8: test_quoting
function test_quoting(&$message, $test_values, $cs, $quote, $email_header, &$tests, &$failed)
{
Reset($test_values);
$end = GetType($value = Key($test_values)) != "string";
for (; !$end; $tests++) {
echo "Test value \"", $value, "\"...";
flush();
$encoded = $quote ? $message->QuoteText($value) : $message->QuotedPrintableEncode($value, $cs, 1, $email_header);
if (strcmp($encoded, $test_values[$value])) {
echo "\tFAIL: returned \"", $encoded, "\" and not \"", $test_values[$value], "\" as expected!\n";
$failed++;
} else {
echo "\tOK!\n";
}
Next($test_values);
$end = GetType($value = Key($test_values)) != "string";
}
}
示例9: GetCommandFile
/**
* Vrátí název souboru ve kterém je command zadaný jako parametr
*
* @param string $Command Název commandu
* @return bool
*/
public function GetCommandFile($Command)
{
reset($this->Data);
do {
if (trim(key($this->Data)) == trim($Command)) {
if (isset($this->Data[key($this->Data)]['file'])) {
return ereg_replace('/', DIRECTORY_SEPARATOR, $this->Data[key($this->Data)]['file'][0]) . '.php';
} elseif (isset($this->Data[key($this->Data)]['alias'])) {
$Alias = trim($this->Data[key($this->Data)]['alias'][0]);
do {
if ($Alias == trim(key($this->Data))) {
return ereg_replace('/', DIRECTORY_SEPARATOR, $this->Data[key($this->Data)]['file'][0]) . '.php';
}
} while (Next($this->Data));
}
}
} while (Next($this->Data));
return false;
}
示例10: AlterTable
function AlterTable(&$db, $name, &$changes, $check)
{
if ($check) {
for ($change = 0, Reset($changes); $change < count($changes); Next($changes), $change++) {
switch (Key($changes)) {
case "AddedFields":
break;
case "RemovedFields":
return $db->SetError("Alter table", "database server does not support dropping table columns");
case "name":
case "RenamedFields":
case "ChangedFields":
default:
return $db->SetError("Alter table", "change type \"" . Key($changes) . "\" not yet supported");
}
}
return 1;
} else {
if (isset($changes[$change = "name"]) || isset($changes[$change = "RenamedFields"]) || isset($changes[$change = "ChangedFields"])) {
return $db->SetError("Alter table", "change type \"{$change}\" not yet supported");
}
$query = "";
if (isset($changes["AddedFields"])) {
$fields = $changes["AddedFields"];
for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
if (!$db->Query("ALTER TABLE {$name} ADD " . $fields[Key($fields)]["Declaration"])) {
return 0;
}
}
}
if (isset($changes["RemovedFields"])) {
$fields = $changes["RemovedFields"];
for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
if (!$db->Query("ALTER TABLE {$name} DROP " . Key($fields))) {
return 0;
}
}
}
return 1;
}
}
示例11: CheckRequirements
function CheckRequirements()
{
if (isset($this->requirements["imagegif"]) && strcmp($this->image_format, "gif")) {
$this->requirements["image" . $this->image_format] = "the GD extension is not able to save in the " . strtoupper($this->image_format) . " format";
unset($this->requirements["imagegif"]);
}
if (isset($this->requirements["imagecreatefromgif"]) && strcmp($this->noise_image_format, "gif")) {
if (strlen($this->noise_image_format)) {
$this->requirements["imagecreatefrom" . $this->noise_image_format] = "the GD extension is not able to read image files in the " . strtoupper($this->noise_image_format) . " format";
}
unset($this->requirements["imagecreatefromgif"]);
}
Reset($this->requirements);
$end = GetType($function = Key($this->requirements)) != "string";
for (; !$end;) {
if (!function_exists($function)) {
return $this->requirements[$function];
}
Next($this->requirements);
$end = GetType($function = Key($this->requirements)) != "string";
}
return "";
}
示例12: AlterTable
function AlterTable(&$db, $name, &$changes, $check)
{
if ($check) {
for ($change = 0, Reset($changes); $change < count($changes); Next($changes), $change++) {
switch (Key($changes)) {
case "AddedFields":
break;
case "RemovedFields":
case "name":
case "RenamedFields":
case "ChangedFields":
default:
return $db->SetError("Alter table", "change type \"" . Key($changes) . "\" not yet supported");
}
}
return 1;
} else {
if (isset($changes[$change = "RemovedFields"]) || isset($changes[$change = "name"]) || isset($changes[$change = "RenamedFields"]) || isset($changes[$change = "ChangedFields"])) {
return $db->SetError("Alter table", "change type \"{$change}\" is not supported by the server");
}
$query = "";
if (isset($changes["AddedFields"])) {
if (strcmp($query, "")) {
$query .= ", ";
}
$query .= "ADD ";
$fields = $changes["AddedFields"];
for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
if (strcmp($query, "")) {
$query .= ", ";
}
$query .= $fields[Key($fields)]["Declaration"];
}
}
return strcmp($query, "") ? $db->Query("ALTER TABLE {$name} {$query}") : 1;
}
}
示例13: ValidateEmailHost
function ValidateEmailHost($email, $hosts = 0)
{
if (!$this->ValidateEmailAddress($email)) {
return 0;
}
$user = strtok($email, "@");
$domain = strtok("");
if (GetMXRR($domain, &$hosts, &$weights)) {
$mxhosts = array();
for ($host = 0; $host < count($hosts); $host++) {
$mxhosts[$weights[$host]] = $hosts[$host];
}
KSort($mxhosts);
for (Reset($mxhosts), $host = 0; $host < count($mxhosts); Next($mxhosts), $host++) {
$hosts[$host] = $mxhosts[Key($mxhosts)];
}
} else {
$hosts = array();
if (strcmp(@gethostbyname($domain), $domain) != 0) {
$hosts[] = $domain;
}
}
return count($hosts) != 0;
}
示例14: ExecuteQuery
function ExecuteQuery($prepared_query)
{
if (!$this->ValidatePreparedQuery($prepared_query)) {
return 0;
}
$index = $prepared_query - 1;
for ($this->clobs[$prepared_query] = $this->blobs[$prepared_query] = array(), $success = 1, $query = "", $last_position = $position = 0; $position < count($this->prepared_queries[$index]["Positions"]); $position++) {
if (!isset($this->prepared_queries[$index]["Values"][$position])) {
return $this->SetError("Execute query", "it was not defined query argument " . ($position + 1));
}
$current_position = $this->prepared_queries[$index]["Positions"][$position];
$query .= substr($this->prepared_queries[$index]["Query"], $last_position, $current_position - $last_position);
$value = $this->prepared_queries[$index]["Values"][$position];
if ($this->prepared_queries[$index]["IsNULL"][$position]) {
$query .= $value;
} else {
switch ($this->prepared_queries[$index]["Types"][$position]) {
case "clob":
if (!($success = $this->GetCLOBFieldValue($prepared_query, $position + 1, $value, $this->clobs[$prepared_query][$position + 1]))) {
unset($this->clobs[$prepared_query][$position + 1]);
break;
}
$query .= $this->clobs[$prepared_query][$position + 1];
break;
case "blob":
if (!($success = $this->GetBLOBFieldValue($prepared_query, $position + 1, $value, $this->blobs[$prepared_query][$position + 1]))) {
unset($this->blobs[$prepared_query][$position + 1]);
break;
}
$query .= $this->blobs[$prepared_query][$position + 1];
break;
default:
$query .= $value;
break;
}
}
$last_position = $current_position + 1;
}
if ($success) {
$query .= substr($this->prepared_queries[$index]["Query"], $last_position);
if ($this->selected_row_limit > 0) {
$this->prepared_queries[$index]["First"] = $this->first_selected_row;
$this->prepared_queries[$index]["Limit"] = $this->selected_row_limit;
}
if (isset($this->prepared_queries[$index]["Limit"]) && $this->prepared_queries[$index]["Limit"] > 0) {
$this->first_selected_row = $this->prepared_queries[$index]["First"];
$this->selected_row_limit = $this->prepared_queries[$index]["Limit"];
} else {
$this->first_selected_row = $this->selected_row_limit = 0;
}
$success = $this->ExecutePreparedQuery($prepared_query, $query);
}
for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
$this->FreeCLOBValue($prepared_query, Key($this->clobs[$prepared_query]), $this->clobs[$prepared_query][Key($this->clobs[$prepared_query])], $success);
}
unset($this->clobs[$prepared_query]);
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$this->FreeBLOBValue($prepared_query, Key($this->blobs[$prepared_query]), $this->blobs[$prepared_query][Key($this->blobs[$prepared_query])], $success);
}
unset($this->blobs[$prepared_query]);
return $success;
}
示例15: SendMessageHeaders
function SendMessageHeaders($headers)
{
$header_data = "";
//$date=date("D, d M Y H:i:s T");
$date = date("D, d M Y H:i:s O");
if ($this->smtp_direct_delivery && strlen($this->localhost)) {
$local_ip = gethostbyname($this->localhost);
$header_data .= $this->FormatHeader("Received", "FROM " . $this->localhost . " ([" . $local_ip . "]) BY " . $this->localhost . " ([" . $local_ip . "]) WITH SMTP; " . $date) . "\r\n";
}
for ($message_id_set = $date_set = 0, $header = 0, $return_path = $from = $to = $recipients = array(), Reset($headers); $header < count($headers); $header++, Next($headers)) {
$header_name = Key($headers);
switch (strtolower($header_name)) {
case "return-path":
$return_path[$headers[$header_name]] = 1;
break;
case "from":
$error = $this->GetRFC822Addresses($headers[$header_name], $from);
break;
case "to":
$error = $this->GetRFC822Addresses($headers[$header_name], $to);
break;
case "cc":
case "bcc":
$this->GetRFC822Addresses($headers[$header_name], $recipients);
break;
case "date":
$date_set = 1;
break;
case "message-id":
$message_id_set = 1;
break;
}
if (strcmp($error, "")) {
return $this->OutputError($error);
}
if (strtolower($header_name) == "bcc") {
continue;
}
$header_data .= $this->FormatHeader($header_name, $headers[$header_name]) . "\r\n";
}
if (count($from) == 0) {
return $this->OutputError("it was not specified a valid From header");
}
if (count($to) == 0) {
return $this->OutputError("it was not specified a valid To header");
}
Reset($return_path);
Reset($from);
$this->invalid_recipients = array();
if (!$this->smtp->MailFrom(count($return_path) ? Key($return_path) : Key($from)) || !$this->SetRecipients($to, $valid_recipients)) {
return $this->OutputError($this->smtp->error);
}
if ($valid_recipients == 0) {
return $this->OutputError("it were not specified any valid recipients");
}
if (!$date_set) {
$header_data .= "Date: " . $date . "\r\n";
}
if (!$message_id_set && $this->auto_message_id) {
$sender = count($return_path) ? Key($return_path) : Key($from);
$header_data .= $this->GenerateMessageID($sender) . "\r\n";
}
if (!$this->SetRecipients($recipients, $valid_recipients) || !$this->smtp->StartData() || !$this->smtp->SendData($header_data . "\r\n")) {
return $this->OutputError($this->smtp->error);
}
return "";
}