d099838c by Insu Mun

Fix line endings.

1 parent 32d48127
Showing 105 changed files with 2495 additions and 2495 deletions
ChatterBox @ fc0eb457
1 Subproject commit 3c6a4b1f0ff2a6517cf6eecfdac812b73a40b61a 1 Subproject commit fc0eb457230d3e5bf96f6ac11c83319764220fb8
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.net 33 package com.adobe.net
34 { 34 {
35 import flash.utils.ByteArray; 35 import flash.utils.ByteArray;
36 36
37 /** 37 /**
38 * This class implements an efficient lookup table for URI 38 * This class implements an efficient lookup table for URI
39 * character escaping. This class is only needed if you 39 * character escaping. This class is only needed if you
40 * create a derived class of URI to handle custom URI 40 * create a derived class of URI to handle custom URI
41 * syntax. This class is used internally by URI. 41 * syntax. This class is used internally by URI.
42 * 42 *
43 * @langversion ActionScript 3.0 43 * @langversion ActionScript 3.0
44 * @playerversion Flash 9.0* 44 * @playerversion Flash 9.0*
45 */ 45 */
46 public class URIEncodingBitmap extends ByteArray 46 public class URIEncodingBitmap extends ByteArray
47 { 47 {
48 /** 48 /**
49 * Constructor. Creates an encoding bitmap using the given 49 * Constructor. Creates an encoding bitmap using the given
50 * string of characters as the set of characters that need 50 * string of characters as the set of characters that need
51 * to be URI escaped. 51 * to be URI escaped.
52 * 52 *
53 * @langversion ActionScript 3.0 53 * @langversion ActionScript 3.0
54 * @playerversion Flash 9.0 54 * @playerversion Flash 9.0
55 */ 55 */
56 public function URIEncodingBitmap(charsToEscape:String) : void 56 public function URIEncodingBitmap(charsToEscape:String) : void
57 { 57 {
58 var i:int; 58 var i:int;
59 var data:ByteArray = new ByteArray(); 59 var data:ByteArray = new ByteArray();
60 60
61 // Initialize our 128 bits (16 bytes) to zero 61 // Initialize our 128 bits (16 bytes) to zero
62 for (i = 0; i < 16; i++) 62 for (i = 0; i < 16; i++)
63 this.writeByte(0); 63 this.writeByte(0);
64 64
65 data.writeUTFBytes(charsToEscape); 65 data.writeUTFBytes(charsToEscape);
66 data.position = 0; 66 data.position = 0;
67 67
68 while (data.bytesAvailable) 68 while (data.bytesAvailable)
69 { 69 {
70 var c:int = data.readByte(); 70 var c:int = data.readByte();
71 71
72 if (c > 0x7f) 72 if (c > 0x7f)
73 continue; // only escape low bytes 73 continue; // only escape low bytes
74 74
75 var enc:int; 75 var enc:int;
76 this.position = (c >> 3); 76 this.position = (c >> 3);
77 enc = this.readByte(); 77 enc = this.readByte();
78 enc |= 1 << (c & 0x7); 78 enc |= 1 << (c & 0x7);
79 this.position = (c >> 3); 79 this.position = (c >> 3);
80 this.writeByte(enc); 80 this.writeByte(enc);
81 } 81 }
82 } 82 }
83 83
84 /** 84 /**
85 * Based on the data table contained in this object, check 85 * Based on the data table contained in this object, check
86 * if the given character should be escaped. 86 * if the given character should be escaped.
87 * 87 *
88 * @param char the character to be escaped. Only the first 88 * @param char the character to be escaped. Only the first
89 * character in the string is used. Any other characters 89 * character in the string is used. Any other characters
90 * are ignored. 90 * are ignored.
91 * 91 *
92 * @return the integer value of the raw UTF8 character. For 92 * @return the integer value of the raw UTF8 character. For
93 * example, if '%' is given, the return value is 37 (0x25). 93 * example, if '%' is given, the return value is 37 (0x25).
94 * If the character given does not need to be escaped, the 94 * If the character given does not need to be escaped, the
95 * return value is zero. 95 * return value is zero.
96 * 96 *
97 * @langversion ActionScript 3.0 97 * @langversion ActionScript 3.0
98 * @playerversion Flash 9.0 98 * @playerversion Flash 9.0
99 */ 99 */
100 public function ShouldEscape(char:String) : int 100 public function ShouldEscape(char:String) : int
101 { 101 {
102 var data:ByteArray = new ByteArray(); 102 var data:ByteArray = new ByteArray();
103 var c:int, mask:int; 103 var c:int, mask:int;
104 104
105 // write the character into a ByteArray so 105 // write the character into a ByteArray so
106 // we can pull it out as a raw byte value. 106 // we can pull it out as a raw byte value.
107 data.writeUTFBytes(char); 107 data.writeUTFBytes(char);
108 data.position = 0; 108 data.position = 0;
109 c = data.readByte(); 109 c = data.readByte();
110 110
111 if (c & 0x80) 111 if (c & 0x80)
112 { 112 {
113 // don't escape high byte characters. It can make international 113 // don't escape high byte characters. It can make international
114 // URI's unreadable. We just want to escape characters that would 114 // URI's unreadable. We just want to escape characters that would
115 // make URI syntax ambiguous. 115 // make URI syntax ambiguous.
116 return 0; 116 return 0;
117 } 117 }
118 else if ((c < 0x1f) || (c == 0x7f)) 118 else if ((c < 0x1f) || (c == 0x7f))
119 { 119 {
120 // control characters must be escaped. 120 // control characters must be escaped.
121 return c; 121 return c;
122 } 122 }
123 123
124 this.position = (c >> 3); 124 this.position = (c >> 3);
125 mask = this.readByte(); 125 mask = this.readByte();
126 126
127 if (mask & (1 << (c & 0x7))) 127 if (mask & (1 << (c & 0x7)))
128 { 128 {
129 // we need to escape this, return the numeric value 129 // we need to escape this, return the numeric value
130 // of the character 130 // of the character
131 return c; 131 return c;
132 } 132 }
133 else 133 else
134 { 134 {
135 return 0; 135 return 0;
136 } 136 }
137 } 137 }
138 } 138 }
139 } 139 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict 1 package com.adobe.protocols.dict
2 { 2 {
3 public class Database 3 public class Database
4 { 4 {
5 private var _name:String; 5 private var _name:String;
6 private var _description:String; 6 private var _description:String;
7 7
8 public function Database(name:String, description:String) 8 public function Database(name:String, description:String)
9 { 9 {
10 this._name = name; 10 this._name = name;
11 this._description = description; 11 this._description = description;
12 } 12 }
13 13
14 public function set name(name:String):void 14 public function set name(name:String):void
15 { 15 {
16 this._name = name; 16 this._name = name;
17 } 17 }
18 18
19 public function get name():String 19 public function get name():String
20 { 20 {
21 return this._name; 21 return this._name;
22 } 22 }
23 23
24 public function set description(description:String):void 24 public function set description(description:String):void
25 { 25 {
26 this._description = description; 26 this._description = description;
27 } 27 }
28 28
29 public function get description():String 29 public function get description():String
30 { 30 {
31 return this._description; 31 return this._description;
32 } 32 }
33 } 33 }
34 } 34 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict 1 package com.adobe.protocols.dict
2 { 2 {
3 public class Definition 3 public class Definition
4 { 4 {
5 private var _definition:String; 5 private var _definition:String;
6 private var _database:String; 6 private var _database:String;
7 private var _term:String; 7 private var _term:String;
8 8
9 public function set definition(definition:String):void 9 public function set definition(definition:String):void
10 { 10 {
11 this._definition = definition; 11 this._definition = definition;
12 } 12 }
13 13
14 public function get definition():String 14 public function get definition():String
15 { 15 {
16 return this._definition; 16 return this._definition;
17 } 17 }
18 18
19 public function set database(database:String):void 19 public function set database(database:String):void
20 { 20 {
21 this._database = database; 21 this._database = database;
22 } 22 }
23 23
24 public function get database():String 24 public function get database():String
25 { 25 {
26 return this._database; 26 return this._database;
27 } 27 }
28 28
29 public function set term(term:String):void 29 public function set term(term:String):void
30 { 30 {
31 this._term = term; 31 this._term = term;
32 } 32 }
33 33
34 public function get term():String 34 public function get term():String
35 { 35 {
36 return this._term; 36 return this._term;
37 } 37 }
38 } 38 }
39 } 39 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict 1 package com.adobe.protocols.dict
2 { 2 {
3 public class DictionaryServer 3 public class DictionaryServer
4 { 4 {
5 private var _server:String; 5 private var _server:String;
6 private var _description:String; 6 private var _description:String;
7 7
8 public function set server(server:String):void 8 public function set server(server:String):void
9 { 9 {
10 this._server = server; 10 this._server = server;
11 } 11 }
12 12
13 public function get server():String 13 public function get server():String
14 { 14 {
15 return this._server; 15 return this._server;
16 } 16 }
17 17
18 public function set description(description:String):void 18 public function set description(description:String):void
19 { 19 {
20 this._description = description; 20 this._description = description;
21 } 21 }
22 22
23 public function get description():String 23 public function get description():String
24 { 24 {
25 return this._description; 25 return this._description;
26 } 26 }
27 } 27 }
28 } 28 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict 1 package com.adobe.protocols.dict
2 { 2 {
3 public class MatchStrategy 3 public class MatchStrategy
4 { 4 {
5 private var _name:String; 5 private var _name:String;
6 private var _description:String; 6 private var _description:String;
7 7
8 public function MatchStrategy(name:String, description:String) 8 public function MatchStrategy(name:String, description:String)
9 { 9 {
10 this._name = name; 10 this._name = name;
11 this._description = description; 11 this._description = description;
12 } 12 }
13 13
14 public function set name(name:String):void 14 public function set name(name:String):void
15 { 15 {
16 this._name = name; 16 this._name = name;
17 } 17 }
18 18
19 public function get name():String 19 public function get name():String
20 { 20 {
21 return this._name; 21 return this._name;
22 } 22 }
23 23
24 public function set description(description:String):void 24 public function set description(description:String):void
25 { 25 {
26 this._description = description; 26 this._description = description;
27 } 27 }
28 28
29 public function get description():String 29 public function get description():String
30 { 30 {
31 return this._description; 31 return this._description;
32 } 32 }
33 } 33 }
34 } 34 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict 1 package com.adobe.protocols.dict
2 { 2 {
3 public class Response 3 public class Response
4 { 4 {
5 private var _code:uint; 5 private var _code:uint;
6 private var _headerText:String; 6 private var _headerText:String;
7 private var _body:String; 7 private var _body:String;
8 8
9 public function set code(code:uint):void 9 public function set code(code:uint):void
10 { 10 {
11 this._code = code; 11 this._code = code;
12 } 12 }
13 13
14 public function set headerText(headerText:String):void 14 public function set headerText(headerText:String):void
15 { 15 {
16 this._headerText = headerText; 16 this._headerText = headerText;
17 } 17 }
18 18
19 public function set body(body:String):void 19 public function set body(body:String):void
20 { 20 {
21 this._body = body; 21 this._body = body;
22 } 22 }
23 23
24 public function get code():uint 24 public function get code():uint
25 { 25 {
26 return this._code; 26 return this._code;
27 } 27 }
28 28
29 public function get headerText():String 29 public function get headerText():String
30 { 30 {
31 return this._headerText; 31 return this._headerText;
32 } 32 }
33 33
34 public function get body():String 34 public function get body():String
35 { 35 {
36 return this._body; 36 return this._body;
37 } 37 }
38 } 38 }
39 } 39 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class ConnectedEvent extends Event 6 public class ConnectedEvent extends Event
7 { 7 {
8 public function ConnectedEvent() 8 public function ConnectedEvent()
9 { 9 {
10 super(Dict.CONNECTED); 10 super(Dict.CONNECTED);
11 } 11 }
12 12
13 } 13 }
14 } 14 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class DatabaseEvent 6 public class DatabaseEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _databases:Array; 9 private var _databases:Array;
10 10
11 public function DatabaseEvent() 11 public function DatabaseEvent()
12 { 12 {
13 super(Dict.DATABASES); 13 super(Dict.DATABASES);
14 } 14 }
15 15
16 public function set databases(databases:Array):void 16 public function set databases(databases:Array):void
17 { 17 {
18 this._databases = databases; 18 this._databases = databases;
19 } 19 }
20 20
21 public function get databases():Array 21 public function get databases():Array
22 { 22 {
23 return this._databases; 23 return this._databases;
24 } 24 }
25 } 25 }
26 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 import com.adobe.protocols.dict.Definition; 5 import com.adobe.protocols.dict.Definition;
6 6
7 public class DefinitionEvent 7 public class DefinitionEvent
8 extends Event 8 extends Event
9 { 9 {
10 private var _definition:Definition; 10 private var _definition:Definition;
11 11
12 public function DefinitionEvent() 12 public function DefinitionEvent()
13 { 13 {
14 super(Dict.DEFINITION); 14 super(Dict.DEFINITION);
15 } 15 }
16 16
17 public function set definition(definition:Definition):void 17 public function set definition(definition:Definition):void
18 { 18 {
19 this._definition = definition; 19 this._definition = definition;
20 } 20 }
21 21
22 public function get definition():Definition 22 public function get definition():Definition
23 { 23 {
24 return this._definition; 24 return this._definition;
25 } 25 }
26 } 26 }
27 } 27 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class DefinitionHeaderEvent 6 public class DefinitionHeaderEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _definitionCount:uint; 9 private var _definitionCount:uint;
10 10
11 public function DefinitionHeaderEvent() 11 public function DefinitionHeaderEvent()
12 { 12 {
13 super(Dict.DEFINITION_HEADER); 13 super(Dict.DEFINITION_HEADER);
14 } 14 }
15 15
16 public function set definitionCount(definitionCount:uint):void 16 public function set definitionCount(definitionCount:uint):void
17 { 17 {
18 this._definitionCount = definitionCount; 18 this._definitionCount = definitionCount;
19 } 19 }
20 20
21 public function get definitionCount():uint 21 public function get definitionCount():uint
22 { 22 {
23 return this._definitionCount; 23 return this._definitionCount;
24 } 24 }
25 } 25 }
26 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class DictionaryServerEvent 6 public class DictionaryServerEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _servers:Array; 9 private var _servers:Array;
10 10
11 public function DictionaryServerEvent() 11 public function DictionaryServerEvent()
12 { 12 {
13 super(Dict.SERVERS); 13 super(Dict.SERVERS);
14 } 14 }
15 15
16 public function set servers(servers:Array):void 16 public function set servers(servers:Array):void
17 { 17 {
18 this._servers = servers; 18 this._servers = servers;
19 } 19 }
20 20
21 public function get servers():Array 21 public function get servers():Array
22 { 22 {
23 return this._servers; 23 return this._servers;
24 } 24 }
25 } 25 }
26 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class DisconnectedEvent extends Event 6 public class DisconnectedEvent extends Event
7 { 7 {
8 public function DisconnectedEvent() 8 public function DisconnectedEvent()
9 { 9 {
10 super(Dict.DISCONNECTED); 10 super(Dict.DISCONNECTED);
11 } 11 }
12 12
13 } 13 }
14 } 14 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class ErrorEvent 6 public class ErrorEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _code:uint; 9 private var _code:uint;
10 private var _message:String; 10 private var _message:String;
11 11
12 public function ErrorEvent() 12 public function ErrorEvent()
13 { 13 {
14 super(Dict.ERROR); 14 super(Dict.ERROR);
15 } 15 }
16 16
17 public function set code(code:uint):void 17 public function set code(code:uint):void
18 { 18 {
19 this._code = code; 19 this._code = code;
20 } 20 }
21 21
22 public function set message(message:String):void 22 public function set message(message:String):void
23 { 23 {
24 this._message = message; 24 this._message = message;
25 } 25 }
26 26
27 public function get code():uint 27 public function get code():uint
28 { 28 {
29 return this._code; 29 return this._code;
30 } 30 }
31 31
32 public function get message():String 32 public function get message():String
33 { 33 {
34 return this._message; 34 return this._message;
35 } 35 }
36 } 36 }
37 } 37 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class MatchEvent 6 public class MatchEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _matches:Array; 9 private var _matches:Array;
10 10
11 public function MatchEvent() 11 public function MatchEvent()
12 { 12 {
13 super(Dict.MATCH); 13 super(Dict.MATCH);
14 } 14 }
15 15
16 public function set matches(matches:Array):void 16 public function set matches(matches:Array):void
17 { 17 {
18 this._matches = matches; 18 this._matches = matches;
19 } 19 }
20 20
21 public function get matches():Array 21 public function get matches():Array
22 { 22 {
23 return this._matches; 23 return this._matches;
24 } 24 }
25 } 25 }
26 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class MatchStrategiesEvent 6 public class MatchStrategiesEvent
7 extends Event 7 extends Event
8 { 8 {
9 private var _strategies:Array; 9 private var _strategies:Array;
10 10
11 public function MatchStrategiesEvent() 11 public function MatchStrategiesEvent()
12 { 12 {
13 super(Dict.MATCH_STRATEGIES); 13 super(Dict.MATCH_STRATEGIES);
14 } 14 }
15 15
16 public function set strategies(strategies:Array):void 16 public function set strategies(strategies:Array):void
17 { 17 {
18 this._strategies = strategies; 18 this._strategies = strategies;
19 } 19 }
20 20
21 public function get strategies():Array 21 public function get strategies():Array
22 { 22 {
23 return this._strategies; 23 return this._strategies;
24 } 24 }
25 } 25 }
26 } 26 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.events 1 package com.adobe.protocols.dict.events
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 import com.adobe.protocols.dict.Dict; 4 import com.adobe.protocols.dict.Dict;
5 5
6 public class NoMatchEvent 6 public class NoMatchEvent
7 extends Event 7 extends Event
8 { 8 {
9 public function NoMatchEvent() 9 public function NoMatchEvent()
10 { 10 {
11 super(Dict.NO_MATCH); 11 super(Dict.NO_MATCH);
12 } 12 }
13 } 13 }
14 } 14 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.util 1 package com.adobe.protocols.dict.util
2 { 2 {
3 import flash.events.Event; 3 import flash.events.Event;
4 4
5 public class CompleteResponseEvent 5 public class CompleteResponseEvent
6 extends Event 6 extends Event
7 { 7 {
8 private var _response:String; 8 private var _response:String;
9 9
10 public function CompleteResponseEvent() 10 public function CompleteResponseEvent()
11 { 11 {
12 super(SocketHelper.COMPLETE_RESPONSE); 12 super(SocketHelper.COMPLETE_RESPONSE);
13 } 13 }
14 14
15 public function set response(response:String):void 15 public function set response(response:String):void
16 { 16 {
17 this._response = response; 17 this._response = response;
18 } 18 }
19 19
20 public function get response():String 20 public function get response():String
21 { 21 {
22 return this._response; 22 return this._response;
23 } 23 }
24 } 24 }
25 } 25 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.adobe.protocols.dict.util 1 package com.adobe.protocols.dict.util
2 { 2 {
3 import com.adobe.net.proxies.RFC2817Socket; 3 import com.adobe.net.proxies.RFC2817Socket;
4 import flash.events.ProgressEvent; 4 import flash.events.ProgressEvent;
5 5
6 public class SocketHelper 6 public class SocketHelper
7 extends RFC2817Socket 7 extends RFC2817Socket
8 { 8 {
9 private var terminator:String = "\r\n.\r\n"; 9 private var terminator:String = "\r\n.\r\n";
10 private var buffer:String; 10 private var buffer:String;
11 public static var COMPLETE_RESPONSE:String = "completeResponse"; 11 public static var COMPLETE_RESPONSE:String = "completeResponse";
12 12
13 public function SocketHelper() 13 public function SocketHelper()
14 { 14 {
15 super(); 15 super();
16 buffer = new String(); 16 buffer = new String();
17 addEventListener(ProgressEvent.SOCKET_DATA, incomingData); 17 addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
18 } 18 }
19 19
20 private function incomingData(event:ProgressEvent):void 20 private function incomingData(event:ProgressEvent):void
21 { 21 {
22 buffer += readUTFBytes(bytesAvailable); 22 buffer += readUTFBytes(bytesAvailable);
23 buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them. 23 buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
24 var codeStr:String = buffer.substring(0, 3); 24 var codeStr:String = buffer.substring(0, 3);
25 if (!isNaN(parseInt(codeStr))) 25 if (!isNaN(parseInt(codeStr)))
26 { 26 {
27 var code:uint = uint(codeStr); 27 var code:uint = uint(codeStr);
28 if (code == 150 || code >= 200) 28 if (code == 150 || code >= 200)
29 { 29 {
30 buffer = buffer.replace("\r\n", this.terminator); 30 buffer = buffer.replace("\r\n", this.terminator);
31 } 31 }
32 } 32 }
33 33
34 while (buffer.indexOf(this.terminator) != -1) 34 while (buffer.indexOf(this.terminator) != -1)
35 { 35 {
36 var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator)); 36 var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
37 buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length); 37 buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
38 throwResponseEvent(chunk); 38 throwResponseEvent(chunk);
39 } 39 }
40 } 40 }
41 41
42 private function throwResponseEvent(response:String):void 42 private function throwResponseEvent(response:String):void
43 { 43 {
44 var responseEvent:CompleteResponseEvent = new CompleteResponseEvent(); 44 var responseEvent:CompleteResponseEvent = new CompleteResponseEvent();
45 responseEvent.response = response; 45 responseEvent.response = response;
46 dispatchEvent(responseEvent); 46 dispatchEvent(responseEvent);
47 } 47 }
48 } 48 }
49 } 49 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.serialization.json { 33 package com.adobe.serialization.json {
34 34
35 /** 35 /**
36 * This class provides encoding and decoding of the JSON format. 36 * This class provides encoding and decoding of the JSON format.
37 * 37 *
38 * Example usage: 38 * Example usage:
39 * <code> 39 * <code>
40 * // create a JSON string from an internal object 40 * // create a JSON string from an internal object
41 * JSON.encode( myObject ); 41 * JSON.encode( myObject );
42 * 42 *
43 * // read a JSON string into an internal object 43 * // read a JSON string into an internal object
44 * var myObject:Object = JSON.decode( jsonString ); 44 * var myObject:Object = JSON.decode( jsonString );
45 * </code> 45 * </code>
46 */ 46 */
47 public class JSON { 47 public class JSON {
48 48
49 49
50 /** 50 /**
51 * Encodes a object into a JSON string. 51 * Encodes a object into a JSON string.
52 * 52 *
53 * @param o The object to create a JSON string for 53 * @param o The object to create a JSON string for
54 * @return the JSON string representing o 54 * @return the JSON string representing o
55 * @langversion ActionScript 3.0 55 * @langversion ActionScript 3.0
56 * @playerversion Flash 9.0 56 * @playerversion Flash 9.0
57 * @tiptext 57 * @tiptext
58 */ 58 */
59 public static function encode( o:Object ):String { 59 public static function encode( o:Object ):String {
60 60
61 var encoder:JSONEncoder = new JSONEncoder( o ); 61 var encoder:JSONEncoder = new JSONEncoder( o );
62 return encoder.getString(); 62 return encoder.getString();
63 63
64 } 64 }
65 65
66 /** 66 /**
67 * Decodes a JSON string into a native object. 67 * Decodes a JSON string into a native object.
68 * 68 *
69 * @param s The JSON string representing the object 69 * @param s The JSON string representing the object
70 * @return A native object as specified by s 70 * @return A native object as specified by s
71 * @throw JSONParseError 71 * @throw JSONParseError
72 * @langversion ActionScript 3.0 72 * @langversion ActionScript 3.0
73 * @playerversion Flash 9.0 73 * @playerversion Flash 9.0
74 * @tiptext 74 * @tiptext
75 */ 75 */
76 public static function decode( s:String ):* { 76 public static function decode( s:String ):* {
77 77
78 var decoder:JSONDecoder = new JSONDecoder( s ) 78 var decoder:JSONDecoder = new JSONDecoder( s )
79 return decoder.getValue(); 79 return decoder.getValue();
80 80
81 } 81 }
82 82
83 } 83 }
84 84
85 } 85 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.serialization.json { 33 package com.adobe.serialization.json {
34 34
35 /** 35 /**
36 * 36 *
37 * 37 *
38 */ 38 */
39 public class JSONParseError extends Error { 39 public class JSONParseError extends Error {
40 40
41 /** The location in the string where the error occurred */ 41 /** The location in the string where the error occurred */
42 private var _location:int; 42 private var _location:int;
43 43
44 /** The string in which the parse error occurred */ 44 /** The string in which the parse error occurred */
45 private var _text:String; 45 private var _text:String;
46 46
47 /** 47 /**
48 * Constructs a new JSONParseError. 48 * Constructs a new JSONParseError.
49 * 49 *
50 * @param message The error message that occured during parsing 50 * @param message The error message that occured during parsing
51 * @langversion ActionScript 3.0 51 * @langversion ActionScript 3.0
52 * @playerversion Flash 9.0 52 * @playerversion Flash 9.0
53 * @tiptext 53 * @tiptext
54 */ 54 */
55 public function JSONParseError( message:String = "", location:int = 0, text:String = "") { 55 public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
56 super( message ); 56 super( message );
57 name = "JSONParseError"; 57 name = "JSONParseError";
58 _location = location; 58 _location = location;
59 _text = text; 59 _text = text;
60 } 60 }
61 61
62 /** 62 /**
63 * Provides read-only access to the location variable. 63 * Provides read-only access to the location variable.
64 * 64 *
65 * @return The location in the string where the error occurred 65 * @return The location in the string where the error occurred
66 * @langversion ActionScript 3.0 66 * @langversion ActionScript 3.0
67 * @playerversion Flash 9.0 67 * @playerversion Flash 9.0
68 * @tiptext 68 * @tiptext
69 */ 69 */
70 public function get location():int { 70 public function get location():int {
71 return _location; 71 return _location;
72 } 72 }
73 73
74 /** 74 /**
75 * Provides read-only access to the text variable. 75 * Provides read-only access to the text variable.
76 * 76 *
77 * @return The string in which the error occurred 77 * @return The string in which the error occurred
78 * @langversion ActionScript 3.0 78 * @langversion ActionScript 3.0
79 * @playerversion Flash 9.0 79 * @playerversion Flash 9.0
80 * @tiptext 80 * @tiptext
81 */ 81 */
82 public function get text():String { 82 public function get text():String {
83 return _text; 83 return _text;
84 } 84 }
85 } 85 }
86 86
87 } 87 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.serialization.json { 33 package com.adobe.serialization.json {
34 34
35 public class JSONToken { 35 public class JSONToken {
36 36
37 private var _type:int; 37 private var _type:int;
38 private var _value:Object; 38 private var _value:Object;
39 39
40 /** 40 /**
41 * Creates a new JSONToken with a specific token type and value. 41 * Creates a new JSONToken with a specific token type and value.
42 * 42 *
43 * @param type The JSONTokenType of the token 43 * @param type The JSONTokenType of the token
44 * @param value The value of the token 44 * @param value The value of the token
45 * @langversion ActionScript 3.0 45 * @langversion ActionScript 3.0
46 * @playerversion Flash 9.0 46 * @playerversion Flash 9.0
47 * @tiptext 47 * @tiptext
48 */ 48 */
49 public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) { 49 public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
50 _type = type; 50 _type = type;
51 _value = value; 51 _value = value;
52 } 52 }
53 53
54 /** 54 /**
55 * Returns the type of the token. 55 * Returns the type of the token.
56 * 56 *
57 * @see com.adobe.serialization.json.JSONTokenType 57 * @see com.adobe.serialization.json.JSONTokenType
58 * @langversion ActionScript 3.0 58 * @langversion ActionScript 3.0
59 * @playerversion Flash 9.0 59 * @playerversion Flash 9.0
60 * @tiptext 60 * @tiptext
61 */ 61 */
62 public function get type():int { 62 public function get type():int {
63 return _type; 63 return _type;
64 } 64 }
65 65
66 /** 66 /**
67 * Sets the type of the token. 67 * Sets the type of the token.
68 * 68 *
69 * @see com.adobe.serialization.json.JSONTokenType 69 * @see com.adobe.serialization.json.JSONTokenType
70 * @langversion ActionScript 3.0 70 * @langversion ActionScript 3.0
71 * @playerversion Flash 9.0 71 * @playerversion Flash 9.0
72 * @tiptext 72 * @tiptext
73 */ 73 */
74 public function set type( value:int ):void { 74 public function set type( value:int ):void {
75 _type = value; 75 _type = value;
76 } 76 }
77 77
78 /** 78 /**
79 * Gets the value of the token 79 * Gets the value of the token
80 * 80 *
81 * @see com.adobe.serialization.json.JSONTokenType 81 * @see com.adobe.serialization.json.JSONTokenType
82 * @langversion ActionScript 3.0 82 * @langversion ActionScript 3.0
83 * @playerversion Flash 9.0 83 * @playerversion Flash 9.0
84 * @tiptext 84 * @tiptext
85 */ 85 */
86 public function get value():Object { 86 public function get value():Object {
87 return _value; 87 return _value;
88 } 88 }
89 89
90 /** 90 /**
91 * Sets the value of the token 91 * Sets the value of the token
92 * 92 *
93 * @see com.adobe.serialization.json.JSONTokenType 93 * @see com.adobe.serialization.json.JSONTokenType
94 * @langversion ActionScript 3.0 94 * @langversion ActionScript 3.0
95 * @playerversion Flash 9.0 95 * @playerversion Flash 9.0
96 * @tiptext 96 * @tiptext
97 */ 97 */
98 public function set value ( v:Object ):void { 98 public function set value ( v:Object ):void {
99 _value = v; 99 _value = v;
100 } 100 }
101 101
102 } 102 }
103 103
104 } 104 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.serialization.json { 33 package com.adobe.serialization.json {
34 34
35 /** 35 /**
36 * Class containing constant values for the different types 36 * Class containing constant values for the different types
37 * of tokens in a JSON encoded string. 37 * of tokens in a JSON encoded string.
38 */ 38 */
39 public class JSONTokenType { 39 public class JSONTokenType {
40 40
41 public static const UNKNOWN:int = -1; 41 public static const UNKNOWN:int = -1;
42 42
43 public static const COMMA:int = 0; 43 public static const COMMA:int = 0;
44 44
45 public static const LEFT_BRACE:int = 1; 45 public static const LEFT_BRACE:int = 1;
46 46
47 public static const RIGHT_BRACE:int = 2; 47 public static const RIGHT_BRACE:int = 2;
48 48
49 public static const LEFT_BRACKET:int = 3; 49 public static const LEFT_BRACKET:int = 3;
50 50
51 public static const RIGHT_BRACKET:int = 4; 51 public static const RIGHT_BRACKET:int = 4;
52 52
53 public static const COLON:int = 6; 53 public static const COLON:int = 6;
54 54
55 public static const TRUE:int = 7; 55 public static const TRUE:int = 7;
56 56
57 public static const FALSE:int = 8; 57 public static const FALSE:int = 8;
58 58
59 public static const NULL:int = 9; 59 public static const NULL:int = 9;
60 60
61 public static const STRING:int = 10; 61 public static const STRING:int = 10;
62 62
63 public static const NUMBER:int = 11; 63 public static const NUMBER:int = 11;
64 64
65 } 65 }
66 66
67 } 67 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 package com.adobe.utils { 32 package com.adobe.utils {
33 33
34 import flash.utils.Endian; 34 import flash.utils.Endian;
35 35
36 /** 36 /**
37 * Contains reusable methods for operations pertaining 37 * Contains reusable methods for operations pertaining
38 * to int values. 38 * to int values.
39 */ 39 */
40 public class IntUtil { 40 public class IntUtil {
41 41
42 /** 42 /**
43 * Rotates x left n bits 43 * Rotates x left n bits
44 * 44 *
45 * @langversion ActionScript 3.0 45 * @langversion ActionScript 3.0
46 * @playerversion Flash 9.0 46 * @playerversion Flash 9.0
47 * @tiptext 47 * @tiptext
48 */ 48 */
49 public static function rol ( x:int, n:int ):int { 49 public static function rol ( x:int, n:int ):int {
50 return ( x << n ) | ( x >>> ( 32 - n ) ); 50 return ( x << n ) | ( x >>> ( 32 - n ) );
51 } 51 }
52 52
53 /** 53 /**
54 * Rotates x right n bits 54 * Rotates x right n bits
55 * 55 *
56 * @langversion ActionScript 3.0 56 * @langversion ActionScript 3.0
57 * @playerversion Flash 9.0 57 * @playerversion Flash 9.0
58 * @tiptext 58 * @tiptext
59 */ 59 */
60 public static function ror ( x:int, n:int ):uint { 60 public static function ror ( x:int, n:int ):uint {
61 var nn:int = 32 - n; 61 var nn:int = 32 - n;
62 return ( x << nn ) | ( x >>> ( 32 - nn ) ); 62 return ( x << nn ) | ( x >>> ( 32 - nn ) );
63 } 63 }
64 64
65 /** String for quick lookup of a hex character based on index */ 65 /** String for quick lookup of a hex character based on index */
66 private static var hexChars:String = "0123456789abcdef"; 66 private static var hexChars:String = "0123456789abcdef";
67 67
68 /** 68 /**
69 * Outputs the hex value of a int, allowing the developer to specify 69 * Outputs the hex value of a int, allowing the developer to specify
70 * the endinaness in the process. Hex output is lowercase. 70 * the endinaness in the process. Hex output is lowercase.
71 * 71 *
72 * @param n The int value to output as hex 72 * @param n The int value to output as hex
73 * @param bigEndian Flag to output the int as big or little endian 73 * @param bigEndian Flag to output the int as big or little endian
74 * @return A string of length 8 corresponding to the 74 * @return A string of length 8 corresponding to the
75 * hex representation of n ( minus the leading "0x" ) 75 * hex representation of n ( minus the leading "0x" )
76 * @langversion ActionScript 3.0 76 * @langversion ActionScript 3.0
77 * @playerversion Flash 9.0 77 * @playerversion Flash 9.0
78 * @tiptext 78 * @tiptext
79 */ 79 */
80 public static function toHex( n:int, bigEndian:Boolean = false ):String { 80 public static function toHex( n:int, bigEndian:Boolean = false ):String {
81 var s:String = ""; 81 var s:String = "";
82 82
83 if ( bigEndian ) { 83 if ( bigEndian ) {
84 for ( var i:int = 0; i < 4; i++ ) { 84 for ( var i:int = 0; i < 4; i++ ) {
85 s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF ) 85 s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF )
86 + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF ); 86 + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF );
87 } 87 }
88 } else { 88 } else {
89 for ( var x:int = 0; x < 4; x++ ) { 89 for ( var x:int = 0; x < 4; x++ ) {
90 s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF ) 90 s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF )
91 + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF ); 91 + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF );
92 } 92 }
93 } 93 }
94 94
95 return s; 95 return s;
96 } 96 }
97 } 97 }
98 98
99 } 99 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.utils 33 package com.adobe.utils
34 { 34 {
35 35
36 /** 36 /**
37 * Class that contains static utility methods for formatting Numbers 37 * Class that contains static utility methods for formatting Numbers
38 * 38 *
39 * @langversion ActionScript 3.0 39 * @langversion ActionScript 3.0
40 * @playerversion Flash 9.0 40 * @playerversion Flash 9.0
41 * @tiptext 41 * @tiptext
42 * 42 *
43 * @see #mx.formatters.NumberFormatter 43 * @see #mx.formatters.NumberFormatter
44 */ 44 */
45 public class NumberFormatter 45 public class NumberFormatter
46 { 46 {
47 47
48 /** 48 /**
49 * Formats a number to include a leading zero if it is a single digit 49 * Formats a number to include a leading zero if it is a single digit
50 * between -1 and 10. 50 * between -1 and 10.
51 * 51 *
52 * @param n The number that will be formatted 52 * @param n The number that will be formatted
53 * 53 *
54 * @return A string with single digits between -1 and 10 padded with a 54 * @return A string with single digits between -1 and 10 padded with a
55 * leading zero. 55 * leading zero.
56 * 56 *
57 * @langversion ActionScript 3.0 57 * @langversion ActionScript 3.0
58 * @playerversion Flash 9.0 58 * @playerversion Flash 9.0
59 * @tiptext 59 * @tiptext
60 */ 60 */
61 public static function addLeadingZero(n:Number):String 61 public static function addLeadingZero(n:Number):String
62 { 62 {
63 var out:String = String(n); 63 var out:String = String(n);
64 64
65 if(n < 10 && n > -1) 65 if(n < 10 && n > -1)
66 { 66 {
67 out = "0" + out; 67 out = "0" + out;
68 } 68 }
69 69
70 return out; 70 return out;
71 } 71 }
72 72
73 } 73 }
74 } 74 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.utils 33 package com.adobe.utils
34 { 34 {
35 35
36 public class XMLUtil 36 public class XMLUtil
37 { 37 {
38 /** 38 /**
39 * Constant representing a text node type returned from XML.nodeKind. 39 * Constant representing a text node type returned from XML.nodeKind.
40 * 40 *
41 * @see XML.nodeKind() 41 * @see XML.nodeKind()
42 * 42 *
43 * @langversion ActionScript 3.0 43 * @langversion ActionScript 3.0
44 * @playerversion Flash 9.0 44 * @playerversion Flash 9.0
45 */ 45 */
46 public static const TEXT:String = "text"; 46 public static const TEXT:String = "text";
47 47
48 /** 48 /**
49 * Constant representing a comment node type returned from XML.nodeKind. 49 * Constant representing a comment node type returned from XML.nodeKind.
50 * 50 *
51 * @see XML.nodeKind() 51 * @see XML.nodeKind()
52 * 52 *
53 * @langversion ActionScript 3.0 53 * @langversion ActionScript 3.0
54 * @playerversion Flash 9.0 54 * @playerversion Flash 9.0
55 */ 55 */
56 public static const COMMENT:String = "comment"; 56 public static const COMMENT:String = "comment";
57 57
58 /** 58 /**
59 * Constant representing a processing instruction type returned from XML.nodeKind. 59 * Constant representing a processing instruction type returned from XML.nodeKind.
60 * 60 *
61 * @see XML.nodeKind() 61 * @see XML.nodeKind()
62 * 62 *
63 * @langversion ActionScript 3.0 63 * @langversion ActionScript 3.0
64 * @playerversion Flash 9.0 64 * @playerversion Flash 9.0
65 */ 65 */
66 public static const PROCESSING_INSTRUCTION:String = "processing-instruction"; 66 public static const PROCESSING_INSTRUCTION:String = "processing-instruction";
67 67
68 /** 68 /**
69 * Constant representing an attribute type returned from XML.nodeKind. 69 * Constant representing an attribute type returned from XML.nodeKind.
70 * 70 *
71 * @see XML.nodeKind() 71 * @see XML.nodeKind()
72 * 72 *
73 * @langversion ActionScript 3.0 73 * @langversion ActionScript 3.0
74 * @playerversion Flash 9.0 74 * @playerversion Flash 9.0
75 */ 75 */
76 public static const ATTRIBUTE:String = "attribute"; 76 public static const ATTRIBUTE:String = "attribute";
77 77
78 /** 78 /**
79 * Constant representing a element type returned from XML.nodeKind. 79 * Constant representing a element type returned from XML.nodeKind.
80 * 80 *
81 * @see XML.nodeKind() 81 * @see XML.nodeKind()
82 * 82 *
83 * @langversion ActionScript 3.0 83 * @langversion ActionScript 3.0
84 * @playerversion Flash 9.0 84 * @playerversion Flash 9.0
85 */ 85 */
86 public static const ELEMENT:String = "element"; 86 public static const ELEMENT:String = "element";
87 87
88 /** 88 /**
89 * Checks whether the specified string is valid and well formed XML. 89 * Checks whether the specified string is valid and well formed XML.
90 * 90 *
91 * @param data The string that is being checked to see if it is valid XML. 91 * @param data The string that is being checked to see if it is valid XML.
92 * 92 *
93 * @return A Boolean value indicating whether the specified string is 93 * @return A Boolean value indicating whether the specified string is
94 * valid XML. 94 * valid XML.
95 * 95 *
96 * @langversion ActionScript 3.0 96 * @langversion ActionScript 3.0
97 * @playerversion Flash 9.0 97 * @playerversion Flash 9.0
98 */ 98 */
99 public static function isValidXML(data:String):Boolean 99 public static function isValidXML(data:String):Boolean
100 { 100 {
101 var xml:XML; 101 var xml:XML;
102 102
103 try 103 try
104 { 104 {
105 xml = new XML(data); 105 xml = new XML(data);
106 } 106 }
107 catch(e:Error) 107 catch(e:Error)
108 { 108 {
109 return false; 109 return false;
110 } 110 }
111 111
112 if(xml.nodeKind() != XMLUtil.ELEMENT) 112 if(xml.nodeKind() != XMLUtil.ELEMENT)
113 { 113 {
114 return false; 114 return false;
115 } 115 }
116 116
117 return true; 117 return true;
118 } 118 }
119 119
120 /** 120 /**
121 * Returns the next sibling of the specified node relative to the node's parent. 121 * Returns the next sibling of the specified node relative to the node's parent.
122 * 122 *
123 * @param x The node whose next sibling will be returned. 123 * @param x The node whose next sibling will be returned.
124 * 124 *
125 * @return The next sibling of the node. null if the node does not have 125 * @return The next sibling of the node. null if the node does not have
126 * a sibling after it, or if the node has no parent. 126 * a sibling after it, or if the node has no parent.
127 * 127 *
128 * @langversion ActionScript 3.0 128 * @langversion ActionScript 3.0
129 * @playerversion Flash 9.0 129 * @playerversion Flash 9.0
130 */ 130 */
131 public static function getNextSibling(x:XML):XML 131 public static function getNextSibling(x:XML):XML
132 { 132 {
133 return XMLUtil.getSiblingByIndex(x, 1); 133 return XMLUtil.getSiblingByIndex(x, 1);
134 } 134 }
135 135
136 /** 136 /**
137 * Returns the sibling before the specified node relative to the node's parent. 137 * Returns the sibling before the specified node relative to the node's parent.
138 * 138 *
139 * @param x The node whose sibling before it will be returned. 139 * @param x The node whose sibling before it will be returned.
140 * 140 *
141 * @return The sibling before the node. null if the node does not have 141 * @return The sibling before the node. null if the node does not have
142 * a sibling before it, or if the node has no parent. 142 * a sibling before it, or if the node has no parent.
143 * 143 *
144 * @langversion ActionScript 3.0 144 * @langversion ActionScript 3.0
145 * @playerversion Flash 9.0 145 * @playerversion Flash 9.0
146 */ 146 */
147 public static function getPreviousSibling(x:XML):XML 147 public static function getPreviousSibling(x:XML):XML
148 { 148 {
149 return XMLUtil.getSiblingByIndex(x, -1); 149 return XMLUtil.getSiblingByIndex(x, -1);
150 } 150 }
151 151
152 protected static function getSiblingByIndex(x:XML, count:int):XML 152 protected static function getSiblingByIndex(x:XML, count:int):XML
153 { 153 {
154 var out:XML; 154 var out:XML;
155 155
156 try 156 try
157 { 157 {
158 out = x.parent().children()[x.childIndex() + count]; 158 out = x.parent().children()[x.childIndex() + count];
159 } 159 }
160 catch(e:Error) 160 catch(e:Error)
161 { 161 {
162 return null; 162 return null;
163 } 163 }
164 164
165 return out; 165 return out;
166 } 166 }
167 } 167 }
168 } 168 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 33
34 package com.adobe.webapis 34 package com.adobe.webapis
35 { 35 {
36 import flash.events.EventDispatcher; 36 import flash.events.EventDispatcher;
37 37
38 /** 38 /**
39 * Base class for remote service classes. 39 * Base class for remote service classes.
40 */ 40 */
41 public class ServiceBase extends EventDispatcher 41 public class ServiceBase extends EventDispatcher
42 { 42 {
43 public function ServiceBase() 43 public function ServiceBase()
44 { 44 {
45 } 45 }
46 46
47 } 47 }
48 } 48 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 package com.adobe.webapis 33 package com.adobe.webapis
34 { 34 {
35 import flash.events.IOErrorEvent; 35 import flash.events.IOErrorEvent;
36 import flash.events.SecurityErrorEvent; 36 import flash.events.SecurityErrorEvent;
37 import flash.events.ProgressEvent; 37 import flash.events.ProgressEvent;
38 38
39 import com.adobe.net.DynamicURLLoader; 39 import com.adobe.net.DynamicURLLoader;
40 40
41 /** 41 /**
42 * Dispatched when data is 42 * Dispatched when data is
43 * received as the download operation progresses. 43 * received as the download operation progresses.
44 * 44 *
45 * @eventType flash.events.ProgressEvent.PROGRESS 45 * @eventType flash.events.ProgressEvent.PROGRESS
46 * 46 *
47 * @langversion ActionScript 3.0 47 * @langversion ActionScript 3.0
48 * @playerversion Flash 9.0 48 * @playerversion Flash 9.0
49 */ 49 */
50 [Event(name="progress", type="flash.events.ProgressEvent")] 50 [Event(name="progress", type="flash.events.ProgressEvent")]
51 51
52 /** 52 /**
53 * Dispatched if a call to the server results in a fatal 53 * Dispatched if a call to the server results in a fatal
54 * error that terminates the download. 54 * error that terminates the download.
55 * 55 *
56 * @eventType flash.events.IOErrorEvent.IO_ERROR 56 * @eventType flash.events.IOErrorEvent.IO_ERROR
57 * 57 *
58 * @langversion ActionScript 3.0 58 * @langversion ActionScript 3.0
59 * @playerversion Flash 9.0 59 * @playerversion Flash 9.0
60 */ 60 */
61 [Event(name="ioError", type="flash.events.IOErrorEvent")] 61 [Event(name="ioError", type="flash.events.IOErrorEvent")]
62 62
63 /** 63 /**
64 * A securityError event occurs if a call attempts to 64 * A securityError event occurs if a call attempts to
65 * load data from a server outside the security sandbox. 65 * load data from a server outside the security sandbox.
66 * 66 *
67 * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR 67 * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
68 * 68 *
69 * @langversion ActionScript 3.0 69 * @langversion ActionScript 3.0
70 * @playerversion Flash 9.0 70 * @playerversion Flash 9.0
71 */ 71 */
72 [Event(name="securityError", type="flash.events.SecurityErrorEvent")] 72 [Event(name="securityError", type="flash.events.SecurityErrorEvent")]
73 73
74 /** 74 /**
75 * Base class for services that utilize URLLoader 75 * Base class for services that utilize URLLoader
76 * to communicate with remote APIs / Services. 76 * to communicate with remote APIs / Services.
77 * 77 *
78 * @langversion ActionScript 3.0 78 * @langversion ActionScript 3.0
79 * @playerversion Flash 9.0 79 * @playerversion Flash 9.0
80 */ 80 */
81 public class URLLoaderBase extends ServiceBase 81 public class URLLoaderBase extends ServiceBase
82 { 82 {
83 protected function getURLLoader():DynamicURLLoader 83 protected function getURLLoader():DynamicURLLoader
84 { 84 {
85 var loader:DynamicURLLoader = new DynamicURLLoader(); 85 var loader:DynamicURLLoader = new DynamicURLLoader();
86 loader.addEventListener("progress", onProgress); 86 loader.addEventListener("progress", onProgress);
87 loader.addEventListener("ioError", onIOError); 87 loader.addEventListener("ioError", onIOError);
88 loader.addEventListener("securityError", onSecurityError); 88 loader.addEventListener("securityError", onSecurityError);
89 89
90 return loader; 90 return loader;
91 } 91 }
92 92
93 private function onIOError(event:IOErrorEvent):void 93 private function onIOError(event:IOErrorEvent):void
94 { 94 {
95 dispatchEvent(event); 95 dispatchEvent(event);
96 } 96 }
97 97
98 private function onSecurityError(event:SecurityErrorEvent):void 98 private function onSecurityError(event:SecurityErrorEvent):void
99 { 99 {
100 dispatchEvent(event); 100 dispatchEvent(event);
101 } 101 }
102 102
103 private function onProgress(event:ProgressEvent):void 103 private function onProgress(event:ProgressEvent):void
104 { 104 {
105 dispatchEvent(event); 105 dispatchEvent(event);
106 } 106 }
107 } 107 }
108 } 108 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Copyright (c) 2008, Adobe Systems Incorporated 2 Copyright (c) 2008, Adobe Systems Incorporated
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are 6 modification, are permitted provided that the following conditions are
7 met: 7 met:
8 8
9 * Redistributions of source code must retain the above copyright notice, 9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 11
12 * Redistributions in binary form must reproduce the above copyright 12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the 13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution. 14 documentation and/or other materials provided with the distribution.
15 15
16 * Neither the name of Adobe Systems Incorporated nor the names of its 16 * Neither the name of Adobe Systems Incorporated nor the names of its
17 contributors may be used to endorse or promote products derived from 17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission. 18 this software without specific prior written permission.
19 19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33 33
34 package com.adobe.webapis.events 34 package com.adobe.webapis.events
35 { 35 {
36 36
37 import flash.events.Event; 37 import flash.events.Event;
38 38
39 /** 39 /**
40 * Event class that contains data loaded from remote services. 40 * Event class that contains data loaded from remote services.
41 * 41 *
42 * @author Mike Chambers 42 * @author Mike Chambers
43 */ 43 */
44 public class ServiceEvent extends Event 44 public class ServiceEvent extends Event
45 { 45 {
46 private var _data:Object = new Object();; 46 private var _data:Object = new Object();;
47 47
48 /** 48 /**
49 * Constructor for ServiceEvent class. 49 * Constructor for ServiceEvent class.
50 * 50 *
51 * @param type The type of event that the instance represents. 51 * @param type The type of event that the instance represents.
52 */ 52 */
53 public function ServiceEvent(type:String, bubbles:Boolean = false, 53 public function ServiceEvent(type:String, bubbles:Boolean = false,
54 cancelable:Boolean=false) 54 cancelable:Boolean=false)
55 { 55 {
56 super(type, bubbles, cancelable); 56 super(type, bubbles, cancelable);
57 } 57 }
58 58
59 /** 59 /**
60 * This object contains data loaded in response 60 * This object contains data loaded in response
61 * to remote service calls, and properties associated with that call. 61 * to remote service calls, and properties associated with that call.
62 */ 62 */
63 public function get data():Object 63 public function get data():Object
64 { 64 {
65 return _data; 65 return _data;
66 } 66 }
67 67
68 public function set data(d:Object):void 68 public function set data(d:Object):void
69 { 69 {
70 _data = d; 70 _data = d;
71 } 71 }
72 72
73 73
74 } 74 }
75 } 75 }
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="utf-8" ?> 1 <?xml version="1.0" encoding="utf-8" ?>
2 <dwsync> 2 <dwsync>
3 <file name="index.php" server="ftp.uploadify.com/www.uploadify.com/" local="128911652226450000" remote="128911651800000000" /> 3 <file name="index.php" server="ftp.uploadify.com/www.uploadify.com/" local="128911652226450000" remote="128911651800000000" />
4 <file name="cancel.png" server="ftp.uploadify.com/www.uploadify.com/" local="128794107540000000" remote="128911638000000000" /> 4 <file name="cancel.png" server="ftp.uploadify.com/www.uploadify.com/" local="128794107540000000" remote="128911638000000000" />
5 </dwsync> 5 </dwsync>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="utf-8" ?> 1 <?xml version="1.0" encoding="utf-8" ?>
2 <dwsync> 2 <dwsync>
3 <file name="default.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911634053800000" remote="128911633800000000" /> 3 <file name="default.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911634053800000" remote="128911633800000000" />
4 <file name="uploadify.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911650121540000" remote="128911650000000000" /> 4 <file name="uploadify.css" server="ftp.uploadify.com/www.uploadify.com/" local="128911650121540000" remote="128911650000000000" />
5 </dwsync> 5 </dwsync>
...\ No newline at end of file ...\ No newline at end of file
......
1 body { 1 body {
2 font: 12px/16px Arial, Helvetica, sans-serif; 2 font: 12px/16px Arial, Helvetica, sans-serif;
3 } 3 }
4 #fileQueue { 4 #fileQueue {
5 width: 400px; 5 width: 400px;
6 height: 300px; 6 height: 300px;
7 overflow: auto; 7 overflow: auto;
8 border: 1px solid #E5E5E5; 8 border: 1px solid #E5E5E5;
9 margin-bottom: 10px; 9 margin-bottom: 10px;
10 } 10 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Uploadify v2.1.0 2 Uploadify v2.1.0
3 Release Date: August 24, 2009 3 Release Date: August 24, 2009
4 4
5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal 8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights 9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is 11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions: 12 furnished to do so, subject to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in 14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software. 15 all copies or substantial portions of the Software.
16 16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE. 23 THE SOFTWARE.
24 */ 24 */
25 .uploadifyQueueItem { 25 .uploadifyQueueItem {
26 font: 11px Verdana, Geneva, sans-serif; 26 font: 11px Verdana, Geneva, sans-serif;
27 border: 2px solid #E5E5E5; 27 border: 2px solid #E5E5E5;
28 background-color: #F5F5F5; 28 background-color: #F5F5F5;
29 margin-top: 5px; 29 margin-top: 5px;
30 padding: 10px; 30 padding: 10px;
31 width: 350px; 31 width: 350px;
32 } 32 }
33 .uploadifyError { 33 .uploadifyError {
34 border: 2px solid #FBCBBC !important; 34 border: 2px solid #FBCBBC !important;
35 background-color: #FDE5DD !important; 35 background-color: #FDE5DD !important;
36 } 36 }
37 .uploadifyQueueItem .cancel { 37 .uploadifyQueueItem .cancel {
38 float: right; 38 float: right;
39 } 39 }
40 .uploadifyProgress { 40 .uploadifyProgress {
41 background-color: #FFFFFF; 41 background-color: #FFFFFF;
42 border-top: 1px solid #808080; 42 border-top: 1px solid #808080;
43 border-left: 1px solid #808080; 43 border-left: 1px solid #808080;
44 border-right: 1px solid #C5C5C5; 44 border-right: 1px solid #C5C5C5;
45 border-bottom: 1px solid #C5C5C5; 45 border-bottom: 1px solid #C5C5C5;
46 margin-top: 10px; 46 margin-top: 10px;
47 width: 100%; 47 width: 100%;
48 } 48 }
49 .uploadifyProgressBar { 49 .uploadifyProgressBar {
50 background-color: #0099FF; 50 background-color: #0099FF;
51 width: 1px; 51 width: 1px;
52 height: 3px; 52 height: 3px;
53 } 53 }
...\ No newline at end of file ...\ No newline at end of file
......
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head> 3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>Uploadify Example Script</title> 5 <title>Uploadify Example Script</title>
6 <link href="/example/css/default.css" rel="stylesheet" type="text/css" /> 6 <link href="/example/css/default.css" rel="stylesheet" type="text/css" />
7 <link href="/example/css/uploadify.css" rel="stylesheet" type="text/css" /> 7 <link href="/example/css/uploadify.css" rel="stylesheet" type="text/css" />
8 <script type="text/javascript" src="/example/scripts/jquery-1.3.2.min.js"></script> 8 <script type="text/javascript" src="/example/scripts/jquery-1.3.2.min.js"></script>
9 <script type="text/javascript" src="/example/scripts/swfobject.js"></script> 9 <script type="text/javascript" src="/example/scripts/swfobject.js"></script>
10 <script type="text/javascript" src="/example/scripts/jquery.uploadify.v2.1.0.min.js"></script> 10 <script type="text/javascript" src="/example/scripts/jquery.uploadify.v2.1.0.min.js"></script>
11 <script type="text/javascript"> 11 <script type="text/javascript">
12 $(document).ready(function() { 12 $(document).ready(function() {
13 $("#uploadify").uploadify({ 13 $("#uploadify").uploadify({
14 'uploader' : 'scripts/uploadify.swf', 14 'uploader' : 'scripts/uploadify.swf',
15 'script' : 'scripts/uploadify.php', 15 'script' : 'scripts/uploadify.php',
16 'cancelImg' : 'cancel.png', 16 'cancelImg' : 'cancel.png',
17 'folder' : 'uploads', 17 'folder' : 'uploads',
18 'queueID' : 'fileQueue', 18 'queueID' : 'fileQueue',
19 'auto' : true, 19 'auto' : true,
20 'multi' : true 20 'multi' : true
21 }); 21 });
22 }); 22 });
23 </script> 23 </script>
24 </head> 24 </head>
25 25
26 <body> 26 <body>
27 <div id="fileQueue"></div> 27 <div id="fileQueue"></div>
28 <input type="file" name="uploadify" id="uploadify" /> 28 <input type="file" name="uploadify" id="uploadify" />
29 <p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p> 29 <p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p>
30 </body> 30 </body>
31 </html> 31 </html>
......
1 <?xml version="1.0" encoding="utf-8" ?> 1 <?xml version="1.0" encoding="utf-8" ?>
2 <dwsync> 2 <dwsync>
3 <file name="check.php" server="ftp.uploadify.com/www.uploadify.com/" local="128870002502195719" remote="128911633200000000" /> 3 <file name="check.php" server="ftp.uploadify.com/www.uploadify.com/" local="128870002502195719" remote="128911633200000000" />
4 <file name="expressInstall.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128886114740000000" remote="128911633200000000" /> 4 <file name="expressInstall.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128886114740000000" remote="128911633200000000" />
5 <file name="jquery-1.3.2.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128799223180000000" remote="128911633200000000" /> 5 <file name="jquery-1.3.2.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128799223180000000" remote="128911633200000000" />
6 <file name="jquery.uploadify.v2.0.0.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128911646622270000" remote="128911646400000000" /> 6 <file name="jquery.uploadify.v2.0.0.min.js" server="ftp.uploadify.com/www.uploadify.com/" local="128911646622270000" remote="128911646400000000" />
7 <file name="uploadify.php" server="ftp.uploadify.com/www.uploadify.com/" local="128907148701750000" remote="128911633200000000" /> 7 <file name="uploadify.php" server="ftp.uploadify.com/www.uploadify.com/" local="128907148701750000" remote="128911633200000000" />
8 <file name="uploadify.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128911508403330000" remote="128911633200000000" /> 8 <file name="uploadify.swf" server="ftp.uploadify.com/www.uploadify.com/" local="128911508403330000" remote="128911633200000000" />
9 <file name="swfobject.js" server="ftp.uploadify.com/www.uploadify.com/" local="128892320400000000" remote="128911637400000000" /> 9 <file name="swfobject.js" server="ftp.uploadify.com/www.uploadify.com/" local="128892320400000000" remote="128911637400000000" />
10 </dwsync> 10 </dwsync>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 /* 2 /*
3 Uploadify v2.1.0 3 Uploadify v2.1.0
4 Release Date: August 24, 2009 4 Release Date: August 24, 2009
5 5
6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
7 7
8 Permission is hereby granted, free of charge, to any person obtaining a copy 8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal 9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights 10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is 12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions: 13 furnished to do so, subject to the following conditions:
14 14
15 The above copyright notice and this permission notice shall be included in 15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software. 16 all copies or substantial portions of the Software.
17 17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE. 24 THE SOFTWARE.
25 */ 25 */
26 $fileArray = array(); 26 $fileArray = array();
27 foreach ($_POST as $key => $value) { 27 foreach ($_POST as $key => $value) {
28 if ($key != 'folder') { 28 if ($key != 'folder') {
29 if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) { 29 if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
30 $fileArray[$key] = $value; 30 $fileArray[$key] = $value;
31 } 31 }
32 } 32 }
33 } 33 }
34 echo json_encode($fileArray); 34 echo json_encode($fileArray);
35 ?> 35 ?>
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Uploadify v2.1.0 2 Uploadify v2.1.0
3 Release Date: August 24, 2009 3 Release Date: August 24, 2009
4 4
5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal 8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights 9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is 11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions: 12 furnished to do so, subject to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in 14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software. 15 all copies or substantial portions of the Software.
16 16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE. 23 THE SOFTWARE.
24 */ 24 */
25 25
26 if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)}; 26 if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)};
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 /* 2 /*
3 Uploadify v2.1.0 3 Uploadify v2.1.0
4 Release Date: August 24, 2009 4 Release Date: August 24, 2009
5 5
6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
7 7
8 Permission is hereby granted, free of charge, to any person obtaining a copy 8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal 9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights 10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is 12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions: 13 furnished to do so, subject to the following conditions:
14 14
15 The above copyright notice and this permission notice shall be included in 15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software. 16 all copies or substantial portions of the Software.
17 17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE. 24 THE SOFTWARE.
25 */ 25 */
26 if (!empty($_FILES)) { 26 if (!empty($_FILES)) {
27 $tempFile = $_FILES['Filedata']['tmp_name']; 27 $tempFile = $_FILES['Filedata']['tmp_name'];
28 $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; 28 $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
29 $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; 29 $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
30 30
31 // $fileTypes = str_replace('*.','',$_REQUEST['fileext']); 31 // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
32 // $fileTypes = str_replace(';','|',$fileTypes); 32 // $fileTypes = str_replace(';','|',$fileTypes);
33 // $typesArray = split('\|',$fileTypes); 33 // $typesArray = split('\|',$fileTypes);
34 // $fileParts = pathinfo($_FILES['Filedata']['name']); 34 // $fileParts = pathinfo($_FILES['Filedata']['name']);
35 35
36 // if (in_array($fileParts['extension'],$typesArray)) { 36 // if (in_array($fileParts['extension'],$typesArray)) {
37 // Uncomment the following line if you want to make the directory if it doesn't exist 37 // Uncomment the following line if you want to make the directory if it doesn't exist
38 // mkdir(str_replace('//','/',$targetPath), 0755, true); 38 // mkdir(str_replace('//','/',$targetPath), 0755, true);
39 39
40 move_uploaded_file($tempFile,$targetFile); 40 move_uploaded_file($tempFile,$targetFile);
41 echo "1"; 41 echo "1";
42 // } else { 42 // } else {
43 // echo 'Invalid file type.'; 43 // echo 'Invalid file type.';
44 // } 44 // }
45 } 45 }
46 ?> 46 ?>
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Uploadify v2.1.0 2 Uploadify v2.1.0
3 Release Date: August 24, 2009 3 Release Date: August 24, 2009
4 4
5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal 8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights 9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is 11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions: 12 furnished to do so, subject to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in 14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software. 15 all copies or substantial portions of the Software.
16 16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE. 23 THE SOFTWARE.
24 */ 24 */
25 25
26 if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)}; 26 if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+h+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+h+'\')"><img src="'+settings.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+k+l+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+h+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}return g}},uploadifyUpload:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,false)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)};
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 Uploadify v2.1.0 2 Uploadify v2.1.0
3 Release Date: August 24, 2009 3 Release Date: August 24, 2009
4 4
5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 5 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal 8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights 9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is 11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions: 12 furnished to do so, subject to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in 14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software. 15 all copies or substantial portions of the Software.
16 16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE. 23 THE SOFTWARE.
24 */ 24 */
25 .uploadifyQueueItem { 25 .uploadifyQueueItem {
26 font: 11px Verdana, Geneva, sans-serif; 26 font: 11px Verdana, Geneva, sans-serif;
27 border: 1px solid #E5E5E5; 27 border: 1px solid #E5E5E5;
28 background-color: #F5F5F5; 28 background-color: #F5F5F5;
29 margin-top: 5px; 29 margin-top: 5px;
30 padding: 10px; 30 padding: 10px;
31 width: 235px; 31 width: 235px;
32 margin-left:120px; 32 margin-left:120px;
33 font-size: 11px; 33 font-size: 11px;
34 } 34 }
35 .uploadifyError { 35 .uploadifyError {
36 border: 1px solid #FBCBBC !important; 36 border: 1px solid #FBCBBC !important;
37 background-color: #FDE5DD !important; 37 background-color: #FDE5DD !important;
38 } 38 }
39 .uploadifyQueueItem .cancel { 39 .uploadifyQueueItem .cancel {
40 float: right; 40 float: right;
41 margin-left:10px; 41 margin-left:10px;
42 } 42 }
43 .uploadifyProgress { 43 .uploadifyProgress {
44 background-color: #FFFFFF; 44 background-color: #FFFFFF;
45 border-top: 1px solid #808080; 45 border-top: 1px solid #808080;
46 border-left: 1px solid #808080; 46 border-left: 1px solid #808080;
47 border-right: 1px solid #C5C5C5; 47 border-right: 1px solid #C5C5C5;
48 border-bottom: 1px solid #C5C5C5; 48 border-bottom: 1px solid #C5C5C5;
49 margin-top: 10px; 49 margin-top: 10px;
50 width: 100%; 50 width: 100%;
51 } 51 }
52 .uploadifyProgressBar { 52 .uploadifyProgressBar {
53 background-color: #0099FF; 53 background-color: #0099FF;
54 width: 1px; 54 width: 1px;
55 height: 10px; 55 height: 10px;
56 } 56 }
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 /* 2 /*
3 Uploadify v2.1.0 3 Uploadify v2.1.0
4 Release Date: August 24, 2009 4 Release Date: August 24, 2009
5 5
6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels 6 Copyright (c) 2009 Ronnie Garcia, Travis Nickels
7 7
8 Permission is hereby granted, free of charge, to any person obtaining a copy 8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal 9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights 10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is 12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions: 13 furnished to do so, subject to the following conditions:
14 14
15 The above copyright notice and this permission notice shall be included in 15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software. 16 all copies or substantial portions of the Software.
17 17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE. 24 THE SOFTWARE.
25 */ 25 */
26 if (!empty($_FILES)) { 26 if (!empty($_FILES)) {
27 $tempFile = $_FILES['Filedata']['tmp_name']; 27 $tempFile = $_FILES['Filedata']['tmp_name'];
28 $targetPath = $_REQUEST['folder'] . '/'; 28 $targetPath = $_REQUEST['folder'] . '/';
29 $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; 29 $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
30 30
31 // $fileTypes = str_replace('*.','',$_REQUEST['fileext']); 31 // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
32 // $fileTypes = str_replace(';','|',$fileTypes); 32 // $fileTypes = str_replace(';','|',$fileTypes);
33 // $typesArray = split('\|',$fileTypes); 33 // $typesArray = split('\|',$fileTypes);
34 // $fileParts = pathinfo($_FILES['Filedata']['name']); 34 // $fileParts = pathinfo($_FILES['Filedata']['name']);
35 35
36 // if (in_array($fileParts['extension'],$typesArray)) { 36 // if (in_array($fileParts['extension'],$typesArray)) {
37 // Uncomment the following line if you want to make the directory if it doesn't exist 37 // Uncomment the following line if you want to make the directory if it doesn't exist
38 // mkdir(str_replace('//','/',$targetPath), 0755, true); 38 // mkdir(str_replace('//','/',$targetPath), 0755, true);
39 39
40 move_uploaded_file($tempFile,$targetFile); 40 move_uploaded_file($tempFile,$targetFile);
41 //echo "1"; 41 //echo "1";
42 // } else { 42 // } else {
43 // echo 'Invalid file type.'; 43 // echo 'Invalid file type.';
44 // } 44 // }
45 45
46 switch ($_FILES['Filedata']['error']) 46 switch ($_FILES['Filedata']['error'])
47 { 47 {
48 case 0: 48 case 0:
49 $msg = "No Error"; // comment this out if you don't want a message to appear on success. 49 $msg = "No Error"; // comment this out if you don't want a message to appear on success.
50 break; 50 break;
51 case 1: 51 case 1:
52 $msg = "The file is bigger than this PHP installation allows"; 52 $msg = "The file is bigger than this PHP installation allows";
53 break; 53 break;
54 case 2: 54 case 2:
55 $msg = "The file is bigger than this form allows"; 55 $msg = "The file is bigger than this form allows";
56 break; 56 break;
57 case 3: 57 case 3:
58 $msg = "Only part of the file was uploaded"; 58 $msg = "Only part of the file was uploaded";
59 break; 59 break;
60 case 4: 60 case 4:
61 $msg = "No file was uploaded"; 61 $msg = "No file was uploaded";
62 break; 62 break;
63 case 6: 63 case 6:
64 $msg = "Missing a temporary folder"; 64 $msg = "Missing a temporary folder";
65 break; 65 break;
66 case 7: 66 case 7:
67 $msg = "Failed to write file to disk"; 67 $msg = "Failed to write file to disk";
68 break; 68 break;
69 case 8: 69 case 8:
70 $msg = "File upload stopped by extension"; 70 $msg = "File upload stopped by extension";
71 break; 71 break;
72 default: 72 default:
73 $msg = "unknown error ".$_FILES['Filedata']['error']; 73 $msg = "unknown error ".$_FILES['Filedata']['error'];
74 break; 74 break;
75 } 75 }
76 76
77 if ( isset($msg) && $msg != "No Error" ) { 77 if ( isset($msg) && $msg != "No Error" ) {
78 $stringData = "Error: ".$_FILES['Filedata']['error']." Error Info: ".$msg; 78 $stringData = "Error: ".$_FILES['Filedata']['error']." Error Info: ".$msg;
79 } else { 79 } else {
80 $stringData = "1"; // This is required for onComplete to fire on Mac OSX 80 $stringData = "1"; // This is required for onComplete to fire on Mac OSX
81 } 81 }
82 echo $stringData; 82 echo $stringData;
83 83
84 } 84 }
85 85
86 86
87 ?> 87 ?>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 // item => array(default,description,[optiona/required],shortcode_available) 2 // item => array(default,description,[optiona/required],shortcode_available)
3 3
4 $config = array( 4 $config = array(
5 'default_gallery' => array('hg-gallery-general','Default Gallery slug name','optional',true) 5 'default_gallery' => array('hg-gallery-general','Default Gallery slug name','optional',true)
6 , 'image_approval' => array('yes','Does linking or uploading a new gallery image require moderator/admin approval? values: yes|no','optional',true) 6 , 'image_approval' => array('yes','Does linking or uploading a new gallery image require moderator/admin approval? values: yes|no','optional',true)
7 , 'video_approval' => array('no','Does linking or uploading a new gallery video require moderator/admin approval? values: yes|no','optional',true) 7 , 'video_approval' => array('no','Does linking or uploading a new gallery video require moderator/admin approval? values: yes|no','optional',true)
8 , 'items_per_page' => array('0','How many gallery items per page? 0 = show all','optional',true) 8 , 'items_per_page' => array('0','How many gallery items per page? 0 = show all','optional',true)
9 , 'youtube_account' => array('','YouTube account ID for uploading videos','required',false) 9 , 'youtube_account' => array('','YouTube account ID for uploading videos','required',false)
10 , 'youtube_pass' => array('','YouTube account password','required',false) 10 , 'youtube_pass' => array('','YouTube account password','required',false)
11 ); 11 );
12 ?> 12 ?>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 error_reporting(E_ALL ^ E_DEPRECATED); 2 error_reporting(E_ALL ^ E_DEPRECATED);
3 require_once("../../../../../wp-config.php"); 3 require_once("../../../../../wp-config.php");
4 4
5 function trace($d,$die = false) { 5 function trace($d,$die = false) {
6 print "<pre>"; 6 print "<pre>";
7 print_r($d); 7 print_r($d);
8 print "</pre>"; 8 print "</pre>";
9 if($die) { die('-- end of trace --'); } 9 if($die) { die('-- end of trace --'); }
10 } 10 }
11 11
12 12
13 function HybridGallery_GetAuthor($id = 0) { 13 function HybridGallery_GetAuthor($id = 0) {
14 if($id==0) { return "Guest"; } 14 if($id==0) { return "Guest"; }
15 $user_info = get_userdata($id); 15 $user_info = get_userdata($id);
16 return $user_info->display_name; 16 return $user_info->display_name;
17 } 17 }
18 18
19 function HybridGallery_MySQLDateToHuman($datetime = "", $format = "F j, Y @ H:i:s") { 19 function HybridGallery_MySQLDateToHuman($datetime = "", $format = "F j, Y @ H:i:s") {
20 20
21 $l = strlen($datetime); 21 $l = strlen($datetime);
22 if(!($l == 10 || $l == 19)) 22 if(!($l == 10 || $l == 19))
23 return 0; 23 return 0;
24 24
25 25
26 26
27 // 27 //
28 $date = $datetime; 28 $date = $datetime;
29 $hours = 0; 29 $hours = 0;
30 $minutes = 0; 30 $minutes = 0;
31 $seconds = 0; 31 $seconds = 0;
32 32
33 // DATETIME only 33 // DATETIME only
34 if($l == 19) 34 if($l == 19)
35 { 35 {
36 list($date, $time) = explode(" ", $datetime); 36 list($date, $time) = explode(" ", $datetime);
37 list($hours, $minutes, $seconds) = explode(":", $time); 37 list($hours, $minutes, $seconds) = explode(":", $time);
38 } 38 }
39 39
40 list($year, $month, $day) = explode("-", $date); 40 list($year, $month, $day) = explode("-", $date);
41 41
42 $newtimestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); 42 $newtimestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
43 43
44 return date($format, $newtimestamp); 44 return date($format, $newtimestamp);
45 } 45 }
46 46
47 $posts = array(); 47 $posts = array();
48 48
49 $args = array(); 49 $args = array();
50 $args['post_type'] = 'gallery'; 50 $args['post_type'] = 'gallery';
51 $args['post_status'] = 'publish'; 51 $args['post_status'] = 'publish';
52 $args['numberposts'] = -1; 52 $args['numberposts'] = -1;
53 $args['orderby'] = 'modified'; 53 $args['orderby'] = 'modified';
54 $args['order'] = 'DESC'; 54 $args['order'] = 'DESC';
55 $args['hbGalleries'] = 'hg-gallery-general'; 55 $args['hbGalleries'] = 'hg-gallery-general';
56 56
57 $i=0; 57 $i=0;
58 foreach(get_posts($args) as $post) { 58 foreach(get_posts($args) as $post) {
59 59
60 $postmeta = get_post_meta($post->ID,'_gallery_item_details',true); 60 $postmeta = get_post_meta($post->ID,'_gallery_item_details',true);
61 61
62 $post->gallery_type = $postmeta['gallery_type']; // image or video 62 $post->gallery_type = $postmeta['gallery_type']; // image or video
63 $post->filename = $postmeta['link']; // filename or URL 63 $post->filename = $postmeta['link']; // filename or URL
64 $post->link_type = $postmeta['source']; // linked of uploaded 64 $post->link_type = $postmeta['source']; // linked of uploaded
65 $post->author_name = HybridGallery_GetAuthor($post->post_author); 65 $post->author_name = HybridGallery_GetAuthor($post->post_author);
66 $post->human_date = HybridGallery_MySQLDateToHuman($post->post_date,"F j, Y @ H:i:s" ); 66 $post->human_date = HybridGallery_MySQLDateToHuman($post->post_date,"F j, Y @ H:i:s" );
67 $post->thumbnail = $postmeta['thumbnail']; 67 $post->thumbnail = $postmeta['thumbnail'];
68 $post->status = $postmeta['status']; 68 $post->status = $postmeta['status'];
69 69
70 $posts[] = $post; 70 $posts[] = $post;
71 71
72 $i++; 72 $i++;
73 } 73 }
74 74
75 echo json_encode($posts); 75 echo json_encode($posts);
76 76
77 ?> 77 ?>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 namespace Tz\WordPress\Tools\HybridGallery; 2 namespace Tz\WordPress\Tools\HybridGallery;
3 ?> 3 ?>
4 4
5 <div id="ChatterBox_AdminContainer" class="wrap"> 5 <div id="ChatterBox_AdminContainer" class="wrap">
6 <?php screen_icon(); ?> 6 <?php screen_icon(); ?>
7 <h2>Hybrid Gallery Settings</h2> 7 <h2>Hybrid Gallery Settings</h2>
8 8
9 <form method="post" action="options.php"> 9 <form method="post" action="options.php">
10 10
11 <?php 11 <?php
12 settings_fields(SETTINGS_NS); 12 settings_fields(SETTINGS_NS);
13 ?> 13 ?>
14 14
15 15
16 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> 16 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
17 <thead> 17 <thead>
18 <tr> 18 <tr>
19 <th scope="col" width="200" class="manage-column">Option</th> 19 <th scope="col" width="200" class="manage-column">Option</th>
20 <th scope="col" class="manage-column">Description/Usage</th> 20 <th scope="col" class="manage-column">Description/Usage</th>
21 <th scope="col" width="100" class="manage-column">Default Value</th> 21 <th scope="col" width="100" class="manage-column">Default Value</th>
22 <th scope="col" width="140" class="manage-column">Your Value</th> 22 <th scope="col" width="140" class="manage-column">Your Value</th>
23 </tr> 23 </tr>
24 </thead> 24 </thead>
25 <tbody> 25 <tbody>
26 <?php foreach($defaults as $option=>$item): 26 <?php foreach($defaults as $option=>$item):
27 $wp_option = SETTINGS_NS . '[' . $option . ']'; 27 $wp_option = SETTINGS_NS . '[' . $option . ']';
28 ?> 28 ?>
29 <tr> 29 <tr>
30 <td><strong><?php echo $option; ?></strong></td> 30 <td><strong><?php echo $option; ?></strong></td>
31 <td><?php echo $item[1]; ?><br /><span style="color:#999;"><?php echo ($item[2]=="optional") ? "(optional)" : "(required)"; ?></span> <?php if($item[3]):?><strong>Shortcode Usage:</strong> [HybridGallery <?php echo $option; ?>="<?php echo $item[0]; ?>"]<?php endif;?></td> 31 <td><?php echo $item[1]; ?><br /><span style="color:#999;"><?php echo ($item[2]=="optional") ? "(optional)" : "(required)"; ?></span> <?php if($item[3]):?><strong>Shortcode Usage:</strong> [HybridGallery <?php echo $option; ?>="<?php echo $item[0]; ?>"]<?php endif;?></td>
32 <td><?php echo $item[0]; ?></td> 32 <td><?php echo $item[0]; ?></td>
33 <td><input type="text" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$WP_Settings[$option]; ?>" style="width:120px;" /></td> 33 <td><input type="text" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$WP_Settings[$option]; ?>" style="width:120px;" /></td>
34 </tr> 34 </tr>
35 <?php endforeach; ?> 35 <?php endforeach; ?>
36 </tbody> 36 </tbody>
37 </table> 37 </table>
38 <p class="submit" style="margin-top:5px;padding-top:0px;"><input type="submit" class="button-primary" value="Save Changes" /></p> 38 <p class="submit" style="margin-top:5px;padding-top:0px;"><input type="submit" class="button-primary" value="Save Changes" /></p>
39 </form> 39 </form>
40 40
41 </div> 41 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 use Tz\WordPress\Tools\Notifications; 2 use Tz\WordPress\Tools\Notifications;
3 use Tz\WordPress\Tools\Notifications\Settings; 3 use Tz\WordPress\Tools\Notifications\Settings;
4 use Tz\WordPress\Tools; 4 use Tz\WordPress\Tools;
5 5
6 /* 6 /*
7 7
8 print "<pre>"; 8 print "<pre>";
9 print_r($notifications); 9 print_r($notifications);
10 print "</pre>"; 10 print "</pre>";
11 11
12 */ 12 */
13 13
14 ?> 14 ?>
15 <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" /> 15 <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" />
16 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.-1.4.2.min.js', __FILE__)?>"></script> 16 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.-1.4.2.min.js', __FILE__)?>"></script>
17 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.qtip-1.0.0-rc3.js', __FILE__)?>"></script> 17 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.qtip-1.0.0-rc3.js', __FILE__)?>"></script>
18 18
19 19
20 20
21 <div id="" class="wrap"> 21 <div id="" class="wrap">
22 <h2>Notifications</h2> 22 <h2>Notifications</h2>
23 23
24 <h3 class="table-caption">Scheduled Notifications</h3> 24 <h3 class="table-caption">Scheduled Notifications</h3>
25 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> 25 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
26 <thead> 26 <thead>
27 <tr> 27 <tr>
28 <th scope="col" class="manage-column">Description</th> 28 <th scope="col" class="manage-column">Description</th>
29 <th scope="col" width="200" class="manage-column">Execute Date/Time</th> 29 <th scope="col" width="200" class="manage-column">Execute Date/Time</th>
30 <th scope="col" width="200" class="manage-column">Send To</th> 30 <th scope="col" width="200" class="manage-column">Send To</th>
31 <th scope="col" width="60" class="manage-column">Email</th> 31 <th scope="col" width="60" class="manage-column">Email</th>
32 <th scope="col" width="60" class="manage-column">System</th> 32 <th scope="col" width="60" class="manage-column">System</th>
33 <th scope="col" width="200" class="manage-column">&nbsp;</th> 33 <th scope="col" width="200" class="manage-column">&nbsp;</th>
34 </tr> 34 </tr>
35 </thead> 35 </thead>
36 <tbody> 36 <tbody>
37 <?php foreach($notifications['scheduled'] as $entry): 37 <?php foreach($notifications['scheduled'] as $entry):
38 38
39 $sendto = $entry->sendto; 39 $sendto = $entry->sendto;
40 if(is_numeric($sendto)) { 40 if(is_numeric($sendto)) {
41 $sendto = Notifications\getGroups($sendto) . " Group"; 41 $sendto = Notifications\getGroups($sendto) . " Group";
42 } else { 42 } else {
43 $sendto = Notifications\get_field_lookup($sendto); 43 $sendto = Notifications\get_field_lookup($sendto);
44 } 44 }
45 45
46 ?> 46 ?>
47 <tr> 47 <tr>
48 <td><?php echo $entry->post_title; ?></td> 48 <td><?php echo $entry->post_title; ?></td>
49 <td><?php echo date("M j, Y @ h:i A",strtotime($entry->execute_date)); ?></td> 49 <td><?php echo date("M j, Y @ h:i A",strtotime($entry->execute_date)); ?></td>
50 <td><?php echo ucwords($sendto); ?></td> 50 <td><?php echo ucwords($sendto); ?></td>
51 <td><?php if ($entry->is_email): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td> 51 <td><?php if ($entry->is_email): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td>
52 <td><?php if ($entry->is_system): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td> 52 <td><?php if ($entry->is_system): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td>
53 <td> 53 <td>
54 54
55 <?php 55 <?php
56 56
57 if (strtotime($entry->execute_date) > current_time('timestamp')):?> 57 if (strtotime($entry->execute_date) > current_time('timestamp')):?>
58 <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> 58 <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a>
59 | <a href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" onclick="return confirm('Are you sure?');">delete</a></td> 59 | <a href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" onclick="return confirm('Are you sure?');">delete</a></td>
60 60
61 <?php else: ?> 61 <?php else: ?>
62 <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> | <em>In progress....</em> 62 <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> | <em>In progress....</em>
63 <?php endif; ?> 63 <?php endif; ?>
64 </tr> 64 </tr>
65 <?php endforeach; ?> 65 <?php endforeach; ?>
66 </tbody> 66 </tbody>
67 </table> 67 </table>
68 68
69 69
70 <h3 class="table-caption">System Triggered Notifications</h3> 70 <h3 class="table-caption">System Triggered Notifications</h3>
71 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> 71 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
72 <thead> 72 <thead>
73 <tr> 73 <tr>
74 <th scope="col" class="manage-column">Description</th> 74 <th scope="col" class="manage-column">Description</th>
75 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> 75 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
76 <th scope="col" width="200" class="manage-column">Trigger/Slug</th> 76 <th scope="col" width="200" class="manage-column">Trigger/Slug</th>
77 <?php endif; ?> 77 <?php endif; ?>
78 78
79 <th scope="col" width="60" class="manage-column">Email</th> 79 <th scope="col" width="60" class="manage-column">Email</th>
80 <th scope="col" width="60" class="manage-column">System</th> 80 <th scope="col" width="60" class="manage-column">System</th>
81 <th scope="col" width="200" class="manage-column">&nbsp;</th> 81 <th scope="col" width="200" class="manage-column">&nbsp;</th>
82 </tr> 82 </tr>
83 </thead> 83 </thead>
84 <tbody> 84 <tbody>
85 <?php foreach($notifications['triggered'] as $entry):?> 85 <?php foreach($notifications['triggered'] as $entry):?>
86 <tr> 86 <tr>
87 <td><?php echo $entry->post_title; ?></td> 87 <td><?php echo $entry->post_title; ?></td>
88 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> 88 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
89 <td><?php echo $entry->trigger; ?></td> 89 <td><?php echo $entry->trigger; ?></td>
90 <?php endif; ?> 90 <?php endif; ?>
91 91
92 <td><?php if ($entry->is_email): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td> 92 <td><?php if ($entry->is_email): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td>
93 <td><?php if ($entry->is_system): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td> 93 <td><?php if ($entry->is_system): ?><img src="<?php echo Tools\url('assets/images/accept.png', __FILE__)?>" /><?php endif;?></td>
94 94
95 <td><a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> 95 <td><a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a>
96 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> 96 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
97 | <a href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" onclick="return confirm('Are you sure?');">delete</a> 97 | <a href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" onclick="return confirm('Are you sure?');">delete</a>
98 <?php endif; ?> 98 <?php endif; ?>
99 </td> 99 </td>
100 </tr> 100 </tr>
101 <?php endforeach; ?> 101 <?php endforeach; ?>
102 </tbody> 102 </tbody>
103 </table> 103 </table>
104 104
105 105
106 </div> 106 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 h3.table-caption { padding:0; margin:25px 0 0px 0; } 1 h3.table-caption { padding:0; margin:25px 0 0px 0; }
2 .wide-input-field { width:350px;resize: none} 2 .wide-input-field { width:350px;resize: none}
3 3
4 .post-success { 4 .post-success {
5 padding:10px; 5 padding:10px;
6 font-size: 12px; 6 font-size: 12px;
7 background: #88c550; 7 background: #88c550;
8 color:#fff; 8 color:#fff;
9 } 9 }
10 .post-success a { color:#fff; text-decoration: underline;} 10 .post-success a { color:#fff; text-decoration: underline;}
11 .post-success a:hover { color:#3b0d32; text-decoration: none; } 11 .post-success a:hover { color:#3b0d32; text-decoration: none; }
12 12
13 table.expandable thead th { 13 table.expandable thead th {
14 cursor:pointer; 14 cursor:pointer;
15 } 15 }
16 16
17 table.expandable tbody { 17 table.expandable tbody {
18 background-color:#f5f5f5; 18 background-color:#f5f5f5;
19 } 19 }
20 20
21 table.expandable thead th.toggle h6 { 21 table.expandable thead th.toggle h6 {
22 background: transparent url(../images/open.png) left no-repeat; 22 background: transparent url(../images/open.png) left no-repeat;
23 padding:0 0 0 16px; 23 padding:0 0 0 16px;
24 24
25 font-size:11px; 25 font-size:11px;
26 margin:0; 26 margin:0;
27 line-height:1.3em; 27 line-height:1.3em;
28 28
29 } 29 }
30 30
31 table.expandable thead.open th.toggle h6 { 31 table.expandable thead.open th.toggle h6 {
32 background: transparent url(../images/close.png) left no-repeat; 32 background: transparent url(../images/close.png) left no-repeat;
33 } 33 }
34 34
35 #ui-timepicker-div { margin: 0px 10px; } 35 #ui-timepicker-div { margin: 0px 10px; }
36 #ui-timepicker-div dl{ text-align: left; } 36 #ui-timepicker-div dl{ text-align: left; }
37 #ui-timepicker-div dl dt{ height: 25px; font-size: 11px; } 37 #ui-timepicker-div dl dt{ height: 25px; font-size: 11px; }
38 #ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; font-size: 11px; } 38 #ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; font-size: 11px; }
39 39
40 .post-errors { border:1px solid red; background: pink;} 40 .post-errors { border:1px solid red; background: pink;}
41 .post-errors-title { padding: 8px 10px; color:#fff; background: red; font: italic 16px/18px Georgia,"Times New Roman","Bitstream Charter",Times,serif;} 41 .post-errors-title { padding: 8px 10px; color:#fff; background: red; font: italic 16px/18px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}
42 .post-errors-content { padding:10px; color:red; margin:0;} 42 .post-errors-content { padding:10px; color:red; margin:0;}
43 43
44 .lblError { font: italic 11px/16px Georgia,"Times New Roman","Bitstream Charter",Times,serif; color: red;} 44 .lblError { font: italic 11px/16px Georgia,"Times New Roman","Bitstream Charter",Times,serif; color: red;}
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php 1 <?php
2 namespace Tz\WordPress\Tools\Notifications\Settings; 2 namespace Tz\WordPress\Tools\Notifications\Settings;
3 ?> 3 ?>
4 4
5 <div id="" class="wrap"> 5 <div id="" class="wrap">
6 6
7 <h2>Notifications - Settings</h2> 7 <h2>Notifications - Settings</h2>
8 <p>In order to comply with the CAN-SPAM act, each outgoing email must include the following:</p> 8 <p>In order to comply with the CAN-SPAM act, each outgoing email must include the following:</p>
9 9
10 10
11 <form method="post" action="options.php"> 11 <form method="post" action="options.php">
12 <?php settings_fields(SETTING_NS); ?> 12 <?php settings_fields(SETTING_NS); ?>
13 13
14 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> 14 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
15 <thead> 15 <thead>
16 <tr> 16 <tr>
17 <th width="150">CAN-SPAM Settings</th> 17 <th width="150">CAN-SPAM Settings</th>
18 <th>&nbsp;</th> 18 <th>&nbsp;</th>
19 </tr> 19 </tr>
20 </thead> 20 </thead>
21 <tbody> 21 <tbody>
22 <tr> 22 <tr>
23 <td width="150">Company Name:</td> 23 <td width="150">Company Name:</td>
24 <?php $wp_option = SETTING_NS . '[company]'; ?> 24 <?php $wp_option = SETTING_NS . '[company]'; ?>
25 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['company'];?>" /></td> 25 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['company'];?>" /></td>
26 </tr> 26 </tr>
27 <tr> 27 <tr>
28 <td width="150">Address:</td> 28 <td width="150">Address:</td>
29 <?php $wp_option = SETTING_NS . '[address]'; ?> 29 <?php $wp_option = SETTING_NS . '[address]'; ?>
30 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['address'];?>" /></td> 30 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['address'];?>" /></td>
31 </tr> 31 </tr>
32 <tr> 32 <tr>
33 <td width="150">City:</td> 33 <td width="150">City:</td>
34 <?php $wp_option = SETTING_NS . '[city]'; ?> 34 <?php $wp_option = SETTING_NS . '[city]'; ?>
35 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['city'];?>" /></td> 35 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['city'];?>" /></td>
36 </tr> 36 </tr>
37 <tr> 37 <tr>
38 <td width="150">Province:</td> 38 <td width="150">Province:</td>
39 <td> 39 <td>
40 <?php $wp_option = SETTING_NS . '[province]'; ?> 40 <?php $wp_option = SETTING_NS . '[province]'; ?>
41 <select name="<?php echo $wp_option; ?>" class="wide-input-field" > 41 <select name="<?php echo $wp_option; ?>" class="wide-input-field" >
42 <option value="Ontario">Ontario</option> 42 <option value="Ontario">Ontario</option>
43 <option value="Quebec">Quebec</option> 43 <option value="Quebec">Quebec</option>
44 <option value="Nova Scotia">Nova Scotia</option> 44 <option value="Nova Scotia">Nova Scotia</option>
45 <option value="New Brunswick">New Brunswick</option> 45 <option value="New Brunswick">New Brunswick</option>
46 <option value="Manitoba">Manitoba</option> 46 <option value="Manitoba">Manitoba</option>
47 <option value="British Columbia">British Columbia</option> 47 <option value="British Columbia">British Columbia</option>
48 <option value="Prince Edward Island">Prince Edward Island</option> 48 <option value="Prince Edward Island">Prince Edward Island</option>
49 <option value="Saskatchewan">Saskatchewan</option> 49 <option value="Saskatchewan">Saskatchewan</option>
50 <option value="Alberta">Alberta</option> 50 <option value="Alberta">Alberta</option>
51 <option value="Newfoundland and Labrador">Newfoundland and Labrador</option> 51 <option value="Newfoundland and Labrador">Newfoundland and Labrador</option>
52 </select> 52 </select>
53 </td> 53 </td>
54 </tr> 54 </tr>
55 <tr> 55 <tr>
56 <td width="150">Postal Code:</td> 56 <td width="150">Postal Code:</td>
57 <?php $wp_option = SETTING_NS . '[postal]'; ?> 57 <?php $wp_option = SETTING_NS . '[postal]'; ?>
58 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['postal'];?>" /></td> 58 <td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['postal'];?>" /></td>
59 </tr> 59 </tr>
60 </body> 60 </body>
61 </table> 61 </table>
62 62
63 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> 63 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
64 <thead> 64 <thead>
65 <tr> 65 <tr>
66 <th width="150">CAN-SPAM Messages</th> 66 <th width="150">CAN-SPAM Messages</th>
67 <th>&nbsp;</th> 67 <th>&nbsp;</th>
68 </tr> 68 </tr>
69 </thead> 69 </thead>
70 <tbody> 70 <tbody>
71 <tr> 71 <tr>
72 <td width="150">Standard Message:</td><!-- --> 72 <td width="150">Standard Message:</td><!-- -->
73 <?php $wp_option = SETTING_NS . '[std_message]'; ?> 73 <?php $wp_option = SETTING_NS . '[std_message]'; ?>
74 <td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';"><?php echo Vars::$settings['std_message'];?></textarea></td> 74 <td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';"><?php echo Vars::$settings['std_message'];?></textarea></td>
75 </tr> 75 </tr>
76 <tr> 76 <tr>
77 <td width="150">OPT-OUT Message:</td><!-- --> 77 <td width="150">OPT-OUT Message:</td><!-- -->
78 <?php $wp_option = SETTING_NS . '[opt_message]'; ?> 78 <?php $wp_option = SETTING_NS . '[opt_message]'; ?>
79 <td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" ><?php echo Vars::$settings['opt_message'];?></textarea></td> 79 <td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" ><?php echo Vars::$settings['opt_message'];?></textarea></td>
80 </tr> 80 </tr>
81 </body> 81 </body>
82 </table> 82 </table>
83 83
84 <p> 84 <p>
85 <input type="submit" value=" Update " /> 85 <input type="submit" value=" Update " />
86 </p> 86 </p>
87 </form> 87 </form>
88 88
89 </div> 89 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 NEW CALLBACK FUNCTION: 1 NEW CALLBACK FUNCTION:
2 ====================== 2 ======================
3 3
4 We have had requests for a method to process the results of sending emails 4 We have had requests for a method to process the results of sending emails
5 through PHPMailer. In this new release, we have implemented a callback 5 through PHPMailer. In this new release, we have implemented a callback
6 function that passes the results of each email sent (to, cc, and/or bcc). 6 function that passes the results of each email sent (to, cc, and/or bcc).
7 We have provided an example that echos the results back to the screen. The 7 We have provided an example that echos the results back to the screen. The
8 callback function can be used for any purpose. With minor modifications, the 8 callback function can be used for any purpose. With minor modifications, the
9 callback function can be used to create CSV logs, post results to databases, 9 callback function can be used to create CSV logs, post results to databases,
10 etc. 10 etc.
11 11
12 Please review the test.php script for the example. 12 Please review the test.php script for the example.
13 13
14 It's pretty straight forward. 14 It's pretty straight forward.
15 15
16 Enjoy! 16 Enjoy!
17 Andy 17 Andy
......
1 CREATE DKIM KEYS and DNS Resource Record: 1 CREATE DKIM KEYS and DNS Resource Record:
2 ========================================= 2 =========================================
3 3
4 To create DomainKeys Identified Mail keys, visit: 4 To create DomainKeys Identified Mail keys, visit:
5 http://dkim.worxware.com/ 5 http://dkim.worxware.com/
6 ... read the information, fill in the form, and download the ZIP file 6 ... read the information, fill in the form, and download the ZIP file
7 containing the public key, private key, DNS Resource Record and instructions 7 containing the public key, private key, DNS Resource Record and instructions
8 to add to your DNS Zone Record, and the PHPMailer code to enable DKIM 8 to add to your DNS Zone Record, and the PHPMailer code to enable DKIM
9 digital signing. 9 digital signing.
10 10
11 /*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/ 11 /*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/
12 12
13 You need to protect your DKIM private and public keys from being viewed or 13 You need to protect your DKIM private and public keys from being viewed or
14 accessed. Add protection to your .htaccess file as in this example: 14 accessed. Add protection to your .htaccess file as in this example:
15 15
16 # secure htkeyprivate file 16 # secure htkeyprivate file
17 <Files .htkeyprivate> 17 <Files .htkeyprivate>
18 order allow,deny 18 order allow,deny
19 deny from all 19 deny from all
20 </Files> 20 </Files>
21 21
22 # secure htkeypublic file 22 # secure htkeypublic file
23 <Files .htkeypublic> 23 <Files .htkeypublic>
24 order allow,deny 24 order allow,deny
25 deny from all 25 deny from all
26 </Files> 26 </Files>
27 27
28 (the actual .htaccess additions are in the ZIP file sent back to you from 28 (the actual .htaccess additions are in the ZIP file sent back to you from
29 http://dkim.worxware.com/ 29 http://dkim.worxware.com/
30 30
31 A few notes on using DomainKey Identified Mail (DKIM): 31 A few notes on using DomainKey Identified Mail (DKIM):
32 32
33 You do not need to use PHPMailer to DKIM sign emails IF: 33 You do not need to use PHPMailer to DKIM sign emails IF:
34 - you enable DomainKey support and add the DNS resource record 34 - you enable DomainKey support and add the DNS resource record
35 - you use your outbound mail server 35 - you use your outbound mail server
36 36
37 If you are a third-party emailer that works on behalf of domain owners to 37 If you are a third-party emailer that works on behalf of domain owners to
38 send their emails from your own server: 38 send their emails from your own server:
39 - you absolutely have to DKIM sign outbound emails 39 - you absolutely have to DKIM sign outbound emails
40 - the domain owner has to add the DNS resource record to match the 40 - the domain owner has to add the DNS resource record to match the
41 private key, public key, selector, identity, and domain that you create 41 private key, public key, selector, identity, and domain that you create
42 - use caution with the "selector" ... at least one "selector" will already 42 - use caution with the "selector" ... at least one "selector" will already
43 exist in the DNS Zone Record of the domain at the domain owner's server 43 exist in the DNS Zone Record of the domain at the domain owner's server
44 you need to ensure that the "selector" you use is unique 44 you need to ensure that the "selector" you use is unique
45 Note: since the IP address will not match the domain owner's DNS Zone record 45 Note: since the IP address will not match the domain owner's DNS Zone record
46 you can be certain that email providers that validate based on DomainKey will 46 you can be certain that email providers that validate based on DomainKey will
47 check the domain owner's DNS Zone record for your DNS resource record. Before 47 check the domain owner's DNS Zone record for your DNS resource record. Before
48 sending out emails on behalf of domain owners, ensure they have entered the 48 sending out emails on behalf of domain owners, ensure they have entered the
49 DNS resource record you provided them. 49 DNS resource record you provided them.
50 50
51 Enjoy! 51 Enjoy!
52 Andy 52 Andy
53 53
54 PS. if you need additional information about DKIM, please see: 54 PS. if you need additional information about DKIM, please see:
55 http://www.dkim.org/info/dkim-faq.html 55 http://www.dkim.org/info/dkim-faq.html
......
1 If you are having problems connecting or sending emails through your SMTP server, please note: 1 If you are having problems connecting or sending emails through your SMTP server, please note:
2 2
3 1. The new rewrite of class.smtp.php provides more information about the processing/errors taking place 3 1. The new rewrite of class.smtp.php provides more information about the processing/errors taking place
4 2. Use the debug functionality of class.smtp.php. To do that, in your own script add the debug level you wish to use. An example of that is: 4 2. Use the debug functionality of class.smtp.php. To do that, in your own script add the debug level you wish to use. An example of that is:
5 5
6 $mail->SMTPDebug = 1; 6 $mail->SMTPDebug = 1;
7 $mail->IsSMTP(); // telling the class to use SMTP 7 $mail->IsSMTP(); // telling the class to use SMTP
8 $mail->SMTPAuth = true; // enable SMTP authentication 8 $mail->SMTPAuth = true; // enable SMTP authentication
9 $mail->Port = 26; // set the SMTP port 9 $mail->Port = 26; // set the SMTP port
10 $mail->Host = "mail.yourhost.com"; // SMTP server 10 $mail->Host = "mail.yourhost.com"; // SMTP server
11 $mail->Username = "name@yourhost.com"; // SMTP account username 11 $mail->Username = "name@yourhost.com"; // SMTP account username
12 $mail->Password = "your password"; // SMTP account password 12 $mail->Password = "your password"; // SMTP account password
13 13
14 Notes on this: 14 Notes on this:
15 $mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default 15 $mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default
16 $mail->SMTPDebug = 1; ... will echo errors and messages 16 $mail->SMTPDebug = 1; ... will echo errors and messages
17 $mail->SMTPDebug = 2; ... will echo messages only 17 $mail->SMTPDebug = 2; ... will echo messages only
18 ... and finally, the options are 0, 1, and 2 ... any number greater than 2 will be interpreted as 2 18 ... and finally, the options are 0, 1, and 2 ... any number greater than 2 will be interpreted as 2
19 19
20 And finally, don't forget to disable debugging before going into production. 20 And finally, don't forget to disable debugging before going into production.
21 21
22 Enjoy! 22 Enjoy!
23 Andy 23 Andy
...\ No newline at end of file ...\ No newline at end of file
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Examples using phpmailer</title> 3 <title>Examples using phpmailer</title>
4 </head> 4 </head>
5 5
6 <body bgcolor="#FFFFFF"> 6 <body bgcolor="#FFFFFF">
7 7
8 <h2>Examples using phpmailer</h2> 8 <h2>Examples using phpmailer</h2>
9 9
10 <h3>1. Advanced Example</h3> 10 <h3>1. Advanced Example</h3>
11 <p> 11 <p>
12 12
13 This demonstrates sending out multiple email messages with binary attachments 13 This demonstrates sending out multiple email messages with binary attachments
14 from a MySQL database with multipart/alternative support.<p> 14 from a MySQL database with multipart/alternative support.<p>
15 <table cellpadding="4" border="1" width="80%"> 15 <table cellpadding="4" border="1" width="80%">
16 <tr> 16 <tr>
17 <td bgcolor="#CCCCCC"> 17 <td bgcolor="#CCCCCC">
18 <pre> 18 <pre>
19 require("class.phpmailer.php"); 19 require("class.phpmailer.php");
20 20
21 $mail = new phpmailer(); 21 $mail = new phpmailer();
22 22
23 $mail->From = "list@example.com"; 23 $mail->From = "list@example.com";
24 $mail->FromName = "List manager"; 24 $mail->FromName = "List manager";
25 $mail->Host = "smtp1.example.com;smtp2.example.com"; 25 $mail->Host = "smtp1.example.com;smtp2.example.com";
26 $mail->Mailer = "smtp"; 26 $mail->Mailer = "smtp";
27 27
28 @MYSQL_CONNECT("localhost","root","password"); 28 @MYSQL_CONNECT("localhost","root","password");
29 @mysql_select_db("my_company"); 29 @mysql_select_db("my_company");
30 $query  = "SELECT full_name, email, photo FROM employee WHERE id=$id"; 30 $query  = "SELECT full_name, email, photo FROM employee WHERE id=$id";
31 $result = @MYSQL_QUERY($query); 31 $result = @MYSQL_QUERY($query);
32 32
33 while ($row = mysql_fetch_array ($result)) 33 while ($row = mysql_fetch_array ($result))
34 { 34 {
35 // HTML body 35 // HTML body
36 $body = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;"; 36 $body = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;";
37 $body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;"; 37 $body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";
38 $body .= "Sincerely, &lt;br&gt;"; 38 $body .= "Sincerely, &lt;br&gt;";
39 $body .= "phpmailer List manager"; 39 $body .= "phpmailer List manager";
40 40
41 // Plain text body (for mail clients that cannot read HTML) 41 // Plain text body (for mail clients that cannot read HTML)
42 $text_body = "Hello " . $row["full_name"] . ", \n\n"; 42 $text_body = "Hello " . $row["full_name"] . ", \n\n";
43 $text_body .= "Your personal photograph to this message.\n\n"; 43 $text_body .= "Your personal photograph to this message.\n\n";
44 $text_body .= "Sincerely, \n"; 44 $text_body .= "Sincerely, \n";
45 $text_body .= "phpmailer List manager"; 45 $text_body .= "phpmailer List manager";
46 46
47 $mail->Body = $body; 47 $mail->Body = $body;
48 $mail->AltBody = $text_body; 48 $mail->AltBody = $text_body;
49 $mail->AddAddress($row["email"], $row["full_name"]); 49 $mail->AddAddress($row["email"], $row["full_name"]);
50 $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg"); 50 $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
51 51
52 if(!$mail->Send()) 52 if(!$mail->Send())
53 echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;"; 53 echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;";
54 54
55 // Clear all addresses and attachments for next loop 55 // Clear all addresses and attachments for next loop
56 $mail->ClearAddresses(); 56 $mail->ClearAddresses();
57 $mail->ClearAttachments(); 57 $mail->ClearAttachments();
58 } 58 }
59 </pre> 59 </pre>
60 </td> 60 </td>
61 </tr> 61 </tr>
62 </table> 62 </table>
63 <p> 63 <p>
64 64
65 <h3>2. Extending phpmailer</h3> 65 <h3>2. Extending phpmailer</h3>
66 <p> 66 <p>
67 67
68 Extending classes with inheritance is one of the most 68 Extending classes with inheritance is one of the most
69 powerful features of object-oriented 69 powerful features of object-oriented
70 programming. It allows you to make changes to the 70 programming. It allows you to make changes to the
71 original class for your 71 original class for your
72 own personal use without hacking the original 72 own personal use without hacking the original
73 classes. Plus, it is very 73 classes. Plus, it is very
74 easy to do. I've provided an example: 74 easy to do. I've provided an example:
75 75
76 <p> 76 <p>
77 Here's a class that extends the phpmailer class and sets the defaults 77 Here's a class that extends the phpmailer class and sets the defaults
78 for the particular site:<br> 78 for the particular site:<br>
79 PHP include file: <b>mail.inc.php</b> 79 PHP include file: <b>mail.inc.php</b>
80 <p> 80 <p>
81 81
82 <table cellpadding="4" border="1" width="80%"> 82 <table cellpadding="4" border="1" width="80%">
83 <tr> 83 <tr>
84 <td bgcolor="#CCCCCC"> 84 <td bgcolor="#CCCCCC">
85 <pre> 85 <pre>
86 require("class.phpmailer.php"); 86 require("class.phpmailer.php");
87 87
88 class my_phpmailer extends phpmailer { 88 class my_phpmailer extends phpmailer {
89 // Set default variables for all new objects 89 // Set default variables for all new objects
90 var $From = "from@example.com"; 90 var $From = "from@example.com";
91 var $FromName = "Mailer"; 91 var $FromName = "Mailer";
92 var $Host = "smtp1.example.com;smtp2.example.com"; 92 var $Host = "smtp1.example.com;smtp2.example.com";
93 var $Mailer = "smtp"; // Alternative to IsSMTP() 93 var $Mailer = "smtp"; // Alternative to IsSMTP()
94 var $WordWrap = 75; 94 var $WordWrap = 75;
95 95
96 // Replace the default error_handler 96 // Replace the default error_handler
97 function error_handler($msg) { 97 function error_handler($msg) {
98 print("My Site Error"); 98 print("My Site Error");
99 print("Description:"); 99 print("Description:");
100 printf("%s", $msg); 100 printf("%s", $msg);
101 exit; 101 exit;
102 } 102 }
103 103
104 // Create an additional function 104 // Create an additional function
105 function do_something($something) { 105 function do_something($something) {
106 // Place your new code here 106 // Place your new code here
107 } 107 }
108 } 108 }
109 </td> 109 </td>
110 </tr> 110 </tr>
111 </table> 111 </table>
112 <br> 112 <br>
113 113
114 Now here's a normal PHP page in the site, which will have all the defaults set 114 Now here's a normal PHP page in the site, which will have all the defaults set
115 above:<br> 115 above:<br>
116 Normal PHP file: <b>mail_test.php</b> 116 Normal PHP file: <b>mail_test.php</b>
117 <p> 117 <p>
118 118
119 <table cellpadding="4" border="1" width="80%"> 119 <table cellpadding="4" border="1" width="80%">
120 <tr> 120 <tr>
121 <td bgcolor="#CCCCCC"> 121 <td bgcolor="#CCCCCC">
122 <pre> 122 <pre>
123 require("mail.inc.php"); 123 require("mail.inc.php");
124 124
125 // Instantiate your new class 125 // Instantiate your new class
126 $mail = new my_phpmailer; 126 $mail = new my_phpmailer;
127 127
128 // Now you only need to add the necessary stuff 128 // Now you only need to add the necessary stuff
129 $mail->AddAddress("josh@example.com", "Josh Adams"); 129 $mail->AddAddress("josh@example.com", "Josh Adams");
130 $mail->Subject = "Here is the subject"; 130 $mail->Subject = "Here is the subject";
131 $mail->Body = "This is the message body"; 131 $mail->Body = "This is the message body";
132 $mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name 132 $mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name
133 133
134 if(!$mail->Send()) 134 if(!$mail->Send())
135 { 135 {
136 echo "There was an error sending the message"; 136 echo "There was an error sending the message";
137 exit; 137 exit;
138 } 138 }
139 139
140 echo "Message was sent successfully"; 140 echo "Message was sent successfully";
141 </pre> 141 </pre>
142 </td> 142 </td>
143 </tr> 143 </tr>
144 </table> 144 </table>
145 </p> 145 </p>
146 146
147 </body> 147 </body>
148 </html> 148 </html>
......