-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
executable file
·51 lines (40 loc) · 1.22 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
// Functions
function updateProgress($num = 0, $total = 100) {
$percent = floor(($num/$total)*100);
echo "\nPROGRESS:".$percent."\n";
}
function progresscallback($resource,$dltotal,$dl,$ultotal,$ul) {
if ($ul) {
updateProgress($ul,$ultotal+($ultotal*.05));
}
}
function updateStatus($string) {
echo "\n".$string."\n";
}
function alert($string, $title = "Warning") {
echo "\nALERT:".$title."|".$string."\n";
}
function ncenter($string, $title = "DropToPTP") {
exec("osascript -e 'display notification \"".$string."\" with title \"".$title."\"'");
}
function getString($question) {
return exec("osascript -e 'display dialog \"".$question."\" default answer \"\"' | cut -f3 -d\":\"");
}
function ask($string) {
$result = exec("osascript -e \"display dialog \\\"".$string."\\\"\" 2>&1");
if (strpos($result,"canceled") !== false) {
return 0;
} else {
return 1;
}
}
function askMulti($string, $buttons) {
$buttonstring = "buttons {\\\"".implode("\\\", \\\"",$buttons)."\\\"} default button ".count($buttons);
$result = exec("osascript -e \"display dialog \\\"".$string."\\\" ".$buttonstring."\" | cut -f2 -d':'");
return array_search($result,$buttons);
}
function quitme() {
echo "\nQUITAPP\n";
}
?>