d099838c by Insu Mun

Fix line endings.

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