本文整理汇总了PHP中Reset函数的典型用法代码示例。如果您正苦于以下问题:PHP Reset函数的具体用法?PHP Reset怎么用?PHP Reset使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Reset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TextDump
function TextDump(&$Var, $Level = 0)
{
if (is_array($Var)) {
$Type = "Array[" . count($Var) . "]";
} else {
if (is_object($Var)) {
$Type = "Object";
} else {
$Type = "";
}
}
if ($Type) {
echo "{$Type}\n";
for (Reset($Var), $Level++; list($k, $v) = each($Var);) {
if (is_array($v) && $k === "GLOBALS") {
continue;
}
for ($i = 0; $i < $Level * 3; $i++) {
echo " ";
}
echo "<b>- [" . htmlspecialchars($k) . "]</b> => ", TextDump($v, $Level);
}
} else {
echo "'" . htmlspecialchars($Var) . "'\n";
}
}
示例2: TextDump
/**
* Помощник для отладки
*
* @version 1.0
* @author Ibragimov "MpaK" Renat <renat@bestweb.ru>
* @copyright Copyright (c) 2009-2010, BESTWEB ltd. www.BESTWEB.ru
*/
function TextDump(&$Var, $Level = 0)
{
$out = '';
if (is_array($Var)) {
$Type = "Array[" . count($Var) . "]";
} else {
if (is_object($Var)) {
$Type = "Object";
} else {
$Type = "";
}
}
if ($Type) {
$out .= "{$Type}\n";
for (Reset($Var), $Level++; list($k, $v) = each($Var);) {
if (is_array($v) && $k === "GLOBALS") {
continue;
}
for ($i = 0; $i < $Level * 3; $i++) {
$out .= " ";
}
$out .= "<b>" . HtmlSpecialChars($k) . "</b> => " . TextDump($v, $Level);
}
} else {
$out .= '"' . HtmlSpecialChars($Var) . '"' . "\n";
}
return $out;
}
示例3: 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']) : '') : '') . ' });';
}
示例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: textDump
function textDump(&$var, $level = 0)
{
if (is_array($var)) {
$type = "Array[" . count($var) . "]";
} else {
if (is_object($var)) {
$type = "Object";
} else {
$type = "";
}
}
if ($type) {
$rez = "{$type}\n";
for (Reset($var), $level++; list($k, $v) = each($var);) {
if (is_array($v) && $k === "GLOBALS") {
continue;
}
for ($i = 0; $i < $level * 3; $i++) {
$rez .= " ";
}
$rez .= $k . ' => ' . textDump($v, $level);
}
} else {
if (is_bool($var)) {
$rez = ($var ? 'true' : 'false') . "\n";
} else {
if (is_long($var) || is_float($var) || intval($var) != 0) {
$rez = $var . "\n";
} else {
$rez = '"' . $var . '"' . "\n";
}
}
}
return $rez;
}
示例6: dumpVar
/**
* @author Melvil (https://github.com/Melvil)
**/
function dumpVar(&$Var, $Level = 0, $Var_s = null, $level_limit = 5)
{
$is_ob_ar = false;
$Type = gettype($Var);
if (is_array($Var))
{
$is_ob_ar = true;
$Type = 'Array[' . count($Var) . ']';
}
if (is_object($Var)) $is_ob_ar = true;
if ($Level == 0)
{
if ($Var_s) echo NL . '<br>' . NL . '<b><span style="color:#ff0000">' . $Var_s . ' = {</span></b>';
if ($is_ob_ar && count($Var)) echo '<pre>' . NL;
else echo NL . '<tt>';
$Level_zero = 0;
}
if ($is_ob_ar)
{
if ($Type == 'object') echo '<span style="color:#05a209">object of</span> <span style="color:#A03000">' . get_class($Var) . '</span>';
else echo '<span style="color:#05a209">' . $Type . '</span>';
if ($Level > $level_limit)
{
if ($level_limit > 1) echo '<b>...</b> LEVEL > 5<br>' . NL;
else echo NL;
return;
}
echo NL;
if ($Level == 0 || !is_object($Var))
for (Reset($Var), $Level++; list($k, $v)=each($Var);)
{
for ($i = 0; $i < $Level*3; $i++) echo ' ';
echo '<b>'.HtmlSpecialChars($k).'</b> => ';
// if (is_object($v) || ($k === 'GLOBALS' && is_array($v))) { echo "\n"; continue; }
if ($k === 'GLOBALS' && is_array($v)) { echo NL; continue; }
dumpVar($v, $Level, null, $level_limit);
}
}
else
{
$iss = is_string($Var);
if ($iss && strlen($Var)>400)
echo '('.$Type.') <span style="color:#35BBFA">strlen = '.strlen($Var).'</span>' . NL;
else {
echo '(' . $Type . ') ' . ($iss ? '"' : '') . '<span style="color:#0000FF">';
if ($Type == 'boolean') echo ($Var ? 'true' : 'false');
else echo HtmlSpecialChars($Var);
echo '</span>' . ($iss ? '"' : '') . NL;
}
}
if (isset($Level_zero))
{
if ($is_ob_ar && count($Var)) echo '</pre>'; else echo '</tt>';
if ($Var_s) echo '<b><span style="color:#ff0000">}</span></b><br>' . NL;
}
return true;
}
示例7: loadGlossaryType
static function loadGlossaryType()
{
$type = Options::Get('glossary_type');
$arr_types = self::getGlossaryTypes();
if (isset($arr_types[$type])) {
self::$type = $arr_types[$type];
} else {
self::$type = Reset($arr_types);
}
}
示例8: 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 "";
}
示例9: 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";
}
}
}
示例10: 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 '';
}
示例11: 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";
}
}
示例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":
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;
}
}
示例13: dumperGet
function dumperGet(&$obj, $leftSp = "")
{
if (is_array($obj)) {
$type = "Array[" . count($obj) . "]";
} elseif (is_object($obj)) {
$type = "Object";
} elseif (gettype($obj) == "boolean") {
return $obj ? "true" : "false";
} else {
return "\"{$obj}\"";
}
$buf = $type;
$leftSp .= " ";
for (Reset($obj); list($k, $v) = each($obj);) {
if ($k === "GLOBALS") {
continue;
}
$buf .= "\n{$leftSp}{$k} => " . dumperGet($v, $leftSp);
}
return $buf;
}
示例14: 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 "";
}
示例15: 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;
}
}