forked from nwsw/nwc2utsk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nwsw_Visibility.php
executable file
·57 lines (46 loc) · 1.45 KB
/
nwsw_Visibility.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
56
57
<?php
/*******************************************************************************
nwsw_Visibility Version 1.01
This script enables fast alteration of the visibility property for selected
items.
Copyright © 2007 by NoteWorthy Software, Inc.
All Rights Reserved
History:
[2007-01-03] Version 1.01 - Inclusion in starter kit
[2006-07-11] Version 1.00 - Initial release
*******************************************************************************/
//
//AdvisoryInvocation:"/visibility=<PROMPT:Set Visibility to:=|Default|Always|TopStaff|Never|>" "/skip=<PROMPT:Skip:=|None|Bar|Bar,Text|Bar,Text,Flow,Ending|>"
require_once("lib/nwc2clips.inc");
$clip = new NWC2Clip('php://stdin');
$opts = array('visibility' => 'hide','skip' => 'all');
foreach ($argv as $k => $v) {
if (!$k) continue;
if (preg_match('/^\/([a-z]+)\=(.*)$/',$v,$m)) {
$optname = $m[1];
$optvalue = $m[2];
$opts[strtolower($optname)] = $optvalue;
}
}
$opts['skip'] = strtolower($opts['skip']);
$skiplist = explode(',',$opts['skip']);
echo $clip->GetClipHeader()."\n";
//
foreach ($clip->Items as $item) {
$o = new NWC2ClipItem($item);
//
$skipit = false;
//
if ($opts['skip'] == 'all') $skipit = true;
else if ($opts['skip'] != 'none') $skipit = in_array(strtolower($o->GetObjType()), $skiplist);
//
if ($skipit) {
echo $item;
continue;
}
$o->Opts['Visibility'] = $opts['visibility'];
echo $o->ReconstructClipText()."\n";
}
echo NWC2_ENDCLIP."\n";
exit(NWC2RC_SUCCESS);
?>