本文整理汇总了PHP中verbose函数的典型用法代码示例。如果您正苦于以下问题:PHP verbose函数的具体用法?PHP verbose怎么用?PHP verbose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verbose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputImage
/**
* Output an image together with last modified header.
*
* @param string $file as path to the image.
* @param boolean $verbose if verbose mode is on or off.
*/
function outputImage($file, $verbose)
{
$info = getimagesize($file);
!empty($info) or errorMessage("The file doesn't seem to be an image.");
$mime = $info['mime'];
$lastModified = filemtime($file);
$gmdate = gmdate("D, d M Y H:i:s", $lastModified);
if ($verbose) {
verbose("Memory peak: " . round(memory_get_peak_usage() / 1024 / 1024) . "M");
verbose("Memory limit: " . ini_get('memory_limit'));
verbose("Time is {$gmdate} GMT.");
}
if (!$verbose) {
header('Last-Modified: ' . $gmdate . ' GMT');
}
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
if ($verbose) {
verbose("Would send header 304 Not Modified, but its verbose mode.");
exit;
}
//die(strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) . " not modified $lastModified");
header('HTTP/1.0 304 Not Modified');
} else {
if ($verbose) {
verbose("Would send header to deliver image with modified time: {$gmdate} GMT, but its verbose mode.");
exit;
}
header('Content-type: ' . $mime);
readfile($file);
}
exit;
}
示例2: verboseFail
function verboseFail($text, $success)
{
if ($success) {
verbose($text);
} else {
echo "<span class=\"error\">" . $text . "</span>\n";
}
}
示例3: report
function report($text, $isErrror = false)
{
global $report, $force, $cms_language, $content;
$text = $isErrror ? '<span class="atm-red">' . $text . '</span>' : '<strong>' . $text . '</strong>';
verbose($text);
if ($isErrror && !$force) {
$send = '<br />
======' . $cms_language->getMessage(MESSAGE_PAGE_END_OF_INSTALL) . '======';
$content .= $send;
echo $content;
exit;
}
}
示例4: start
private function start()
{
verbose('Running ' . $this->getImageName() . '...');
$cmd = 'sudo docker run -v ' . $this->directory . '/www:/var/www -p ' . $this->getPort() . ':80';
if (ArgParser::isInteractiveMode()) {
$cmd .= ' -i -t ' . $this->getImageName() . ' /bin/bash';
new Command($cmd, true);
} else {
$cmd .= ' -d ' . $this->getImageName();
$command = new Command($cmd);
if ($command->exitCode !== 0) {
throw new Exception('Error running container');
}
out($this->getImageName() . ' running successfully at: http://localhost:' . $this->getPort());
}
}
示例5: analyseResourceCalendarXML
function analyseResourceCalendarXML($string, $pimfile)
{
verbose("Analyzing Resource Calendar XML for File '" . $pimfile . "'");
$translator_phPIMap = array("pimfile", "uid", "summary", "from", "to");
$translator_XML = array($pimfile, "uid", "summary", "start-date", "end-date");
$xmlread = new MiniXMLDoc();
$xmlread->fromString($string);
$rootArray = $xmlread->toArray();
print_r($rootArray);
unset($GLOBALS["tmp"]["flattenArray"]);
$ar = flattenArray($rootArray);
print_r($ar);
for ($i = 0; $i < count($translator_XML); $i++) {
$ar[$translator_phPIMap[$i]] = $rootArray[$translator_XML[$i]];
}
return $ar;
}
示例6: analyseResourceTodo
function analyseResourceTodo($folder)
{
$d = opendir($folder);
while ($f = readdir($d)) {
if ($f != "." && $f != ".." && str_replace(".svn", "", $f) != "") {
$pimfile = str_replace("//", "/", $folder . "/" . $f);
$fp = fopen($pimfile, "r");
$c = "";
while (!feof($fp)) {
$c .= fgets($fp, 9999);
}
fclose($fp);
$c = str_replace("\r", "\n", $c);
$c = str_replace("\n\n", "\n", $c);
verbose("Analysing '" . $pimfile . "'");
$c = explode("\n", $c);
for ($i = 0; $i < count($GLOBALS["fields"]["todo"]); $i++) {
if ($GLOBALS["fields"]["todo"][$i] != "pimfile") {
${$GLOBALS["fields"]["todo"][$i]} = "";
}
}
for ($i = 0; $i < count($c); $i++) {
if (strtoupper(substr($c[$i], 0, 4)) == "UID:") {
$x = explode(":", $c[$i]);
$uid = $x[1];
}
if (strtoupper(substr($c[$i], 0, 3)) == "DUE") {
$x = explode(":", $c[$i]);
$due = checkTimeStamp(str_replace("T", "", str_replace("Z", "", $x[1])));
}
if (strtoupper(substr($c[$i], 0, 7)) == "SUMMARY") {
$x = explode(":", $c[$i]);
$summary = $x[1];
}
}
$id = count($GLOBALS["restree"]["todo"]);
for ($i = 0; $i < count($GLOBALS["fields"]["todo"]); $i++) {
$GLOBALS["restree"]["todo"][$id][$GLOBALS["fields"]["todo"][$i]] = ${$GLOBALS["fields"]["todo"][$i]};
}
$GLOBALS["restree"]["todo"][$id][internalid] = $id;
}
}
}
示例7: main
function main($argc, $argv)
{
if ($argc < 2 || $argc > 3) {
usage($argv[0]);
}
// Als '-v' is meegegeven tijdens het starten, ga in verbose mode
if ($argv[1] == '-v') {
verbose(true);
$argc--;
array_shift($argv);
} else {
verbose(false);
}
// Reader voor de XML-bestanden
$reader = new KnowledgeBaseReader();
// Parse een xml-bestand (het eerste argument) tot knowledge base
$state = $reader->parse($argv[1]);
// Start de solver, dat ding dat kan infereren
$solver = new Solver();
// leid alle goals in de knowledge base af.
$goals = $state->goals;
// Begin met de doelen die we hebben op de goal stack te zetten
foreach ($goals as $goal) {
$state->goalStack->push($goal->name);
}
// Zo lang we nog vragen kunnen stellen, stel ze
while (($question = $solver->solveAll($state)) instanceof AskedQuestion) {
$answer = cli_ask($question);
if ($answer instanceof Option) {
$state->apply($answer->consequences, Yes::because("User answered '{$answer->description}' to '{$question->description}'"));
}
}
// Geen vragen meer, print de gevonden oplossingen.
foreach ($goals as $goal) {
printf("%s: %s\n", $goal->description, $goal->answer($state)->description);
}
}
示例8: evaluate
function evaluate($question, $answer)
{
eval('$x=' . filter($answer));
$res = " " . $question[0];
for ($i = 1; $i < strlen($question); ++$i) {
if ($question[$i] == "X" and is_numeric($question[$i - 1])) {
$res .= "*X";
} else {
$res .= $question[$i];
}
}
$res = preg_replace("/(\\d+|X)\\s*\\^\\s*(.*?)\\s/", "pow(\$1,\$2)", $res);
$res = str_replace("X", '$x', $res);
$question = filter($res);
if (!$question) {
return null;
}
$question = str_replace("=", '==', $question);
if (verbose()) {
echo $question . PHP_EOL;
}
eval('$res=' . $question);
return $res;
}
示例9: die_usage
$GLOBALS["isVerbose"] = $argv[2] == "--verbose" ? true : false;
if (!$filePtr) {
die_usage("Error : file not found.");
}
$csv = array_map('str_getcsv', $filePtr);
$total = 0;
$success = 0;
foreach ($csv as $key => $row) {
$address = trim($row[0]);
$address = str_replace(';', ' ', $address);
$address = preg_replace('!\\s+!', ' ', $address);
verbose("Looking for : {$address}");
$geo = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false');
$geo = json_decode($geo, true);
if ($geo['status'] = 'OK') {
$success++;
verbose("Found !");
$latitude = $geo['results'][0]['geometry']['location']['lat'];
$longitude = $geo['results'][0]['geometry']['location']['lng'];
verbose("Longitude : {$longitude}");
verbose("Latitude : {$latitude}");
csv_line("{$latitude};{$longitude}");
} else {
verbose("Not found !");
csv_line(";");
}
$total++;
sleep(1);
}
verbose("Result : {$success} / {$total} founded.");
示例10: json_decode
$games = json_decode($json, true);
$iso = $games[$id]['iso'];
$title = $games[$id]['title'];
echo "<p>";
/* mount the virtual iso */
verbose("Attempting to mount {$title} in \"{$mountfuse}\"");
mount($iso);
/* list all files */
$files = listFiles($iso);
verbose("Cleaning \"{$patch}\"");
clean($patch);
verbose("Initialising \"{$patch}\"");
init($patch);
verbose("Duplicating file structure in \"{$patch}\"");
createSymlinkStructure($files);
verbose("Collecting XML files");
$compatiblexmls = getCompatibleXML($id);
foreach ($compatiblexmls as $compatiblexml) {
$xml = simplexml_load_file($compatiblexml);
foreach ($_POST as $option => $patchesraw) {
if (!empty($patchesraw)) {
$patches = explode(";", $patchesraw);
foreach ($patches as $patch) {
$patchnode = $xml->xpath("./patch[@id='{$patch}']");
if (count($patchnode) > 0) {
foreach ($patchnode[0] as $replacementnode) {
switch ($replacementnode->getName()) {
case "file":
filePatch($replacementnode['disc'], $replacementnode['external']);
break;
case "folder":
示例11: analyseResourceContact
function analyseResourceContact($folder)
{
$d = opendir($folder);
while ($f = readdir($d)) {
if ($f != "." && $f != ".." && str_replace(".svn", "", $f) != "") {
$pimfile = str_replace("//", "/", $folder . "/" . $f);
$fp = fopen($pimfile, "r");
$c = "";
while (!feof($fp)) {
$c .= fgets($fp, 9999);
}
fclose($fp);
$c = str_replace("\r", "\n", $c);
$c = str_replace("\n\n", "\n", $c);
verbose("Analysing '" . $pimfile . "'");
$c = explode("\n", $c);
for ($i = 0; $i < count($GLOBALS["fields"]["contact"]); $i++) {
if ($GLOBALS["fields"]["contact"][$i] != "pimfile") {
${$GLOBALS["fields"]["contact"][$i]} = "";
}
}
for ($i = 0; $i < count($c); $i++) {
if (strtoupper(substr($c[$i], 0, 4)) == "UID:") {
$x = explode(":", $c[$i]);
$uid = $x[1];
}
if (strtoupper(substr($c[$i], 0, 2)) == "N:") {
$x = explode(":", $c[$i]);
$x = explode(";", $x[1]);
$surname = $x[0];
$firstname = $x[1];
}
if (strtoupper(substr($c[$i], 0, 5)) == "BDAY:") {
$x = explode(":", $c[$i]);
$birthday = checkTimeStamp(str_replace("T", "", str_replace("Z", "", $x[1])));
}
if (strtoupper(substr($c[$i], 0, 6)) == "EMAIL:") {
$x = explode(":", $c[$i]);
$email = $x[1];
}
if (strtoupper(substr($c[$i], 0, 4)) == "URL:") {
$x = explode(":", $c[$i]);
$url = $x[1];
}
if (strtoupper(substr($c[$i], 0, 6)) == "TITLE:") {
$x = explode(":", $c[$i]);
$title = $x[1];
}
if (strtoupper(substr($c[$i], 0, 4)) == "ORG:") {
$x = explode(":", $c[$i]);
$organization = $x[1];
}
if (strtoupper(substr($c[$i], 0, 5)) == "NOTE:") {
$x = explode(":", $c[$i]);
$note = $x[1];
}
if (strtoupper(substr($c[$i], 0, 4)) == "TEL;") {
$x = explode(";", $c[$i]);
for ($y = 0; $y < count($x); $y++) {
$nr = explode(":", $x[$y]);
switch ($nr[0]) {
case "TYPE=HOME":
$telephone = $nr[1];
break;
case "TYPE=VOICE":
$mobilephone = $nr[1];
break;
case "TYPE=CELL":
$cellphone = $nr[1];
break;
case "TYPE=FAX":
$fax = $nr[1];
break;
}
}
}
}
$id = count($GLOBALS["restree"]["contact"]);
for ($i = 0; $i < count($GLOBALS["fields"]["contact"]); $i++) {
$GLOBALS["restree"]["contact"][$id][$GLOBALS["fields"]["contact"][$i]] = ${$GLOBALS["fields"]["contact"][$i]};
}
$GLOBALS["restree"]["contact"][$id][internalid] = $id;
}
}
}
示例12: RetrieveVar
}
if (RetrieveVar("calorientation", "0111")) {
$_SESSION["calorientation"] = RetrieveVar("calorientation", "0111");
} elseif ($_SESSION["calorientation"] == "") {
$_SESSION["calorientation"] = TimeStamp(0);
}
$time = TimeStamp2Time($_SESSION["calorientation"]);
$prevyear = date("YmdHis", mktime(0, 0, 0, date("m", $time), date("d", $time), date("Y", $time) - 1));
$prevmonth = date("YmdHis", mktime(0, 0, 0, date("m", $time) - 1, date("d", $time), date("Y", $time)));
$nextyear = date("YmdHis", mktime(0, 0, 0, date("m", $time), date("d", $time), date("Y", $time) + 1));
$nextmonth = date("YmdHis", mktime(0, 0, 0, date("m", $time) + 1, date("d", $time), date("Y", $time)));
$GLOBALS["calendar"]["month"] = date("m", $time);
$GLOBALS["calendar"]["start"] = date("YmdHis", mktime(0, 0, 0, date("m", $time), 1, date("Y", $time)));
$GLOBALS["calendar"]["end"] = date("YmdHis", mktime(23, 59, 59, date("m", $time), date("t", $time), date("Y", $time)));
verbose("Orientiert an Timestamp: " . $time . ", Monat ist " . $GLOBALS["calendar"]["month"]);
verbose("Monat geht von " . $GLOBALS["calendar"]["start"] . " bis " . $GLOBALS["calendar"]["end"]);
$selection = $GLOBALS["restree"]["calendar"];
$selection1 = filterResources($selection, "to", $GLOBALS["calendar"]["start"], ">=", null);
$selection1x = filterResources($selection1, "to", $GLOBALS["calendar"]["end"], "<=", null);
$selection2 = filterResources($selection, "from", $GLOBALS["calendar"]["end"], "<=", null);
$selection2x = filterResources($selection2, "from", $GLOBALS["calendar"]["start"], ">=", null);
$selection = mergeSelections($selection1x, $selection2x);
for ($i = 0; $i < count($selection); $i++) {
$hasevent[date("j", TimeStamp2Time($selection[$i]["from"]))] = true;
}
append("<table border=\"1\" id=\"minical\" name=\"minical\">\n");
append(" <tr class=\"calnavi\">\n");
append(" <td> </td>\n");
append(" <td><a href=\"?module=calendar&calorientation=" . $prevyear . "\"><<</a></td>\n");
append(" <td><a href=\"?module=calendar&calorientation=" . $prevmonth . "\"><</a></td>\n");
append(" <td colspan=\"3\">\n" . " <a href=\"?module=calendar&calrange=month\">\n" . $GLOBALS["calendar"]["month"] . " " . date("M", $time) . "</a>\n" . " </td>\n");
示例13: file_put_contents
}
}
if ($version) {
file_put_contents("{$css_dest}/min.bundle-v{$version}.css", $mergedCss);
} else {
file_put_contents("{$css_dest}/min.bundle.css", $mergedCss);
}
if ($css_header_file) {
$csshdrt = "{$mini_css_conditional_if}\n <link rel=\"stylesheet\" type=\"text/css\" href=\"{$http_css}/min.bundle";
if ($version) {
$csshdrt .= "-v{$version}";
}
$csshdrt .= ".css\" />\n{$mini_css_conditional_else}\n{$csshdr}{$mini_css_conditional_end}\n";
file_put_contents($css_header_file, $csshdrt);
}
verbose(" done\n\n");
}
if ($version && !$js_header_file) {
echo "\n\n****** VERSION NUMBER WAS SPECIFIED - DON'T FORGET TO UPDATE HEADER FILES!! ******\n\n";
}
function verbose($msg)
{
global $verbose;
if ($verbose) {
print $msg;
}
}
function print_version($mini = true)
{
echo "\nMinify V" . VERSION . "- A JS and CSS minifier for projects using the Smarty PHP templating engine\n\nCopyright (c) 2010 - 2012, Open Source Solutions Limited, Dublin, Ireland - http://www.opensolutions.ie\nReleased under the BSD License.\n";
if (!$mini) {
示例14: filePatch
function filePatch($disc, $external)
{
global $sd;
global $patchfiles;
if (file_exists($patchfiles . $disc)) {
unlink($patchfiles . $disc);
}
symlink($sd . $external, $patchfiles . $disc);
verbose("Linked \"{$sd}{$external}\" to \"{$patchfiles}{$disc}\"");
}
示例15: get_directory_list
$files = get_directory_list($olddir);
if (empty($files)) {
continue;
}
// Create new user directory
if (!($newdir = make_user_directory($userid))) {
// some weird directory - do not stop the upgrade, just ignore it
continue;
}
// Move contents of old directory to new one
if (file_exists($olddir) && file_exists($newdir)) {
$restored = false;
foreach ($files as $file) {
if (!file_exists($newdir . '/' . $file)) {
copy($olddir . '/' . $file, $newdir . '/' . $file);
verbose("Moved {$olddir}/{$file} into {$newdir}/{$file}");
$restored = true;
}
}
if ($restored) {
$restored_count++;
}
} else {
notify("Could not move the contents of {$olddir} into {$newdir}!");
$result = false;
break;
}
}
if ($settings['eolchar'] == '<br />') {
print_box_start('generalbox centerpara');
}