-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinatPrefs.php
executable file
·55 lines (36 loc) · 1.21 KB
/
MinatPrefs.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
52
53
54
55
<?php
// MinatPrefs 0.1.0
//
// Includes
require (__DIR__."/functions.php");
require (__DIR__."/functions.pashua.php");
// Read Prefs
$p = unserialize(file_get_contents(__DIR__."/prefs.php"));
if(!$p['destpath']) {
$p['destpath'] = "/Users/".get_current_user()."/Desktop";
}
// Load strings
$strings[] = array("Temp","Inline","Custom");
$strings[] = array("Do nothing","Quicklook","Show in Finder","Open with handler...");
$strings[] = array("Rename","Transcode","Spectrogram");
$result = Pashua::showDialog(makeWindowString($p, $strings));
// User cancelled
if (@$result['cb']) {
echo "0";
die;
}
// Fix strings
$result['dest'] = array_search($result['dest'],$strings[0]);
$result['postflight'] = array_search($result['postflight'],$strings[1]);
$result['mode'] = array_search($result['mode'],$strings[2]);
$result['spec_dims'] = array($result['spec_dims_x'],$result['spec_dims_y']);
// If the user didn't specify a destpath, set to desktop
if(!$p['destpath']) {
$p['destpath'] = "/Users/".get_current_user()."/Desktop";
}
// Fix a fucking Pashua bug
$result['destpath'] = str_replace("Desktop/Desktop","Desktop",$result['destpath']);
// Write Prefs
file_put_contents("prefs.php",serialize($result));
echo "1";
?>