diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..93c4b27b4 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: processing +custom: https://processingfoundation.org/ diff --git a/.gitignore b/.gitignore index 367672981..27c953a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ about/ contrib_generate/contribs.txt # File now built on the server side; don't need to track here contrib_generate/contributions.txt # File now built on the server side; don't need to track here *~ +/bin/ diff --git a/README.md b/README.md index c0183179c..60a674da3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ +> ⚠️ This repository is now deprecated and will be archived soon. If you have any issues or want to submit a pull request, please direct them to the [processing-website](https://github.com/processing/processing-website) repo. Make sure to check the [README](https://github.com/processing/processing-website/blob/main/README.md) for information on how to contribute to the documentation. + + + Processing Documentation ========== -This is the official source code for the Processing reference, examples, tutorials, and [processing.org](http://processing.org) web site. +~~This is the official source code for the Processing reference, examples, tutorials, and [processing.org](http://processing.org) web site.~~ -If you have found an error in the Processing reference, examples, tutorials, or website you can file it here under the ["issues" tab](https://github.com/processing/processing-docs/issues). +~~If you have found an error in the Processing reference, examples, tutorials, or website you can file it here under the ["issues" tab](https://github.com/processing/processing-docs/issues).~~ -The [processing](https://github.com/processing/processing) repository contains the source code for Processing itself. (Please use that link to file issues regarding the Processing software.) +~~The [processing](https://github.com/processing/processing) repository contains the source code for Processing itself. (Please use that link to file issues regarding the Processing software.)~~ diff --git a/config-f.php b/config-f.php deleted file mode 100644 index 500644b22..000000000 --- a/config-f.php +++ /dev/null @@ -1,47 +0,0 @@ - array('English', 'utf-8', true, $domain) //, - //'zh' => array('Chinese Traditional', 'big5', false, $domain."zh/"), - //'zh-cn' => array('Chinese Simplified', 'GB2312', false, $domain."zh-cn/"), - //'fr' => array('French', 'utf-8', true, $domain."fr/"), - //'id' => array('Indonesian', 'utf-8', false, $domain."id/"), - //'it' => array('Italian', 'utf-8', true, $domain."it/"), - //'jp' => array('Japanese', 'Shift_JIS', false, 'http://stage.itp.tsoa.nyu.edu/~tk403/proce55ing_reference_jp/'), - //'kn' => array('Korean', 'utf-8', false, 'http://www.nabi.or.kr/processing/'), - //'es' => array('Spanish', 'utf-8', true, $domain."es/"), - //'tr' => array('Turkish', 'ISO-8859-9', true, $domain."tr/"), - //'he' => array('Hebrew', 'Windows-1255', false, ''), - //'ru' => array('Russian', 'ISO-8859-5', false, ''), - //'pl' => array('Polish', 'ISO-8859-2', false, '') - ); -// Langauges with finished references available to the public -$FINISHED = array('en'); - -// for reference index formatting -$break_before = array('Shape', 'Color'); - -?> \ No newline at end of file diff --git a/content/api_en/LIB_io/GPIO_digitalRead.xml b/content/api_en/LIB_io/GPIO_digitalRead.xml index 2efc9fbb1..4a8c8d36d 100755 --- a/content/api_en/LIB_io/GPIO_digitalRead.xml +++ b/content/api_en/LIB_io/GPIO_digitalRead.xml @@ -14,20 +14,21 @@
-You can use noInterrupts() and interrupts() in tandem to make sure no interrupts are occuring while your sketch is doing a particular task. By default, interrupts are enabled. +You can use noInterrupts() and interrupts() in tandem to make sure no interrupts are occuring while your sketch is doing a particular task. By default, interrupts are enabled. ]]> diff --git a/content/api_en/LIB_io/GPIO_pinMode.xml b/content/api_en/LIB_io/GPIO_pinMode.xml index bbc5de5d0..be923c726 100755 --- a/content/api_en/LIB_io/GPIO_pinMode.xml +++ b/content/api_en/LIB_io/GPIO_pinMode.xml @@ -14,20 +14,21 @@ +Configures a pin to act either as input (INPUT), or input with internal pull-up resistor (INPUT_PULLUP), or input with internal pull-down resistor (INPUT_PULLDOWN) or output (OUTPUT)

Unlike on Arduino, where pins are implicitly set to inputs by default, it is necessary -to call this function for any pin you want to access, including input pins. +to call this function for any pin you want to access, including input pins.
+
+Pull-up and pull-down resistors are very useful when connecting buttons and switches, since they will force the value of the pin in a specified electrical state when no electrical connection is made, and the pin would otherwise be left "floating".
+
+The ability to set (and clear) pull-up and pull-down resistors is currently limited to the Raspberry Pi running the Raspbian distribution. On other systems, a warning will be shown. ]]>
diff --git a/content/api_en/LIB_io/GPIO_waitForInterrupt.xml b/content/api_en/LIB_io/GPIO_waitFor.xml similarity index 58% rename from content/api_en/LIB_io/GPIO_waitForInterrupt.xml rename to content/api_en/LIB_io/GPIO_waitFor.xml index 6bdc62287..d94c87a64 100755 --- a/content/api_en/LIB_io/GPIO_waitForInterrupt.xml +++ b/content/api_en/LIB_io/GPIO_waitFor.xml @@ -1,7 +1,7 @@ -waitForInterrupt() +waitFor() I/O @@ -20,14 +20,16 @@ void setup() { // trigger a reset of an external device with GPIO 4 GPIO.digitalWrite(4, GPIO.HIGH); + // wait for the device signalling us that it's ready // by pulling up our pin 5 - boolean success = GPIO.waitForInterrupt(5, GPIO.RISING, 1000); - if (!success) { - println("Device didn't wake up in time"); - exit(); - } - // do something else... + GPIO.waitFor(5, GPIO.RISING, 1000); + // if this takes longer than 1000ms an exception will be raised + + // GPIO.waitFor(5, GPIO.RISING); + // would alternatively wait indefinitely + + // ... } ]]>
@@ -36,14 +38,13 @@ void setup() {
-The mode parameter determines when the function will return: GPIO.FALLING occurs when the level changes from high to low, GPIO.RISING when the level changes from low -to high, and GPIO.CHANGE when either occurs.
+The mode parameter determines when the function will return: GPIO.FALLING occurs when the level changes from high to low, GPIO.RISING when the level changes from low to high, and GPIO.CHANGE when either occurs.

-This function returns true if the change, false if the timeout occured. +The optional timeout parameter determines how many milliseconds the function will wait at the most. If the value of the input pin hasn't changed at this point, an exception is raised for this line. Without a timeout parameter the function will wait indefinitely until the input pin has changed to the desired state. ]]>
-GPIO.waitForInterrupt() +GPIO.waitFor() diff --git a/content/api_en/LIB_io/LED.xml b/content/api_en/LIB_io/LED.xml index 286d1c56b..12f9fa0f7 100755 --- a/content/api_en/LIB_io/LED.xml +++ b/content/api_en/LIB_io/LED.xml @@ -17,17 +17,20 @@ LED greenLed; boolean ledOn = false; void setup() { + // list all available LEDs + printArray(LED.list()); + // the green LED is led0 on the Raspberry Pi - greenLed = new LED(LED.list()[0]); + greenLed = new LED("led0"); frameRate(0.5); } void draw() { ledOn = !ledOn; if (ledOn) { - greenLed.set(1.0); + greenLed.brightness(1.0); } else { - greenLed.set(0.0); + greenLed.brightness(0.0); } } diff --git a/content/api_en/LIB_io/LED_brightness.xml b/content/api_en/LIB_io/LED_brightness.xml index c6d5f675d..3696d5f7f 100755 --- a/content/api_en/LIB_io/LED_brightness.xml +++ b/content/api_en/LIB_io/LED_brightness.xml @@ -18,16 +18,16 @@ boolean ledOn = false; void setup() { // the green LED is led0 on the Raspberry Pi - greenLed = new LED(LED.list()[0]); + greenLed = new LED("led0"); frameRate(0.5); } void draw() { ledOn = !ledOn; if (ledOn) { - greenLed.set(1.0); + greenLed.brightness(1.0); } else { - greenLed.set(0.0); + greenLed.brightness(0.0); } } diff --git a/content/api_en/LIB_io/LED_close.xml b/content/api_en/LIB_io/LED_close.xml index 3b6d993a4..a49e9d1cf 100755 --- a/content/api_en/LIB_io/LED_close.xml +++ b/content/api_en/LIB_io/LED_close.xml @@ -18,16 +18,16 @@ boolean ledOn = false; void setup() { // the green LED is led0 on the Raspberry Pi - greenLed = new LED(LED.list()[0]); + greenLed = new LED("led0"); frameRate(1); } void draw() { ledOn = !ledOn; if (ledOn) { - greenLed.set(1.0); + greenLed.brightness(1.0); } else { - greenLed.set(0.0); + greenLed.brightness(0.0); } } diff --git a/content/api_en/LIB_io/PWM_set.xml b/content/api_en/LIB_io/PWM_set.xml index 5437657b2..f21b3bfba 100755 --- a/content/api_en/LIB_io/PWM_set.xml +++ b/content/api_en/LIB_io/PWM_set.xml @@ -17,7 +17,9 @@ +
+When no period is specified, a default 1 kHz (1000 Hz) is used. ]]>
diff --git a/content/api_en/LIB_io/index.html b/content/api_en/LIB_io/index.html index f0cb8656d..2637f8462 100755 --- a/content/api_en/LIB_io/index.html +++ b/content/api_en/LIB_io/index.html @@ -28,7 +28,7 @@
GPIO
noInterrupts()
interrupts()
releaseInterrupt()
- waitForInterrupt()
+ waitFor()
releasePin()

diff --git a/content/api_en/LIB_net/clientEvent.xml b/content/api_en/LIB_net/clientEvent.xml index b71892510..d831f37a4 100755 --- a/content/api_en/LIB_net/clientEvent.xml +++ b/content/api_en/LIB_net/clientEvent.xml @@ -19,25 +19,27 @@ int dataIn; void setup() { size(200, 200); myClient = new Client(this, "127.0.0.1", 5204); + noLoop(); } -void draw() { } // Empty draw keeps the program running +void draw() { + background(dataIn); +} -// ClientEvent message is generated when the server -// sends data to an existing client. +// ClientEvent message is generated when the +// server sends data to an existing client. void clientEvent(Client someClient) { print("Server Says: "); - dataIn = myClient.read(); + dataIn = someClient.read(); println(dataIn); - background(dataIn); - + redraw(); } ]]>
diff --git a/content/api_en/LIB_sound/AudioDevice.xml b/content/api_en/LIB_sound/AudioDevice.xml index 5bb214dba..1172dc020 100755 --- a/content/api_en/LIB_sound/AudioDevice.xml +++ b/content/api_en/LIB_sound/AudioDevice.xml @@ -4,7 +4,7 @@ Sound -I/O +Configuration Application @@ -29,16 +29,6 @@ void draw() { Audio Device allows for configuring the audio server. If you need a low latency server you can reduce the buffer size. Allowed values are power of 2. For changing the sample rate pass the appropriate value in the constructor. ]]> - - - - - - - - - - AudioDevice(parent, samplerate, buffersize) @@ -57,10 +47,8 @@ AudioDevice(parent, samplerate, buffersize) int: buffersize (i.e. 32/64/128 ..) - - - +Sound 1.0 diff --git a/content/api_en/LIB_sound/AudioSample.xml b/content/api_en/LIB_sound/AudioSample.xml new file mode 100755 index 000000000..053be266c --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample.xml @@ -0,0 +1,49 @@ + + +AudioSample + +Sound + +Audio Files + +Application + + + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_amp.xml b/content/api_en/LIB_sound/AudioSample_amp.xml new file mode 100644 index 000000000..7a1181b3e --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_amp.xml @@ -0,0 +1,42 @@ + + + +play() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_channels.xml b/content/api_en/LIB_sound/AudioSample_channels.xml new file mode 100755 index 000000000..af430a14d --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_channels.xml @@ -0,0 +1,40 @@ + + + +channels() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_cue.xml b/content/api_en/LIB_sound/AudioSample_cue.xml new file mode 100755 index 000000000..c4eae7ace --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_cue.xml @@ -0,0 +1,37 @@ + + + +cue() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_duration.xml b/content/api_en/LIB_sound/AudioSample_duration.xml new file mode 100755 index 000000000..b083d3e47 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_duration.xml @@ -0,0 +1,38 @@ + + + +duration() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_frames.xml b/content/api_en/LIB_sound/AudioSample_frames.xml new file mode 100755 index 000000000..c58a3c077 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_frames.xml @@ -0,0 +1,36 @@ + + + +frames() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_isPlaying.xml b/content/api_en/LIB_sound/AudioSample_isPlaying.xml new file mode 100755 index 000000000..9a7ab422b --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_isPlaying.xml @@ -0,0 +1,45 @@ + + + +isPlaying() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_jump.xml b/content/api_en/LIB_sound/AudioSample_jump.xml new file mode 100755 index 000000000..290eb7cfd --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_jump.xml @@ -0,0 +1,36 @@ + + + +jump() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_loop.xml b/content/api_en/LIB_sound/AudioSample_loop.xml new file mode 100644 index 000000000..f95b7e484 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_loop.xml @@ -0,0 +1,40 @@ + + + +loop() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_pan.xml b/content/api_en/LIB_sound/AudioSample_pan.xml new file mode 100755 index 000000000..7b2b176db --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_pan.xml @@ -0,0 +1,38 @@ + + + +pan() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_pause.xml b/content/api_en/LIB_sound/AudioSample_pause.xml new file mode 100755 index 000000000..67ece9ab7 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_pause.xml @@ -0,0 +1,51 @@ + + + +pause() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_play.xml b/content/api_en/LIB_sound/AudioSample_play.xml new file mode 100755 index 000000000..d1584ae38 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_play.xml @@ -0,0 +1,40 @@ + + + +play() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_rate.xml b/content/api_en/LIB_sound/AudioSample_rate.xml new file mode 100755 index 000000000..fbe8dc446 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_rate.xml @@ -0,0 +1,47 @@ + + + +rate() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_read.xml b/content/api_en/LIB_sound/AudioSample_read.xml new file mode 100755 index 000000000..b21fc039a --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_read.xml @@ -0,0 +1,56 @@ + + + +read() + +Sound Files + + + +Web & Application + + + + + + + + + +AudioSample.frames() + + diff --git a/content/api_en/LIB_sound/AudioSample_resize.xml b/content/api_en/LIB_sound/AudioSample_resize.xml new file mode 100755 index 000000000..d326abdc6 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_resize.xml @@ -0,0 +1,40 @@ + + + +resize() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_sampleRate.xml b/content/api_en/LIB_sound/AudioSample_sampleRate.xml new file mode 100755 index 000000000..b67c1fb85 --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_sampleRate.xml @@ -0,0 +1,37 @@ + + + +sampleRate() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/AudioSample_write.xml b/content/api_en/LIB_sound/AudioSample_write.xml new file mode 100755 index 000000000..e8cfbeb4c --- /dev/null +++ b/content/api_en/LIB_sound/AudioSample_write.xml @@ -0,0 +1,49 @@ + + + +write() + +Sound Files + + + +Web & Application + + + + + + + + + +AudioSample.read + + diff --git a/content/api_en/LIB_sound/BrownNoise.xml b/content/api_en/LIB_sound/BrownNoise.xml index 72c8fe79b..f8b95cac7 100755 --- a/content/api_en/LIB_sound/BrownNoise.xml +++ b/content/api_en/LIB_sound/BrownNoise.xml @@ -29,66 +29,7 @@ void draw() { - - - - - - - - -play() -Start the generator - - - -stop() -Stop the generator - - - -amp() -Change the amplitude/volume of the generator - - - -add() -Offset the output of the generator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -BrownNoise(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/BrownNoise_add.xml b/content/api_en/LIB_sound/BrownNoise_add.xml index ec5550347..d00869e8d 100755 --- a/content/api_en/LIB_sound/BrownNoise_add.xml +++ b/content/api_en/LIB_sound/BrownNoise_add.xml @@ -35,19 +35,4 @@ void draw() { The .add() method is useful for modulating other audio signals. ]]> - -noise.add(add) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/BrownNoise_amp.xml b/content/api_en/LIB_sound/BrownNoise_amp.xml index edb349c7d..4264c2f4b 100755 --- a/content/api_en/LIB_sound/BrownNoise_amp.xml +++ b/content/api_en/LIB_sound/BrownNoise_amp.xml @@ -35,24 +35,4 @@ void draw() { Changes the amplitude/volume of the noise generator. Allowed values are between 0.0 and 1.0. ]]> - -noise.amp(vol) - - - - - - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/BrownNoise_pan.xml b/content/api_en/LIB_sound/BrownNoise_pan.xml index 71043d021..6644626fd 100755 --- a/content/api_en/LIB_sound/BrownNoise_pan.xml +++ b/content/api_en/LIB_sound/BrownNoise_pan.xml @@ -36,19 +36,4 @@ void draw() { Pan the generator in a stereo panorama. -1.0 pans to the left channel and 1.0 to the right channel. ]]> - -noise.pan(pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/BrownNoise_play.xml b/content/api_en/LIB_sound/BrownNoise_play.xml index 9a1c30f40..915d8cfcb 100755 --- a/content/api_en/LIB_sound/BrownNoise_play.xml +++ b/content/api_en/LIB_sound/BrownNoise_play.xml @@ -34,19 +34,4 @@ void draw() { Starts the Brown Noise generator. ]]> - -noise.play() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/BrownNoise_set.xml b/content/api_en/LIB_sound/BrownNoise_set.xml index 1ace27281..a24a1c3ef 100755 --- a/content/api_en/LIB_sound/BrownNoise_set.xml +++ b/content/api_en/LIB_sound/BrownNoise_set.xml @@ -41,19 +41,4 @@ void mousePressed() { Sets amplitude, add and pan position with one method. ]]> - -noise.set(amp, add, pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/BrownNoise_stop.xml b/content/api_en/LIB_sound/BrownNoise_stop.xml index 849ca5f8d..6111b73ae 100755 --- a/content/api_en/LIB_sound/BrownNoise_stop.xml +++ b/content/api_en/LIB_sound/BrownNoise_stop.xml @@ -38,19 +38,4 @@ void mousePressed() { Stops the Brown Noise generator. ]]> - -noise.stop() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/FFT_analyze.xml b/content/api_en/LIB_sound/FFT_analyze.xml index 6c05e7396..4bd4c1bfa 100755 --- a/content/api_en/LIB_sound/FFT_analyze.xml +++ b/content/api_en/LIB_sound/FFT_analyze.xml @@ -41,34 +41,14 @@ void draw() { for(int i = 0; i < bands; i++){ // The result of the FFT is normalized // draw the line for frequency band i scaling it up by 5 to get more amplitude. - line( i, height, i, height - spectrum[i]*height*5 ); + line(i, height, i, height - spectrum[i]*height*5 ); } } ]]> - -amp.analyze() - - - - - - - -float - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise.xml b/content/api_en/LIB_sound/PinkNoise.xml index 59f26ae9a..fd74f29e5 100755 --- a/content/api_en/LIB_sound/PinkNoise.xml +++ b/content/api_en/LIB_sound/PinkNoise.xml @@ -29,66 +29,7 @@ void draw() { - - - - - - - - -play() -Start the generator - - - -stop() -Stop the generator - - - -amp() -Change the amplitude/volume of the generator - - - -add() -Offset the output of the generator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -WhiteNoise(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/PinkNoise_add.xml b/content/api_en/LIB_sound/PinkNoise_add.xml index 999b05183..28de64b97 100755 --- a/content/api_en/LIB_sound/PinkNoise_add.xml +++ b/content/api_en/LIB_sound/PinkNoise_add.xml @@ -35,19 +35,4 @@ void draw() { The .add() method is useful for modulating other audio signals. ]]> - -noise.add(add) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise_amp.xml b/content/api_en/LIB_sound/PinkNoise_amp.xml index 14e8a8745..67e87cc56 100755 --- a/content/api_en/LIB_sound/PinkNoise_amp.xml +++ b/content/api_en/LIB_sound/PinkNoise_amp.xml @@ -35,24 +35,4 @@ void draw() { Changes the amplitude/volume of the noise generator. Allowed values are between 0.0 and 1.0. ]]> - -noise.amp(vol) - - - - - - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise_pan.xml b/content/api_en/LIB_sound/PinkNoise_pan.xml index d786b649b..10bb0cf09 100755 --- a/content/api_en/LIB_sound/PinkNoise_pan.xml +++ b/content/api_en/LIB_sound/PinkNoise_pan.xml @@ -36,19 +36,4 @@ void draw() { Pan the generator in a stereo panorama. -1.0 pans to the left channel and 1.0 to the right channel. ]]> - -noise.pan(pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise_play.xml b/content/api_en/LIB_sound/PinkNoise_play.xml index 9cf795d7d..c40593f4d 100755 --- a/content/api_en/LIB_sound/PinkNoise_play.xml +++ b/content/api_en/LIB_sound/PinkNoise_play.xml @@ -34,19 +34,4 @@ void draw() { Starts the Pink Noise generator. ]]> - -noise.play() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise_set.xml b/content/api_en/LIB_sound/PinkNoise_set.xml index ff84919dc..9914d239f 100755 --- a/content/api_en/LIB_sound/PinkNoise_set.xml +++ b/content/api_en/LIB_sound/PinkNoise_set.xml @@ -41,19 +41,4 @@ void mousePressed() { Sets amplitude, add and pan position with one method. ]]> - -noise.set(amp, add, pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/PinkNoise_stop.xml b/content/api_en/LIB_sound/PinkNoise_stop.xml index 2e0db52be..f9bc7dca5 100755 --- a/content/api_en/LIB_sound/PinkNoise_stop.xml +++ b/content/api_en/LIB_sound/PinkNoise_stop.xml @@ -38,19 +38,4 @@ void mousePressed() { Stops the Pink Noise generator. ]]> - -noise.stop() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/Pulse.xml b/content/api_en/LIB_sound/Pulse.xml index 2bae58c81..e1b4402cd 100755 --- a/content/api_en/LIB_sound/Pulse.xml +++ b/content/api_en/LIB_sound/Pulse.xml @@ -9,7 +9,7 @@ Application - +../../../images/LIB_sound_Pulse.png - - - - - - - - -play() -Start the oscillator - - - -stop() -Stop the oscillator - - - -freq() -Change the frequency of the oscillator - - - -width() -Change the pulse width of the oscillator - - - -amp() -Change the amplitude/volume of the oscillator - - - -add() -Offset the output of the oscillator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -Pulse(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/SawOsc.xml b/content/api_en/LIB_sound/SawOsc.xml index 514326e8f..979ca1bb5 100755 --- a/content/api_en/LIB_sound/SawOsc.xml +++ b/content/api_en/LIB_sound/SawOsc.xml @@ -9,7 +9,7 @@ Application - +../../../images/LIB_sound_SawOsc.png - - - - - - - - -play() -Start the oscillator - - - -stop() -Stop the oscillator - - - -freq() -Change the frequency of the oscillator - - - -amp() -Change the amplitude/volume of the oscillator - - - -add() -Offset the output of the oscillator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -SqrOsc(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/SinOsc.xml b/content/api_en/LIB_sound/SinOsc.xml index 1f6c8ad1e..abec47858 100755 --- a/content/api_en/LIB_sound/SinOsc.xml +++ b/content/api_en/LIB_sound/SinOsc.xml @@ -9,7 +9,7 @@ Application - +../../../images/LIB_sound_SinOsc.png - - - - - - - - -play() -Start the oscillator - - - -stop() -Stop the oscillator - - - -freq() -Change the frequency of the oscillator - - - -amp() -Change the amplitude/volume of the oscillator - - - -add() -Offset the output of the oscillator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -SinOsc(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/SinOsc_play.xml b/content/api_en/LIB_sound/SinOsc_play.xml index 31761bad6..4c89cd172 100755 --- a/content/api_en/LIB_sound/SinOsc_play.xml +++ b/content/api_en/LIB_sound/SinOsc_play.xml @@ -13,7 +13,7 @@ + +Sound + +Sound + +Configuration + +Application + + + + + + + + +AudioIn + + + \ No newline at end of file diff --git a/content/api_en/LIB_sound/SoundFile.xml b/content/api_en/LIB_sound/SoundFile.xml index db860e881..c6eb0d03c 100755 --- a/content/api_en/LIB_sound/SoundFile.xml +++ b/content/api_en/LIB_sound/SoundFile.xml @@ -9,7 +9,6 @@ Application - - - - - - - - - -play() -Play the soundfile - - - -loop() -Loop the soundfile - - - -cue() -Set the starting position of the soundfile - - - -jump() -Jump to a specific position in the file while continuing to play - - - -stop() -Stop the soundfile - - - -rate() -Change the playback rate of the soundfile - - - -amp() -Change the amplitude/volume of the player - - - -add() -Offset the output of the player by given value - - - -pan() -Move the soundfile in a stereo panorama - - - -set() -Set multiple parameters at once - - - -duration() -Returns the duration of the soundfile - - - -sampleRate() -Returns the sample rate of the soundfile - - - -frames() -Returns the number of frames/samples of the soundfile - - - -channels() -Returns the number of channels of the soundfile - - - -SoundFile(parent, path) - - - -parent -PApplet: typically use "this" - - - -path -Full Path to file or filename for data path - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/SoundFile_add.xml b/content/api_en/LIB_sound/SoundFile_add.xml index 28df56508..2b92734e5 100755 --- a/content/api_en/LIB_sound/SoundFile_add.xml +++ b/content/api_en/LIB_sound/SoundFile_add.xml @@ -18,12 +18,12 @@ SoundFile file; void setup() { size(640, 360); background(255); - + // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); file.play(); file.add(0.1); -} +} void draw() { } @@ -32,7 +32,7 @@ void draw() { diff --git a/content/api_en/LIB_sound/SoundFile_amp.xml b/content/api_en/LIB_sound/SoundFile_amp.xml index 8fed77f35..34002bbd2 100755 --- a/content/api_en/LIB_sound/SoundFile_amp.xml +++ b/content/api_en/LIB_sound/SoundFile_amp.xml @@ -21,8 +21,8 @@ void setup() { // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); - file.play(); file.amp(0.5); + file.play(); } void draw() { diff --git a/content/api_en/LIB_sound/SoundFile_channels.xml b/content/api_en/LIB_sound/SoundFile_channels.xml index 2e371f9e2..ace503d83 100755 --- a/content/api_en/LIB_sound/SoundFile_channels.xml +++ b/content/api_en/LIB_sound/SoundFile_channels.xml @@ -18,11 +18,11 @@ SoundFile file; void setup() { size(640, 360); background(255); - + // Load a soundfile from the /data folder of the sketch and get the number of channels file = new SoundFile(this, "sample.mp3"); println(file.channels()); -} +} void draw() { } @@ -31,22 +31,7 @@ void draw() { - -file.channels() - - -int - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_cue.xml b/content/api_en/LIB_sound/SoundFile_cue.xml index 347d45dc4..bded003ce 100755 --- a/content/api_en/LIB_sound/SoundFile_cue.xml +++ b/content/api_en/LIB_sound/SoundFile_cue.xml @@ -21,33 +21,17 @@ void setup() { // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); - file.cue(15); + file.cue(3.5); file.play(); } void draw() { } - ]]> second parameter supports only integer values. +Cues the playhead to a fixed position in the soundfile. Note that cue() only affects the playhead for future calls to play(), but not to loop(). ]]> - -file.cue(second) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_duration.xml b/content/api_en/LIB_sound/SoundFile_duration.xml index ca9e0e073..969d68a02 100755 --- a/content/api_en/LIB_sound/SoundFile_duration.xml +++ b/content/api_en/LIB_sound/SoundFile_duration.xml @@ -21,32 +21,16 @@ void setup() { // Load a soundfile from the data folder of the sketch and get the duration of the file file = new SoundFile(this, "sample.mp3"); - println("SFDuration= " + file.duration() + " seconds"); + println("Duration= " + file.duration() + " seconds"); } void draw() { } - ]]> - -file.duration() - - -float - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_frames.xml b/content/api_en/LIB_sound/SoundFile_frames.xml index eb464331f..f4a66de1a 100755 --- a/content/api_en/LIB_sound/SoundFile_frames.xml +++ b/content/api_en/LIB_sound/SoundFile_frames.xml @@ -18,10 +18,10 @@ SoundFile file; void setup() { size(640, 360); background(255); - + // Load a soundfile from the data folder of the sketch and get the number of frames file = new SoundFile(this, "sample.mp3"); - println("SFSamples= " + file.frames() + " samples"); + println("Frames= " + file.frames() + " frames"); } void draw() { @@ -31,22 +31,7 @@ void draw() { - -file.frames() - - -int - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_isPlaying.xml b/content/api_en/LIB_sound/SoundFile_isPlaying.xml new file mode 100755 index 000000000..fb5ec3082 --- /dev/null +++ b/content/api_en/LIB_sound/SoundFile_isPlaying.xml @@ -0,0 +1,45 @@ + + + +isPlaying() + +Sound Files + + + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/SoundFile_jump.xml b/content/api_en/LIB_sound/SoundFile_jump.xml index caa6a01a9..23bb57fa1 100755 --- a/content/api_en/LIB_sound/SoundFile_jump.xml +++ b/content/api_en/LIB_sound/SoundFile_jump.xml @@ -21,32 +21,16 @@ void setup() { // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); - file.jump(15.3); + file.jump(3.5); } void draw() { } - ]]> - -file.jump(second) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_loop.xml b/content/api_en/LIB_sound/SoundFile_loop.xml index d66e81a83..8f42ae4d9 100755 --- a/content/api_en/LIB_sound/SoundFile_loop.xml +++ b/content/api_en/LIB_sound/SoundFile_loop.xml @@ -31,7 +31,7 @@ void draw() { diff --git a/content/api_en/LIB_sound/SoundFile_pan.xml b/content/api_en/LIB_sound/SoundFile_pan.xml index 52fc29f6b..44e6f2746 100755 --- a/content/api_en/LIB_sound/SoundFile_pan.xml +++ b/content/api_en/LIB_sound/SoundFile_pan.xml @@ -19,7 +19,7 @@ void setup() { size(640, 360); background(255); - // Load a soundfile from the data folder of the sketch and play it back + // Load a MONO soundfile from the data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); file.play(); } @@ -32,22 +32,7 @@ void draw() { - -file.pan() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_sampleRate.xml b/content/api_en/LIB_sound/SoundFile_pause.xml similarity index 52% rename from content/api_en/LIB_sound/SoundFile_sampleRate.xml rename to content/api_en/LIB_sound/SoundFile_pause.xml index 38e25aff2..abfe629ae 100755 --- a/content/api_en/LIB_sound/SoundFile_sampleRate.xml +++ b/content/api_en/LIB_sound/SoundFile_pause.xml @@ -1,7 +1,7 @@ -sampleRate() +pause() Sound Files @@ -18,35 +18,27 @@ SoundFile file; void setup() { size(640, 360); background(255); - - // Load a soundfile from the data folder of the sketch and get the sample rate + + // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); - println("SFSampleRate= " + file.sampleRate() + " Hz"); -} + file.play(); +} void draw() { } +void mousePressed() { + if (file.isPlaying()) { + file.pause(); + } else { + file.play(); + } +} ]]> - -file.sampleRate() - - -int - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_play.xml b/content/api_en/LIB_sound/SoundFile_play.xml index 95f493497..f3bb129ef 100755 --- a/content/api_en/LIB_sound/SoundFile_play.xml +++ b/content/api_en/LIB_sound/SoundFile_play.xml @@ -22,31 +22,15 @@ void setup() { // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); file.play(); -} +} void draw() { } - ]]> - -file.play() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_rate.xml b/content/api_en/LIB_sound/SoundFile_rate.xml index 48ef77737..953ca579d 100755 --- a/content/api_en/LIB_sound/SoundFile_rate.xml +++ b/content/api_en/LIB_sound/SoundFile_rate.xml @@ -21,34 +21,17 @@ void setup() { // Load a soundfile from the data folder of the sketch and play it back double the speed file = new SoundFile(this, "sample.mp3"); - file.play(); + file.loop(); file.rate(2); } void draw() { } - ]]> - -file.rate() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/SoundFile_set.xml b/content/api_en/LIB_sound/SoundFile_set.xml index e0b029462..b9f42ee74 100755 --- a/content/api_en/LIB_sound/SoundFile_set.xml +++ b/content/api_en/LIB_sound/SoundFile_set.xml @@ -19,27 +19,26 @@ void setup() { size(640, 360); background(255); - // Load a soundfile from the data folder of the sketch and get the number of channels + // Load a soundfile from the data folder of the sketch file = new SoundFile(this, "sample.mp3"); - println("SFSampleRate= " + file.sampleRate() + " Hz"); } void draw() { } void mousePressed() { - float rate=3; - float pos=0.5; - float amp=0.5; - float add=0; - file.set(rate, amp, add, pos); + float rate = 3; + float pos = 0.5; + float amp = 0.5; + float add = 0; + file.set(rate, pos, amp, add); } ]]> diff --git a/content/api_en/LIB_sound/SoundFile_stop.xml b/content/api_en/LIB_sound/SoundFile_stop.xml index d8648eda5..d4b3830e7 100755 --- a/content/api_en/LIB_sound/SoundFile_stop.xml +++ b/content/api_en/LIB_sound/SoundFile_stop.xml @@ -15,26 +15,26 @@ import processing.sound.*; SoundFile file; - void setup() { +void setup() { size(640, 360); background(255); - + // Load a soundfile from the /data folder of the sketch and play it back file = new SoundFile(this, "sample.mp3"); file.play(); - } +} - void(){ - } - - void mousePressed() { +void draw() { +} + +void mousePressed() { file.stop(); - } +} ]]> diff --git a/content/api_en/LIB_sound/Sound_inputDevice.xml b/content/api_en/LIB_sound/Sound_inputDevice.xml new file mode 100755 index 000000000..e09498aac --- /dev/null +++ b/content/api_en/LIB_sound/Sound_inputDevice.xml @@ -0,0 +1,36 @@ + + + +inputDevice() + +Sound + +Configuration + +Web & Application + + + + + + + + + +AudioIn + + + diff --git a/content/api_en/LIB_sound/Sound_list.xml b/content/api_en/LIB_sound/Sound_list.xml new file mode 100755 index 000000000..80644eb01 --- /dev/null +++ b/content/api_en/LIB_sound/Sound_list.xml @@ -0,0 +1,28 @@ + + + +Sound.list() + +Sound + +Configuration + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/Sound_outputDevice.xml b/content/api_en/LIB_sound/Sound_outputDevice.xml new file mode 100755 index 000000000..3f26b40eb --- /dev/null +++ b/content/api_en/LIB_sound/Sound_outputDevice.xml @@ -0,0 +1,33 @@ + + + +outputDevice() + +Sound + +Configuration + +Web & Application + + + + + + + + + +AudioIn + + + diff --git a/content/api_en/LIB_sound/Sound_sampleRate.xml b/content/api_en/LIB_sound/Sound_sampleRate.xml new file mode 100755 index 000000000..0e37ce728 --- /dev/null +++ b/content/api_en/LIB_sound/Sound_sampleRate.xml @@ -0,0 +1,31 @@ + + +sampleRate() + +Sound + +Configuration + +Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/Sound_volume.xml b/content/api_en/LIB_sound/Sound_volume.xml new file mode 100755 index 000000000..96d9e6700 --- /dev/null +++ b/content/api_en/LIB_sound/Sound_volume.xml @@ -0,0 +1,46 @@ + + + +volume() + +Sound + +Configuration + +Web & Application + + + + + + + + + diff --git a/content/api_en/LIB_sound/SqrOsc.xml b/content/api_en/LIB_sound/SqrOsc.xml index d1d0c096f..f4ff7ec2f 100755 --- a/content/api_en/LIB_sound/SqrOsc.xml +++ b/content/api_en/LIB_sound/SqrOsc.xml @@ -9,7 +9,7 @@ Application - +../../../images/LIB_sound_SqrOsc.png - - - - - - - - -play() -Start the oscillator - - - -stop() -Stop the oscillator - - - -freq() -Change the frequency of the oscillator - - - -amp() -Change the amplitude/volume of the oscillator - - - -add() -Offset the output of the oscillator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -SqrOsc(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/TriOsc.xml b/content/api_en/LIB_sound/TriOsc.xml index 2ca49c832..d504de89a 100755 --- a/content/api_en/LIB_sound/TriOsc.xml +++ b/content/api_en/LIB_sound/TriOsc.xml @@ -9,7 +9,7 @@ Application - +../../../images/LIB_sound_TriOsc.png - - - - - - - - -play() -Start the oscillator - - - -stop() -Stop the oscillator - - - -freq() -Change the frequency of the oscillator - - - -amp() -Change the amplitude/volume of the oscillator - - - -add() -Offset the output of the oscillator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -TriOsc(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/Waveform.xml b/content/api_en/LIB_sound/Waveform.xml new file mode 100644 index 000000000..4251ddd60 --- /dev/null +++ b/content/api_en/LIB_sound/Waveform.xml @@ -0,0 +1,107 @@ + + + +Waveform + +Sound + +Analyzer + +Application + + + + + + + + + + + + + + + + +input() +Define the audio input for the analyzer + + + +analyze() +Gets the last nsamples captured from the connected input sound source, writes them + into this Waveform's `data` array, and returns it. + + + +stop() +Stop the analyzer + + + +data +`float[]` of length nsamples, with the sample amplitudes between `-1` and `1` + + + +Waveform(parent) + + + +parent +PApplet: typically use "this" + + + + + + + +Object + +Library + + diff --git a/content/api_en/LIB_sound/WhiteNoise.xml b/content/api_en/LIB_sound/WhiteNoise.xml index 0f67dfb46..ba8d252c2 100755 --- a/content/api_en/LIB_sound/WhiteNoise.xml +++ b/content/api_en/LIB_sound/WhiteNoise.xml @@ -29,66 +29,7 @@ void draw() { - - - - - - - - -play() -Start the generator - - - -stop() -Stop the generator - - - -amp() -Change the amplitude/volume of the generator - - - -add() -Offset the output of the generator by given value - - - -pan() -Move the sound in a stereo panorama - - - -set() -Set multiple parameters at once - - - -WhiteNoise(parent) - - - -parent -PApplet: typically use "this" - - - - - - - -1.0 - -Object - -Library - diff --git a/content/api_en/LIB_sound/WhiteNoise_add.xml b/content/api_en/LIB_sound/WhiteNoise_add.xml index 1876dc1ab..a6da5916b 100755 --- a/content/api_en/LIB_sound/WhiteNoise_add.xml +++ b/content/api_en/LIB_sound/WhiteNoise_add.xml @@ -34,19 +34,4 @@ void draw() { The .add() method is useful for modulating other audio signals. ]]> - -noise.add(add) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/WhiteNoise_amp.xml b/content/api_en/LIB_sound/WhiteNoise_amp.xml index 98ea36777..83eef598a 100755 --- a/content/api_en/LIB_sound/WhiteNoise_amp.xml +++ b/content/api_en/LIB_sound/WhiteNoise_amp.xml @@ -35,24 +35,4 @@ void draw() { Changes the amplitude/volume of the noise generator. Allowed values are between 0.0 and 1.0. ]]> - -noise.amp(vol) - - - - - - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/WhiteNoise_pan.xml b/content/api_en/LIB_sound/WhiteNoise_pan.xml index 3bcfab0ec..ffb68b7cf 100755 --- a/content/api_en/LIB_sound/WhiteNoise_pan.xml +++ b/content/api_en/LIB_sound/WhiteNoise_pan.xml @@ -36,19 +36,4 @@ void draw() { Pan the generator in a stereo panorama. -1.0 pans to the left channel and 1.0 to the right channel. ]]> - -noise.pan(pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/WhiteNoise_play.xml b/content/api_en/LIB_sound/WhiteNoise_play.xml index c25d29486..9dd12d80d 100755 --- a/content/api_en/LIB_sound/WhiteNoise_play.xml +++ b/content/api_en/LIB_sound/WhiteNoise_play.xml @@ -34,19 +34,4 @@ void draw() { Starts the White Noise generator. ]]> - -noise.play() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/WhiteNoise_set.xml b/content/api_en/LIB_sound/WhiteNoise_set.xml index a4d965129..6ecf74ca1 100755 --- a/content/api_en/LIB_sound/WhiteNoise_set.xml +++ b/content/api_en/LIB_sound/WhiteNoise_set.xml @@ -41,19 +41,4 @@ void mousePressed() { Sets amplitude, add and pan position with one method. ]]> - -noise.set(amp, add, pos) - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/WhiteNoise_stop.xml b/content/api_en/LIB_sound/WhiteNoise_stop.xml index a5b932fd8..783fa8a36 100755 --- a/content/api_en/LIB_sound/WhiteNoise_stop.xml +++ b/content/api_en/LIB_sound/WhiteNoise_stop.xml @@ -38,19 +38,4 @@ void mousePressed() { Stops the White Noise generator. ]]> - -noise.stop() - - - - - - -1.0 - -Method - -Library - - diff --git a/content/api_en/LIB_sound/index.html b/content/api_en/LIB_sound/index.html index 007b42f79..5bee0974e 100755 --- a/content/api_en/LIB_sound/index.html +++ b/content/api_en/LIB_sound/index.html @@ -1,71 +1,75 @@ - -

Sound

- -
-

- The new Sound library for Processing 3 provides a simple way to work with audio. It can play, analyze, and synthesize sound. The library comes with a collection of oscillators for basic wave forms, a variety of noise generators, and effects and filters to alter sound files and other generated sounds. The syntax is minimal to make it easy to patch one sound object into another. -

-

- The source code is available on the processing-sound GitHub repository. Please report bugs here. This library is only compatible with Processing 3.0+. -

- -
- -
-

- - I/O -

- AudioDevice
- AudioIn
-

- - Audio Files - -

- SoundFile
-

- - Effects - -

- LowPass
- HighPass
- BandPass
- Delay
- Reverb
-

- - Analysis -

- Amplitude
- FFT
-

- -

-
- -
-

- Noise -

- WhiteNoise
- PinkNoise
- BrownNoise
-

- - Oscillators -

- SinOsc
- SawOsc
- SqrOsc
- TriOsc
- Pulse
-

- - Envelopes -

- Env
-

-

-
+ +

Sound

+ +
+

+ The new Sound library for Processing 3 provides a simple way to work with audio. It can play, analyze, and synthesize sound. It provides a collection of oscillators for basic wave forms, a variety of noise generators, and effects and filters to play and alter sound files and other generated sounds. The syntax is minimal to make it easy to patch one sound object into another. The library also comes with example sketches covering many use cases to help you get started. +

+

+ The source code is available on the processing-sound GitHub repository. Please report bugs here. This library is only compatible with Processing 3.0+. +

+ +
+ +
+

+ + Configuration +

+ Sound
+

+ + I/O +

+ AudioIn
+

+ + Sampling +

+ SoundFile
+ AudioSample
+

+ + Effects + +

+ LowPass
+ HighPass
+ BandPass
+ Delay
+ Reverb
+

+ +

+
+ +
+

+ Noise +

+ WhiteNoise
+ PinkNoise
+ BrownNoise
+

+ + Oscillators +

+ SinOsc
+ SawOsc
+ SqrOsc
+ TriOsc
+ Pulse
+

+ + Envelopes +

+ Env
+

+ + Analysis +

+ Amplitude
+ FFT
+

+

+
diff --git a/content/api_en/LIB_svg/index.html b/content/api_en/LIB_svg/index.html new file mode 100644 index 000000000..24737df1d --- /dev/null +++ b/content/api_en/LIB_svg/index.html @@ -0,0 +1,167 @@ + +

SVG Export

+ +
+

The SVG library makes it possible to write SVG files directly from Processing. These vector graphics files can be scaled to any size and output at very high resolutions. The SVG library can flatten 3D data into a 2D vector file, but to export 3D data, use the DXF library. The source code is available on the Processing GitHub repository. Please report bugs here.
+
+ This library can be used with the core Processing function size(), or createGraphics(). See the examples below for different techniques.

+
+ +
+

+SVG Export (No Screen Display)
+
+This example draws a single frame to a SVG file and quits. (Note that no display window will open; this helps when you're trying to create massive SVG images that are far larger than the screen size.)

+ +
import processing.svg.*;
+
+void setup() {
+  size(400, 400, SVG, "filename.svg");
+}
+
+void draw() {
+  // Draw something good here
+  line(0, 0, width/2, height);
+
+  // Exit the program
+  println("Finished.");
+  exit();
+}
+ + +

SVG Export (With Screen Display)
+
+To draw to the screen while also saving an SVG beginRecord() +and endRecord() functions. Unlike the PDF renderer, the SVG renderer will only save the final frame of a sequence. This is slower, but is useful when you need to +see what you're working on as it saves.

+ +
import processing.svg.*;
+
+void setup() {
+  size(400, 400);
+  noLoop();
+  beginRecord(SVG, "filename.svg");
+}
+
+void draw() {
+  // Draw something good here
+  line(0, 0, width/2, height);
+
+  endRecord();
+}
+ + +

Single Frame from an Animation (With Screen Display)
+It's also possible to save one frame from a program with moving elements. +Create a boolean variable to turn the SVG recording process on and off

+ +
import processing.svg.*;
+
+boolean record;
+
+void setup() {
+  size(400, 400);
+}
+
+void draw() {
+  if (record) {
+    // Note that #### will be replaced with the frame number. Fancy!
+    beginRecord(SVG, "frame-####.svg");
+  }
+
+  // Draw something good here
+  background(255);
+  line(mouseX, mouseY, width/2, height/2);
+
+  if (record) {
+    endRecord();
+	record = false;
+  }
+}
+
+// Use a keypress so thousands of files aren't created
+void mousePressed() {
+  record = true;
+}
+ + +

SVG Files from 3D Geometry (With Screen Display)
+
+To create vectors from 3D data, use the beginRaw() and endRaw() commands. +These commands will grab the shape data just before it is rendered to the screen. +At this stage, your entire scene is nothing but a long list of lines and triangles. +This means that a shape created with sphere() method will be made up of hundreds of +triangles, rather than a single object.

+ +

When using beginRaw() and endRaw(), it's possible to write to either a 2D or 3D renderer. +For instance, beginRaw() with the SVG library will write the geometry as flattened triangles +and lines.

+ +
import processing.svg.*;
+
+boolean record;
+
+void setup() {
+  size(500, 500, P3D);
+}
+
+void draw() {
+  if (record) {
+    beginRaw(SVG, "output.svg");
+  }
+
+  // Do all your drawing here
+  background(204);
+  translate(width/2, height/2, -200);
+  rotateZ(0.2);
+  rotateY(mouseX/500.0);
+  box(200);
+
+  if (record) {
+    endRaw();
+    record = false;
+  }
+}
+
+// Hit 'r' to record a single frame
+void keyPressed() {
+  if (key == 'r') {
+    record = true;
+  }
+}
+
+ +

Using createGraphics() to Create an SVG File
+
+To write a SVG file using only the createGraphics() command, rather than as +part of a sketch, it's necessary to call dispose() on the PGraphicsSVG object. +This is the same as calling exit(), but it won't quit the sketch.

+ +
import processing.svg.*;
+
+PGraphics svg = createGraphics(300, 300, SVG, "output.svg");
+svg.beginDraw();
+svg.background(128, 0, 0);
+svg.line(50, 50, 250, 250);
+svg.dispose();
+svg.endDraw();
+ + +

+Additional notes for the SVG renderer: + +

    + +
  • If you want 3D data, use the DXF recording library instead. + +
  • Using hint(ENABLE_DEPTH_SORT) can improve the appearance of 3D geometry drawn to 2D file formats. + +
  • Many methods, particularly pixel-based methods, don't make sense for SVG renderers. This includes: loadPixels, updatePixels, get, set, mask, filter, copy, blend, save, and image + +
  • Again, exit() is really important when using SVG with size(). + +
+ +

+ +
diff --git a/content/api_en/PImage_filter.xml b/content/api_en/PImage_filter.xml index 30df9a9da..f30582ad1 100755 --- a/content/api_en/PImage_filter.xml +++ b/content/api_en/PImage_filter.xml @@ -156,7 +156,7 @@ POSTERIZE
Limits each channel of the image to the number of colors specified as the parameter. The parameter can be set to values between 2 and 255, but results are most noticeable in the lower ranges.

BLUR
-Executes a Guassian blur with the level parameter specifying the extent of the blurring. If no parameter is used, the blur is equivalent to Guassian blur of radius 1. Larger values increase the blur.
+Executes a Gaussian blur with the level parameter specifying the extent of the blurring. If no parameter is used, the blur is equivalent to Gaussian blur of radius 1. Larger values increase the blur.

ERODE
Reduces the light areas. No parameter is used.
diff --git a/content/api_en/PImage_loadPixels.xml b/content/api_en/PImage_loadPixels.xml index 23c5f9730..a9c353f84 100644 --- a/content/api_en/PImage_loadPixels.xml +++ b/content/api_en/PImage_loadPixels.xml @@ -34,8 +34,6 @@ void draw() { pixels[] array. This function must always be called before reading from or writing to pixels[]. -

-Certain renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must have previously called loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. ]]>
diff --git a/content/api_en/PImage_pixels.xml b/content/api_en/PImage_pixels.xml index 68203cae0..1f2a363e2 100755 --- a/content/api_en/PImage_pixels.xml +++ b/content/api_en/PImage_pixels.xml @@ -31,7 +31,7 @@ void draw() {
+The pixels[] array contains the values for all the pixels in the image. These values are of the color datatype. This array is the size of the image, meaning if the image is 100 x 100 pixels, there will be 10,000 values and if the window is 200 x 300 pixels, there will be 60,000 values.

Before accessing this array, the data must loaded with the loadPixels() method. Failure to do so may result in a NullPointerException. After the array data has been modified, the updatePixels() method must be run to update the content of the display window. ]]>
diff --git a/content/api_en/PImage_save.xml b/content/api_en/PImage_save.xml index d485f5cc8..0c6830b00 100755 --- a/content/api_en/PImage_save.xml +++ b/content/api_en/PImage_save.xml @@ -29,7 +29,7 @@ newImage.save("outputImage.jpg"); filename parameter. For example, "image.tif" will have a TIFF image and "image.png" will save a PNG image. If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu. It is not possible to use save() while running the program in a web browser.

To save an image created within the code, rather than through loading, it's necessary to make the image with the createImage() function so it is aware of the location of the program and can therefore save the file to the right place. See the createImage() reference for more information. +Saves the image into a file. Append a file extension to the name of the file, to indicate the file format to be used: either TIFF (.tif), TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu.

To save an image created within the code, rather than through loading, it's necessary to make the image with the createImage() function so it is aware of the location of the program and can therefore save the file to the right place. See the createImage() reference for more information. ]]>
diff --git a/content/api_en/PImage_updatePixels.xml b/content/api_en/PImage_updatePixels.xml index 7e713fffd..470c33d07 100644 --- a/content/api_en/PImage_updatePixels.xml +++ b/content/api_en/PImage_updatePixels.xml @@ -34,10 +34,6 @@ void draw() { pixels[] array. Use in conjunction with loadPixels(). If you're only reading pixels from the array, there's no need to call updatePixels(). -

-Certain renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must first call loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. -

-Currently, none of the renderers use the additional parameters to updatePixels(), however this may be implemented in the future. ]]>
diff --git a/content/api_en/PShape_addChild.xml b/content/api_en/PShape_addChild.xml index 3d69836a8..36dcc867a 100644 --- a/content/api_en/PShape_addChild.xml +++ b/content/api_en/PShape_addChild.xml @@ -11,13 +11,13 @@ path, rectangle, and circle are added to a parent PShape variable named house that is a GROUP. ]]> diff --git a/content/api_en/PShape_beginContour.xml b/content/api_en/PShape_beginContour.xml index fefc7d7d1..510cf16f1 100644 --- a/content/api_en/PShape_beginContour.xml +++ b/content/api_en/PShape_beginContour.xml @@ -14,12 +14,12 @@ PShape s; void setup() { - size(100, 100); + size(200, 200, P2D); // Make a shape s = createShape(); s.beginShape(); - s.noStroke(); + //s.noStroke(); // Exterior part of shape s.vertex(-50,-50); @@ -36,11 +36,11 @@ void setup() { s.endContour(); // Finish off shape - s.endShape(); + s.endShape(CLOSE); } void draw() { - background(52); + background(204); translate(width/2, height/2); s.rotate(0.01); shape(s); diff --git a/content/api_en/PShape_endContour.xml b/content/api_en/PShape_endContour.xml index b88cd4c3f..43119b0ea 100644 --- a/content/api_en/PShape_endContour.xml +++ b/content/api_en/PShape_endContour.xml @@ -14,12 +14,12 @@ PShape s; void setup() { - size(100, 100); + size(200, 200, P2D); // Make a shape s = createShape(); s.beginShape(); - s.noStroke(); + //s.noStroke(); // Exterior part of shape s.vertex(-50,-50); @@ -36,11 +36,11 @@ void setup() { s.endContour(); // Finish off shape - s.endShape(); + s.endShape(CLOSE); } void draw() { - background(52); + background(204); translate(width/2, height/2); s.rotate(0.01); shape(s); diff --git a/content/api_en/StringList_hasValue.xml b/content/api_en/StringList_hasValue.xml index 764dfa9d9..c864feb07 100755 --- a/content/api_en/StringList_hasValue.xml +++ b/content/api_en/StringList_hasValue.xml @@ -21,8 +21,8 @@ void setup() { inventory.append("flour"); inventory.append("tea"); println(inventory); - if (inventory.hasValue("tea") == true) { - println("Yes, we have a tea"); + if (inventory.hasValue("tea")) { + println("Yes, we have tea"); } else { println("Sorry, no tea"); } diff --git a/content/api_en/ambientLight.xml b/content/api_en/ambientLight.xml index 8f2ed792f..029c8dcf4 100755 --- a/content/api_en/ambientLight.xml +++ b/content/api_en/ambientLight.xml @@ -41,7 +41,7 @@ sphere(30); draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The v1, v2, and v3 parameters are interpreted as either RGB or HSB values, depending on the current color mode. +Adds an ambient light. Ambient light doesn't come from a specific direction, the rays of light have bounced around so much that objects are evenly lit from all sides. Ambient lights are almost always used in combination with other types of lights. Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The v1, v2, and v3 parameters are interpreted as either RGB or HSB values, depending on the current color mode. ]]> diff --git a/content/api_en/append.xml b/content/api_en/append.xml index d9fc3aecc..fea9cc952 100755 --- a/content/api_en/append.xml +++ b/content/api_en/append.xml @@ -23,7 +23,7 @@ println(sa2); element parameter must be the same as the datatype of the array.
+Expands a one-dimensional array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) append(originalArray, element) ]]>
diff --git a/content/api_en/arc.xml b/content/api_en/arc.xml index 742e7391f..071891848 100755 --- a/content/api_en/arc.xml +++ b/content/api_en/arc.xml @@ -37,10 +37,10 @@ arc(50, 50, 80, 80, 0, PI+QUARTER_PI, PIE); a, b, c, and d parameters. The origin of the arc's ellipse may be changed with the ellipseMode() function. Use the start and stop parameters to specify the angles (in radians) at which to draw the arc.
-
-There are three ways to draw an arc; the rendering technique used is defined by the optional seventh parameter. The three options, depicted in the above examples, are PIE, OPEN, and CHORD. The default mode is the OPEN stroke with a PIE fill.
-
+Draws an arc to the screen. Arcs are drawn along the outer edge of an ellipse defined by the a, b, c, and d parameters. The origin of the arc's ellipse may be changed with the ellipseMode() function. Use the start and stop parameters to specify the angles (in radians) at which to draw the arc. The start/stop values must be in clockwise order. +

+There are three ways to draw an arc; the rendering technique used is defined by the optional seventh parameter. The three options, depicted in the above examples, are PIE, OPEN, and CHORD. The default mode is the OPEN stroke with a PIE fill. +

In some cases, the arc() function isn't accurate enough for smooth drawing. For example, the shape may jitter on screen when rotating slowly. If you're having an issue with how arcs are rendered, you'll need to draw the arc yourself with beginShape()/endShape() or a PShape. ]]>
diff --git a/content/api_en/arrayCopy.xml b/content/api_en/arrayCopy.xml index 1d0d41ef7..1b5165a10 100644 --- a/content/api_en/arrayCopy.xml +++ b/content/api_en/arrayCopy.xml @@ -41,7 +41,7 @@ Copies an array (or part of an array) to another array. The src array is
The simplified version with only two arguments — arrayCopy(src, dst) — copies an entire array to another of the same size. It is equivalent to arrayCopy(src, 0, dst, 0, src.length).

-Using this function is far more efficient for copying array data than iterating through a for() loop and copying each element individually. This function only copies references, which means that for most purposes it only copies one-dimensional arrays (a single set of brackets). If used with a two (or three or more) dimensional array, it will only copy the references at the first level, because a two dimensional array is simply an "array of arrays". This does not produce an error, however, because this is often the desired behavior. Internally, this function calls Java's System.arraycopy() method, so most things that apply there are inherited. +Using this function is far more efficient for copying array data than iterating through a for() loop and copying each element individually. This function only copies references, which means that for most purposes it only copies one-dimensional arrays (a single set of brackets). If used with a two (or three or more) dimensional array, it will only copy the references at the first level, because a two dimensional array is simply an "array of arrays". This does not produce an error, however, because this is often the desired behavior. Internally, this function calls Java's System.arraycopy() method, so most things that apply there are inherited. ]]> diff --git a/content/api_en/attrib.xml b/content/api_en/attrib.xml new file mode 100644 index 000000000..3d21bc538 --- /dev/null +++ b/content/api_en/attrib.xml @@ -0,0 +1,63 @@ + + + +attrib() + +Rendering + + + + + + + + + + +attrib() function attaches custom values to each vertex in the scene. By default, Processing handles several per-vertex attributes: position, color, normal, texture coordinates, etc. These attributes are used by the renderer to determine how the geometry will look on the screen as result of applying the built-in shaders that compute texture, lighting, etc. However, if the coder sets a custom shader that does some additional rendering calculations, then she might need to pass additional information to the the shader in the form of custom attributes. These attributes can be of three types: position, normal, color, and other. The first three are meant to specify xyz coordinates, normal coordinates, and color components, respectively. The third type can be use to pass any kind of attribute value. +]]> + + diff --git a/content/api_en/blend.xml b/content/api_en/blend.xml index d10a95f76..59d8431c9 100755 --- a/content/api_en/blend.xml +++ b/content/api_en/blend.xml @@ -52,15 +52,15 @@ blend(img, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);
-BLEND - linear interpolation of colours: C = A*factor + B
+BLEND - linear interpolation of colors: C = A*factor + B

ADD - additive blending with white clip: C = min(A*factor + B, 255)

SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)

-DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
+DARKEST - only the darkest color succeeds: C = min(A*factor, B)

-LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
+LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)

DIFFERENCE - subtract colors from underlying image.

diff --git a/content/api_en/blendMode.xml b/content/api_en/blendMode.xml index 26e3285a2..a3c309cb1 100755 --- a/content/api_en/blendMode.xml +++ b/content/api_en/blendMode.xml @@ -35,17 +35,17 @@ line(75, 25, 25, 75); +Blends the pixels in the display window according to a defined mode. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels already in the display window (B). Each pixel's final color is the result of applying one of the blend modes with each channel of (A) and (B) independently. The red channel is compared with red, green with green, and blue with blue.

-BLEND - linear interpolation of colours: C = A*factor + B. This is the default blending mode.
+BLEND - linear interpolation of colors: C = A*factor + B. This is the default.

ADD - additive blending with white clip: C = min(A*factor + B, 255)

SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)

-DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
+DARKEST - only the darkest color succeeds: C = min(A*factor, B)

-LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
+LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)

DIFFERENCE - subtract colors from underlying image.

diff --git a/content/api_en/circle.xml b/content/api_en/circle.xml new file mode 100755 index 000000000..0e1d9adfb --- /dev/null +++ b/content/api_en/circle.xml @@ -0,0 +1,23 @@ + + +circle() + +Shape + +2D Primitives + + + + +ellipse_.png + + + +ellipseMode() function. +]]> + + + diff --git a/content/api_en/clear.xml b/content/api_en/clear.xml index d71f240d8..4db47b198 100644 --- a/content/api_en/clear.xml +++ b/content/api_en/clear.xml @@ -15,23 +15,25 @@ PGraphics pg; void setup() { size(200, 200); - pg = createGraphics(100, 100); + pg = createGraphics(width, height); } void draw() { background(204); - pg.beginDraw(); - pg.stroke(0, 102, 153); - pg.line(0, 0, mouseX, mouseY); - pg.endDraw(); - image(pg, 50, 50); -} - -// Click to clear the PGraphics object -void mousePressed() { - pg.beginDraw(); - pg.clear(); - pg.endDraw(); + + // Clear the PGraphics when the mouse is pressed + if (mousePressed == true) { + pg.beginDraw(); + pg.clear(); + pg.endDraw(); + } else { + pg.beginDraw(); + pg.stroke(0, 102, 153); + pg.line(width/2, height/2, mouseX, mouseY); + pg.endDraw(); + } + + image(pg, 0, 0); } ]]>
diff --git a/content/api_en/createGraphics.xml b/content/api_en/createGraphics.xml index 64ab9244c..2eb84e5bc 100755 --- a/content/api_en/createGraphics.xml +++ b/content/api_en/createGraphics.xml @@ -30,11 +30,13 @@ void draw() { PGraphics object. Use this class if you need to draw into an off-screen graphics buffer. The first two parameters define the width and height in pixels. The third, optional parameter specifies the renderer. It can be defined as P2D, P3D, or PDF. If the third parameter isn't used, the default renderer is set. The PDF renderer requires the filename parameter.
+Creates and returns a new PGraphics object. Use this class if you need to draw into an off-screen graphics buffer. The first two parameters define the width and height in pixels. The third, optional parameter specifies the renderer. It can be defined as P2D, P3D, PDF, or SVG. If the third parameter isn't used, the default renderer is set. The PDF and SVG renderers require the filename parameter.

-It's important to consider the renderer used with createGraphics() in relation to the main renderer specified in size(). For example, it's only possible to use P2D or P3D with createGraphics() when one of them is defined in size(). Unlike Processing 1.0, P2D and P3D use OpenGL for drawing, and when using an OpenGL renderer it's necessary for the main drawing surface to be OpenGL-based. If P2D or P3D are used as the renderer in size(), then any of the options can be used with createGraphics(). If the default renderer is used in size(), then only the default or PDF can be used with createGraphics().
+It's important to consider the renderer used with createGraphics() in relation to the main renderer specified in size(). For example, it's only possible to use P2D or P3D with createGraphics() when one of them is defined in size(). Unlike Processing 1.0, P2D and P3D use OpenGL for drawing, and when using an OpenGL renderer it's necessary for the main drawing surface to be OpenGL-based. If P2D or P3D are used as the renderer in size(), then any of the options can be used with createGraphics(). If the default renderer is used in size(), then only the default, PDF, or SVG can be used with createGraphics().

-It's important to call any drawing functions between beginDraw() and endDraw() statements. This is also true for any functions that affect drawing, such as smooth() or colorMode().
+It's important to run all drawing functions between the beginDraw() and endDraw(). As the exception to this rule, smooth() should be run on the PGraphics object before beginDraw(). See the reference for smooth() for more detail.
+
+The createGraphics() function should almost never be used inside draw() because of the memory and time needed to set up the graphics. One-time or occasional use during draw() might be acceptable, but code that calls createGraphics() at 60 frames per second might run out of memory or freeze your sketch.

Unlike the main drawing surface which is completely opaque, surfaces created with createGraphics() can have transparency. This makes it possible to draw into a graphics and maintain the alpha channel. By using save() to write a PNG or TGA file, the transparency of the graphics object will be honored. ]]>
diff --git a/content/api_en/createReader.xml b/content/api_en/createReader.xml index a72384cf6..5ffe8049a 100644 --- a/content/api_en/createReader.xml +++ b/content/api_en/createReader.xml @@ -11,30 +11,25 @@ diff --git a/content/api_en/createShape.xml b/content/api_en/createShape.xml index 644deb0a5..4469495e8 100755 --- a/content/api_en/createShape.xml +++ b/content/api_en/createShape.xml @@ -91,6 +91,7 @@ void setup() { alien = createShape(GROUP); // Make two shapes + ellipseMode(CORNER); head = createShape(ELLIPSE, -25, 0, 50, 50); head.setFill(color(255)); body = createShape(RECT, -25, 45, 50, 40); @@ -111,7 +112,7 @@ void draw() { createShape() function is used to define a new shape. Once created, this shape can be drawn with the shape() function. The basic way to use the function defines new primitive shapes. One of the following parameters are used as the first parameter: ELLIPSE, RECT, ARC, TRIANGLE, SPHERE, BOX, QUAD, or LINE. The parameters for each of these different shapes are the same as their corresponding functions: ellipse(), rect(), arc(), triangle(), sphere(), box(), and line(). The first example above clarifies how this works.
+The createShape() function is used to define a new shape. Once created, this shape can be drawn with the shape() function. The basic way to use the function defines new primitive shapes. One of the following parameters are used as the first parameter: ELLIPSE, RECT, ARC, TRIANGLE, SPHERE, BOX, QUAD, or LINE. The parameters for each of these different shapes are the same as their corresponding functions: ellipse(), rect(), arc(), triangle(), sphere(), box(), quad(), and line(). The first example above clarifies how this works.

Custom, unique shapes can be made by using createShape() without a parameter. After the shape is started, the drawing attributes and geometry can be set directly to the shape within the beginShape() and endShape() methods. See the second example above for specifics, and the reference for beginShape() for all of its options.

diff --git a/content/api_en/cursor.xml b/content/api_en/cursor.xml index 3b3e9b0a3..81499ab44 100755 --- a/content/api_en/cursor.xml +++ b/content/api_en/cursor.xml @@ -14,8 +14,11 @@ // Move the mouse left and right across the image // to see the cursor change from a cross to a hand -void draw() -{ +void setup() { + size(100, 100); +} + +void draw() { if (mouseX < 50) { cursor(CROSS); } else { @@ -26,10 +29,10 @@ void draw()
x and y must be less than the dimensions of the image. -

+Sets the cursor to a predefined symbol or an image, or makes it visible if already hidden. If you are trying to set an image as the cursor, the recommended size is 16x16 or 32x32 pixels. The values for parameters x and y must be less than the dimensions of the image. +

Setting or hiding the cursor does not generally work with "Present" mode (when running full-screen). -

+

With the P2D and P3D renderers, a generic set of cursors are used because the OpenGL renderer doesn't have access to the default cursor images for each platform (Issue 3791). ]]>
diff --git a/content/api_en/curvePoint.xml b/content/api_en/curvePoint.xml index 8c9a6e011..c38a07c22 100755 --- a/content/api_en/curvePoint.xml +++ b/content/api_en/curvePoint.xml @@ -30,7 +30,7 @@ for (int i = 0; i <= steps; i++) { t for points a, b, c, d. The parameter t may range from 0 (the start of the curve) and 1 (the end of the curve). a and d are points on the curve, and b and c are the control points. This can be used once with the x coordinates and a second time with the y coordinates to get the location of a curve at t. +Evaluates the curve at point t for points a, b, c, d. The parameter t may range from 0 (the start of the curve) and 1 (the end of the curve). a and d are the control points, and b and c are points on the curve. As seen in the example above, this can be used once with the x coordinates and a second time with the y coordinates to get the location of a curve at t. ]]> diff --git a/content/api_en/endShape.xml b/content/api_en/endShape.xml index a6c604615..eaa2d1e05 100755 --- a/content/api_en/endShape.xml +++ b/content/api_en/endShape.xml @@ -28,7 +28,7 @@ endShape(); endShape() function is the companion to beginShape() and may only be called after beginShape(). When endshape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer. The constant CLOSE as the value for the MODE parameter to close the shape (to connect the beginning and the end). +The endShape() function is the companion to beginShape() and may only be called after beginShape(). When endShape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer. The constant CLOSE as the value for the MODE parameter to close the shape (to connect the beginning and the end). ]]> diff --git a/content/api_en/environment/index.html b/content/api_en/environment/index.html index 4d2e038d2..5d92731eb 100644 --- a/content/api_en/environment/index.html +++ b/content/api_en/environment/index.html @@ -531,8 +531,8 @@
Android Mode

Sketches written in this mode can be exported to run on Android phones and tablets. - This mode is documented on the - Processing for Android page of the Processing Wiki. To add this mode, click on + This mode is documented on the + Processing for Android page. To add this mode, click on the mode button in the upper-right corner of the PDE and select "Add Mode..."

--> @@ -574,7 +574,7 @@

- The Export information and + The Export information and Tips page on the Processing Wiki covers the details of exporting Applications from Java mode.

diff --git a/content/api_en/expand.xml b/content/api_en/expand.xml index 30c9d4afe..f0f020319 100755 --- a/content/api_en/expand.xml +++ b/content/api_en/expand.xml @@ -32,7 +32,7 @@ println(imgs.length); // Prints "64" newSize parameter provides precise control over the increase in size. +Increases the size of a one-dimensional array. By default, this function doubles the size of the array, but the optional newSize parameter provides precise control over the increase in size.

When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) expand(originalArray) ]]>
diff --git a/content/api_en/frustum.xml b/content/api_en/frustum.xml index 5469e611d..f9645bd5a 100755 --- a/content/api_en/frustum.xml +++ b/content/api_en/frustum.xml @@ -25,7 +25,7 @@ Sets a perspective matrix as defined by the parameters.

A frustum is a geometric form: a pyramid with its top cut off. With the viewer's eye at the imaginary top of the pyramid, the six planes of the frustum act as clipping planes when rendering a 3D view. Thus, any form inside the clipping planes is rendered and visible; anything outside those planes is not visible.

-Setting the frustum has the effect of changing the perspective with which the scene is rendered. This can be acheived more simply in many cases by using perspective().
+Setting the frustum has the effect of changing the perspective with which the scene is rendered. This can be achieved more simply in many cases by using perspective().

Note that the near value must be greater than zero (as the point of the frustum "pyramid" cannot converge "behind" the viewer). Similarly, the far value must be greater than the near value (as the "far" plane of the frustum must be "farther away" from the viewer than the near plane).

diff --git a/content/api_en/get.xml b/content/api_en/get.xml index c1307b3cd..be56dc889 100755 --- a/content/api_en/get.xml +++ b/content/api_en/get.xml @@ -31,10 +31,12 @@ rect(25, 25, 50, 50); x and y parameters to get the value of one pixel. Get a section of the display window by specifying additional w and h parameters. When getting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
-
+Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Use the x and y parameters to get the value of one pixel. Get a section of the display window by specifying additional w and h parameters. When getting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode(). +

If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. For example, even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB format.

+If a width and a height are specified, get(x, y, w, h) returns a PImage corresponding to the part of the original PImage where the top left pixel is at the (x, y) position with a width of w a height of h. +

Getting the color of a single pixel with get(x, y) is easy, but not as fast as grabbing the data directly from pixels[]. The equivalent statement to get(x, y) using pixels[] is pixels[y*width+x]. See the reference for pixels[] for more information. ]]>
diff --git a/content/api_en/green.xml b/content/api_en/green.xml index 7d3ff0566..f1c38fe88 100755 --- a/content/api_en/green.xml +++ b/content/api_en/green.xml @@ -27,8 +27,8 @@ Extracts the green value from a color, scaled to match current colorMode() The green() function is easy to use and understand, but it is slower than a technique called bit shifting. When working in colorMode(RGB, 255), you can acheive the same results as green() but with greater speed by using the right shift operator (>>) with a bit mask. For example, the following two lines of code are equivalent means of getting the green value of the color value c:

-
float r1 = green(c);  // Simpler, but slower to calculate
-float r2 = c >> 8 & 0xFF;  // Very fast to calculate
+
float g1 = green(c);  // Simpler, but slower to calculate
+float g2 = c >> 8 & 0xFF;  // Very fast to calculate
]]> diff --git a/content/api_en/include/ArrayList.xml b/content/api_en/include/ArrayList.xml index 1cf04f77d..8feb4dc3a 100644 --- a/content/api_en/include/ArrayList.xml +++ b/content/api_en/include/ArrayList.xml @@ -64,7 +64,7 @@ An ArrayList stores a variable number of objects. This is similar to maki
An ArrayList is a resizable-array implementation of the Java List interface. It has many methods used to control and search its contents. For example, the length of the ArrayList is returned by its size() method, which is an integer value for the total number of elements in the list. An element is added to an ArrayList with the add() method and is deleted with the remove() method. The get() method returns the element at the specified position in the list. (See the above example for context.)

-For a list of the numerous ArrayList features, please read the Java reference description. +For a list of the numerous ArrayList features, please read the Java reference description. ]]> diff --git a/content/api_en/include/BufferedReader.xml b/content/api_en/include/BufferedReader.xml index 354daa453..c7ef0855d 100644 --- a/content/api_en/include/BufferedReader.xml +++ b/content/api_en/include/BufferedReader.xml @@ -45,17 +45,14 @@ A BufferedReader object is used to read files line-by-line as individual Starting with Processing release 0134, all files loaded and saved by the Processing API use UTF-8 encoding. In previous releases, the default encoding for your platform was used, which causes problems when files are moved to other platforms. ]]> + + readLine() returns a String that is the current line in the text file - - - - - - + @@ -67,8 +64,9 @@ catch 1.0 -Function +Object + +PDE -Core diff --git a/content/api_en/include/HashMap.xml b/content/api_en/include/HashMap.xml index 56ba42897..493e893de 100644 --- a/content/api_en/include/HashMap.xml +++ b/content/api_en/include/HashMap.xml @@ -22,7 +22,7 @@ hm.put("Ava", 1); hm.put("Cait", 35); hm.put("Casey", 36); -// Using an enhanced loop to interate over each entry +// Using an enhanced loop to iterate over each entry for (Map.Entry me : hm.entrySet()) { print(me.getKey() + " is "); println(me.getValue()); @@ -39,7 +39,7 @@ println("Casey is " + val); HashMap stores a collection of objects, each referenced by a key. This is similar to an Array, only instead of accessing elements with a numeric index, a String is used. (If you are familiar with associative arrays from other languages, this is the same idea.) The above example covers basic use, but there's a more extensive example included with the Processing examples. In addition, for simple pairings of Strings and integers, Strings and floats, or Strings and Strings, you can now use the simpler IntDict, FloatDict, and StringDict classes.

-For a list of the numerous HashMap features, please read the Java reference description. +For a list of the numerous HashMap features, please read the Java reference description. ]]>
diff --git a/content/api_en/include/Object.xml b/content/api_en/include/Object.xml index 46ff0c441..c2b5dc9dd 100755 --- a/content/api_en/include/Object.xml +++ b/content/api_en/include/Object.xml @@ -35,7 +35,7 @@ class HLine { } void update() { ypos += speed; - if (ypos > width) { + if (ypos > height) { ypos = 0; } line(0, ypos, width, ypos); diff --git a/content/api_en/include/String.xml b/content/api_en/include/String.xml index e4c4a9625..2febbe7de 100755 --- a/content/api_en/include/String.xml +++ b/content/api_en/include/String.xml @@ -24,12 +24,9 @@ println(str2); // Prints "CCCP" to the console @@ -46,11 +43,11 @@ println(quoted); // This one has "quotes" String includes methods for examining individual characters, comparing strings, searching strings, extracting parts of strings, and for converting an entire string uppercase and lowercase. Strings are always defined inside double quotes ("Abc"), and characters are always defined inside single quotes ('A').

-To compare the contents of two Strings, use the equals() method, as in if (a.equals(b)), instead of if (a == b). A String is an Object, so comparing them with the == operator only compares whether both Strings are stored in the same memory location. Using the equals() method will ensure that the actual contents are compared. (The troubleshooting reference has a longer explanation.)
+To compare the contents of two Strings, use the equals() method, as in if (a.equals(b)), instead of if (a == b). A String is an Object, so comparing them with the == operator only compares whether both Strings are stored in the same memory location. Using the equals() method will ensure that the actual contents are compared. (The troubleshooting reference has a longer explanation.)

Because a String is defined between double quotation marks, to include such marks within the String itself you must use the \ (backslash) character. (See the third example above.) This is known as an escape sequence. Other escape sequences include \t for the tab character and \n for new line. Because backslash is the escape character, to include a single backslash within a String, you must use two consecutive backslashes, as in: \\

-There are more string methods than those linked from this page. Additional documentation is located online in the official Java documentation. +There are more string methods than those linked from this page. Additional documentation is located online in the official Java documentation. ]]>
@@ -110,7 +107,6 @@ String(data, offset, length) int: number of characters - @@ -124,6 +120,4 @@ text() PDE - - diff --git a/content/api_en/include/String_substring.xml b/content/api_en/include/String_substring.xml index 0514f23ae..40813a34c 100755 --- a/content/api_en/include/String_substring.xml +++ b/content/api_en/include/String_substring.xml @@ -16,8 +16,8 @@ String str1 = "CCCP"; String str2 = "Rabbit"; String ss1 = str1.substring(2); // Returns "CP" String ss2 = str2.substring(3); // Returns "bit" -String ss3 = str1.substring(0, 2); // Returns "CC" -println(ss1 + ":" + ss2 + ":" + ss3); // Prints "CP:bit:CC" +String ss3 = str2.substring(0, 2); // Returns "Ra" +println(ss1 + ":" + ss2 + ":" + ss3); // Prints "CP:bit:Ra" ]]>
diff --git a/content/api_en/include/class.xml b/content/api_en/include/class.xml index 45eedd292..5f1e84cab 100755 --- a/content/api_en/include/class.xml +++ b/content/api_en/include/class.xml @@ -46,7 +46,7 @@ class HLine { Object-Oriented Programming is hosted on the Oracle website. +Keyword used to indicate the declaration of a class. A class is a composite of fields (data) and methods (functions that are a part of the class) which may be instantiated as objects. The first letter of a class name is usually uppercase to separate it from other kinds of variables. A related tutorial on Object-Oriented Programming is hosted on the Oracle website. ]]> diff --git a/content/api_en/include/color_datatype.xml b/content/api_en/include/color_datatype.xml index 2b501bf56..0f0b7b8f0 100755 --- a/content/api_en/include/color_datatype.xml +++ b/content/api_en/include/color_datatype.xml @@ -23,7 +23,7 @@ rect(50, 0, 50, 100); get() and color() or they may be specified directly using hexadecimal notation such as #FFCC00 or 0xFFFFCCOO. +Datatype for storing color values. Colors may be assigned with get() and color() or they may be specified directly using hexadecimal notation such as #FFCC00 or 0xFFFFCC00.

Using print() or println() on a color will produce strange results (usually negative numbers) because of the way colors are stored in memory. A better technique is to use the hex() function to format the color data, or use the red(), green(), and blue() functions to get individual values and print those. The hue(), saturation(), and brightness() functions work in a similar fashion. To extract red, green, and blue values more quickly (for instance when analyzing an image or a frame of video), use bit shifting.

diff --git a/content/api_en/include/curlybraces.xml b/content/api_en/include/curlybraces.xml index f4f1898c9..e9984f0d7 100755 --- a/content/api_en/include/curlybraces.xml +++ b/content/api_en/include/curlybraces.xml @@ -26,7 +26,7 @@ void draw() { for and if structures. Curly braces are also used for defining inital values in array declarations. +Define the beginning and end of functions blocks and statement blocks such as the for and if structures. Curly braces are also used for defining initial values in array declarations. ]]> diff --git a/content/api_en/include/doccomment.xml b/content/api_en/include/doccomment.xml index bb4331414..fa036a032 100755 --- a/content/api_en/include/doccomment.xml +++ b/content/api_en/include/doccomment.xml @@ -22,7 +22,9 @@ line(50, 0, 50, 100);
+Doc comments may be converted into browseable documentation using external editors and tools such as the command line javadoc, doc generators such as Doxygen, or IDEs such as Eclipse, Netbeans, or IntelliJ IDEA. ]]>
diff --git a/content/api_en/include/double.xml b/content/api_en/include/double.xml index 75ce6f466..24942764e 100644 --- a/content/api_en/include/double.xml +++ b/content/api_en/include/double.xml @@ -11,11 +11,11 @@ diff --git a/content/api_en/include/equality.xml b/content/api_en/include/equality.xml index 4ddfbd69a..a47eac505 100755 --- a/content/api_en/include/equality.xml +++ b/content/api_en/include/equality.xml @@ -14,15 +14,16 @@ int a = 23; int b = 23; if (a == b) { - println("variables a and b are equal"); + println("the values of variables 'a' and 'b' are the same"); } ]]> +Determines if two values are equivalent. Please note the equality operator (==) is different from the assignment operator (=) and although they look similar, they have a different use. If you're comparing two variables, the equality operator (==) only works with primitive data types like int, boolean, and char. It doesn't work with composite data types like Array, Table, and PVector.
+
+Note that when comparing String objects, you must use the equals() method instead of ==. See the reference for String or the troubleshooting note for more explanation.

-Note that when comparing String objects, you must use the equals() method instead of == to compare their contents. See the reference for String or the troubleshooting note for more explanation. ]]>
diff --git a/content/api_en/include/float.xml b/content/api_en/include/float.xml index 964d946e6..134cb33f4 100755 --- a/content/api_en/include/float.xml +++ b/content/api_en/include/float.xml @@ -41,7 +41,7 @@ Data type for floating-point numbers, e.g. numbers that have a decimal point.
Floats are not precise, so adding small values (such as 0.0001) may not always increment precisely due to rounding errors. If you want to increment a value in small intervals, use an int, and divide by a float value before using it. (See the second example above.)

-Floating-point numbers can be as large as 3.40282347E+38 and as low as -3.40282347E+38. They are stored as 32 bits (4 bytes) of information. The float data type is inherited from Java; you can read more about the technical details here and here.
+Floating-point numbers can be as large as 3.40282347E+38 and as low as -3.40282347E+38. They are stored as 32 bits (4 bytes) of information. The float data type is inherited from Java; you can read more about the technical details here and here.

Processing supports the double datatype from Java as well. However, none of the Processing functions use double values, which use more memory and are typically overkill for most work created in Processing. We do not plan to add support for double values, as doing so would require increasing the number of API functions significantly. ]]>
diff --git a/content/api_en/hint.xml b/content/api_en/include/hint.xml similarity index 88% rename from content/api_en/hint.xml rename to content/api_en/include/hint.xml index 7068ab8c8..a48311069 100644 --- a/content/api_en/hint.xml +++ b/content/api_en/include/hint.xml @@ -6,7 +6,27 @@ - +function + + + + + hint() to allow people to tune the settings for their particular sketch. Implementing a hint() is a last resort that's used when a more elegant solution cannot be found. Some options might graduate to standard features instead of hints over time, or be added and removed between (major) releases. @@ -48,4 +68,27 @@ Forces the P3D renderer to draw each shape (including its strokes) separately, i Enables stroke geometry (lines and points) to be affected by the perspective, meaning that they will look smaller as they move away from the camera. ]]> + +hint(which) + + + + + + + +void + + +PGraphics +createGraphics() +size() + + +1.0 + +Function + +PDE + diff --git a/content/api_en/include/intconvert.xml b/content/api_en/include/intconvert.xml index f14376165..56ba6ddb8 100755 --- a/content/api_en/include/intconvert.xml +++ b/content/api_en/include/intconvert.xml @@ -20,7 +20,7 @@ println(c + " : " + i); // Prints "E : 69" boolean, byte, char, color, float, int, or long) to its integer representation.
+Converts any value of a primitive data type (boolean, byte, char, color, float, int, or long) or String to its integer representation.

When an array of values is passed in, then an int array of the same length is returned. ]]>
diff --git a/content/api_en/include/multilinecomment.xml b/content/api_en/include/multilinecomment.xml index bd88002cb..a1c9dd6a1 100755 --- a/content/api_en/include/multilinecomment.xml +++ b/content/api_en/include/multilinecomment.xml @@ -22,7 +22,7 @@ line(50, 0, 50, 100); diff --git a/content/api_en/include/multiply.xml b/content/api_en/include/multiply.xml index 20c71bb1f..a125ad6fd 100755 --- a/content/api_en/include/multiply.xml +++ b/content/api_en/include/multiply.xml @@ -37,7 +37,7 @@ Multiplies the values of the two parameters. Multiplication is equivalent to a s -+ (add) ++ (addition) / (divide) @@ -48,10 +48,4 @@ Multiplies the values of the two parameters. Multiplication is equivalent to a s PDE - - - - - - diff --git a/content/api_en/include/rightshift.xml b/content/api_en/include/rightshift.xml index 27526643b..06437e001 100755 --- a/content/api_en/include/rightshift.xml +++ b/content/api_en/include/rightshift.xml @@ -37,7 +37,7 @@ rect(30, 20, 55, 55);
Bit shifting is helpful when using the color data type. A right shift can extract red, green, blue, and alpha values from a color. A left shift can be used to quickly reassemble a color value (more quickly than the color() function). ]]>
diff --git a/content/api_en/include/setLocation.xml b/content/api_en/include/setLocation.xml new file mode 100644 index 000000000..c54f0ee04 --- /dev/null +++ b/content/api_en/include/setLocation.xml @@ -0,0 +1,60 @@ + + +setLocation() + +Structure + + + +function + + + + + + +setLocation() function defines the position of the Processing sketch in relation to the upper-left corner of the computer screen. +

+There are more features of PSurface documented in the Processing JavaDoc. +]]>
+ + +surface.setLocation(x, y) + + + + + + + + + + + + +void + + + + +3.0 + +Function + +PDE + +
diff --git a/content/api_en/include/setResizable.xml b/content/api_en/include/setResizable.xml new file mode 100644 index 000000000..3b4261790 --- /dev/null +++ b/content/api_en/include/setResizable.xml @@ -0,0 +1,55 @@ + + +setResizable() + +Structure + + + +function + + + + + + +surface.setResizable(true) is used within a sketch, the window can be resized while it's running. +

+There are more features of PSurface documented in the Processing JavaDoc. +]]>
+ + +surface.setResizable(resizable) + + + + + + + +void + + + + +3.0 + +Function + +PDE + +
diff --git a/content/api_en/include/setTitle.xml b/content/api_en/include/setTitle.xml new file mode 100644 index 000000000..1c18e6d22 --- /dev/null +++ b/content/api_en/include/setTitle.xml @@ -0,0 +1,55 @@ + + +setTitle() + +Structure + + + +function + + + + + + +setTitle() function defines the title to appear at the top of the sketch window. +

+There are more features of PSurface documented in the Processing JavaDoc. +]]>
+ + +surface.setTitle(title) + + + + + + + +void + + + + +3.0 + +Function + +PDE + +
diff --git a/content/api_en/include/strconvert.xml b/content/api_en/include/strconvert.xml index 2126306f9..e81be07c5 100755 --- a/content/api_en/include/strconvert.xml +++ b/content/api_en/include/strconvert.xml @@ -29,7 +29,7 @@ println(sb); // Prints 'false-28R-32.61024' boolean, byte, char, color, double, float, int, or long) to its String representation. For example, converting an integer with str(3) will return the String value of "3", converting a float with str(-12.6) will return "-12.6", and converting a boolean with str(true) will return "true".
+Converts a value of a primitive data type (boolean, byte, char, int, or float) to its String representation. For example, converting an integer with str(3) will return the String value of "3", converting a float with str(-12.6) will return "-12.6", and converting a boolean with str(true) will return "true".

When an array of values is passed in, then a String array of the same length is returned. ]]>
diff --git a/content/api_en/key.xml b/content/api_en/key.xml index 282186f52..0b7d3bde0 100755 --- a/content/api_en/key.xml +++ b/content/api_en/key.xml @@ -30,7 +30,7 @@ void draw() { key always contains the value of the most recent key on the keyboard that was used (either pressed or released).

-For non-ASCII keys, use the keyCode variable. The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and DELETE) do not require checking to see if they key is coded, and you should simply use the key variable instead of keyCode If you're making cross-platform projects, note that the ENTER key is commonly used on PCs and Unix and the RETURN key is used instead on Macintosh. Check for both ENTER and RETURN to make sure your program will work for all platforms. +For non-ASCII keys, use the keyCode variable. The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and DELETE) do not require checking to see if the key is coded, and you should simply use the key variable instead of keyCode If you're making cross-platform projects, note that the ENTER key is commonly used on PCs and Unix and the RETURN key is used instead on Macintosh. Check for both ENTER and RETURN to make sure your program will work for all platforms.

There are issues with how keyCode behaves across different renderers and operating systems. Watch out for unexpected behavior as you switch renderers and operating systems. ]]>
diff --git a/content/api_en/keyCode.xml b/content/api_en/keyCode.xml index b11ea3ca0..8a3cd3d2f 100755 --- a/content/api_en/keyCode.xml +++ b/content/api_en/keyCode.xml @@ -39,9 +39,11 @@ When checking for these keys, it can be useful to first check if the key is code

The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and DELETE) do not require checking to see if the key is coded; for those keys, you should simply use the key variable directly (and not keyCode). If you're making cross-platform projects, note that the ENTER key is commonly used on PCs and Unix, while the RETURN key is used on Macs. Make sure your program will work on all platforms by checking for both ENTER and RETURN.

-For those familiar with Java, the values for UP and DOWN are simply shorter versions of Java's KeyEvent.VK_UP and KeyEvent.VK_DOWN. Other keyCode values can be found in the Java KeyEvent reference. +For those familiar with Java, the values for UP and DOWN are simply shorter versions of Java's KeyEvent.VK_UP and KeyEvent.VK_DOWN. Other keyCode values can be found in the Java KeyEvent reference.

There are issues with how keyCode behaves across different renderers and operating systems. Watch out for unexpected behavior as you switch renderers and operating systems and you are using keys are aren't mentioned in this reference entry. +

+If you are using P2D or P3D as your renderer, use the NEWT KeyEvent constants. ]]> diff --git a/content/api_en/keyPressed.xml b/content/api_en/keyPressed.xml index 224ed7da8..9cc506b40 100755 --- a/content/api_en/keyPressed.xml +++ b/content/api_en/keyPressed.xml @@ -41,6 +41,8 @@ Because of how operating systems handle key repeats, holding down a key may caus Note that there is a similarly named boolean variable called keyPressed. See its reference page for more information.

Mouse and keyboard events only work when a program has draw(). Without draw(), the code is only run once and then stops listening for events. +

+With the release of macOS Sierra, Apple changed how key repeat works, so keyPressed may not function as expected. See here for details of the problem and how to fix it. ]]> diff --git a/content/api_en/lerpColor.xml b/content/api_en/lerpColor.xml index 07e24aa29..99ab9f4f4 100755 --- a/content/api_en/lerpColor.xml +++ b/content/api_en/lerpColor.xml @@ -29,7 +29,7 @@ rect(70, 20, 20, 60); amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is halfway in between, etc. +Calculates a color between two colors at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 is equal to the first point, 0.1 is very near the first point, 0.5 is halfway in between, etc.
An amount below 0 will be treated as 0. Likewise, amounts above 1 will be capped at 1. This is different from the behavior of lerp(), but necessary because otherwise numbers outside the range will produce strange and unexpected colors. ]]>
diff --git a/content/api_en/libraries/index.html b/content/api_en/libraries/index.html index 11cc19e54..e507a7c8b 100644 --- a/content/api_en/libraries/index.html +++ b/content/api_en/libraries/index.html @@ -16,7 +16,12 @@
PDF Export
Network

Send and receive data over the Internet through simple clients and servers.

- + +
  • +
    SVG Export
    +

    Create SVG files.

    +
  • +
  • Serial

    Send data between Processing and external hardware through serial communication (RS-232).

    diff --git a/content/api_en/loadJSONArray.xml b/content/api_en/loadJSONArray.xml index d7b7444ac..da22530e9 100755 --- a/content/api_en/loadJSONArray.xml +++ b/content/api_en/loadJSONArray.xml @@ -13,24 +13,26 @@ pixels[] array. This function must always be called before reading from or writing to pixels[]. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again.
    -
    -Certain renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must have previously called loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. +Loads the pixel data of the current display window into the pixels[] array. This function must always be called before reading from or writing to pixels[]. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again. ]]>
    diff --git a/content/api_en/loadStrings.xml b/content/api_en/loadStrings.xml index 50a71d6cf..321fa0140 100755 --- a/content/api_en/loadStrings.xml +++ b/content/api_en/loadStrings.xml @@ -11,7 +11,7 @@ If the file contains a header row, include "header" in the options parameter. If the file does not have a header row, then simply omit the "header" option.

    -When specifying both a header and the file type as the options parameter, separate the options with commas, as in: loadTable("data.csv", "header, tsv")
    +Some CSV files contain newline (CR or LF) characters inside cells. This is rare, but adding the "newlines" option will handle them properly. (This is not enabled by default because the parsing code is much slower.)
    +
    +When specifying multiple options, separate them with commas, as in: loadTable("data.csv", "header, tsv")

    All files loaded and saved by the Processing API use UTF-8 encoding. ]]> diff --git a/content/api_en/match.xml b/content/api_en/match.xml index 1db3a9f3a..92d1b2fdf 100755 --- a/content/api_en/match.xml +++ b/content/api_en/match.xml @@ -51,7 +51,7 @@ To use the function, first check to see if the result is null. If the result is
    If there are groups (specified by sets of parentheses) in the regular expression, then the contents of each will be returned in the array. Element [0] of a regular expression match returns the entire matching string, and the match groups start at element [1] (the first group is [1], the second [2], and so on).

    -The syntax can be found in the reference for Java's Pattern class. For regular expression syntax, read the Java Tutorial on the topic. +The syntax can be found in the reference for Java's Pattern class. For regular expression syntax, read the Java Tutorial on the topic. ]]> diff --git a/content/api_en/matchAll.xml b/content/api_en/matchAll.xml index 56feb6b5b..4f0345fbe 100644 --- a/content/api_en/matchAll.xml +++ b/content/api_en/matchAll.xml @@ -33,7 +33,7 @@ To use the function, first check to see if the result is null. If the result is
    If there are groups (specified by sets of parentheses) in the regular expression, then the contents of each will be returned in the array. Assuming a loop with counter variable i, element [i][0] of a regular expression match returns the entire matching string, and the match groups start at element [i][1] (the first group is [i][1], the second [i][2], and so on).

    -The syntax can be found in the reference for Java's Pattern class. For regular expression syntax, read the Java Tutorial on the topic. +The syntax can be found in the reference for Java's Pattern class. For regular expression syntax, read the Java Tutorial on the topic. ]]> diff --git a/content/api_en/mouseWheel.xml b/content/api_en/mouseWheel.xml index 02c01cd7a..0a2344176 100755 --- a/content/api_en/mouseWheel.xml +++ b/content/api_en/mouseWheel.xml @@ -26,7 +26,7 @@ void mouseWheel(MouseEvent event) {
    mouseWheel() function returns positive values when the mouse wheel is rotated down (toward the user), and negative values for the other direction (up or away from the user). On OS X with "natural" scrolling enabled, the values are opposite. +The code within the mouseWheel() event function is run when the mouse wheel is moved. (Some mice don't have wheels and this function is only applicable with mice that have a wheel.) The getCount() function used within mouseWheel() returns positive values when the mouse wheel is rotated down (toward the user), and negative values for the other direction (up or away from the user). On OS X with "natural" scrolling enabled, the values are opposite.

    Mouse and keyboard events only work when a program has draw(). Without draw(), the code is only run once and then stops listening for events. ]]>
    diff --git a/content/api_en/nf.xml b/content/api_en/nf.xml index f1e6123dd..295db43ac 100755 --- a/content/api_en/nf.xml +++ b/content/api_en/nf.xml @@ -26,11 +26,16 @@ String se = nf(e, 5, 3); println(se); // Prints "00040.200" String sf = nf(f, 3, 5); println(sf); // Prints "009.01200" + +String sf2 = nf(f, 0, 5); +println(sf2); // Prints "9.01200" +String sf3 = nf(f, 0, 2); +println(sf3); // Prints "9.01" ]]>
    digits, left, and right parameters should always be positive integers.

    As shown in the above example, nf() is used to add zeros to the left and/or right of a number. This is typically for aligning a list of numbers. To remove digits from a floating-point number, use the int(), ceil(), floor(), or round() functions. +Utility function for formatting numbers into strings. There are two versions: one for formatting floats, and one for formatting ints. The values for the digits and right parameters should always be positive integers. The left parameter should be positive or 0. If it is zero, only the right side is formatted.

    As shown in the above example, nf() is used to add zeros to the left and/or right of a number. This is typically for aligning a list of numbers. To remove digits from a floating-point number, use the int(), ceil(), floor(), or round() functions. ]]>
    diff --git a/content/api_en/noSmooth.xml b/content/api_en/noSmooth.xml index aa1ceec8d..d40dd92e6 100755 --- a/content/api_en/noSmooth.xml +++ b/content/api_en/noSmooth.xml @@ -38,7 +38,7 @@ void draw() { smooth() is active by default, so it is necessary to call noSmooth() to disable smoothing of geometry, fonts, and images. Since the release of Processing 3.0, the noSmooth() function can only be run once for each sketch, either at the top of a sketch without a setup(), or after the size() function when used in a sketch with setup(). See the examples above for both scenarios. +Draws all geometry and fonts with jagged (aliased) edges and images with hard edges between the pixels when enlarged rather than interpolating pixels. Note that smooth() is active by default, so it is necessary to call noSmooth() to disable smoothing of geometry, fonts, and images. Since the release of Processing 3.0, the noSmooth() function can only be run once for each sketch, either at the top of a sketch without a setup(), or after the size() function when used in a sketch with setup(). See the examples above for both scenarios. ]]> diff --git a/content/api_en/noiseDetail.xml b/content/api_en/noiseDetail.xml index b770659f0..dfd0d0633 100755 --- a/content/api_en/noiseDetail.xml +++ b/content/api_en/noiseDetail.xml @@ -31,7 +31,7 @@ void draw() { +Adjusts the character and level of detail produced by the Perlin noise function. Similar to harmonics in physics, noise is computed over several octaves. Lower octaves contribute more to the output signal and as such define the overall intensity of the noise, whereas higher octaves create finer-grained details in the noise sequence.

    By default, noise is computed over 4 octaves with each octave contributing exactly half than its predecessor, starting at 50% strength for the first octave. This falloff amount can be changed by adding an additional function parameter. For example, a falloff factor of 0.75 means each octave will now have 75% impact (25% less) of the previous lower octave. While any number between 0.0 and 1.0 is valid, note that values greater than 0.5 may result in noise() returning values greater than 1.0.

    diff --git a/content/api_en/pixelDensity.xml b/content/api_en/pixelDensity.xml index 02d96afe8..35b15bac1 100755 --- a/content/api_en/pixelDensity.xml +++ b/content/api_en/pixelDensity.xml @@ -57,9 +57,10 @@ void draw() { size() in a program without a setup() and used within setup() when a program has one. The pixelDensity() should only be used with hardcoded numbers (in almost all cases this number will be 2) or in combination with displayDensity() as in the third example above. - +

    +When the pixel density is set to more than 1, it changes all of the pixel operations including the way get(), set(), blend(), copy(), and updatePixels() all work. See the reference for pixelWidth and pixelHeight for more information. +

    To use variables as the arguments to pixelDensity() function, place the pixelDensity() function within the settings() function. There is more information about this on the settings() reference page. - ]]>
    diff --git a/content/api_en/pixelHeight.xml b/content/api_en/pixelHeight.xml index 8be6e94d4..1a2e15e63 100755 --- a/content/api_en/pixelHeight.xml +++ b/content/api_en/pixelHeight.xml @@ -8,10 +8,41 @@ + + + + diff --git a/content/api_en/pixelWidth.xml b/content/api_en/pixelWidth.xml index 45ab35d9e..5f88fa136 100755 --- a/content/api_en/pixelWidth.xml +++ b/content/api_en/pixelWidth.xml @@ -8,10 +8,41 @@ + + + + diff --git a/content/api_en/pixels.xml b/content/api_en/pixels.xml index b7ac0be33..536f50338 100755 --- a/content/api_en/pixels.xml +++ b/content/api_en/pixels.xml @@ -21,8 +21,8 @@ updatePixels(); -
    +The pixels[] array contains the values for all the pixels in the display window. These values are of the color datatype. This array is defined by the size of the display window. For example, if the window is 100 x 100 pixels, there will be 10,000 values and if the window is 200 x 300 pixels, there will be 60,000 values. When the pixel density is set to higher than 1 with the pixelDensity() function, these values will change. See the reference for pixelWidth or pixelHeight for more information. +

    Before accessing this array, the data must loaded with the loadPixels() function. Failure to do so may result in a NullPointerException. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again. After pixels has been modified, the updatePixels() function must be run to update the content of the display window. ]]>
    diff --git a/content/api_en/point.xml b/content/api_en/point.xml index 141dc932f..6034c7f82 100755 --- a/content/api_en/point.xml +++ b/content/api_en/point.xml @@ -35,6 +35,10 @@ point(30, 75, -50); Draws a point, a coordinate in space at the dimension of one pixel. The first parameter is the horizontal value for the point, the second value is the vertical value for the point, and the optional third value is the depth value. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example.

    Use stroke() to set the color of a point(). +

    +Point appears round with the default strokeCap(ROUND) and square with strokeCap(PROJECT). Points are invisible with strokeCap(SQUARE) (no cap). +

    +Using point() with strokeWeight(1) or smaller may draw nothing to the screen, depending on the graphics settings of the computer. Workarounds include setting the pixel using set() or drawing the point using either circle() or square(). ]]>
    diff --git a/content/api_en/pop.xml b/content/api_en/pop.xml new file mode 100644 index 000000000..743748933 --- /dev/null +++ b/content/api_en/pop.xml @@ -0,0 +1,51 @@ + + +pop() + +Structure + + + + + + +popMatrix_.png + + + + +popStyle_0.png + + + +pop() function restores the previous drawing style settings and transformations after push() has changed them. Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push(), it builds on the current style and transform information.
    +
    +push() stores information related to the current transformation state and style settings controlled by the following functions: rotate(), translate(), scale(), fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), imageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(), textFont(), textMode(), textSize(), textLeading().
    +
    +The push() and pop() functions were added with Processing 3.5. They can be used in place of pushMatrix(), popMatrix(), pushStyles(), and popStyles(). The difference is that push() and pop() control both the transformations (rotate, scale, translate) and the drawing styles at the same time. +]]> + + diff --git a/content/api_en/push.xml b/content/api_en/push.xml new file mode 100644 index 000000000..e926650fb --- /dev/null +++ b/content/api_en/push.xml @@ -0,0 +1,51 @@ + + +push() + +Structure + + + + + + +pushMatrix_.png + + + + +pushStyle_0.png + + + +push() function saves the current drawing style settings and transformations, while pop() restores these settings. Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push(), it builds on the current style and transform information.
    +
    +push() stores information related to the current transformation state and style settings controlled by the following functions: rotate(), translate(), scale(), fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), imageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(), textFont(), textMode(), textSize(), textLeading().
    +
    +The push() and pop() functions were added with Processing 3.5. They can be used in place of pushMatrix(), popMatrix(), pushStyles(), and popStyles(). The difference is that push() and pop() control both the transformations (rotate, scale, translate) and the drawing styles at the same time. +]]>
    + +
    diff --git a/content/api_en/quadraticVertex.xml b/content/api_en/quadraticVertex.xml index 1cf51f929..c3dd03bc5 100644 --- a/content/api_en/quadraticVertex.xml +++ b/content/api_en/quadraticVertex.xml @@ -35,7 +35,7 @@ endShape(); quadraticVertex() defines the position of one control points and one anchor point of a Bezier curve, adding a new segment to a line or shape. The first time quadraticVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). Using the 3D version requires rendering with P3D (see the Environment reference for more information). +Specifies vertex coordinates for quadratic Bezier curves. Each call to quadraticVertex() defines the position of one control point and one anchor point of a Bezier curve, adding a new segment to a line or shape. The first time quadraticVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). Using the 3D version requires rendering with P3D (see the Environment reference for more information). ]]> diff --git a/content/api_en/resetMatrix.xml b/content/api_en/resetMatrix.xml index 733a2803b..fb1c6ac42 100755 --- a/content/api_en/resetMatrix.xml +++ b/content/api_en/resetMatrix.xml @@ -9,7 +9,7 @@ -resetMatrix_.png +
    When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) shorten(originalArray) ]]>
    diff --git a/content/api_en/size.xml b/content/api_en/size.xml index 50ddae1f3..bd6f4c1b0 100755 --- a/content/api_en/size.xml +++ b/content/api_en/size.xml @@ -51,7 +51,7 @@ box(35);
    setup() function, the size() function must be the first line of code inside setup().
    +Defines the dimension of the display window width and height in units of pixels. In a program that has the setup() function, the size() function must be the first line of code inside setup(), and the setup() function must appear in the code tab with the same name as your sketch folder.

    The built-in variables width and height are set by the parameters passed to this function. For example, running size(640, 480) will assign 640 to the width variable and 480 to the height variable. If size() is not used, the window will be given a default size of 100 x 100 pixels.

    @@ -73,6 +73,8 @@ The renderer parameter selects which rendering engine to use. For example
    PDF: The PDF renderer draws 2D graphics directly to an Acrobat PDF file. This produces excellent results when you need vector shapes for high-resolution output or printing. You must first use Import Library → PDF to make use of the library. More information can be found in the PDF library reference.

    +SVG: The SVG renderer draws 2D graphics directly to an SVG file. This is great for importing into other vector programs or using for digital fabrication. You must first use Import Library → SVG Export to make use of the library.
    +
    As of Processing 3.0, to use variables as the parameters to size() function, place the size() function within the settings() function (instead of setup()). There is more information about this on the settings() reference page.

    ]]>
    diff --git a/content/api_en/smooth.xml b/content/api_en/smooth.xml index 6b82e35b5..c19f7a303 100755 --- a/content/api_en/smooth.xml +++ b/content/api_en/smooth.xml @@ -28,6 +28,8 @@ void draw() { + + + + + smooth() only needs to be used when a program needs to set the smoothing in a different way. The level parameter increases the level of smoothness. This is the level of over sampling applied to the graphics buffer.
    -
    -With the P2D and P3D renderers, smooth(2) is the default, this is called "2x anti-aliasing." The code smooth(4) is used for 4x anti-aliasing and smooth(8) is specified for 8x anti-aliasing. The maximum anti-aliasing level is determined by the hardware of the machine that is running the software, so smooth(4) and smooth(8) will not work with every computer.
    -
    -The default renderer uses smooth(3) by default. This is bicubic smoothing. The other option for the default renderer is smooth(2), which is bilinear smoothing.
    -
    +Draws all geometry with smooth (anti-aliased) edges. This behavior is the default, so smooth() only needs to be used when a program needs to set the smoothing in a different way. The level parameter increases the amount of smoothness. This is the level of over sampling applied to the graphics buffer. +

    +With the P2D and P3D renderers, smooth(2) is the default, this is called "2x anti-aliasing." The code smooth(4) is used for 4x anti-aliasing and smooth(8) is specified for "8x anti-aliasing." The maximum anti-aliasing level is determined by the hardware of the machine that is running the software, so smooth(4) and smooth(8) will not work with every computer. +

    +The default renderer uses smooth(3) by default. This is bicubic smoothing. The other option for the default renderer is smooth(2), which is bilinear smoothing. +

    With Processing 3.0, smooth() is different than before. It was common to use smooth() and noSmooth() to turn on and off antialiasing within a sketch. Now, because of how the software has changed, smooth() can only be set once within a sketch. It can be used either at the top of a sketch without a setup(), or after the size() function when used in a sketch with setup(). The noSmooth() function also follows the same rules. +

    +When smooth() is used with a PGraphics object, it should be run right after the object is created with createGraphics(), as shown in the Reference in the third example. ]]>
    diff --git a/content/api_en/splice.xml b/content/api_en/splice.xml index c62c959e8..a9f5358c6 100755 --- a/content/api_en/splice.xml +++ b/content/api_en/splice.xml @@ -39,7 +39,7 @@ println(a); +Inserts a value or an array of values into an existing array. The first two parameters must be arrays of the same datatype. The first parameter specifies the initial array to be modified, and the second parameter defines the data to be inserted. The third parameter is an index value which specifies the array position from which to insert data. (Remember that array index numbering starts at zero, so the first position is 0, the second position is 1, and so on.)

    When splicing an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) splice(array1, array2, index) ]]>
    diff --git a/content/api_en/split.xml b/content/api_en/split.xml index 13841d3ba..5b01ca9f2 100755 --- a/content/api_en/split.xml +++ b/content/api_en/split.xml @@ -38,7 +38,7 @@ String[] list = split(men, " ] "); split() function breaks a String into pieces using a character or string as the delimiter. The delim parameter specifies the character or characters that mark the boundaries between each piece. A String[] array is returned that contains each of the pieces.

    -If the result is a set of numbers, you can convert the String[] array to to a float[] or int[] array using the datatype conversion functions int() and float(). (See the second example above.) +If the result is a set of numbers, you can convert the String[] array to a float[] or int[] array using the datatype conversion functions int() and float(). (See the second example above.)

    The splitTokens() function works in a similar fashion, except that it splits using a range of characters instead of a specific character or sequence.

     

     

    - - - + Programming Interactivity: A Designer's Guide to Processing, Arduino, and openFrameworks - Programming Interactivity
    + Programming Interactivity
    Joshua Noble.
    Published January 2012, O'Reilly. 728 pages. Paperback.
    » Order from Amazon.com
    - The O'Reilly website says, "Make cool stuff. If you're a designer or artist without a lot of programming experience, this book will teach you to work with 2D and 3D graphics, sound, physical interaction, and electronic circuitry to create all sorts of interesting and compelling experiences -- online and off. Programming Interactivity explains programming and electrical engineering basics, and introduces three freely available tools created specifically for artists and designers: Processing, Arduino, and OpenFrameworks." - + The O'Reilly website says, "Make cool stuff. If you're a designer or artist without a lot of programming experience, this book will teach you to work with 2D and 3D graphics, sound, physical interaction, and electronic circuitry to create all sorts of interesting and compelling experiences -- online and off. Programming Interactivity explains programming and electrical engineering basics, and introduces three freely available tools created specifically for artists and designers: Processing, Arduino, and OpenFrameworks." + + +

     

    @@ -296,7 +394,6 @@

    Books. Processing books cove -

     

    @@ -317,15 +414,12 @@

    Books. Processing books cove The Wiley website says, "this book offers a series of generic procedures that can function as building blocks and encourages you to then use those building blocks to experiment, explore, and channel your thoughts, ideas, and principles into potential solutions. The book covers such topics as structured shapes, solid geometry, networking and databases, physical computing, image processing, graphic user interfaces, and more." - -

     

     

    - Data-driven Graphic Design: Creative Coding for Visual Communication @@ -335,20 +429,16 @@

    Books. Processing books cove Andrew Richardson.
    Published January 2016, Bloomsbury. 224 Pages. Paperback.
    » Order from Amazon.com -
    +

    The book description reads, "Data-driven Graphic Design introduces the creative potential of computational data and how it can be used to inform and create everything from typography, print and moving graphics to interactive design and physical installations. Using code as a creative environment allows designers to step outside the boundaries of commercial software tools, and create a set of unique, digitally informed pieces of work. The use of code offers a new way of thinking about and creating design for the digital environment." - - - + - +

     

     

    @@ -394,7 +484,7 @@

    Books. Processing books cove - +

     

     

    @@ -456,21 +546,65 @@

    Books. Processing books cove

     

    + + Creating Procedural Artworks with Processing + +

    + Creating Procedural Artworks with Processing
    A Holistic Guide

    + Penny de Byl
    + Published May 2017, CreateSpace Independent Publishing Platform, 386 pages. Paperback
    + » Order Print/eBook from Amazon
    + » Order from iBooks
    +
    + This book started as a set of tutorials for university level multimedia students to introduce them to computer programming through the development of artworks. It's therefore presented in a non-threatening way that will ease the reader into programming and has been written for absolute beginners who want to learn to program. It approaches coding through a unique combination of teaching programming while keeping in mind the principles of design and mathematics. +

    + The chapters are organised to weave together programming functionality and design principles presenting one concept at a time, with multiple hands on exercises in each chapter. +
    +
    + Additional information available at http://holistic3d.com/creating-procedural-artworks/

    + Experience an example of the artworks created at http://holistic3d.com/processing
    + + + +

     

    +

     

    + - + + + + O Código Transcendente: Uma Introdução Prática à Programação e Arte Gerativa + O Código Transcendente: Uma Introdução Prática à Programação e Arte Gerativa
    + Mateus Berruezo.
    + Published December 2019. 270 pages. PDF, Web.
    + Text in Portuguese.
    + » Download
    + » Read online +
    +
    + Este livro é um guia de programação com enfoque prático considerando o contexto da arte gerativa e do pensamento computacional. Ele conta com explicações e exemplos visuais cuidadosamente projetados para serem de valor tanto para programadores quanto artistas. As aplicações e estudos de caso foram direcionados para a linguagem Processing cuja própria filosofia segue o princípio da exploração do artístico através do código. + + + +

     

    +

     

    + + Einführung ins Programmieren mit Processing Einführung ins Programmieren mit Processing
    - Matthias Wolf.
    - Published August 2013. 178 pages. PDF, Paperback.
    - Text in German.
    - » Order Print/EBook from lulu.com
    -
    -

    Die eigenständige Programmiersprache Processing basiert auf Java und ähnelt diesem sehr, verbirgt aber gleichzeitig viel von dessen Komplexität. Dadurch ist Processing für den Programmieranfänger ideal geeignet, um sich Konzepte des Programmierens zu erschließen und bewahrt gleichzeitig die Möglichkeit eines späteren Umstiegs. Dennoch ist die Sprache keineswegs nur für triviale Anfängeraufgaben geeignet: speziell im Bereich der graphischen Datenverarbeitung spielt Processing seine Stärken aus.

    -

    Dieses Buch richtet sich in erster Linie an den Einsteiger, den es an die Bewältigung auch komplexerer Aufgaben heranführt, wobei grundlegende Konzepte der imperativen und der objektorientierten Programmierung vorgestellt werden. Auch notwendige theoretische Hintergründe kommen dabei nicht zu kurz. Ausführlich kommentierter Beispielcode erschließt Konzepte und Sprache. Aber auch der routinierte Programmierer, der sich "nur" eine neue Sprache erschließen will, wird fündig!

    -

    Aus dem Inhalt: Datentypen — Variablen — Arrays (ein- und mehrdiomensional) — Flusssteuerung — Methoden — Objektorientiertes Programmieren — 2D-Graphik — 3D-Graphik — Dateizugriff — PDF — QuickTimeTM — Arduino®-Mikrocontroller — Alphabetischer Index + Matthias Wolf.
    + Published August 2013. 178 pages. PDF, Paperback.
    + Text in German.
    + » Order Print/EBook from lulu.com
    +
    +

    Die eigenständige Programmiersprache Processing basiert auf Java und ähnelt diesem sehr, verbirgt aber gleichzeitig viel von dessen Komplexität. Dadurch ist Processing für den Programmieranfänger ideal geeignet, um sich Konzepte des Programmierens zu erschließen und bewahrt gleichzeitig die Möglichkeit eines späteren Umstiegs. Dennoch ist die Sprache keineswegs nur für triviale Anfängeraufgaben geeignet: speziell im Bereich der graphischen Datenverarbeitung spielt Processing seine Stärken aus.

    +

    Dieses Buch richtet sich in erster Linie an den Einsteiger, den es an die Bewältigung auch komplexerer Aufgaben heranführt, wobei grundlegende Konzepte der imperativen und der objektorientierten Programmierung vorgestellt werden. Auch notwendige theoretische Hintergründe kommen dabei nicht zu kurz. Ausführlich kommentierter Beispielcode erschließt Konzepte und Sprache. Aber auch der routinierte Programmierer, der sich "nur" eine neue Sprache erschließen will, wird fündig!

    +

    Aus dem Inhalt: Datentypen — Variablen — Arrays (ein- und mehrdiomensional) — Flusssteuerung — Methoden — Objektorientiertes Programmieren — 2D-Graphik — 3D-Graphik — Dateizugriff — PDF — QuickTimeTM — Arduino®-Mikrocontroller — Alphabetischer Index @@ -488,7 +622,7 @@

    Books. Processing books cove Text in German.

    The OReilly.de site writes, "Processing ist eine auf Grafik, Simulation und Animation spezialisierte objektorientierte Programmiersprache, die besonders für Menschen mit wenig Programmiererfahrung geeignet ist. Deshalb eignet sie sich vor allem für Künstler, Bastler und Programmiereinsteiger. Die aus Java abgeleitete Sprache wurde geschaffen, um schnell und effektiv mit relativ wenig Aufwand zu beeindruckenden Ergebnissen zu kommen. Processing führt den Leser zügig in die Programmieressentials ein und geht dann unmittelbar zur Programmierung grafisch anspruchsvoller Anwendungen über. Spielerisch wird dem Leser die 2D- und 3D-Programierung, Textrendering, die Bildbearbeitung und sogar die Videomanipulation nahe gebracht." -

    + @@ -560,7 +694,8 @@

    Books. Processing books cove During the 50‘s ”era of cybernetics“, computer entered into the history of art simultaneously in different parts of the world. Art and science were in great turmoil. Science, with its theories and experiments, was approaching artificially mimicking both natural phenomena, such as light and sound, and the human phenomena of language and communication. Art, with its aesthetic and exhibitions, had transcended the boundaries of the avant-garde. Now, with the computer, it was confronting a reality that challenged ”the where“ and ”the how“ of doing art and the very meaning of ”masterpiece“. Antonio Rollo takes us on a tour of these seminal works from his unique perspective of the artist, through the code!

    - There's additional information on the publisher's website. + There's additional information on the publisher's website. + @@ -580,7 +715,8 @@

    Books. Processing books cove
    Note from Casey: "I received a copy of this book from the authors on a recent trip to Japan. It's a beautifully produced full-color book with sections introducing Processing, featuring work created with Processing (many are from the Exhibition section of the Processing website), and introducing programming through progressively complicated examples. The majority of the book is an introduction to programming. There are many good examples and the code is color-coded like in the Processing Environment. This book is less comprehensive than the Greenberg and Reas/Fry books, but it appears to be a good, brief introduction."

    - There's additional information on the publisher's website. + There's additional information on the publisher's website. + @@ -610,49 +746,5 @@

    Books. Processing books cove - - - -

     

    -

     

    - - -

     

    - - Processing is also discussed through examples and projects in the following books: - -
    - -
    - - 10 PRINT CHR$(205.5+RND(1)); : GOTO 10
    By Nick Montfort, Patsy Baudoin, John Bell, Ian Bogost, Jeremy Douglass, Mark C. Marino, Michael Mateas, Casey Reas, Mark Sample, Noah Vawter. Examples use Processing to explore a modern interpretation of a 1982 Commodore 64 program.
    - -
    - - Make: Getting Started with Arduino
    By Massimo Banzi. Examples use Processing to communicate with an Arduino board.
    - -
    - - Building Wireless Sensor Networks: with ZigBee, XBee, Arduino, and Processing
    By Robert Faludi. Network examples use Processing.
    - -
    - - Physical Computing: Sensing and Controlling the Physical World with Computers
    - By Dan O'Sullivan and Tom Igoe. Examples using Processing for RS-232 communication and - computer vision.
    - -
    - - Aesthetic Computing.
    - Edited by Paul Fishwick. Casey Reas and Ben Fry contributed a chapter entitled - "Processing Code: Programming within the Context of Visual Art and Design."
    - -
    - - Hacking Roomba: ExtremeTech
    By Tod E. Kurt. Processing is introduced and used to design an application to control a Roomba (a robot vacuum cleaner).
    - -
    - Analog In, Digital Out
    By Brendan Dawes. Numerous projects created with Processing are illustrated and discussed.
    -

    diff --git a/content/static/download.html b/content/static/download.html new file mode 100644 index 000000000..122db5e30 --- /dev/null +++ b/content/static/download.html @@ -0,0 +1,334 @@ +
    + +

    Download Processing. Processing is available for Linux, Mac OS X, and Windows. Select your choice to download the software below.

    + + +
    + + + + +
    + 4.0b1 + (9 August 2021) + +
    + + +
    + +
    + Read about the changes in 4.0. The list of revisions covers the differences between releases in detail. +
    +
    +
    + + +
    +

    Stable Releases

    +
  • + 4.0b1 + (9 August 2021) + Windows 64 + Linux 64 + macOS +
  • +
  • + 3.5.4 + (17 January 2020) + Win 32 + Win 64 + Linux 64 + Mac OS X +
  • + + +
  • + 2.2.1 + (19 May 2014) + Win 32 + Win 64 + Linux 32 + Linux 64 + Mac OS X +
  • + +
  • + 1.5.1 + (15 May 2011) + Win (standard) + Win (no Java) + Linux x86 + Mac OS X +
  • + +

    Earlier releases have been removed because we can only support the current versions of the software. To update old code, read the changes page. Changes for each release can be found in revisions.txt. If you have problems with the current release, please file a bug so that we can fix it. Older releases can also be built from the source. Read More about the releases and their numbering. To use Android Mode, Processing 3 or later is required.

    +
    + + +
    +

    Pre-Releases

    + +

    The changes document covers incremental updates between 4.x releases, and is especially important to read for pre-releases.

    +
    + + +
    + Processing is Open Source Software. The PDE (Processing Development Environment) is released under the GNU GPL (General Public License). The export libraries (also known as 'core') are released under the GNU LGPL (Lesser General Public License). There's more information about Processing and Open Source in the FAQ and more information about the GNU GPL and GNU LGPL at opensource.org. Please support Processing! +
    + +
    diff --git a/content/static/foundation-site/donate.html b/content/static/foundation-site/donate.html deleted file mode 100644 index f7ec3331c..000000000 --- a/content/static/foundation-site/donate.html +++ /dev/null @@ -1,38 +0,0 @@ -

    Donate

    - -

    - - - - -
    - - - -
    -

    diff --git a/content/static/foundation-site/fellowships.html b/content/static/foundation-site/fellowships.html deleted file mode 100644 index 8359f116c..000000000 --- a/content/static/foundation-site/fellowships.html +++ /dev/null @@ -1,57 +0,0 @@ -

    Fellowships

    - -

    - - - - - -
    - -

    -The Processing Foundation maintains a fellowship program that supports the development and expansion of Processing and its affiliated projects. Work done by fellows is supported through funding and mentorship from The Processing Foundation. The projects done so far have all been undertaken in parallel with each of the fellows’ practices as artists. - -

    -
    - -
    -
    -

    -Wilm Thoben (2013-14) -

    -

    -Thoben developed a new core Sound library from fall 2013 through winter 2014. This library is now released with Processing 3.0. -
    -
    -Wilm Thoben is a sound artist and researcher. He is currently working on his dissertation about the 1960s art and technology group E.A.T. His work deals with perception and definition of space or the abstraction of everyday life. See more of Thoben's work at wilmthoben.com. -

    -
    - -
    -
    -

    -Lauren McCarthy (2013) -

    -

    -McCarthy started the work that has now become p5.js in spring, summer, and fall 2013. p5.js is a JavaScript interpretation of Processing. -
    -
    -Lauren McCarthy is an artist and programmer based in Brooklyn, NY. She is adjunct faculty at RISD and NYU ITP, a researcher in residence at ITP, and recently a resident at Eyebeam. She holds an MFA from UCLA and a BS Computer Science and BS Art and Design from MIT. Her work explores the structures and systems of social interactions, identity, and self-representation, and the potential for technology to mediate, manipulate, and evolve these interactions. She is fascinated by the slightly uncomfortable moments when patterns are shifted, expectations are broken, and participants become aware of the system. See more of McCarthy's work at lauren-mccarthy.com. - -

    -
    - -
    -
    -

    -Greg Borenstein (2013) -

    -

    -Borenstein expanded and released the OpenCV library in spring and summer 2013. -
    -
    -Greg Borenstein is an artist, technologist, and teacher. He creates illusions for humans and machines. His work explores computer vision, machine learning, game design, visual effects, and drawing as media for storytelling and design. Greg is a graduate of the NYU Interactive Telecommunications Program and has worked for firms such as Makerbot and Berg London. He is the author of a book for O'Reilly about the Microsoft Kinect, titled: Making Things See: 3D vision with Kinect, Processing, Arduino, and MakerBot. He's currently a researcher in the Playful Systems Group at the MIT Media Lab. See more of Borenstein's work at gregborenstein.com. -

    - -
    -

    diff --git a/content/static/foundation-site/imgs/JH_bio.png b/content/static/foundation-site/imgs/JH_bio.png deleted file mode 100644 index 1bc2b1b1a..000000000 Binary files a/content/static/foundation-site/imgs/JH_bio.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/ben_worksample_sm.png b/content/static/foundation-site/imgs/ben_worksample_sm.png deleted file mode 100644 index 23d723fe3..000000000 Binary files a/content/static/foundation-site/imgs/ben_worksample_sm.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/dan_worksample_sm.png b/content/static/foundation-site/imgs/dan_worksample_sm.png deleted file mode 100644 index a29e3dba9..000000000 Binary files a/content/static/foundation-site/imgs/dan_worksample_sm.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/greg_worksample1.png b/content/static/foundation-site/imgs/greg_worksample1.png deleted file mode 100644 index 61ab8c712..000000000 Binary files a/content/static/foundation-site/imgs/greg_worksample1.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/greg_worksample2.png b/content/static/foundation-site/imgs/greg_worksample2.png deleted file mode 100644 index d1411648b..000000000 Binary files a/content/static/foundation-site/imgs/greg_worksample2.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/greg_worksample3.png b/content/static/foundation-site/imgs/greg_worksample3.png deleted file mode 100644 index fb5a1e0ae..000000000 Binary files a/content/static/foundation-site/imgs/greg_worksample3.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/john_worksample_sm.png b/content/static/foundation-site/imgs/john_worksample_sm.png deleted file mode 100644 index 21c3ad277..000000000 Binary files a/content/static/foundation-site/imgs/john_worksample_sm.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/lauren_worksample1.png b/content/static/foundation-site/imgs/lauren_worksample1.png deleted file mode 100644 index c6aed5299..000000000 Binary files a/content/static/foundation-site/imgs/lauren_worksample1.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/lauren_worksample2.png b/content/static/foundation-site/imgs/lauren_worksample2.png deleted file mode 100644 index 71a59024e..000000000 Binary files a/content/static/foundation-site/imgs/lauren_worksample2.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/lauren_worksample3.png b/content/static/foundation-site/imgs/lauren_worksample3.png deleted file mode 100644 index dd32868d8..000000000 Binary files a/content/static/foundation-site/imgs/lauren_worksample3.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/lauren_worksample_sm.png b/content/static/foundation-site/imgs/lauren_worksample_sm.png deleted file mode 100644 index 50e7fee7b..000000000 Binary files a/content/static/foundation-site/imgs/lauren_worksample_sm.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/processing-foundation-logo.svg b/content/static/foundation-site/imgs/processing-foundation-logo.svg deleted file mode 100644 index 76b2e09a2..000000000 --- a/content/static/foundation-site/imgs/processing-foundation-logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - -Processing Foundation - diff --git a/content/static/foundation-site/imgs/processing-logo.svg b/content/static/foundation-site/imgs/processing-logo.svg deleted file mode 100644 index 6eaebe60a..000000000 --- a/content/static/foundation-site/imgs/processing-logo.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/content/static/foundation-site/imgs/processing-site.png b/content/static/foundation-site/imgs/processing-site.png deleted file mode 100644 index 615c4b9c0..000000000 Binary files a/content/static/foundation-site/imgs/processing-site.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/reas_worksample_sm.png b/content/static/foundation-site/imgs/reas_worksample_sm.png deleted file mode 100644 index cbf6befe7..000000000 Binary files a/content/static/foundation-site/imgs/reas_worksample_sm.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/search-f.svg b/content/static/foundation-site/imgs/search-f.svg deleted file mode 100644 index 8066b89ab..000000000 --- a/content/static/foundation-site/imgs/search-f.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/content/static/foundation-site/imgs/wilm_worksample1.png b/content/static/foundation-site/imgs/wilm_worksample1.png deleted file mode 100644 index 74514bb21..000000000 Binary files a/content/static/foundation-site/imgs/wilm_worksample1.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/wilm_worksample2.png b/content/static/foundation-site/imgs/wilm_worksample2.png deleted file mode 100644 index 33a021566..000000000 Binary files a/content/static/foundation-site/imgs/wilm_worksample2.png and /dev/null differ diff --git a/content/static/foundation-site/imgs/wilm_worksample3.png b/content/static/foundation-site/imgs/wilm_worksample3.png deleted file mode 100644 index f009d61fe..000000000 Binary files a/content/static/foundation-site/imgs/wilm_worksample3.png and /dev/null differ diff --git a/content/static/foundation-site/mission.html b/content/static/foundation-site/mission.html deleted file mode 100644 index b26fe4bd7..000000000 --- a/content/static/foundation-site/mission.html +++ /dev/null @@ -1,37 +0,0 @@ -

    Mission

    - -

    - - - - -
    - -

    - Since its inception in 2001, Processing has sought to bridge the traditionally divided cultures of the arts and the sciences. The mission of the Processing Foundation is to link these two cultures so they can be used within a diverse constituency, by way of developing the Processing software. For those with a tendency to think in numbers, Processing introduces a language of the visual arts through a more familiar computer science vocabulary. Likewise, the software is structured through an image-based framework, making it accessible to visual thinkers. Core computer science concepts like variables, functions, and conditionals are taught side by side with visual basics like image, shape, and color. -

    - -

    - The key to our philosophy is the merging between the two: we see software as a medium, or something that connects two things. We view it as a means for making, and see our role as providing a new medium to artists and users across a variety of fields. At a time when our society requires a literacy and sensitivity to media of all kinds, we see ourselves making this possible for a broad spectrum of constituencies. - -

    - -

    - Processing serves a wide range of communities in different contexts, from the university classroom to the tinkerer’s garage, used by everyone from the professional to the hobbyist. Within education at a university level, we have seen Processing leveraged as a classroom tool across disciplines as varied as computer science, English, art, architecture, design, and the digital humanities. In the last few years, it has begun to become a presence in high school and middle school classrooms, being particularly effective when used to teach science, math, and more generally, computer science. For example, the Kahn Academy now uses Processing’s tutorials and language in their beginning computer science instruction. In areas of professional development, Processing has become enfolded into the practices of interface and communication designers, artists and media artists, photographers, architects, and filmmakers. It also has a substantial role in the communities of makers and amateurs, and among hackerspaces and gatherings of hobbyists. - -

    - -

    - The growing use of Processing in the classroom over the last twelve years has pointed toward a direction to rethink the way students are taught to program. Instead of learning a specific vocational skill (such as any one certain programming language or software), the teaching of Processing follows from a philosophy that advocates for a more generalized and strategic way of thinking. Because technology changes at such a rapid pace, the goal of any education in software has to teach the fundamentals of programming. With knowledge of such a foundation, a student is able to learn any other piece of software. Processing was specifically designed to relate to other languages, so a working knowledge of it means that a student can become well-versed in others that are more domain-specific, in relatively little time. Also, it uses a visual framework, so as to be more accessible to people who don’t naturally think like mathematicians or computer scientists. This has opened the door for software to become part of an artist’s toolkit in a way never before seen. -

    - -

    - The use of Processing within the visual arts and design fields has grown continuously since the software was first released. Appearing at a critical moment when artists began introducing new media and technology into their practices, Processing has allowed for thousands of creative professionals to leverage it as a medium, changing the landscape of the arts at the beginning of the 21st century. Software is still a nascent medium for artists and designers, and part of The Processing Foundation’s mission is to nurture this trajectory to be both widely used and accepted. -

    - -

    - Within technology, Processing has made it possible to understand massive data sets in a visual and more accessible way. It has also helped foster the connection between engineering and visual design that has been pushed to the fore by Apple and others. -

    - -
    -

    diff --git a/content/static/foundation-site/overview.html b/content/static/foundation-site/overview.html deleted file mode 100644 index a7addf80c..000000000 --- a/content/static/foundation-site/overview.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - -
    - -

    - The Processing Foundation was founded in 2012 with the two-fold mission to promote software literacy within the visual arts, and visual literacy within technology-related fields. Our primary goal is to empower people of all interests and backgrounds to learn how to program, so as to facilitate a sophisticated way of thinking about and creating media at a time when such knowledge is crucial. We do this by developing and distributing a group of related software projects, which includes Processing (Java), p5.js (Javascript), and Processing.py (Python). -

    - -

    -We serve a growing community of artists, designers, educators, programmers, engineers, and anyone in between who has an inclination toward both the arts and technology. Core to our belief is that learning how to program is a process of learning how to think, rather than acquiring a certain skillset, so that this knowledge may be applied to any number of fields, from creating artworks to imagining new technologies. We view Processing as a means to bridge seemingly disparate disciplines, providing platforms for collaboration between communities that might not otherwise have had access to each other. We also envision Processing as a new tool for both artists and technologists to use in their work, as a medium and as a context. We see ourselves situated at the place of convergence between the arts and technology, facilitating the pursuit and literacy of both. -

    - -

    -Processing is primarily developed by a dedicated group affiliated with Fathom Information Design (Boston), the UCLA Arts Software Studio (Los Angeles), and ITP at NYU (New York City). -

    - -

    - The Processing Foundation supports a fellowship program to initiate and develop research projects for the Processing software. -

    - -

    -We are supported by our community and actively seek donations through downloads of Processing. -

    - -

    -Contact us at foundation@processing.org -

    - -
    diff --git a/content/static/foundation-site/patrons.html b/content/static/foundation-site/patrons.html deleted file mode 100644 index da4035913..000000000 --- a/content/static/foundation-site/patrons.html +++ /dev/null @@ -1,56 +0,0 @@ -

    Patrons

    - -

    - - - - - -
    - -

    - Individuals making $5 to $100 donations are the largest source of income for the Processing Foundation. We’re grateful to all who have donated and we’re proud to be supported by the community. You can donate when you download the software here. -

    - -

    - The University of Denver and the Emergent Digital Practices program sponsored a Processing 3.0 development meeting in November 2014. We thank Chris Coleman and Laleh Mehran for arranging this session and gracefully hosting us. -

    - -

    - The Google Summer of Code program has provided and excellent source of energy and new development through supporting students to work with us. This program has now supported Processing for four years, 2010 to 2014. It has provided the base for many important enhancements to the software. -

    - -

    - In 2013, O'Reilly Media and Arduino made donations to the Processing Foundation. -

    - -

    - Prior to incorporating as a Foundation, Processing received key funding and support from several organizations and companies. These commitments enabled a series of pivotal improvements to the software: -

    - -
      - -
    • - The Interactive Telecommunications Program (ITP) at New York University sponsored a Processing 2.0 development workshop in the summer of 2011. -
    • - -
    • - The Armstrong Institute for Interactive Media Studies at Miami University funded The Oxford Project, a series of Processing development workshops during the 2008-2009 academic year. These four-day meetings in Oxford, Ohio, enabled the November 2008 launch of Processing 1.0 and stimulated future development. -
    • - -
    • - Oblong Industries funded Ben Fry to develop Processing during the summer of 2008. This funding also assisted in the completion of the 1.0 release. -
    • -
    • - The Rockefeller Foundation awarded Ben Fry with a Media Arts Fellowship in 2006. The grant marked the first time that Ben was able to work on Processing as a funded project. This support led to further developments of the OpenGL and PDF rendering engines, as well as significant enhancements to other libraries and their integration. -
    • - -
    • - The Interaction Design Institute Ivrea funded four individuals' work on Processing in the summer of 2003. This resulted in Dan Mosedale's preprocessor using Antlr, Sami Arola's contributions to the graphics engine, and other contributions to the Processing Development Environment and 2D graphics engine. We are grateful to Interaction Ivrea director Gillian Crampton Smith for her encouragement and support. -
    • - -
    - - -
    -

    diff --git a/content/static/foundation-site/people.html b/content/static/foundation-site/people.html deleted file mode 100644 index 67311af77..000000000 --- a/content/static/foundation-site/people.html +++ /dev/null @@ -1,71 +0,0 @@ -

    Board of Directors

    - - - - - - - - - - - - - - - - - - - - - - -
    - - - Ben Fry is principal of Fathom, a design and software consultancy located in Boston. He received his doctoral degree from the Aesthetics + Computation Group at the MIT Media Laboratory, where his research focused on combining fields such as computer science, statistics, graphic design, and data visualization as a means for understanding information. After completing his thesis, he spent time developing tools for visualization of genetic data as a postdoc with Eric Lander at the Eli and Edythe L. Broad Institute of MIT and Harvard. During the 2006-2007 school year, Ben was the Nierenberg Chair of Design for the Carnegie Mellon School of Design. In 2011, he won the National Design Award for Interaction Design from the Cooper-Hewitt. With Casey Reas, Fry initiated Processing in 2001. -
    - - - Daniel Shiffman works as an Associate Arts Professor at the Interactive Telecommunications Program at NYU's Tisch School of the Arts. Originally from Baltimore, Daniel received a BA in Mathematics and Philosophy from Yale University and a Master's Degree from the Interactive Telecommunications Program. He works on developing tutorials, examples, and libraries for Processing, the open source programming language and environment created by Casey Reas and Ben Fry. He is the author of Learning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction and The Nature of Code (self-published via Kickstarter), an open source book about simulating natural phenomenon in Processing. -
    - - - Lauren McCarthy is an artist based in Brooklyn, NY. She is full-time faculty at NYU ITP, and recently a resident at CMU STUDIO for Creative Inquiry and Eyebeam. She holds an MFA from UCLA and a BS Computer Science and BS Art and Design from MIT. Her work explores current systems and structures for being a person and interacting with other people. -
    - - - Casey Reas is an artist and educator based in Los Angeles. He has exhibited, screened, and performed his work internationally in galleries and museums around the world. Reas is a professor at the University of California, Los Angeles. He holds a masters degree from the Massachusetts Institute of Technology in Media Arts and Sciences as well as a bachelors degree from the School of Design, Architecture, Art, and Planning at the University of Cincinnati. With Ben Fry, Reas initiated Processing in 2001. -
    - -

    Assistant Director

    - - - - - - - - -
    - - - Johanna Hedva is an artist and writer whose practice manifests in a wide range of projects, from performances of Ancient Greek plays rewritten to respond to feminist and queer political discourse, to poetry, novels, criticism, and theory. She's got an MA in Aesthetics and Politics, and an MFA in Art, from California Institute of the Arts, and has been an artist-in-residence at Headlands Center for the Arts, and writer-in-residence at the Armory Center for the Arts. Her work with the Processing Foundation is motivated by her political and social commitments to gender and racial diversity in technology and the arts; open-source philosophy and practice; and promoting the attenuation of the boundaries between creative and thought-making disciplines of all kinds. -
    - - -

    Advisor

    - - - - - - - - -
    - - - John Maeda is currently a Design Partner at Kleiner Perkins Caufield & Byers. He was the President of the Rhode Island School of Design from 2008 to 2013, is a recipient of the National Design Award, and is represented in the permanent collection of the Museum of Modern Art. Beginning in 1996, lasting for 13 years, he was a Professor at MIT, where he served as an Associate Director of Research at the MIT Media Lab and was responsible for managing research relationships with 70+ industrial organizations. He received a Ph.D. in Design Science from the University of Tsukuba Institute of Art and Design in Japan. In May 2003, he received an Honorary Doctorate of Fine Arts from the Maryland Institute of Contemporary Art. He received an MBA from Arizona State University in May 2006. -
    diff --git a/content/static/foundation-site/projects.html b/content/static/foundation-site/projects.html deleted file mode 100644 index 926060e62..000000000 --- a/content/static/foundation-site/projects.html +++ /dev/null @@ -1,49 +0,0 @@ -

    Projects

    - -

    - - - - -
    - -

    Processing

    - -

    - Processing is a programming language, development environment, and online community. Founded in 2001, Processing was initially created to serve as a software sketchbook and to teach computer programming fundamentals within a visual context. Processing has since evolved into a development tool for professionals, an educational tool used in classrooms around the country, and a new context and medium for artists. Today, there are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production. -

    - -

    - It was designed to be a user’s first programming language, inspired by earlier languages like BASIC and Logo, as well as our experiences as students and teaching visual arts foundation curricula. It is now used in classrooms worldwide, often in art schools and visual arts programs in universities, but also in high schools, computer science programs, and humanities curricula. -

    - -

    - In addition to educational purposes, the Processing software is used by thousands of visual designers, artists, and architects to create their works. Projects created with Processing have been featured at the Museum of Modern Art in New York, the Victoria and Albert Museum in London, the Centre Georges Pompidou in Paris, and many other prominent venues. Processing is used to create projected stage designs for dance and music performances; to generate images for music videos and film; to export images for posters, magazines, and books; and to create interactive installations in galleries, in museums, and on the street. -

    - -
    - -

    p5.js

    - -

    - p5.js is a JavaScript library that starts with the original goal of Processing--to make coding accessible for artists, designers, educators, and beginners--and reinterprets this for today's web. Using the original metaphor of a software sketchbook, p5.js has a full set of drawing functionality for the entire browser page. For this, p5.js has addon libraries that streamline interaction with other HTML5 objects, including text, input, video, webcam, and sound. -

    - -

    - Having just been released, p5.js is in active development, with an official editing environment and other features coming soon. -

    - -
    - -

    Processing.py

    - -

    - Our most recent initiative: To write Processing code. In Python. -

    - -

    - We are thrilled to make available this public release of the Python Mode for Processing, and its associated documentation. If you'd like to help us improve the implementation of Python Mode and its documentation, please find us on Github. -

    - -
    -

    diff --git a/content/static/foundation-site/reports.html b/content/static/foundation-site/reports.html deleted file mode 100644 index bd1dff641..000000000 --- a/content/static/foundation-site/reports.html +++ /dev/null @@ -1,176 +0,0 @@ -

    Annual Reports

    - -

    - - - - - -
    - -

    2013 Report

    - -

    - We had a busy and productive 2013 with a wide range of activities: -

      -
    • Released Processing 2.0 and 2.1
    • -
        -
      • New OpenGL renderers for speed
      • -
      • Integrated GLSL shaders and API
      • -
      • New video library for faster capture and playback
      • -
      • Enhanced library manager for easy install
      • -
      • Enhanced modes infrastructure to make it easier to add new languages to the PDE
      • -
      • New features for working with XML and JSON
      • -
      • New classes for working with data
      • -
      • New features for working with SVN and OBJ
      • -
      -
    • Launched "Hello Processing" video tutorial
    • - -
    • Processing Fellows
    • -
        -
      • Lauren McCarthy, exploratory research led to p5.js
      • -
      • Greg Borenstein, released OpenCV library
      • -
      • Wilm Thoben, work started on new core Sound library
      • -
      -
    • Community Development
    • -
        -
      • Worked with community library authors to port and develop 109 libraries for 2.0
      • -
      • New templates developed for creating libraries and tools
      • -
      • 2.0 Processing Forum launched and 1.0 Forum archived
      • -
      • Website redesigned with simplified navigation and new tutorials
      • -
      - -
    • Thank you! This year, we're especially grateful to the following people and groups:
    • -
        -
      • Processing users who have donated through the Download page
      • -
      • O'Reilly Media for the December 2013 matching grant
      • -
      • Arduino for the generous donation in February 2013
      • -
      • The Google Summer of Code program for supporting students to work with us
      • -
      -
    -

    - -
    -
    -

    Google Summer of Code

    - -

    2014 Report

    - -

    - The Processing Foundation participated in Google Summer of Code for its fourth consecutive year in 2014, completing a total of eleven projects (summarized below) with a group of dedicated, innovative, and inspiring students. -

      -
    • “Android Mode for Processing 3.0” by Imil Ziyaztdinov, mentored by Andres Colubri
    • -
        -
      • Export signed package (with transparent handing of keystores)
      • -
      • Device selector
      • -
      • Automatic SDK download/installation
      • -
      • Target SDK selector
      • -
      • Fixed critical bugs, most notably the missing javac error during package building
      • -
      - -
    • “Contributions Manager: Reloaded” by Joel Moniz, mentored by Florian Jenett
    • -
        -
      • Addition, removal, and update of Tools and Modes without restart
      • -
      • New "examples-package"-type contribution
      • -
      -
    • “Loom” by Chris Johnson-Roberson, mentored by R. Luke DuBois
    • -
        -
      • Allows for creation and manipulation of patterns from timed events.
      • -
      -
    • New video library using GStreamer 1.x by Roland Elek, co-mentored by Levente Farkas and Andres Colubri
    • -
        -
      • Creates a set of Java bindings for the GStreamer 1.x series to use within Processing
      • -
      -
    • “ofSketch” by Brannon Dorsey, mentored by Christopher Baker -
    • -
        -
      • Browser-based IDE for openFrameworks
      • -
      • API specific autocomplete
      • -
      • Compilation feedback
      • -
      • Error reporting
      • -
      • Project export
      • -
      • Remote coding capabilities
      • -
      • Raspberry Pi support
      • -
      -
    • “p5.sound” by Jason Sigal, mentored by Evelyn Eastmond
    • -
        -
      • Audio input
      • -
      • Playback
      • -
      • Manipulation
      • -
      • Effects
      • -
      • Recording
      • -
      • Analysis
      • -
      • Synthesis
      • -
      • Built with syntax from Wilm Thoben's Sound for Processing library
      • -
      -
    • “p5 IDE” by Sam Lavigne, mentored by Lauren McCarthy -
    • -
        -
      • Easy to use desktop IDE for creating pg5.js projects
      • -
      - -
    • “PDE X for Processing 3.0” by Manindra Moharana, mentored by Daniel Shiffman -
    • -
        -
      • Easy to use desktop IDE for creating p5.js projects
      • -
      - -
    • “POculus” by Pratik Sharma, mentored by Elie Zananiri -
    • -
        -
      • Oculus Rift renderer for Processing
      • -
      • Runs any P3D sketch in an Oculus Rift
      • - -
      - -
    • “Sound for Processing 3.0” by Wilm Thoben, mentored by Casey Reas
    • -
        -
      • New lightweight sound library for Processing
      • -
      • Using enhanced version of the methcla sound engine
      • -
      • Low latency support
      • -
      • Synthesis objects, analyzers, and effects
      • -
      - -
    • “TweakMode” for Processing 3.0 by Gal Sasson, mentored by Daniel Shiffman
    • -
        -
      • Allows changing sketch parameters in real-time.
      • -
      -
    -

    - -
    -

    2013 Report

    - -

    - In 2013, our third year participating in Google Summer of Code, the Processing Foundation completed four projects in collaboration and mentorship with a group of talented students. -

      -
    • “GUI Library for Processing” by Martin Leopold
    • -
        -
      • Prototype for new graphical user interface for Processing
      • -
      - -
    • “PDE X” by Manindra Moharana
    • -
        -
      • Augments the Processing development
      • -
      • Code completion
      • -
      • Refactoring
      • -
      • Real-time error checking
      • -
      • Debugging
      • -
      -
    • “Serial Library for Processing” by Gottfried Haider
    • -
        -
      • Replaces existing RXTX-based serial library with one built on top of Java Simple Serial Connector
      • -
      • Improved corss platform support
      • -
      -
    • “Tweak Mode” by Gal Sasson
    • -
        -
      • Allows "tweaking" of hard-coded numbers in real-time through a GUI built into Processing's PDE
      • -
      -

      - - -
    -

    diff --git a/content/static/foundation.html b/content/static/foundation.html deleted file mode 100644 index caa4c380c..000000000 --- a/content/static/foundation.html +++ /dev/null @@ -1,121 +0,0 @@ -

    Foundation. The Processing Foundation is an organization that develops software tools for the visual arts.

    - -

    - - - - - -
    - - -

    Overview

    - -

    - The goal of the Processing Foundation is to promote software literacy, particularly within the visual arts, and to promote visual literacy within technology. Our primary charge is to develop and distribute the Processing software, both the core Application Programming Interface (API) and the programming environment, the Processing Development Environment (PDE). The board of directors for the Processing Foundation consists of Ben Fry, Casey Reas, and Dan Shiffman. The first member of the board of advisors is John Maeda. -

    - -

    - To succeed, the Foundation needs to raise money to support future versions of the Processing software and related initiatives. The Processing team, a small group of volunteers, has released over 200 versions of the software since 2001, leading to the 2.0 release in the spring of 2013.With almost no funding between the 1.0 and 2.0 releases, the software was written slowly while the developers managed full-time work and many other responsibilities. The 2.0 software release happened in an unsustainable way, at tremendous personal expense to the lead developers. The Foundation must raise funding for the initiative to continue. -

    - -

    - With the 2.0 software release, we're now asking for donations from individuals who use the software, and we're actively seeking larger gifts from individuals, companies, and other non-profit organizations. To learn more about why you might want to contribute, please read the 2013 status report below. The Processing Foundation was publicly announced in June 2013 with the release of the Processing 2.0 software. Our official non-profit status was was granted by the IRS on 6 March 2014, with our tax exception status retroactive to our date of formation, 14 June 2012. -

    -

    - - - -

    2013 Report

    - -

    - We had a busy and productive 2013 with a wide range of activities: -

      -
    • Released Processing 2.0 and 2.1
    • -
        -
      • New OpenGL renderers for speed
      • -
      • Integrated GLSL shaders and API
      • -
      • New video library for faster capture and playback
      • -
      • Enhanced library manager for easy install
      • -
      • Enhanced modes infrastructure to make it easier to add new languages to the PDE
      • -
      • New features for working with XML and JSON
      • -
      • New classes for working with data
      • -
      • New features for working with SVN and OBJ
      • -
      -
    • Launched "Hello Processing" video tutorial
    • - -
    • Processing Fellows
    • -
        -
      • Lauren McCarthy, exploratory research led to p5.js
      • -
      • Greg Borenstein, released OpenCV library
      • -
      • Wilm Thoben, work started on new core Sound library
      • -
      -
    • Community Development
    • -
        -
      • Worked with community library authors to port and develop 109 libraries for 2.0
      • -
      • New templates developed for creating libraries and tools
      • -
      • 2.0 Processing Forum launched and 1.0 Forum archived
      • -
      • Website redesigned with simplified navigation and new tutorials
      • -
      -
    • Google Summer of Code 2013. For the third year, we mentored a group of university students to explore their ideas for extended Processing. Please read our summary post.
    • -
        -
      • Manindra Moharana's PDEX brings code completion, debugging, and more to the PDE
      • -
      • Gal Sasson's Tweak Mode makes it easy to modify parameters while a program runs
      • -
      • Gottfried Haider's Serial library is a needed update to the core library
      • -
      • Martin Leopold's GUI library is a new approach to created interface elements
      • -
      -
    • Thank you! This year, we're especially grateful to the following people and groups:
    • -
        -
      • Processing users who have donated through the Download page
      • -
      • O'Reilly Media for the December 2013 matching grant
      • -
      • Arduino for the generous donation in February 2013
      • -
      • The Google Summer of Code program for supporting students to work with us
      • -
      -
    -

    - -

    - Despite the new fundraising goals, Processing remains almost entirely a volunteer organization pushed forward by a small group of people. In starting our fundraising push, the initial goal was to hire one full-time developer to maintain and build the Processing code base, while the current Processing team continues to volunteer time to the project. We've received a constant stream of donations through the Download page interface, but at the end of nine months the amount is about 10% of what we need to hire a developer. We're currently utilizing the donations to support Processing Fellows, short-term appointments to explore future directions for Processing and to produce essential libraries. For instance, we supported Lauren McCarthy to explore new ideas for integrating Processing with JavaScript and we supported Greg Borenstein to development the new OpenCV library. -

    - - - -

    Patrons

    - -

    - Individuals making $5 to $100 donations are the largest source of income for the Processing Foundation. We're grateful to all who have donated and we're proud to be supported by the community. -

    - -

    - In 2013, O'Reilly Media and Arduino made donations to the Processing Foundation. -

    - -

    - The Google Summer of Code program has provided and excellent source of energy and new development through supporting students to work with us. This program has now supported Processing for three years, 2010 to 2013. It has provided the base for many important enhancements to the software. -

    - -

    - Prior to incorporating as a Foundation, Processing received key funding and support from several organizations and companies. These commitments enabled a series of pivotal improvements to the software. -

    - -

    - The Interactive Telecommunications Program (ITP) at New York University sponsored a Processing 2.0 development workshop in the summer of 2011. -

    - -

    - The Armstrong Institute for Interactive Media Studies at Miami University funded The Oxford Project, a series of Processing development workshops during the 2008-2009 academic year. These four-day meetings in Oxford, Ohio, enabled the November 2008 launch of Processing 1.0 and stimulated future development. -

    - -

    - Oblong Industries funded Ben Fry to develop Processing during the summer of 2008. This funding also assisted in the completion of the 1.0 release. The Rockefeller Foundation awarded Ben Fry with a Media Arts Fellowship in 2006. The grant marked the first time that Ben was able to work on Processing as a funded project. This support led to further developments of the OpenGL and PDF rendering engines, as well as significant enhancements to other libraries and their integration. -

    - -

    - The Interaction Design Institute Ivrea funded four individuals' work on Processing in the summer of 2003. This resulted in Dan Mosedale's preprocessor using Antlr, Sami Arola's contributions to the graphics engine, and other contributions to the Processing Development Environment and 2D graphics engine. We are grateful to Interaction Ivrea director Gillian Crampton Smith for her encouragement and support. -

    - -
    -

    diff --git a/content/static/handbook.html b/content/static/handbook.html index e1fbca351..27ef76ed6 100644 --- a/content/static/handbook.html +++ b/content/static/handbook.html @@ -6,13 +6,13 @@

    Processing: A Programming Handbook Published December 2014, The MIT Press.
    720 Pages. Hardcover.

    - » Order from MIT Press
    + » Order from MIT Press
    » Order from Amazon

    » Download Examples
    » Errata

    - If you are an educator, you can request a desk/exam copy from the MIT Press website. + If you are an educator, you can request a desk/exam copy from the MIT Press website.

    @@ -28,7 +28,7 @@

    Processing: A Programming Handbook

    - Interviews with SUE.C, Larry Cuba, Mark Hansen, Lynn Hershman Leeson, Jürg Lehni, LettError, Golan Levin and Zachary Lieberman, Benjamin Maus, Manfred Mohr, Ash Nehru, Josh On, Bob Sabiston, Jennifer Steinkamp, Jared Tarbell, Steph Thirion, and Robert Winter. + Interviews with SUE.C, Larry Cuba, Mark Hansen, Lynn Hershman Leeson, Jürg Lehni, LettError, Golan Levin and Zachary Lieberman, Benjamin Maus, Manfred Mohr, Ash Nehru, Josh On, Bob Sabiston, Jennifer Steinkamp, Jared Tarbell, Steph Thirion, and Robert Winter.

    diff --git a/content/static/overview.html b/content/static/overview.html index 13349191d..d5d3d30ff 100644 --- a/content/static/overview.html +++ b/content/static/overview.html @@ -6,14 +6,11 @@

    Overview. A short introducti

    - For the past fourteen years, Processing has promoted software literacy, particularly within the visual arts, and visual literacy within technology. Initially created to serve as a software sketchbook and to teach programming fundamentals within a visual context, Processing has also evolved into a development tool for professionals. The Processing software is free and open source, and runs on the Mac, Windows, and GNU/Linux platforms. - -

    - Processing continues to be an alternative to proprietary software tools with restrictive and expensive licenses, making it accessible to schools and individual students. Its open source status encourages the community participation and collaboration that is vital to Processing’s growth. Contributors share programs, contribute code, and build libraries, tools, and modes to extend the possibilities of the software. The Processing community has written more than a hundred libraries to facilitate computer vision, data visualization, music composition, networking, 3D file exporting, and programming electronics. + For the past sixteen years, Processing has promoted software literacy, particularly within the visual arts, and visual literacy within technology. Initially created to serve as a software sketchbook and to teach programming fundamentals within a visual context, Processing has also evolved into a development tool for professionals. The Processing software is free and open source, and runs on the Mac, Windows, and GNU/Linux platforms.

    - Processing is currently developed primarily in Boston (at Fathom Information Design), Los Angeles (at the UCLA Arts Software Studio), and New York City (at NYU’s ITP). + Processing continues to be an alternative to proprietary software tools with restrictive and expensive licenses, making it accessible to schools and individual students. Its open source status encourages the community participation and collaboration that is vital to Processing’s growth. Contributors share programs, contribute code, and build libraries, tools, and modes to extend the possibilities of the software. The Processing community has written more than a hundred libraries to facilitate computer vision, data visualization, music composition, networking, 3D file exporting, and programming electronics.

    Education

    @@ -27,7 +24,7 @@

    Education

    - The innovations in teaching through Processing have been adapted for the Khan Academy computer science tutorials, offered online for free. The tutorials begin with drawing, using most of the Processing functions for drawing. The Processing approach has also been applied to electronics through the Arduino and Wiring projects. Arduino uses a syntax inspired by that used with Processing, and continues to use a modified version of the Processing programming environment to make it easier for students to learn how to program robots and countless other electronics projects. + The innovations in teaching through Processing have been adapted for the Khan Academy computer science tutorials, offered online for free. The tutorials begin with drawing, using most of the Processing functions for drawing. The Processing approach has also been applied to electronics through the Arduino and Wiring projects. Arduino uses a syntax inspired by that used with Processing, and continues to use a modified version of the Processing programming environment to make it easier for students to learn how to program robots and countless other electronics projects.

    Culture

    @@ -45,21 +42,23 @@

    Research

    Foundation

    -The primary charge of the Foundation is to develop and distribute the Processing software. This includes the original Processing (Java), p5.js (Javascript), and Processing.py (Python). There is more information about the Foundation at http://foundation.processing.org/. +The primary charge of the Foundation is to develop and distribute the Processing software. This includes the original Processing (Java), p5.js (Javascript), and Processing.py (Python). There is more information about the Foundation at https://processingfoundation.org/.

    History

    - Processing was started by Ben Fry and Casey Reas in the spring of 2001, while both were graduate students at the MIT Media Lab within John Maeda's Aesthetics and Computation research group. Development continued in their free time while Casey pursued his artistic and teaching career and Ben pursued a Ph.D. and founded Fathom Information Design. Many of the ideas in Processing go back to Muriel Cooper's Visual Language Workshop, and it grew directly out of Maeda's Design By Numbers project, developed at the Media Lab and released in 1999. The Wiring and Arduino projects, in turn, grew out of Processing while Casey was teaching at the Interaction Design Institute Ivrea in Italy. Processing also prompted John Resig (jQuery) to build Processing.js, a JavaScript version that then inspired more related work such as the Khan Academy curriculum in computer science. Versions of Processing that use Python, Ruby, ActionScript, and Scala are also in development. Processing and its sister projects have inspired over twenty educational books. + Processing was started by Ben Fry and Casey Reas in the spring of 2001, while both were graduate students at the MIT Media Lab within John Maeda's Aesthetics and Computation research group. Development continued in their free time while Casey pursued his art and teaching career and Ben pursued a Ph.D. and founded Fathom Information Design. Many of the ideas in Processing go back to Muriel Cooper's Visual Language Workshop, and it grew directly out of Maeda's Design By Numbers project, developed at the Media Lab and released in 1999. The Wiring and Arduino projects, in turn, grew out of Processing while Casey was teaching at the Interaction Design Institute Ivrea in Italy.

    +

    For more information, please write to foundation@processing.org diff --git a/content/static/people.html b/content/static/people.html index ed14bc057..d406b648c 100755 --- a/content/static/people.html +++ b/content/static/people.html @@ -6,78 +6,57 @@

    People. Processing is a comm

    - Lead Developers
    + Project Leads
    Ben Fry and Casey Reas started Processing in Spring 2001 and continue to obsessively work on it. In 2012, they started the Processing Foundation along with Dan Shiffman, who formally joined as a third project lead.

    - Senior Developers
    - Andres Colubri (Boston), OpenGL / Video
    - Florian Jenett (Frankfurt), Forum
    - Elie Zananiri (Montreal), Contributed Libraries / Tools
    - Scott Murray (San Francisco), Website / Reference / UI
    + Developers
    + Andres Colubri (Boston), OpenGL / Video
    + Elie Zananiri (New York), Contributed Libraries / Tools
    + Samuel Pottinger (San Francisco), Processing Core

    -

    + -

    +

    Libraries, Tools
    - The core Processing software is augmented by libraries and tools contributed through the community. - These inventive extensions are a bright future for the project. We have a list of - Contributed Libraries and + The core Processing software is augmented by libraries and tools contributed through + the community. These inventive extensions are a bright future for the project. We have a + list of Contributed Libraries and Contributed Tools posted online. - These contributions can't be underestimated. For example, see how - Karsten Schmidt (London) has transformed Processing - through the toxiclibs library and how - Damien Di Fede (Austin) has extended the project - into programming sound through his minim - library.
    -

    - - - -

    - Fellowship Alumni
    - Lauren McCarthy (New York), Spring/Summer/Fall 2013
    - Greg Borenstein (New York), Spring/Summer 2013
    - Wilm Thoben (Los Angeles), Fall 2013/Winter 2014
    + These contributions can't be underestimated. For example, see how Karsten Schmidt (London) has + transformed Processing through the toxiclibs library and how Damien Di Fede (Austin) has extended + the project into programming sound through his minim library.

    - Developer Alumni
    + Alumni
    + Jakub Valtar (Brno), Processing Core
    + Scott Garner (New York), Hello Processing Website
    + Scott Murray (San Francisco), Website / Reference / UI
    + Gottfried Haider (Los Angeles), Processing for Pi
    + Florian Jenett (Frankfurt), Forum
    + Jamie Kosoy (San Francisco), Website
    + Manindra Moharana (San Diego), PDE / Core
    + James Grady (Boston), Visual Design
    + + Patrick Hebron, Video Library (Summer 2011)
    Peter Kalauskas, Library/Tool/Mode Install Utility (Summer, Fall 2011)
    Andreas Schlegel, Libraries (Winter 2008 - Summer 2011)
    Harshani Nawarathna, Processing Development Environment (Summer 2011)
    Cindy Chi, Reference Editing (Summer 2011)
    - Jonathan Feinberg, Parsing & Android Hacking (Spring 2011)
    + Jonathan Feinberg, Parsing & Android Hacking (Spring 2011)
    Chris Lonnen, Processing Development Environment (Summer 2011)
    Eric Jordan, Graphics Weapon (2007 - 2009)
    Tom Carden, Processing Hacks Director (Summer 2005 - Fall 2008)
    @@ -132,13 +111,9 @@

    People. Processing is a comm Burak Arikan, Turkish

    -

    -   -

    -

    We offer a special "Thank You!" to Sami Arola for writing the base of the original P3D - and Simon Greenwold for incorporting camera and lights. Tom Carden contributed great + and Simon Greenwold for incorporating camera and lights. Tom Carden contributed great energy by co-creating Processing Hacks and maintaining Processing Blogs. Andreas Schlegel did amazing work for over three years organizing the Contributed Libraries and building templates and documentation. diff --git a/content/static/support.html b/content/static/support.html new file mode 100644 index 000000000..2a8f77f05 --- /dev/null +++ b/content/static/support.html @@ -0,0 +1,48 @@ + + +

    + We need your help! Please support Processing by making a donation to the Processing Foundation. Your donation contributes to software development, education resources like code examples and tutorials, Fellowships, and community events. +

    + + + + + + + + + +
    + +
    + + + +

    + The Processing Foundation was established in 2012 after more than a decade of work with the Processing software. The Foundation’s mission is to promote software literacy within the visual arts, and visual literacy within technology-related fields — and to make these fields accessible to diverse communities. Our goal is to empower people of all interests and backgrounds to learn how to program and make creative work with code, especially those who might not otherwise have access to these tools and resources. You can read more about the history of Processing in the short essay "A Modern Prometheus." +

    diff --git a/content/static/tutorials/android/index.html b/content/static/tutorials/android/index.html index f339fd9ba..75a355092 100644 --- a/content/static/tutorials/android/index.html +++ b/content/static/tutorials/android/index.html @@ -121,7 +121,7 @@

    Step Three: Running the App on a Device

    Some helpful tips when you’re working with Processing & Android:

    - I know I’ve said this before, but be patient. Canceling a process (ie. the emulator load or a device compile) can cause problems. If you do this inadvertently, you’re best off restarting Processing.

    -

    - Make sure to check out the Processing Android Wiki, where you’ll find some troubleshooting advice, and some tips on how to get your sketches working properly on your device.

    +

    - Make sure to check out the Processing Android Wiki, where you’ll find some troubleshooting advice, and some tips on how to get your sketches working properly on your device.

    This tutorial is for Processing version 2.0+. If you see any errors or have comments, please let us know. This tutorial is adapted from 'Processing & Android: Mobile App Development Made (Very) Easy' by Jer Thorp

    diff --git a/content/static/tutorials/arraylist/index.html b/content/static/tutorials/arraylist/index.html index 613ffee6a..5f24a6ad5 100644 --- a/content/static/tutorials/arraylist/index.html +++ b/content/static/tutorials/arraylist/index.html @@ -1,4 +1,4 @@ -In truth, we could use a simple array to manage our Particle objects. Some particle systems might have a fixed number of particles, and arrays are magnificently efficient in those instances. Processing also offers expand(), contract(), subset(), splice() and other methods for resizing arrays. However, for these examples, the Java class ArrayList (found in the java.util package: http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html) will prove to be the best solution.

Using an ArrayList is conceptually similar to a standard array, but the syntax is different. Here is some code (that assumes the existence of a generic Particle class) demonstrating identical results: first with an array, and second with an ArrayList. +In truth, we could use a simple array to manage our Particle objects. Some particle systems might have a fixed number of particles, and arrays are magnificently efficient in those instances. Processing also offers expand(), contract(), subset(), splice() and other methods for resizing arrays. However, for these examples, the Java class ArrayList (found in the java.util package: https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html) will prove to be the best solution.

Using an ArrayList is conceptually similar to a standard array, but the syntax is different. Here is some code (that assumes the existence of a generic Particle class) demonstrating identical results: first with an array, and second with an ArrayList. // THE STANDARD ARRAY WAY int total = 10; diff --git a/content/static/tutorials/data/index-old.html b/content/static/tutorials/data/index-old.html index 0df744e1b..6221a4a80 100644 --- a/content/static/tutorials/data/index-old.html +++ b/content/static/tutorials/data/index-old.html @@ -17,7 +17,7 @@

    Daniel Shiffman

    Manipulating Strings

    - In Strings and Drawing Text, we touched on a few of the basic functions available in the Java String class, such as charAt(), toUpperCase(), equals(), and length(). These functions are documented on the Processing reference page for Strings. Nevertheless, in order to perform some more advanced data parsing techniques, we'll need to explore some additional String manipulation functions documented in the Java API. + In Strings and Drawing Text, we touched on a few of the basic functions available in the Java String class, such as charAt(), toUpperCase(), equals(), and length(). These functions are documented on the Processing reference page for Strings. Nevertheless, in order to perform some more advanced data parsing techniques, we'll need to explore some additional String manipulation functions documented in the Java API.

    @@ -518,7 +518,7 @@

    Threads

    Two examples that follow this methodology can be found under Topics --> Advanced Data in the Processing examples.

    -

    While using the thread() function is a very simple way of getting an independent thread, it should be noted that it is somewhat limited. Being able to make a thread object is a great deal more powerful, and this can be done by extending the Java Thread class.

    +

    While using the thread() function is a very simple way of getting an independent thread, it should be noted that it is somewhat limited. Being able to make a thread object is a great deal more powerful, and this can be done by extending the Java Thread class.

    diff --git a/content/static/tutorials/data/index.html b/content/static/tutorials/data/index.html index d45a525a6..ebafcce92 100644 --- a/content/static/tutorials/data/index.html +++ b/content/static/tutorials/data/index.html @@ -17,7 +17,7 @@

    Daniel Shiffman

    Manipulating Strings

    - In Strings and Drawing Text, we touched on a few of the basic functions available in the Java String, such as charAt(), toUpperCase(), equals(), and length(). These functions are documented on the Processing reference page for Strings. Nevertheless, in order to perform some more advanced data parsing techniques, we'll need to explore some additional String manipulation functions documented in the Java API. + In Strings and Drawing Text, we touched on a few of the basic functions available in the Java String, such as charAt(), toUpperCase(), equals(), and length(). These functions are documented on the Processing reference page for Strings. Nevertheless, in order to perform some more advanced data parsing techniques, we'll need to explore some additional String manipulation functions documented in the Java API.

    Let's take a closer look at the following two String functions: indexOf() and substring().

    indexOf() locates a sequence of characters within a string. It takes one argument — a search string — and returns a numeric value that corresponds to the first occurrence of the search string inside of the String object being searched.
    @@ -493,7 +493,7 @@

    Data that is not in a Standardized Format

    In code, this looks like:

    -int start      = stuff.indexOf("apples:" ) + 8;  // STEP 1 
    +int start      = stuff.indexOf("apples:" ) + 7;  // STEP 1 
     // The index where a string ends can be found by 
     // searching for that string and adding its length (here, 8).
     int end        = stuff.indexOf(".", start);      // STEP 2
    @@ -1404,6 +1404,34 @@ 

    Threads

    JSONObject json = loadJSONObject("http://time.jsontest.com/"); time = json.getString("time"); } + + +class Timer { + + int savedTime; + boolean running = false; + int totalTime; + + Timer(int tempTotalTime) { + totalTime = tempTotalTime; + } + + void start() { + running = true; + savedTime = millis(); + } + + boolean isFinished() { + int passedTime = millis() - savedTime; + if (running && passedTime > totalTime) { + running = false; + return true; + } else { + return false; + } + } + +}

    APIs

    diff --git a/content/static/tutorials/drawing/imgs/drawing-05.svg b/content/static/tutorials/drawing/imgs/drawing-05.svg index 0f55e2269..44653c110 100644 --- a/content/static/tutorials/drawing/imgs/drawing-05.svg +++ b/content/static/tutorials/drawing/imgs/drawing-05.svg @@ -1,166 +1,210 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Example: - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/static/tutorials/eclipse/index.html b/content/static/tutorials/eclipse/index.html index b5084926c..1dde1915c 100644 --- a/content/static/tutorials/eclipse/index.html +++ b/content/static/tutorials/eclipse/index.html @@ -1,22 +1,22 @@

    Processing in Eclipse

    Shane White

    - -

    +

     

    diff --git a/content/static/tutorials/electronics/imgs/fg39-16.svg b/content/static/tutorials/electronics/imgs/fg39-16.svg index 46abb2371..92324f100 100644 --- a/content/static/tutorials/electronics/imgs/fg39-16.svg +++ b/content/static/tutorials/electronics/imgs/fg39-16.svg @@ -1,1112 +1,3907 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +image/svg+xml \ No newline at end of file diff --git a/content/static/tutorials/electronics/index.html b/content/static/tutorials/electronics/index.html index 9777b0f8f..02b31bdcc 100644 --- a/content/static/tutorials/electronics/index.html +++ b/content/static/tutorials/electronics/index.html @@ -635,9 +635,10 @@

    Code

     // Read data from the serial port and set the position of a servomotor 
     // according to the value
    +#include <Servo.h>
     
     Servo myservo;                   // Create servo object to control a servo
    -int servoPin = 4;                // Connect yellow servo wire to digital I/O pin 4 
    +int servoPin = 3;                // Connect yellow servo wire to digital I/O pin 3 (must be PWM) 
     int val = 0;                     // Data received from the serial port
     
     void setup() {
    @@ -672,7 +673,12 @@ 

    Code

    noStroke(); frameRate(10); // Open the port that the board is connected to and use the same speed (9600 bps) - port = new Serial(this, 9600); + port = new Serial(this, 9600); // Comment this line if it's not the correct port + // If the above does not work uncomment the lines below to choose the correct port + // List all the available serial ports, preceded by their index number: + //printArray(Serial.list()); + // Instead of 0 input the index number of the port you are using: + //port = new Serial(this, Serial.list()[0], 9600); } void draw() { @@ -918,4 +924,4 @@

    Resources

    -

    This tutorial is for Processing version 3.0+. If you see any errors or have comments, please let us know. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

    +

    The Long Version

    In order to use the Processing library to create our graphics while coding in Eclipse, we need to do a couple things. The first thing we need to do is import the Processing core as a library for our project, and the second is to set up our client class to take into consideration some of the processes (pun intended) that the Processing IDE does for us in the background.

    This guide is written for Processing 3+, with the intended audience of someone who has already downloaded Eclipse, but may have never used it before. If you are experienced with Java and Eclipse, you can jump to the bottom for a quick summary of the steps involved.

    Create a new Project

    First create a new project. It just needs to be a regular Java Project.

    File > New > Java Project

    -

    Let's name it 'Hello Processing'. Leave all the default settings and click Finish.

    +

    Let's name it 'Hello Processing'. Leave all the default settings and click Finish.

    Next, create a new class.

    File > New > Class

    -

    Let's name it 'UsingProcessing'. You can choose to include public static void main.

    -

    Creating a new Class

    +

    Let's name it 'UsingProcessing'. You can choose to include public static void main.

    +

    Creating a new Class

    We should now have a new class that probably looks like this:

    public class UsingProcessing {
    @@ -30,28 +30,28 @@ 

    Create a new Project

    Now that we have our project and client class ready to go, we need to get the Processing core as a library.

    The idea of Libraries

    -

    One of the most important aspects of Java (or nearly any programming environment) is the idea of a Library. A Library is a collection of code that performs related tasks. They can be one class, or many. Some Libraries are so powerful and robust that they can almost be considered a "Language" themselves. When you combine the Processing library with the Processing IDE, you end up with something that most people refer to as the Processing 'Language', but technically, at it's heart, it's a collection of Java code.

    +

    One of the most important aspects of Java (or nearly any programming environment) is the idea of a Library. A Library is a collection of code that performs related tasks. They can be one class, or many. Some Libraries are so powerful and robust that they can almost be considered a "Language" themselves. When you combine the Processing library with the Processing IDE, you end up with something that most people refer to as the Processing 'Language', but technically, at it's heart, it's a collection of Java code.

    To make it work, the Processing IDE does a lot of stuff for us in the background 'Java' environment in order to make it really easy for us as programmers to create sketches. However, to make full use of all the Java awesomeness at our disposal, it's helpful to use a more robust IDE, which is why we are jumping into Eclipse. So let's get Eclipse to use Processing as a Library.

    Import the Processing Core

    In order for Eclipse to see the code that makes up Processing, we need to import it into our project.

    File > Import > General > File System

    Click next. On Windows, click "Browse..." and select the Processing jar files inside PATH_TO_PROCESSING/core/library/. On OS X, do not use the "Browse..." button. Instead, use the "From directory:" field to manually enter the path to Processing's jar files, which is typically /Applications/Processing 3.app/Contents/Java/core/library/. At minimum, select the "core.jar" file inside the "library" folder.

    -

    Importing the Processing Core

    +

    Importing the Processing Core

    A .jar file is a compiled collection of Java code. The core.jar is the core of the Processing libraries, it has all the code that does the stuff that we are used to doing in Processing, like drawing shapes. Once we have it, we can make use of all the normal Processing commands that are found on the reference page.

    Click Finish. If you look at the Package Explorer, you'll notice that there is a new file in our project, called 'core.jar'.

    -

    A new file in our project!

    +

    A new file in our project!

    Now that we have the file in our project, we need to tell Eclipse that this file is part of the code base that is used to build, or compile and run, this project. Do this by right clicking on the core.jar, going to Build Path, and then Add to Build Path

    -

    Adding the core.jar to the build path

    +

    Adding the core.jar to the build path

    You'll notice the project will expand to have a new section called 'Referenced Libraries', where there is a new core.jar file. You can expand this to see a hierarchy of it's contents, if you are really interested.

    -

    A successful add to build path

    -

    We are finally ready to set up our client class (the class with our main function, where the program starts), to run the project like a Processing sketch.

    +

    A successful add to build path

    +

    We are finally ready to set up our client class (the class with our main function, where the program starts), to run the project like a Processing sketch.

    Setting up the Client Class

    -

    A Processing window is a special type of Java program called a PApplet. This is technically a Java Class, which has its own main function (or method) and does all kinds of fancy stuff that we don't need to worry about to create a new window and draw graphics onto it. In order for us to make use of the PApplet class, we want our program to BE a PApplet. To make this happen, we use the keyword extends in our class declaration. This will allow our class to 'inherit' all the PApplet class' functions and variables. Change the first line of code to be:

    +

    A Processing window is a special type of Java program called a PApplet. This is technically a Java Class, which has its own main function (or method) and does all kinds of fancy stuff that we don't need to worry about to create a new window and draw graphics onto it. In order for us to make use of the PApplet class, we want our program to BE a PApplet. To make this happen, we use the keyword extends in our class declaration. This will allow our class to 'inherit' all the PApplet class' functions and variables. Change the first line of code to be:

    public class UsingProcessing extends PApplet{

    You'll notice this will give you an error. This occurs because, although we have included the core.jar to our project, we still have to link to the library in the code. We do this by using an import statement, at the top of the Java file. Anytime we are going to reference a function, variable, or class outside of the Java file we are writing in, we need to tell Java where it is by importing it. Eclipse will help you by suggesting to do this. Hover over the error (where it's underlined in red) and choose from the options "Import 'PApplet' (processing.core)".

    -

    Import PApplet

    +

    Import PApplet

    This will auto add a new line of code to the top of the file: import processing.core.PApplet; You can also type this in yourself if you choose. This will allow Java to see all the public parts of the PApplet class.

    The next step is to simply start a PApplet application, and tell it to use this class,UsingProcessing, as the program to run. This is done by calling PApplet's main method and giving it the name of this class as a parameter.

    Add the following line to the main function (method), and if the TODO comment is still there, you can delete/replace it.

    @@ -71,11 +71,11 @@

    Setting up the Client Class

    } -

    NOTE: If your class is part of a package other than the default package, you must call PApplet's main using the package name as well, like this:

    +

    NOTE: If your class is part of a package other than the default package, you must call PApplet's main using the package name as well, like this:

    PApplet.main("packageName.ClassName");
    -

    At this point, you can run the program. If Eclipse asks, choose to run the program as a Java Application. Processing no longer extends the Applet class, so you can't run it as an Applet!

    +

    At this point, you can run the program. If Eclipse asks, choose to run the program as a Java Application. Processing no longer extends the Applet class, so you can't run it as an Applet!

    This will run a PApplet as if you had run an empty sketch. You will get a new 100x100 window open with a blank canvas!

    Now we are ready to add the final touches to be ready to program like we were before. After main(), add three new functions: settings()setup(), and draw(). It's just like we did in Processing, but you will also need to include the public declaration before the void declaration. Now we have this:

    @@ -127,7 +127,7 @@

    Setting up the Client Class

    }

    We did it! We have a Processing application running from Eclipse, and now we can take advantage of all the powerful tools that Eclipse has to offer. From here, you can develop your processing sketch to your heart's content.

    -

    The Short Version

    +

    The Short Version

    The quick break down of what we did here:

    1. Create a new Java Project
    2. @@ -137,7 +137,8 @@

      The Short Version

    3. Add a public void settings()public void setup(), and public void draw().
    4. Use the size() call inside of settings(), and other than that, use setup() and draw() like normal!
    -

    It runs!

    +

    It runs!

    +

     

    Processing in Eclipse with Multiple Classes

    Take a look at this example Processing sketch. The example is object-oriented and contains a class called "Stripe." In Processing, all classes are treated as "inner classes," meaning they are not individual entities unto themselves, but rather are classes inside of the larger PApplet. This is why you can do anything you can do in a PApplet inside of the Stripe class. You can draw onto the window calling rect() and access the PApplet variables such as width and height. To get this example working in Eclipse, it's perfectly reasonable to just copy it in as is and include the Stripe class code below setup() and draw() inside the parent PApplet class. However, the inner class methodology can quickly become unwieldy in the case of larger applications with lots and lots of classes.

    And so we find ourselves in need of a means for creating separate Java classes in Eclipse that we can use in conjunction with a Processing-based application.

    First thing first, we can put all the code that is not the Stripe class in a Java class like with the first example.

    import processing.core.*;
    @@ -220,7 +221,22 @@ 

    Processing in Eclipse with Multiple Classes


    and if you are in another class and have to refer to the "parent" PApplet:

    int pink = parent.color(255,200,200);
    -

     

    +

    Globally Available Functions

    +

    Pretty much anything you can find in the reference can be used in Eclipse the same way, with some concesssions to be made for proper Java syntax. For example, any of the mouse Event functions, including mouseClicked(), mousePressed(), mouseDragged(), and mouseWheel().

    +

    These can be added in the exact same way as setup(), and draw(), just by adding the keyword 'public' to the declaration. So, looking at the reference example of mousePressed():

    +
    void mousePressed() {
    +  if (value == 0) {
    +    ...
    +}
    +

    Would be declared instead as:

    +
    public void mousePressed() { 
    +  if (value == 0) {
    +    ...
    +}
    +

    That's all there is to it! The same process works for all the mouse, keyboard, and other event based functions.

    +

    Note, however, that these functions are inherited from PApplet, thus you will only be able to use them in your client class, and not in any other object classes.

    +

    Exporting in Eclipse

    +

    You can export a project from eclipse the same way you export any project in Eclipse. For more information, visit Eclipse's documentation. How to export a runnable .jar in Eclipse.

    This tutorial is for Processing version 3.0+. If you see any errors or have comments, please let us know. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

    \ No newline at end of file + diff --git a/content/static/tutorials/gettingstarted/index.html b/content/static/tutorials/gettingstarted/index.html index 5def1e1a5..2ebe7335b 100644 --- a/content/static/tutorials/gettingstarted/index.html +++ b/content/static/tutorials/gettingstarted/index.html @@ -34,7 +34,7 @@

    Casey Reas and Ben Fry

    ./processing

  • -

    With any luck, the main Processing window will now be visible. Everyone's setup is different, so if the program didn't start, or you're otherwise stuck, visit the troubleshooting page for possible solutions.

    +

    With any luck, the main Processing window will now be visible. Everyone's setup is different, so if the program didn't start, or you're otherwise stuck, visit the troubleshooting page for possible solutions.

    diff --git a/content/static/tutorials/index.html b/content/static/tutorials/index.html index 17369c6a1..7434e5bbb 100644 --- a/content/static/tutorials/index.html +++ b/content/static/tutorials/index.html @@ -294,16 +294,21 @@

    Text Tutorials. A collection

    Level: Advanced

    -
    - preview image -


    Anatomy of a Program
    - by J David Eisenberg

    -

    How do you analyze a problem and break it down into steps that the computer can do?

    -

    Level: Advanced

    + +
    + preview image +


    Anatomy of a Program
    + by J David Eisenberg

    +

    How do you analyze a problem and break it down into steps that the computer can do?

    +

    Level: Advanced

    +
    + +
    + - + Electronics diff --git a/content/static/tutorials/typography/index.html b/content/static/tutorials/typography/index.html index c71b0d284..931690834 100644 --- a/content/static/tutorials/typography/index.html +++ b/content/static/tutorials/typography/index.html @@ -156,7 +156,7 @@

    Draw text

    Vector Fonts

    - To work with fonts different than the default, more functions are needed to prepare a font to be used with Processing. The createFont() function is used to convert a TrueType font (.ttf) or OpenType font (.otf) so that is can display through text(). The textFont() function is used to define the current font to display. Any compatible font installed on the computer running Processing or stored in the sketch’s data folder may be used. The following short program is used to print the list of the available installed fonts to the console: + To work with fonts different than the default, more functions are needed to prepare a font to be used with Processing. The createFont() function is used to convert a TrueType font (.ttf) or OpenType font (.otf) so that it can display through text(). The textFont() function is used to define the current font to display. Any compatible font installed on the computer running Processing or stored in the sketch’s data folder may be used. The following short program is used to print the list of the available installed fonts to the console:

    diff --git a/content/static/tutorials/video/index.html b/content/static/tutorials/video/index.html
    index 7336bac6e..22ccf759b 100644
    --- a/content/static/tutorials/video/index.html
    +++ b/content/static/tutorials/video/index.html
    @@ -33,7 +33,7 @@ 

    Live Video

    Capture video;
    -Step 3. Initailize the Capture object. +Step 3. Initialize the Capture object.

    The Capture object “video” is just like any other object — to construct an object, you use the new operator followed by the constructor. With a Capture object, this code typically appears in setup().
    @@ -50,12 +50,12 @@ 

    Live Video

    Let’s walk through the arguments used in the Capture constructor.
      -
    • this: If you’re confused by what this means, you are not alone. Technically speaking, this refers to the instance of a class in which the word this appears. Unfortunately, such a definition is likely to induce head spinning. Anicer way to think of it is as a self-referential statement. After all, what if you needed to refer to your Processing program within your own code? You might try to say “me” or “I.” Well, these words are not available in Java, so instead you say this. The reason you pass this into the Capture object is you are telling it: “Hey listen, I want to do video capture and when the camera has a new image I want you to alert this sketch.”
    • -
    • 320: Fortunately, the first argument, this, is the only confusing one. 320 refers to the width of thevideo captured by the camera.
    • +
    • this: If you’re confused by what this means, you are not alone. Technically speaking, this refers to the instance of a class in which the word this appears. Unfortunately, such a definition is likely to induce head spinning. A nicer way to think of it is as a self-referential statement. After all, what if you needed to refer to your Processing program within your own code? You might try to say “me” or “I.” Well, these words are not available in Java, so instead you say this. The reason you pass this into the Capture object is you are telling it: “Hey listen, I want to do video capture and when the camera has a new image I want you to alert this sketch.”
    • +
    • 320: Fortunately, the first argument, this, is the only confusing one. 320 refers to the width of the video captured by the camera.
    • 240: The height of the video.
    -There are some cases, however, where the above will not do. For example, what if you have multiple cameras attached to your computer. How do you select the one you want to capture? In addition, in some rare cases, you might also want to specify a frame rate from the camera. For these cases, Processing will give you a list of all possible camera configurations via Capture.list(). You can display these in your message console, for example, by saying:
    +There are some cases, however, where the above will not do. For example, what if you have multiple cameras attached to your computer? How do you select the one you want to capture? In addition, in some rare cases, you might also want to specify a frame rate from the camera. For these cases, Processing will give you a list of all possible camera configurations via Capture.list(). You can display these in your message console, for example, by saying:
     printArray(Capture.list());
     
    @@ -81,6 +81,7 @@

    Live Video



    Step 5. Read the image from the camera. +

    There are two strategies for reading frames from the camera. I will briefly look at both and choose one forthe remainder of the examples in this chapter. Both strategies, however, operate under the same fundamental principle: I only want to read an image from the camera when a new frame is available to be read.

    @@ -115,7 +116,7 @@

    Live Video

    All of this is put together in the following code:
     // Step 1. Import the video library.
    -import processing video.
    +import processing.video.*;
     
     //Step 2. Declare a capture object.
     Capture video;
    @@ -146,7 +147,9 @@ 

    Live Video

     import processing.video.*;
     
    -Capture video;void setup() {  
    +Capture video;
    +
    +void setup() {
       size(320, 240);  
       video = new Capture(this, 320, 240); 
       video.start();
    @@ -297,14 +300,16 @@ 

    Recorded video

    }
    -Although Processing is by no means the most sophisticated environment for displaying and manipulating recorded video, there are some more advanced features available in the video library. There are function sfor obtaining the duration (length measured in seconds) of a video, for speeding it up and slowing it down, and for jumping to a specific point in the video (among others). If you find that performance is sluggish and the video playback is choppy, I would suggest trying the P2D or P3D renderers. +Although Processing is by no means the most sophisticated environment for displaying and manipulating recorded video, there are some more advanced features available in the video library. There are functions for obtaining the duration (length measured in seconds) of a video, for speeding it up and slowing it down, and for jumping to a specific point in the video (among others). If you find that performance is sluggish and the video playback is choppy, I would suggest trying the P2D or P3D renderers.

    Following is an example that makes use of jump() (jump to a specific point in the video) and duration() (returns the length of movie in seconds). In this example, if mouseX equals 0, the video jumps to the beginning. If mouseX equals width, it jumps to the end. Any other value is in between. The jump() function allows you to jump immediately to a point of time within the video. duration() returns the total length of the movie in seconds.
     import processing.video.*;
     
    -Movie movie;void setup() {  
    +Movie movie;
    +
    +void setup() {
       size(200, 200);  
       background(0);  
       movie = new Movie(this, "testmovie.mov");
    @@ -375,6 +380,8 @@ 

    Software mirrors



    For every square at column i and row j, I look up the color at pixel (i, j) in the video image and color it accordingly. See the following example with the new parts in bold:
    +import processing.video.*;
    +
     // Size of each cell in the grid, ratio of window size to video size
     int videoScale = 8;
     // Number of columns and rows in the system
    @@ -388,7 +395,8 @@ 

    Software mirrors

    cols = width/videoScale; rows = height/videoScale; background(0); - video = new Capture(this, cols, rows); + video = new Capture(this, cols, rows); + video.start() } // Read image from the camera @@ -535,13 +543,14 @@

    Software mirrors

    } void captureEvent(Capture video) { - // Read image from the camera video.read(); + // Read image from the camera + video.read(); } void draw() { video.loadPixels(); float newx = constrain(x + random(-20, 20), 0, width); - float newy = constrain(y + random(-20, 20), 0, height); + float newy = constrain(y + random(-20, 20), 0, height-1); // Find the midpoint of the line int midx = int((newx + x) / 2); diff --git a/contrib_generate/broken.conf b/contrib_generate/broken.conf index 5c8731a21..39f170b32 100644 --- a/contrib_generate/broken.conf +++ b/contrib_generate/broken.conf @@ -1,6 +1,4 @@ 008 -009 -010 016 020 021 @@ -9,7 +7,6 @@ 031 033 047 -049 050 068 070 @@ -28,7 +25,6 @@ 120 123 129 -130 136 141 144 diff --git a/contrib_generate/build_listing.py b/contrib_generate/build_listing.py index ca72a4ce3..2c4a43b22 100755 --- a/contrib_generate/build_listing.py +++ b/contrib_generate/build_listing.py @@ -165,11 +165,11 @@ def missing_key(exports): script = argv conf = 'sources.conf' fileout = 'contribs.txt' - minrev = 0 + minrev = 228 maxrev = 0 elif len(argv) == 3: script, conf, fileout = argv - minrev = 0 + minrev = 228 maxrev = 0 elif len(argv) == 5: script, conf, fileout, minrev, maxrev = argv @@ -228,7 +228,7 @@ def missing_key(exports): key = missing_key(exports) if key: - print 'Error reading', prop_url + print 'Error missing key', prop_url print " No value for '%s'. Maybe it's a 404 page" % key continue # if no download is explicitly provided, use the default download url diff --git a/contrib_generate/skipped.conf b/contrib_generate/skipped.conf index f4e2bf989..fb4891e7a 100644 --- a/contrib_generate/skipped.conf +++ b/contrib_generate/skipped.conf @@ -1,6 +1,5 @@ 007 039 -041 050 051 052 diff --git a/contrib_generate/sources.conf b/contrib_generate/sources.conf index 16cf2a879..8fc82f839 100644 --- a/contrib_generate/sources.conf +++ b/contrib_generate/sources.conf @@ -1,10 +1,10 @@ -# Next ID: 207 +# Next ID: 273 # Increment after assigning ID to new contribution [Library : 3D] 001 \ https://github.com/remixlab/proscene/releases/download/latest/proscene.txt 006 \ http://www.die-seite.ch/colladaloader/colladaLoader.txt -009 \ http://hemesh.wblut.com/hemesh-latest.txt +# 009 \ http://www.wblut.com/hemesh/hemesh.txt 017 \ http://mrfeinberg.com/peasycam/peasycam.txt # 022 \ http://fluidforms.eu/processing/fluid-forms-libs/download/FluidFormsLibs.txt 032 \ http://n.clavaud.free.fr/processing/library/picking/download/Picking.txt @@ -18,9 +18,13 @@ 120 \ https://simple-openni.googlecode.com/svn/trunk/SimpleOpenNI-2.0/dist/all/SimpleOpenNI.txt 123 \ http://igeo.jp/igeo.txt 130 \ https://github.com/codeanticode/planetarium/releases/download/latest/planetarium.txt -174 \ http://ixora.io/downloads/camera3D/Camera3D.txt +174 \ https://ixora.io/downloads/camera3D/Camera3D.txt 195 \ http://culebra.technology/culebra.txt 196 \ https://github.com/jrc03c/queasycam/releases/download/latest/queasycam.txt +215 \ http://maxlfarrell.gitlab.io/extruder/extruder.txt +244 \ http://giftedapprentice.com/ewbIK/ewbIK.txt +245 \ https://github.com/VisualComputing/nub/releases/download/latest/nub.txt +252 \ http://www.bdhont.net/lunar.txt [Library : Animation] 001 \ https://github.com/remixlab/proscene/releases/download/latest/proscene.txt @@ -30,6 +34,12 @@ 062 \ http://www.lagers.org.uk/processing/sprites/Sprites.txt 083 \ http://rdlester.github.com/hermes/downloads/hermes.txt 095 \ https://dl.dropbox.com/u/87680069/frames.txt +219 \ https://teddavis.org/xyscope/download/XYscope.txt +231 \ http://objectstothinkwith.com/tracer/tracer.txt +244 \ http://giftedapprentice.com/ewbIK/ewbIK.txt +245 \ https://github.com/VisualComputing/nub/releases/download/latest/nub.txt +253 \ https://ztdp.ca/projects/school/Green/Green.txt +272 \ https://fox-gieg.com/patches/processing/libraries/tiltProcessing/tiltProcessing.txt [Library : Compilation] 004 \ http://staff.city.ac.uk/~jwo/giCentre/utils/gicentreUtils.txt @@ -40,12 +50,12 @@ [Library : Data] 008 \ http://www.saint-clair.net/download/gml4u/GML4U.txt -011 \ http://www.shiffman.net/p5/libraries/sftp/sftp.txt +011 \ https://github.com/shiffman/SFTP-Processing/releases/download/latest/sftp.txt 012 \ http://www.shiffman.net/p5/libraries/qrcode/qrcodeprocessing.txt 040 \ http://r-s-g.org/carnivore/download/carnivore_p5lib.txt # 042 \ http://wyldco.com/romefeeder/download/romefeeder.txt 044 \ http://www.reades.com/MapThing/MapThing.txt -053 \ http://mrzl.net/yahooweather/YahooWeather.txt +#053 \ http://mrzl.net/yahooweather/YahooWeather.txt #404# 065 \ http://blog.stainpixels.com/public/share.txt 072 \ http://sojamo.de/libraries/oscp5/oscP5.txt 073 \ http://ubaa.net/shared/processing/udp/udp.txt @@ -58,13 +68,21 @@ #404# 128 \ http://dasmithii.com/GNet.txt 133 \ https://raw.githubusercontent.com/nok/redis-processing/master/download/Redis.txt 135 \ https://temboo.com/files/temboo-processing.txt -137 \ http://shiffman.net/p5/libraries/httprequests_processing/httprequests_processing.txt +137 \ https://github.com/runemadsen/HTTP-Requests-for-Processing/releases/download/latest/httprequests_processing.txt 144 \ http://unfoldingmaps.org/Unfolding.txt 175 \ https://github.com/alexandrainst/processing_websockets/releases/download/latest/webSockets.txt 183 \ https://github.com/onlylemi/processing-android-capture/releases/download/latest/AndroidCaptureForProcessing.txt 198 \ http://cagewebdev.com/zxing4p/zxing4p3.txt 203 \ https://github.com/OliverColeman/hivis/releases/download/latest/HiVis.txt 206 \ https://ap-sync.github.io/libs/AP_sync_processing/APsync.txt +208 \ https://github.com/gohai/processing-simpletweet/releases/download/latest/processing-simpletweet.txt +229 \ https://github.com/Shinhoo/Wooting-Keyboard-Library/releases/download/lastest/WootingKeyboard.txt +230 \ https://github.com/cansik/artnet4j/releases/download/latest/artnet4j.txt +241 \ http://agathelenclen.fr/downloads/Squarify.txt +248 \ https://github.com/runwayml/processing-library/releases/download/latest/RunwayML.txt +262 \ https://github.com/SamuelAl/SQuelized-for-Processing/releases/latest/download/SQuelized.txt +267 \ https://github.com/cansik/deep-vision-processing/releases/download/contribution/deepvision.txt +270 \ https://ronghaoliang.page/Weka4P/download/Weka4P.txt [Library : Fabrication] # 078 \ http://s373.net/code/marchingcubes/download/marchingcubes.txt @@ -77,6 +95,10 @@ 113 \ http://sixthsensor.dk/code/p5/point2line/download/point2line.txt 195 \ http://culebra.technology/culebra.txt 204 \ https://github.com/thwegene/OCT/releases/download/latest/OCT.txt +214 \ http://www.garciadelcastillo.es/dashedlines/dashedlines.txt +231 \ http://objectstothinkwith.com/tracer/tracer.txt +237 \ http://gicentre.org/handy/handy.txt +241 \ http://agathelenclen.fr/downloads/Squarify.txt [Library : GUI] 001 \ https://github.com/remixlab/proscene/releases/download/latest/proscene.txt @@ -86,14 +108,17 @@ 058 \ http://www.sojamo.de/libraries/controlP5/controlP5.txt # 061 \ https://dl.dropbox.com/u/87680069/piccolo2d.txt 180 \ http://interfascia.berg.industries/download/interfascia.txt +224 \ https://github.com/BillKujawa/meter/releases/download/latest/meter.txt +237 \ http://gicentre.org/handy/handy.txt +256 \ https://github.com/Milchreis/uibooster-for-processing/releases/latest/download/UiBooster.txt [Library : Hardware] 015 \ http://www.shiffman.net/p5/libraries/sms/sms.txt 024 \ https://github.com/firmata/processing/releases/download/latest/processing-arduino.txt 028 \ http://projects.formatlos.de/ambientlightsensor/download/AmbientLightSensor.txt # 064 \ http://www.muvium.com/frappuccino/frappuccino.txt -066 \ http://ketailibrary.org/ketai.txt -071 \ http://cloud.github.com/downloads/hdavid/dmxP512/dmxP512.txt +066 \ http://ketai.org/ketai.txt +071 \ http://motscousus.com/stuff/2011-01_dmxP512/dmxP512.txt 090 \ https://dl.dropbox.com/u/87680069/LeapMotion.txt # 102 \ http://s176381904.onlinehome.fr/processing/MoveLib/download/MoveLib.txt 104 \ http://arvydas.github.io/blinkstick-processing/download/BlinkStick.txt @@ -104,24 +129,33 @@ 188 \ http://developers.gausstoys.com/processing/GaussSense.txt 189 \ http://ciaron.net/hpglgraphics/download/hpglgraphics.txt 190 \ https://github.com/gohai/processing/releases/download/latest/io.txt -197 \ https://github.com/sgeigers/Phidgets-For-Processing/releases/download/latest/PhidgetsForProcessing.txt +# 197 \ https://github.com/sgeigers/Phidgets-For-Processing/releases/download/latest/PhidgetsForProcessing.txt +211 \ https://github.com/diwi/PS3Eye/releases/download/latest/PS3Eye.txt +218 \ https://github.com/cansik/sweep-processing/releases/download/latest/SweepProcessing.txt +219 \ https://teddavis.org/xyscope/download/XYscope.txt +224 \ https://github.com/BillKujawa/meter/releases/download/latest/meter.txt +225 \ http://web.tecnico.ulisboa.pt/augusto.esteves/GazeTrack/GazeTrack.txt +238 \ https://github.com/cansik/realsense-processing/releases/download/contributed/RealSenseProcessing.txt +239 \ http://skweezee.net/processing/download/SkweezeeForProcessing.txt +266 \ https://github.com/sgeigers/SimplePhidgets/releases/download/latest/SimplePhidgets.txt +268 \ http://github.com/jaysonh/Dmx4Artists/releases/latest/download/Dmx4Artists.txt [Library : I/O] 001 \ https://github.com/remixlab/proscene/releases/download/latest/proscene.txt 016 \ http://www.silentlycrashing.net/ezgestures/files/ezgestures.txt 025 \ http://jorgecardoso.eu/processing/NXTComm/NXTComm.txt 026 \ http://jorgecardoso.eu/processing/MindSetProcessing/download/MindsetProcessing.txt -039 \ https://github.com/codeanticode/tablet/releases/tag/latestv2/Tablet.txt +039 \ https://github.com/codeanticode/tablet/releases/download/latestv2/Tablet.txt 060 \ https://dl.dropbox.com/u/87680069/gamepad.txt 067 \ http://www.graffitiresearchlab.de/wp-content/uploads/proJMS.txt 084 \ http://iddi.github.io/oocsi-processing/oocsi.txt 091 \ http://n-e-r-v-o-u-s.com/tools/obj/OBJExport.txt -097 \ http://pif.github.com/android-select-file/download/SelectFile.txt +097 \ https://andrusiv.com/android-select-file/download/SelectFile.txt 098 \ http://vialab.science.uoit.ca/smt/dl/SMT.txt 105 \ http://paulhertz.net/ignocodelib/download/IgnoCodeLib.txt 121 \ https://github.com/codeanticode/tablet/releases/download/latest/Tablet.txt 136 \ http://www.extrapixel.ch/processing/gifAnimation/gifAnimation.txt -139 \ http://erniejunior.github.io/VSync-for-Processing/download/VSync.txt +139 \ http://ernestum.github.io/VSync-for-Processing/download/VSync.txt 143 \ http://www.lagers.org.uk/processing/gamecontrol/GameControlPlus.txt 167 \ http://www.lagers.org.uk/processing3/gamecontrol/GameControlPlus.txt 168 \ http://transfluxus.github.io/SimpleHTTPServer/download/SimpleHTTPServer.txt @@ -132,11 +166,19 @@ 177 \ https://github.com/keshrath/Console/releases/download/latest/Console.txt 178 \ https://github.com/keshrath/ImageLoader/releases/download/latest/ImageLoader.txt 179 \ https://github.com/keshrath/MuKCast/releases/download/latest/MuKCast.txt -187 \ http://funprogramming.org/VideoExport-for-Processing/download/VideoExport.txt +187 \ https://funprogramming.org/VideoExport-for-Processing/download/VideoExport.txt 206 \ https://ap-sync.github.io/libs/AP_sync_processing/APsync.txt +209 \ https://github.com/gohai/processing-simplereceiptprinter/releases/download/latest/processing-simplereceiptprinter.txt +217 \ https://pierdr.github.io/Tramontana-for-Processing/tramontana.txt +229 \ https://github.com/Shinhoo/Wooting-Keyboard-Library/releases/download/lastest/WootingKeyboard.txt +232 \ https://github.com/haschdl/pLaunchController/releases/download/latest/pLaunchController.txt +239 \ http://skweezee.net/processing/download/SkweezeeForProcessing.txt +247 \ https://github.com/orgicus/image-sequence-player/releases/download/latest/ImageSequencePlayer.txt +258 \ https://github.com/Transmedia-Gx/grab/releases/latest/download/Grab.txt +269 \ http://augmenta-tech.com/libs/processing/Augmenta.txt [Library : Language] -063 \ http://www.rednoise.org/rita/RiTa.txt +063 \ http://rednoise.org/rita/rita.txt 119 \ https://github.com/codeanticode/eliza/releases/download/latest/Eliza.txt [Library : Math] @@ -148,11 +190,13 @@ 131 \ http://www.lagers.org.uk/processing/qscript/QScript.txt 156 \ http://www.lagers.org.uk/processing/jasmine/Jasmine.txt 203 \ https://github.com/OliverColeman/hivis/releases/download/latest/HiVis.txt +251 \ https://github.com/pallav12/matrixMath-for-processing/releases/download/latest/MatrixMath.txt [Library : Other] 093 \ http://www.lagers.org.uk/processing/pathfinder/Path_Finder.txt 157 \ http://www.lagers.org.uk/processing/steganos/Steganos.txt 185 \ http://softlab.pt/ptmx/ptmx.txt +253 \ https://ztdp.ca/projects/school/Green/Green.txt [Library : Simulation] 018 \ http://www.ricardmarxer.com/fisica/download/fisica.txt @@ -170,6 +214,9 @@ 127 \ http://www.lagers.org.uk/processing/ai4g/AI_for_2D_Games.txt 195 \ http://culebra.technology/culebra.txt 201 \ https://github.com/diwi/PixelFlow/releases/download/latest/PixelFlow.txt +216 \ https://github.com/diwi/LiquidFunProcessing/releases/download/latest/LiquidFunProcessing.txt +244 \ http://giftedapprentice.com/ewbIK/ewbIK.txt +261 \ https://github.com/dennisppaul/teilchen/releases/latest/download/teilchen.txt [Library : Sound] 153 \ https://github.com/processing/processing-sound/releases/download/latest/sound.txt @@ -181,6 +228,11 @@ 147 \ http://code.compartmental.net/minim/distro/minim_for_processing.txt 151 \ https://corajr.github.io/loom/download/loom.txt 170 \ https://github.com/shlomihod/cassette/releases/download/latest/cassette.txt +219 \ https://teddavis.org/xyscope/download/XYscope.txt +254 \ http://www.kramann.info/ComposingForEveryone.txt +260 \ https://github.com/sphaero/procmod/releases/latest/download/procmod.txt +264 \ https://github.com/dennisppaul/wellen/releases/latest/download/wellen.txt +271 \ https://www.robertesler.com/software/Pd4P3.txt [Library : Utilities] 001 \ https://github.com/remixlab/proscene/releases/download/latest/proscene.txt @@ -208,18 +260,32 @@ 192 \ https://github.com/barelief/freeTransform-processing/releases/download/latest/FreeTransform.txt 193 \ http://shiffman.net/p5/libraries/processing3/mpe/mpe.txt 201 \ https://github.com/diwi/PixelFlow/releases/download/latest/PixelFlow.txt -202 \ http://ixora.io/downloads/colorblindness/ColorBlindness.txt +202 \ https://ixora.io/downloads/colorblindness/ColorBlindness.txt +207 \ https://github.com/Lord-of-the-Galaxy/Timing-Utilities/releases/download/latest/timing_utils.txt +210 \ http://cagewebdev.com/colorharmony/colorharmony.txt +212 \ https://github.com/cansik/processing-postfx/releases/download/latest/PostFX.txt +213 \ https://github.com/AlexPoupakis/mouse2DTransformations/releases/download/latest/Mouse2DTransformations.txt +217 \ https://pierdr.github.io/Tramontana-for-Processing/tramontana.txt +229 \ https://github.com/Shinhoo/Wooting-Keyboard-Library/releases/download/lastest/WootingKeyboard.txt +235 \ https://www.barkmin.eu/processing-library-scratch/download/scratch.txt +240 \ https://commonpike.github.io/nl.kw.processing.portmods/dist/PortMods.txt +245 \ https://github.com/VisualComputing/nub/releases/download/latest/nub.txt +246 \ https://github.com/federico-pepe/nice-color-palettes/releases/download/latest/NiceColorPalettes.txt +248 \ https://github.com/runwayml/processing-library/releases/download/latest/RunwayML.txt +255 \ https://bdhont.net/LiveBrush.txt +257 \ https://rect.dev/processing/infinidecimal/GRInfinidecimalCanvas.txt +258 \ https://github.com/Transmedia-Gx/grab/releases/latest/download/Grab.txt [Library : Typography] 038 \ http://www.ricardmarxer.com/geomerative/geomerative.txt 088 \ https://raw.github.com/andreaskoller/Fontastic/master/download/Fontastic.txt -116 \ https://github.com/prisonerjohn/NextText/releases/download/latest/NextText.txt +# 116 \ https://github.com/prisonerjohn/NextText/releases/download/latest/NextText.txt [Library : Video & Vision] 150 \ https://github.com/processing/processing-video/releases/download/latest/video.txt 013 \ http://shiffman.net/p5/libraries/openkinect_processing/openkinect_processing.txt 023 \ http://www.v3ga.net/processing/BlobDetection/blobDetection.txt -041 \ https://github.com/Syphon/Processing/releases/download/latestv2/Syphon.txt +041 \ https://github.com/Syphon/Processing/releases/latest/download/Syphon.txt # 059 \ http://thomasdiewald.at/processing/libraries/dLibs_freenect/download/dLibs_freenect.txt # 077 \ http://s373.net/code/flob/download/flob.txt # 081 \ http://ubaa.net/shared/processing/opencv/download/opencv.txt @@ -227,13 +293,18 @@ 132 \ https://github.com/atduskgreg/opencv-processing/releases/download/latest/opencv_processing.txt 134 \ http://decoder.x10host.com/blobscanner/blobscanner.txt 146 \ http://boofcv.org/processing/boofcv_processing.txt -148 \ https://github.com/Syphon/Processing/releases/download/latest/Syphon.txt +# 148 \ https://github.com/Syphon/Processing/releases/download/latest/Syphon.txt 149 \ http://www.magicandlove.com/software/Kinect4WinSDK.txt 161 \ http://codigogenerativo.com/KinectPV2.txt 176 \ http://www.stefanobaldan.com/projects/ipcapture/download/IPCapture.txt 184 \ https://github.com/gohai/processing-glvideo/releases/download/latest/processing-glvideo.txt 186 \ https://github.com/leadedge/SpoutProcessing/releases/download/latest/spout.txt 201 \ https://github.com/diwi/PixelFlow/releases/download/latest/PixelFlow.txt +211 \ https://github.com/diwi/PS3Eye/releases/download/latest/PS3Eye.txt +222 \ https://pierdr.github.io/tramontanaCV/download/tramontanaCV.txt +223 \ https://github.com/nyatla/NyARToolkit-for-Processing/releases/download/latest/nyar4psg.txt +227 \ https://github.com/Milchreis/processing-imageprocessing/releases/download/latest/processing-imageprocessing.txt +236 \ http://softlab.pt/VLCJVideo/VLCJVideo.txt [Examples : Books] 154 \ http://shiffman.net/p5/examples/natureofcode.txt @@ -241,9 +312,13 @@ 165 \ https://processing.org/handbook/handbook_2e.txt 166 \ https://processing.org/books/gswp_2e.txt 205 \ http://mad4j.github.io/book-mdpc/book-mdpc.txt +265 \ https://codingart-book.github.io/examples/CodingArtBookExamples.txt [Examples : ] 194 \ http://damellis.github.io/wovns-processing-examples/WOVNS.txt +226 \ https://github.com/Apress/processing-for-android/releases/download/latest/processing-for-android-examples.txt +243 \ https://coding-creative.dringtech.com/examples/coding-creative-examples.txt +249 \ https://github.com/jeremydouglass/rosetta_examples_p5/releases/latest/download/rosetta_examples_p5.txt [Tool : ] 020 \ https://dl.dropboxusercontent.com/u/69944346/ColorSelectorPlus/ColorSelectorPlusTool.txt @@ -261,6 +336,12 @@ 181 \ https://github.com/joelmoniz/Shape-Sketch/releases/download/latest/ShapeSketch.txt 182 \ https://github.com/rzats/font-highlighting-editor/releases/download/latest/FontHighlightingEditor.txt 191 \ https://github.com/gohai/processing-uploadtopi/releases/download/latest/UploadToPiTool.txt +221 \ http://jonathan.dahlberg.media/ecc/ecc.txt +228 \ https://perceptualcolor.org/distribution/PerceptualColorPicker/download/PerceptualColorPicker.txt +233 \ https://github.com/jaewhyun/GettingStarted/releases/download/latest/GettingStarted.txt +234 \ https://github.com/jaewhyun/ReferenceTool/releases/download/latest/ReferenceTool.txt +242 \ https://jwilder4690.github.io/tools/ArtStation/ArtStation.txt +263 \ http://jonathan.dahlberg.media/processing2js/Processing2JSTool.txt [Mode : ] 070 \ http://bezier.de/processing/modes/CoffeeScriptMode.txt @@ -268,7 +349,9 @@ 101 \ https://github.com/processing/processing-android/releases/download/latest/AndroidMode.txt # 122 \ http://galsasson.com/tweakmode/tweakmode.txt # 124 \ http://download.processing.org/pdeX.txt -142 \ http://py.processing.org/PythonMode.txt +# 142 \ http://py.processing.org/PythonMode.txt 162 \ https://github.com/joelmoniz/REPLmode/releases/download/latest/REPLMode.txt -169 \ http://py.processing.org/3/PythonMode.txt +169 \ https://py.processing.org/3/PythonMode.txt 199 \ https://github.com/fathominfo/processing-p5js-mode/releases/download/latest/p5jsMode.txt +220 \ https://github.com/processing-r/Processing.R/releases/latest/download/RLangMode.txt +250 \ https://github.com/Izza11/shader-mode/releases/download/latest/ShaderMode.txt diff --git a/css/style.css b/css/style.css index c837eb78b..65fd77ba4 100755 --- a/css/style.css +++ b/css/style.css @@ -7,12 +7,10 @@ Reworked by CR, 23 Sep 2011 Reworked by Jon Gacnik, 19 Feb 2013 Created: 2005.08.29 04:28PM -Last Modified: 2014.11.15 by Scott Murray +Last Modified: 2019.07.26 by Casey Reas to remove Foundation Site CSS "-f" */ - - @font-face { font-family: 'theSerifItalic'; src: url(fonts/TheSerif_B4_Italic.eot), @@ -54,7 +52,6 @@ Last Modified: 2014.11.15 by Scott Murray } - /* ================ GLOBAL ================== */ body { @@ -70,7 +67,7 @@ body { -webkit-text-size-adjust: none; font-size : 100%; - font-size : 0.79em; + font-size : 0.85em; /* 0.79em; */ font-weight : normal; line-height : 1.5em; color : #252525; @@ -79,6 +76,7 @@ body { img { border: 0px solid #000000; } a { + cursor: pointer; text-decoration: none; font-weight: normal; color: #2c7bb5; @@ -102,6 +100,7 @@ a.large-link:before { content: ''; } + /* ================ COVER SLIDESHOW ================== */ #slideshow { @@ -127,7 +126,6 @@ a.large-link:before { } - /* ================ LAYOUT ================== */ #container { @@ -137,7 +135,6 @@ a.large-link:before { } - /* ================ RIBBON ================== */ #ribbon { @@ -179,6 +176,8 @@ a.large-link:before { border-right: 1px solid #1a1a1a; } + + #ribbon ul.right li { float: right; border-left: 1px solid #1a1a1a; @@ -209,12 +208,48 @@ a.large-link:before { font-weight: bold; } +#ribbon-announce { + text-align: center; + width: 900px; + height: auto; + background-color: #d1f94e; + background: linear-gradient(to bottom, #1d517e, #d1f94e); + margin-bottom: 30px; /* added when placed below the header */ +} + +#ribbon-announce ul { + display: inline-block; + margin: 0; + padding: 0; +} + +#ribbon-announce ul.center { + float: center; +} + +#ribbon-announce ul li { + display: inline-block; + margin: 0; + padding: 6px 10px 5px 10px; + list-style: none; +} + +#ribbon-announce ul.center li { + float: center; +} + +#ribbon-announce ul li a { + color: white; + font-weight: bold; +} + /* ================ HEADER ================== */ + #header { width: 900px; height: 106px; - margin-bottom: 30px; + margin-bottom: 30px; /* was 30px, but changed to 0 when ribbon placed below header */ overflow: hidden; background: #0c2033 url(../img/processing-web.png) center center no-repeat; background-position: bottom; @@ -222,16 +257,6 @@ a.large-link:before { position: relative; } -#header-f { - width: 900px; - height: 106px; - margin-bottom: 30px; - overflow: hidden; - background: #0c2033 url(/images/processing-site.png) center center no-repeat; - background-size: 900px 106px; - position: relative; -} - #header .processing-logo { width: 206px; height: 38px; @@ -243,17 +268,6 @@ a.large-link:before { background-image: linear-gradient(transparent, transparent), url(../img/processing-logo.svg); } -#header-f .processing-logo { - width: 370px; - height: 38px; - margin: 20px 0 0 30px; - /* -- NEW FOUNDATION LOGO GOES HERE -- */ - background: transparent url(/images/processing-foundation-logo.svg) center center no-repeat; - background-image: -webkit-linear-gradient(transparent, transparent), url(/images/processing-foundation-logo.svg); - background-image: -moz-linear-gradient(transparent, transparent), url(/images/processing-foundation-logo.svg); - background-image: linear-gradient(transparent, transparent), url(/images/processing-foundation-logo.svg); -} - #header .processing-logo.no-cover:before { position: relative; top: 3px; @@ -262,14 +276,6 @@ a.large-link:before { content: '\2039'; } -#header-f .processing-logo.no-cover:before { - position: relative; - top: 3px; - left: -18px; - font-size: 24px; - content: '\2039'; -} - #Overview2 .processing-logo.no-cover:before { position: relative; top: 3px; @@ -284,23 +290,11 @@ a.large-link:before { color: white; } -#header-f a { - font-family: 'theSerif', 'Enriqueta', georgia, times, sans-serif; - text-decoration: none; - border: none; - color: white; -} - #header h1 { display: none; float: left; } -#header-f h1 { - display: none; - float: left; -} - #header form { position: absolute; top: 20px; @@ -309,14 +303,6 @@ a.large-link:before { color: #959595; } -#header-f form { - position: absolute; - top: 20px; - right: 5px; - width: 176px; - color: #959595; -} - #header form input { float: left; border: 1px solid #136796; @@ -328,29 +314,12 @@ a.large-link:before { color: #959595; } -#header-f form input { - float: left; - border: 1px solid #136796; - outline: none; - height: 18px; - background: #fff; - font-family: 'theSerif', 'Enriqueta', georgia, times, serif; - font-size: 1em; - color: #959595; -} - #header form input[type="text"]{ padding-left: 3px; width: 127px; border-right: none; } -#header-f form input[type="text"]{ - padding-left: 3px; - width: 127px; - border-right: none; -} - #header form input[type="submit"]{ height: 22px; width: 22px; @@ -362,21 +331,8 @@ a.large-link:before { cursor: pointer; } -#header-f form input[type="submit"]{ - height: 22px; - width: 22px; - border-left: none; - background: white url(/images/search-f.svg) center center no-repeat; - background-image: -webkit-linear-gradient(transparent, transparent), url(/images/search-f.svg); - background-image: -moz-linear-gradient(transparent, transparent), url(/images/search-f.svg); - background-image: linear-gradient(transparent, transparent), url(/images/search-f.svg); - cursor: pointer; -} - #header form p { margin: 0; } -#header-f form p { margin: 0; } - /* ================ NAVBAR ================== */ #navigation { @@ -407,6 +363,7 @@ a.large-link:before { position: relative; } + /* ================ FOOTER ================== */ #footer { @@ -428,26 +385,6 @@ a.large-link:before { padding-top: 10px; } -/* === FOUNDATION FOOTER === */ - -#footer-f { - clear: both; - padding: 100px 30px 20px 30px; - line-height: 23px; - color: #959595; -} -#footer-f a { - color: #959595; - border-bottom: 1px solid #CECECE; -} -#footer-f #copyright, -#footer-f #colophon { - -} -#footer-f #copyright { - border-top: 1px solid #A6BCCF; - padding-top: 10px; -} /* ================ TYPOGRAPHY ================== */ @@ -524,13 +461,12 @@ li {margin-bottom: 1em; } .large-header .black { color: #000; } .error { color: #f00; margin: 0; } -/* ================ UI Elements ================== */ - - /* ================== RANDOM CLASSES =============== */ + .clear { clear: both; } + /* ================== PAGE SPECIFIC CSS =============== */ /**************************************************************** Cover ***/ @@ -678,15 +614,8 @@ dl.network dt { font-style: normal; } dl.network dd { margin: 0; } dl.network dd.date { color: #999999; margin-bottom: 1em; } -//p.network { margin: 0 23px 1em 0; width:200px; } -//p.network span.date { color: #999999; } - p.exhibition-nav { margin-top: 20px; margin-bottom: 10px; } -/**************************************************************** Foundation ***/ - -.foundation-p { line-height: 0em; } - /**************************************************************** Reference ***/ @@ -694,8 +623,6 @@ p.exhibition-nav { margin-top: 20px; margin-bottom: 10px; } #Language h5 a { float: left; margin-left: -30px; } - - .skinny { margin-left : 0px; margin-right : 50px; @@ -711,7 +638,7 @@ p.exhibition-nav { margin-top: 20px; margin-bottom: 10px; } margin-bottom: 20px; } -.ref-notice { margin: 0 0 2.5em 0; color: #FF3399; clear: both; margin-right: 40px;} +.ref-notice { margin: 0 0 2.5em 0; color: #666666; clear: both; margin-right: 40px;} .ref-item { margin-bottom: 60px; } .ref-item th { width: 100px; font-weight: bold; text-align: left; vertical-align: top; } @@ -879,8 +806,6 @@ div.ref-col { /**************************************************************** download ***/ -/* download */ - #Download .download ul { list-style: none; margin: 0; padding: 0; } #Download span.version-date { color: #959595; } #Download h5 { @@ -1059,16 +984,13 @@ div.ref-col { /************************************************************** contribute ***/ -/*#Contribute h1 { margin-bottom: 0; }*/ #Contribute .message { margin-top: 0; margin-right: 40px; } #Contribute .threecol { float: left; width: 210px; margin-right: 20px; } #Contribute .threecol p { margin-bottom: 2em; } - /************************************************************** learning ***/ -/*#Learning h1 { margin-bottom: 0; margin-top: 0;}*/ #Learning .message { margin-top: 0; margin-right: 40px; } #Learning .threecol { float: left; width: 200px; margin-right: 30px; margin-top: 0px;} #Learning .threecol p { margin-bottom: 2em; } @@ -1080,13 +1002,10 @@ div.ref-col { .doc-float { margin-right: 40px;} - - h2 { margin-bottom: 0; margin-top: 0;} .example-notice { margin: -1.0em 0 2.5em 0; color: #FF3399; clear: both; margin-right: 40px;} - #Copyright p { margin-right: 20px; } @@ -1097,37 +1016,6 @@ h2 { margin-bottom: 0; margin-top: 0;} #Tutorials .colthree { width: 224px; float: left; margin-right: 20px; } #Tutorials h2 { margin: 0 0 20px 0; font-size: 1em; } -/*#Tutorials p { - margin-top: 2.0em; - margin-bottom: 2.0em; - font-size : 1.0em; - font-weight : normal; - line-height : 2.0em; - }*/ - -/*#Tutorials h3 { - font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size : 1.3em; - font-weight : bold; - margin-bottom : 0.4em; - margin-top : 1.8em; -} - -#Tutorials h5 { - font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; - font-weight : bold; - font-size : 1.0em; - margin-bottom : 0.4em; - margin-top : 1.4em; -}*/ - -/*#Tutorials h1 { - font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size : 2.0em; - font-weight : normal; - font-style : normal; -}*/ - /*--------------------TUTORIAL HEADER SPACING------------------*/ .Tutorials { line-height: 0em; } @@ -1176,6 +1064,7 @@ h2 { margin-bottom: 0; margin-top: 0;} background-color: #eee; } +/* #Tutorials p.txt { margin-top: 0em; margin-bottom: 2em; @@ -1183,10 +1072,10 @@ h2 { margin-bottom: 0; margin-top: 0;} font-weight: normal; line-height: 200%; } +*/ /************************************************************** Books ***/ -/*#Books h1 { margin-bottom: 0; margin-top: 0;}*/ #Books td { vertical-align: top; font-size: 1.0em} @@ -1210,9 +1099,6 @@ h2 { margin-bottom: 0; margin-top: 0;} margin-top: 30px; } - - - #Tools-index h5 { margin-bottom: 0; font-size: 1em; } #Tools-index .twocol p { margin-top: 0; } .lib-nav { display: block; @@ -1231,7 +1117,6 @@ h2 { margin-bottom: 0; margin-top: 0;} #Tools h4 { font-size: 1em; margin-bottom: .5em; } #Tools h4 a {float:left; margin-left:-30px; martin-top:-5px; } - #Tools .threecol { float: left; width: 210px; @@ -1241,10 +1126,8 @@ h2 { margin-bottom: 0; margin-top: 0;} .threecol:nth-child(5) { margin: 0 !important; } - /************************************************************** Library Indices ***/ - #Libraries .colone { width: 300px; float: left; @@ -1266,10 +1149,8 @@ h2 { margin-bottom: 0; margin-top: 0;} #Libraries .twocol-alt { width: 330px; float: left; - //background: #cccccc; } - #Libraries .twocol p { margin-top: 0; } #Libraries .full { @@ -1294,8 +1175,6 @@ h2 { margin-bottom: 0; margin-top: 0;} margin-bottom: 2px; } - - #Libraries .lib-nav { display: block; margin-bottom: 10px; margin-left: -30px; @@ -1306,7 +1185,6 @@ h2 { margin-bottom: 0; margin-top: 0;} #Libraries pre { margin-left: 30px; margin-bottom: 30px; } #Libraries h2 { margin-top: 2em; } -/*#Libraries h3 { clear: both; margin-bottom: 0; }*/ #Libraries h3 { margin-top: 0; margin-bottom: 0;} @@ -1329,13 +1207,13 @@ h2 { margin-bottom: 0; margin-top: 0;} /************************************************************** environment ***/ -/*#Environment h1 { margin-top: 2em; }*/ -#Environment h5 { margin-top: 3em; } + +#Environment h5 { margin-top: 2em; margin-bottom: 1em; } #Environment h6 { margin-bottom: 0em; } #Environment h5 a { float: left; margin-left: -30px; } ul.nostyle { margin: 0; padding: 0; list-style: none outside; } #Environment td { padding-bottom: 1em; } -#Environment .content p, +/*#Environment .content p,*/ #Environment .content ul, #Environment .content table { width: 560px; @@ -1343,31 +1221,22 @@ ul.nostyle { margin: 0; padding: 0; list-style: none outside; } /************************************************************** overview ***/ + #Overview .content p, #Overview .content ul, -#Overview .content table { - width: 560px; -} +#Overview .content table { width: 560px; } #Foundation .content p, #Foundation .content ul, -#Foundation .content table { - width: 560px; -} - +#Foundation .content table { width: 560px; } #People .content p, #People .content ul, -#People .content table { - width: 560px; -} +#People .content table { width: 560px; } #people-f .content p, #people-f .content ul, -#people-f .content table { - width: 680px; -} - +#people-f .content table { width: 680px; } /************************************************************** examples ***/ @@ -1377,16 +1246,12 @@ p.doc-float { margin-left: 250px; } p.doc { margin-right: 40px; margin-top: 30px;} pre.code { clear: both; margin-top: 10px; } -/* #examples-nav { margin-left: -44px; display: relative; } */ //#examples-nav { margin-left: 0px; display: relative; } .examples-nav-div { margin-left: -44px; margin-top: -10px; width: 480px; display: relative; align: left; } #examples-nav img { display: absolute; top: 15px; left: 100px; } -/*#Examples h1 { margin-bottom: 0; }*/ - - div.updateRequired { color:#999; } @@ -1402,7 +1267,9 @@ ul.examples { -webkit-column-count:3; /* Safari and Chrome */ column-count:3; } + ul.examples li { margin: 0; padding: 0; } + ul.examples ul { list-style: none; padding: 0; @@ -1410,58 +1277,80 @@ ul.examples ul { margin-bottom: 17px; width: 100%; } + ul.examples ul li { margin: 0; } + div.examples-nav { margin-left: -41px; margin-bottom: 17px; position: relative; } -div.examples-nav img { position: relative; top: 11px; } - - -/**************************************************************** updates, courses, happenings ***/ -/* -#Courses .content, #Updates .content, #Happenings .content { - width: 595px; - } -#Updates h2 { margin-top: 0 0 20px 0; } - - -.course-desc p { margin: 0; } -.course-desc p.date { margin: 0; } -.course-desc h3 { margin: 0; font-size: 1em; font-weight: bold; line-height: 1em; } -.course-desc { margin-bottom: 2em; } -*/ - -/************************************************************** comparison ***/ -/* - -#Compare h1 { margin-top: 2em; } -#Compare h2 { margin-bottom: 0; } -#Compare .threecol { float: left; width: 210px; margin-right: 20px; } -#Compare .threecol p { margin-top: 0; } - - -#Compare .content { - margin-left : 55px; - margin-right : 0px; - position: relative; -} -*/ -/************************************************************** troubleshooting ***/ -/* -#Troubleshooting h1 { margin-top: 2em; } -#Troubleshooting h5 a { float: left; margin-left: -30px; } -ul.nostyle { margin: 0; padding: 0; list-style: none outside; } -#Troubleshooting td { padding-bottom: 1em; } -*/ - -/************************************************************** FAQ ***/ - -/* -#FAQ h5 a { float: left; margin-left: -30px; } -*/ +div.examples-nav img { position: relative; top: 11px; } + .donate-card-row { + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-justify-content: space-between; + -ms-flex-pack: justify; + justify-content: space-between; + margin-left: -10px; + margin-right: -10px; + } + + .donate-card { + text-align: center; + width: 30%; + border: 1px solid #CBCBCB; + /*background: #FAFAFA;*/ + padding: 20px; + margin: 10px; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + } + + .donate-card h4 { + line-height: 1.3; + margin: 0 0 0 0; + color: #2c7bb5; + } + + a.donate-card { + color: #252525; + } + + a.donate-card:hover { + border-color: #2c7bb5; + } + + .donate-list { + list-style: none; + margin-left: 0; + padding-left: 0; + } + + .donate-list li { + margin-bottom: 0; + } + + .donate-list li:before { + content: '» ' + } + + .donate-content hr { + margin-top: 2em; + margin-bottom: 2em; + background: none; + border: none; + border-top: 1px solid #CBCBCB; + } diff --git a/download/README.md b/download/README.md deleted file mode 100755 index d8599a827..000000000 --- a/download/README.md +++ /dev/null @@ -1,17 +0,0 @@ -## Processing Donation Form - -### Description - -The code here handles the Stripe and PayPal purchasing system for Processing Foundation. - -### Libraries/Classes Used -[Stripe Donation Form](https://github.com/tommymarshall/Stripe-Donation-Form/zipball/master) -[PayPal Express Checkout](https://github.com/maly/paypal) -[PHPMailer](https://github.com/Synchro/PHPMailer) - -### Feature Overview - -- Process donation using Stripe Payments & PayPal Express Checkout -- Send email reciept -- Log purchase -- Forward user to Downloads page \ No newline at end of file diff --git a/download/_downloads.php b/download/_downloads.php deleted file mode 100644 index 5d22a9c1d..000000000 --- a/download/_downloads.php +++ /dev/null @@ -1,314 +0,0 @@ - -
    - -

    Download Processing. Processing is available for Linux, Mac OS X, and Windows. Select your choice to download the software below.

    - -
    Thank you for donating to the Processing Foundation.
    - - - -
    - - - - -
    - 3.3 - (12 February 2017) - -
    - - -
    - -
    - Read about the changes in 3.0. The list of revisions covers the differences between releases in detail. -
    -
    -
    - - -
    -

    Stable Releases

    - -

    Earlier releases have been removed because we can only support the current versions of the software. To update old code, read the changes page. Changes for each release can be found in revisions.txt. If you have problems with the current release, please file a bug so that we can fix it. Older releases can also be built from the source. Read More about the releases and their numbering. To use Android Mode, Processing 3 or later is required.

    -
    - - -
    -

    Pre-Releases

    -
      -
    • No pre-release versions are currently available.
    • - - - - -
    -

    The revisions cover incremental changes between releases, and are especially important to read for pre-releases.

    -
    - - -
    - Processing is Open Source Software. The PDE (Processing Development Environment) is released under the GNU GPL (General Public License). The export libraries (also known as 'core') are released under the GNU LGPL (Lesser General Public License). There's more information about Processing and Open Source in the FAQ and more information about the GNU GPL and GNU LGPL at opensource.org. Please contribute to Processing! -
    - -
    - - - - - - - - - diff --git a/download/_emailtest.php b/download/_emailtest.php deleted file mode 100644 index 013bdaec7..000000000 --- a/download/_emailtest.php +++ /dev/null @@ -1,67 +0,0 @@ -
    - Scott"; -$name = "Scott Murray"; -$email = "shm@alignedleft.com"; - - -// Build and send the email *using PHPMailer - -$mail = new PHPMailer(); - -$mail->SMTPDebug = 3; //0 is no debug output, 3 is verbose - -$mail->IsSMTP(); -$mail->SMTPAuth = true; -$mail->SMTPSecure = 'tls'; -$mail->Port = 25; -$mail->Host = $mailConfig['host']; -$mail->Username = $mailConfig['user']; -$mail->Password = $mailConfig['pass']; - -$mail->From = 'foundation@processing.org'; -$mail->FromName = 'Processing Foundation'; -$mail->addAddress($email, $name); -$mail->addBCC('foundation@processing.org'); - -$message = str_replace('%name%', $name , $body) . "\n\n"; -$message .= "Email: " . $email . "
    \n"; - -$mail->isHTML(true); -$mail->Subject = "Test message from Processing.org"; -$mail->Body = $message; - -if(!$mail->send()) { - echo 'Message could not be sent.'; - echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message has been sent'; -} - - -//echo("

    mailed returned " . $result . "

    "); -//echo("

    ErrorInfo is " . $mail->ErrorInfo . "

    "); - -exit; - -?> \ No newline at end of file diff --git a/download/_helpers.php b/download/_helpers.php deleted file mode 100644 index dc5c90325..000000000 --- a/download/_helpers.php +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/download/_js/donate.js b/download/_js/donate.js deleted file mode 100644 index b847b5ad9..000000000 --- a/download/_js/donate.js +++ /dev/null @@ -1,54 +0,0 @@ -$(function(){ - - var $donateForm = $('#donateForm') - var $submit = $donateForm.find('input[type="submit"]') - var stripe = true - - // if($('input[name=type]:checked').val() != 'stripe'){ - // stripe = false - // $('.ccInfo').hide() - // } - - $('input[name=type]').on('change', function(){ - if($(this).val()=='stripe'){ - stripe = true - $('.ccInfo').show() - } else if($(this).val()=='paypal'){ - stripe = false - $('.ccInfo').hide() - } - }) - - var stripeResponseHandler = function(status, response) { - if (response.error) { - $('.messages').html(response.error.message) - $submit.prop('disabled', false).val('Complete Donation') - } else { - var token = response['id'] - $donateForm.append('') - $donateForm.get(0).submit() - } - } - - // $donateForm.validate() - $donateForm.on('submit',function(){ - $submit.prop('disabled', true).val('Processing...'); - - if(stripe){ - Stripe.createToken({ - name: $('.first-name').val() + ' ' + $('.last-name').val(), - number: $('.card-number').val(), - cvc: $('.card-cvc').val(), - exp_month: $('.card-expiry-month').val(), - exp_year: $('.card-expiry-year').val() - }, stripeResponseHandler); - - return false; - } - - if(!stripe){ - - } - }) - -}) diff --git a/download/_js/jquery.validate.min.js b/download/_js/jquery.validate.min.js deleted file mode 100755 index cc0414e65..000000000 --- a/download/_js/jquery.validate.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery Validation Plugin - v1.11.0 - 2/4/2013 -* https://github.com/jzaefferer/jquery-validation -* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */ -(function(e){e.extend(e.fn,{validate:function(t){if(!this.length){t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.");return}var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(t.target).hasClass("cancel")&&(n.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return n.settings.submitHandler?(n.submitButton&&(r=e("").attr("name",n.submitButton.name).val(n.submitButton.value).appendTo(n.currentForm)),n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&r.remove(),!1):!0}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,r()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):r():(n.focusInvalid(),!1)})),n)},valid:function(){if(e(this[0]).is("form"))return this.validate().form();var t=!0,n=e(this[0].form).validate();return this.each(function(){t&=n.element(this)}),t},removeAttrs:function(t){var n={},r=this;return e.each(t.split(/\s/),function(e,t){n[t]=r.attr(t),r.removeAttr(t)}),n},rules:function(t,n){var r=this[0];if(t){var i=e.data(r.form,"validator").settings,s=i.rules,o=e.validator.staticRules(r);switch(t){case"add":e.extend(o,e.validator.normalizeRule(n)),s[r.name]=o,n.messages&&(i.messages[r.name]=e.extend(i.messages[r.name],n.messages));break;case"remove":if(!n)return delete s[r.name],o;var u={};return e.each(n.split(/\s/),function(e,t){u[t]=o[t],delete o[t]}),u}}var a=e.validator.normalizeRules(e.extend({},e.validator.classRules(r),e.validator.attributeRules(r),e.validator.dataRules(r),e.validator.staticRules(r)),r);if(a.required){var f=a.required;delete a.required,a=e.extend({required:f},a)}return a}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+t.value)},filled:function(t){return!!e.trim(""+t.value)},unchecked:function(e){return!e.checked}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return arguments.length===1?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\\{"+e+"\\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e,t){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e,t){!this.checkable(e)&&(e.name in this.submitted||!this.optional(e))&&this.element(e)},onkeyup:function(e,t){if(t.which===9&&this.elementValue(e)==="")return;(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e,t){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).addClass(n).removeClass(r):e(t).addClass(n).removeClass(r)},unhighlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).removeClass(n).addClass(r):e(t).removeClass(n).addClass(r)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function r(t){var n=e.data(this[0].form,"validator"),r="on"+t.type.replace(/^validate/,"");n.settings[r]&&n.settings[r].call(n,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var t=this.groups={};e.each(this.settings.groups,function(n,r){typeof r=="string"&&(r=r.split(/\s/)),e.each(r,function(e,r){t[r]=n})});var n=this.settings.rules;e.each(n,function(t,r){n[t]=e.validator.normalizeRule(r)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",r).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",r),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t)),this.lastElement=t,this.prepareElement(t),this.currentElements=e(t);var n=this.check(t)!==!1;return n?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var n in t)this.errorList.push({message:t[n],element:this.findByName(n)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t=0;for(var n in e)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&e.grep(this.errorList,function(e){return e.element.name===t.name}).length===1&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in n||!t.objectLength(e(this).rules())?!1:(n[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n=e(t).attr("type"),r=e(t).val();return n==="radio"||n==="checkbox"?e("input[name='"+e(t).attr("name")+"']:checked").val():typeof r=="string"?r.replace(/\r/g,""):r},check:function(t){t=this.validationTargetFor(this.clean(t));var n=e(t).rules(),r=!1,i=this.elementValue(t),s;for(var o in n){var u={method:o,parameters:n[o]};try{s=e.validator.methods[o].call(this,i,t,u.parameters);if(s==="dependency-mismatch"){r=!0;continue}r=!1;if(s==="pending"){this.toHide=this.toHide.not(this.errorsFor(t));return}if(!s)return this.formatAndAdd(t,u),!1}catch(a){throw this.settings.debug&&window.console&&console.log("Exception occured when checking element "+t.id+", check the '"+u.method+"' method.",a),a}}if(r)return;return this.objectLength(n)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg-"+n.toLowerCase())||t.attributes&&e(t).attr("data-msg-"+n.toLowerCase())},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;eWarning: No message defined for "+t.name+"
    ")},formatAndAdd:function(t,n){var r=this.defaultMessage(t,n.method),i=/\$?\{(\d+)\}/g;typeof r=="function"?r=r.call(this,n.parameters,t):i.test(r)&&(r=e.validator.format(r.replace(i,"{$1}"),n.parameters)),this.errorList.push({message:r,element:t}),this.errorMap[t.name]=r,this.submitted[t.name]=r},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message)}this.errorList.length&&(this.toShow=this.toShow.add(this.containers));if(this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(n)):(r=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,e(t)):r.insertAfter(t))),!n&&this.settings.success&&(r.text(""),typeof this.settings.success=="string"?r.addClass(this.settings.success):this.settings.success(r,t)),this.toShow=this.toShow.add(r)},errorsFor:function(t){var n=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===n})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return this.dependTypes[typeof e]?this.dependTypes[typeof e](e,t):!0},dependTypes:{"boolean":function(e,t){return e},string:function(t,n){return!!e(t,n.form).length},"function":function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],n&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&this.pendingRequest===0&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},r=e(t).attr("class");return r&&e.each(r.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},attributeRules:function(t){var n={},r=e(t);for(var i in e.validator.methods){var s;i==="required"?(s=r.get(0).getAttribute(i),s===""&&(s=!0),s=!!s):s=r.attr(i),s?n[i]=s:r[0].getAttribute("type")===i&&(n[i]=!0)}return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(t){var n,r,i={},s=e(t);for(n in e.validator.methods)r=s.data("rule-"+n.toLowerCase()),r!==undefined&&(i[n]=r);return i},staticRules:function(t){var n={},r=e.data(t.form,"validator");return r.settings.rules&&(n=e.validator.normalizeRule(r.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(r,i){if(i===!1){delete t[r];return}if(i.param||i.depends){var s=!0;switch(typeof i.depends){case"string":s=!!e(i.depends,n.form).length;break;case"function":s=i.depends.call(n,n)}s?t[r]=i.param!==undefined?i.param:!0:delete t[r]}}),e.each(t,function(r,i){t[r]=e.isFunction(i)?i(n):i}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:typeof t[this]=="string"&&(n=t[this].split(/[\s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if(typeof t=="string"){var n={};e.each(t.split(/\s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,r){e.validator.methods[t]=n,e.validator.messages[t]=r!==undefined?r:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,r){if(!this.depend(r,n))return"dependency-mismatch";if(n.nodeName.toLowerCase()==="select"){var i=e(n).val();return i&&i.length>0}return this.checkable(n)?this.getLength(t,n)>0:e.trim(t).length>0},remote:function(t,n,r){if(this.optional(n))return"dependency-mismatch";var i=this.previousValue(n);this.settings.messages[n.name]||(this.settings.messages[n.name]={}),i.originalMessage=this.settings.messages[n.name].remote,this.settings.messages[n.name].remote=i.message,r=typeof r=="string"&&{url:r}||r;if(i.old===t)return i.valid;i.old=t;var s=this;this.startRequest(n);var o={};return o[n.name]=t,e.ajax(e.extend(!0,{url:r,mode:"abort",port:"validate"+n.name,dataType:"json",data:o,success:function(r){s.settings.messages[n.name].remote=i.originalMessage;var o=r===!0||r==="true";if(o){var u=s.formSubmitted;s.prepareElement(n),s.formSubmitted=u,s.successList.push(n),delete s.invalid[n.name],s.showErrors()}else{var a={},f=r||s.defaultMessage(n,"remote");a[n.name]=i.message=e.isFunction(f)?f(t):f,s.invalid[n.name]=!0,s.showErrors(a)}i.valid=o,s.stopRequest(n,o)}},r)),"pending"},minlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r},maxlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i<=r},rangelength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r[0]&&i<=r[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},email:function(e,t){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test((new Date(e)).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var n=0,r=0,i=!1;e=e.replace(/\D/g,"");for(var s=e.length-1;s>=0;s--){var o=e.charAt(s);r=parseInt(o,10),i&&(r*=2)>9&&(r-=9),n+=r,i=!i}return n%10===0},equalTo:function(t,n,r){var i=e(r);return this.settings.onfocusout&&i.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(n).valid()}),t===i.val()}}}),e.format=e.validator.format})(jQuery),function(e){var t={};if(e.ajaxPrefilter)e.ajaxPrefilter(function(e,n,r){var i=e.port;e.mode==="abort"&&(t[i]&&t[i].abort(),t[i]=r)});else{var n=e.ajax;e.ajax=function(r){var i=("mode"in r?r:e.ajaxSettings).mode,s=("port"in r?r:e.ajaxSettings).port;return i==="abort"?(t[s]&&t[s].abort(),t[s]=n.apply(this,arguments)):n.apply(this,arguments)}}}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,n,r){return this.bind(n,function(n){var i=e(n.target);if(i.is(t))return r.apply(i,arguments)})}})}(jQuery); \ No newline at end of file diff --git a/download/_js/select.js b/download/_js/select.js deleted file mode 100644 index 7ac3da94b..000000000 --- a/download/_js/select.js +++ /dev/null @@ -1,44 +0,0 @@ -$(function(){ - - var $selectForm = $('#selectForm') - var $radio = $selectForm.find('input[type="radio"]') - var $wildCard = $selectForm.find('input[type="radio"]#wildcard') - var $otherAmount = $selectForm.find('input#otra') - var $radioChecked = $selectForm.find('input[name="radioChecked"]') - var $submit = $selectForm.find('input[type="submit"]') - - if($('input[name=selectAmount]:checked').val() == 0) - $submit.val('Download') - - $radio.on('change', function(){ - $radioChecked.val(1) - if($(this).val()==0) - $submit.val('Download') - else - $submit.val('Donate & Download') - }) - - $otherAmount.on('change', function(){ - $wildCard.val($(this).val()) - }) - - $selectForm.on('submit',function(){ - - if($radioChecked.val() <= 0){ - $('.messages').html('Please select a donation amount') - return false - } - - if($('input[name=selectAmount]:checked').val() == 'other' && $('#otra').val() == ''){ - $('.messages').html('Please enter a donation amount') - return false - } - - if($('input[name=selectAmount]:checked').val() == 0){ - window.location = '/download/?processing' - return false - } - - }) - -}) \ No newline at end of file diff --git a/download/_paymentForm.php b/download/_paymentForm.php deleted file mode 100644 index d3f7808b2..000000000 --- a/download/_paymentForm.php +++ /dev/null @@ -1,62 +0,0 @@ -

    Download Processing. Please consider making a donation to the Processing Foundation before downloading the software.

    - - \ No newline at end of file diff --git a/download/_paypalProcessing.php b/download/_paypalProcessing.php deleted file mode 100644 index 4d0c08ea9..000000000 --- a/download/_paypalProcessing.php +++ /dev/null @@ -1,21 +0,0 @@ -doExpressCheckout($amount, 'Donation to the Processing Foundation')); - -//An error occured. The auxiliary information is in the $ret array - -echo 'Error:'; - -print_r($ret); - -?> \ No newline at end of file diff --git a/download/_ppEmailThanks.php b/download/_ppEmailThanks.php deleted file mode 100644 index d477f43d2..000000000 --- a/download/_ppEmailThanks.php +++ /dev/null @@ -1,74 +0,0 @@ -doPayment(); - -if ($final['ACK'] == 'Success') { - - $payment = $r->getCheckoutDetails($final['TOKEN']); - - //If payment from PayPal is successful, send out our thankyou email - $first_name = $payment['FIRSTNAME']; - $last_name = $payment['LASTNAME']; - $name = $first_name . ' ' . $last_name; - $email = $payment['EMAIL']; - $amount = $payment['CUSTOM']; - $amount = explode("|", $amount, 2); - $amount = $amount[0]; - $date = $payment['TIMESTAMP']; - $date = strtotime($date); - - // Build and send the email *using PHPMailer - $mail = new PHPMailer(); - - $mail->SMTPDebug = 0; //0 is no debug output, 3 is verbose - - $mail->IsSMTP(); - $mail->SMTPAuth = true; - $mail->SMTPSecure = 'tls'; - $mail->Port = 25; - $mail->Host = $mailConfig['host']; - $mail->Username = $mailConfig['user']; - $mail->Password = $mailConfig['pass']; - - $mail->From = 'foundation@processing.org'; - $mail->FromName = 'Processing Foundation'; - $mail->addAddress($email, $name); - $mail->addBCC('foundation@processing.org'); - - // Build message from PayPal values. Find and replace from config email - $message = str_replace('%name%', $name , $config['email-message']) . "\n\n"; - $message .= "Amount: $" . $amount . "
    \n"; - $message .= "Email: " . $email . "
    \n"; - $message .= "Date: " . date('M j, Y', $date) . "

    \n"; - $message .= "Best regards, and thanks again,
    Ben Fry, Casey Reas, and Dan Shiffman"; - - $mail->isHTML(true); - $mail->Subject = $config['email-subject']; - $mail->Body = $message; - - $mail->Send(); - - $log = __DIR__ . '/../../../cred/purchases.log'; - $cleanDate = date('Y-m-d', $date); - $data = $cleanDate."\t".$amount."\t".'paypal'."\t".$name."\t".$email."\t".get_client_ip()."\n"; - file_put_contents($log, $data, FILE_APPEND | LOCK_EX); - - -} - -?> \ No newline at end of file diff --git a/download/_selectForm.php b/download/_selectForm.php deleted file mode 100644 index a3ac30aff..000000000 --- a/download/_selectForm.php +++ /dev/null @@ -1,35 +0,0 @@ -

    Download Processing. Please consider making a donation to the Processing Foundation before downloading the software.

    - - - - \ No newline at end of file diff --git a/download/_stripeProcessing.php b/download/_stripeProcessing.php deleted file mode 100644 index 67dc7876d..000000000 --- a/download/_stripeProcessing.php +++ /dev/null @@ -1,97 +0,0 @@ - $token, - 'description' => 'Donation by ' . $name . ' (' . $email . ')', - 'amount' => $amount * 100, - 'currency' => 'usd') - ); - - // Build and send the email *using PHPMailer - $mail = new PHPMailer(); - - $mail->SMTPDebug = 0; //0 is no debug output, 3 is verbose - - $mail->IsSMTP(); - $mail->SMTPAuth = true; - $mail->SMTPSecure = 'tls'; - $mail->Port = 25; - $mail->Host = $mailConfig['host']; - $mail->Username = $mailConfig['user']; - $mail->Password = $mailConfig['pass']; - - $mail->From = 'foundation@processing.org'; - $mail->FromName = 'Processing Foundation'; - $mail->addAddress($email, $name); - $mail->addBCC('foundation@processing.org'); - - // Build message from Stripe values. Find and replace from config email - $message = str_replace('%name%', $name , $config['email-message']) . "\n\n"; - $message .= "Amount: $" . $amount . "
    \n"; - $message .= "Email: " . $email . "
    \n"; - $message .= "Date: " . date('M j, Y', $donation['created']) . "
    \n"; - $message .= "Transaction ID: " . $donation['id'] . "

    \n\n\n"; - $message .= "Best regards, and thanks again,
    Ben Fry, Casey Reas, and Dan Shiffman"; - - $mail->isHTML(true); - $mail->Subject = $config['email-subject']; - $mail->Body = $message; - - $mail->Send(); - - $log = __DIR__ . '/../../../cred/purchases.log'; - $cleanDate = date('Y-m-d', $donation['created']); - $data = $cleanDate."\t".$amount."\t".'stripe'."\t".$name."\t".$email."\t".get_client_ip()."\n"; - file_put_contents($log, $data, FILE_APPEND | LOCK_EX); - - - // Forward to "Downloads" page - header('Location: ' . $config['download']); - exit; - - } - catch (Stripe_Error $e) { - $showPaymentForm = true; - $dinky = $e->getJsonBody(); - $dinky = $dinky['error']['message']; - } - catch (Exception $e) { - $error = $e->getMessage(); - } -} - -?> \ No newline at end of file diff --git a/download/index.php b/download/index.php deleted file mode 100755 index e0fbc9b47..000000000 --- a/download/index.php +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - Download \ Processing.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - -
    - - - - - - - - - -
    - - - - -
    - - - diff --git a/download/install-arm.sh b/download/install-arm.sh old mode 100644 new mode 100755 index 4aa157250..b70361d77 --- a/download/install-arm.sh +++ b/download/install-arm.sh @@ -3,15 +3,19 @@ # This script installs the latest version of Processing for ARM into /usr/local/lib # Run it like this: "curl https://processing.org/download/install-arm.sh | sudo sh" -# this assumes that newer releases are at the top -TAR="$(curl -sL https://api.github.com/repos/processing/processing/releases | grep -oh -m 1 'https.*linux-armv6hf.tgz')" +# check if on a 64-bit operating system +case "$(file $(which file))" in + *aarch64*) FLAVOR="arm64"; TAR="$(curl -sL https://api.github.com/repos/processing/processing/releases | grep -oh -m 1 'https.*linux-arm64.tgz')" ;; + *) FLAVOR="armv6hf"; TAR="$(curl -sL https://api.github.com/repos/processing/processing/releases | grep -oh -m 1 'https.*linux-armv6hf.tgz')" ;; +esac -echo "\nDownloading $TAR..." -curl -L $TAR > processing-linux-armv6hf-latest.tgz +echo "" +echo "Downloading $TAR..." +curl -L $TAR > processing-linux-$FLAVOR-latest.tgz echo "Installing in /usr/local..." -tar fx processing-linux-armv6hf-latest.tgz -C /usr/local/lib -rm -f processing-linux-armv6hf-latest.tgz +tar fx processing-linux-$FLAVOR-latest.tgz -C /usr/local/lib +rm -f processing-linux-$FLAVOR-latest.tgz # this returns the highest version installed VER="$(basename $(ls -dvr /usr/local/lib/processing-* | head -1))" @@ -33,4 +37,5 @@ sed -i 's|/opt/processing|/usr/local/lib/processing|' /usr/local/share/applicati # silence validation errors desktop-file-install /usr/local/share/applications/processing.desktop >/dev/null 2>&1 -echo "Done! You can start Processing by running \"processing\" in the terminal, or through the applications menu (might require a restart).\n" +echo "Done! You can start Processing by running processing in the terminal, or through the applications menu (might require a restart)." +echo "" diff --git a/download/latest.txt b/download/latest.txt index 96f0815f8..98de25a15 100644 --- a/download/latest.txt +++ b/download/latest.txt @@ -1,2 +1,2 @@ -0257 +1276 diff --git a/download/paypal/httprequest.php b/download/paypal/httprequest.php deleted file mode 100755 index d4ebaa45a..000000000 --- a/download/paypal/httprequest.php +++ /dev/null @@ -1,131 +0,0 @@ -host = $host; - $this->rawhost = $ssl ? ("ssl://".$host) : $host; - $this->path = $path; - $this->method = strtoupper($method); - if ($port) { - $this->port = $port; - } else { - if (!$ssl) $this->port = 80; else $this->port = 443; - } - } - - public function connect( $data = ''){ - $fp = fsockopen($this->rawhost, $this->port); - if (!$fp) return false; - fputs($fp, "$this->method $this->path HTTP/1.1\r\n"); - fputs($fp, "Host: $this->host\r\n"); - //fputs($fp, "Content-type: $contenttype\r\n"); - fputs($fp, "Content-length: ".strlen($data)."\r\n"); - fputs($fp, "Connection: close\r\n"); - fputs($fp, "\r\n"); - fputs($fp, $data); - - $responseHeader = ''; - $responseContent = ''; - - do - { - $responseHeader.= fread($fp, 1); - } - while (!preg_match('/\\r\\n\\r\\n$/', $responseHeader)); - - - if (!strstr($responseHeader, "Transfer-Encoding: chunked")) - { - while (!feof($fp)) - { - $responseContent.= fgets($fp, 128); - } - } - else - { - - while ($chunk_length = hexdec(fgets($fp))) - { - $responseContentChunk = ''; - - $read_length = 0; - - while ($read_length < $chunk_length) - { - $responseContentChunk .= fread($fp, $chunk_length - $read_length); - $read_length = strlen($responseContentChunk); - } - - $responseContent.= $responseContentChunk; - - fgets($fp); - - } - - } - - $this->header = chop($responseHeader); - $this->content = $responseContent; - $this->parsedHeader = $this->headerParse(); - - $code = intval(trim(substr($this->parsedHeader[0], 9))); - - return $code; - } - - function headerParse(){ - $h = $this->header; - $a=explode("\r\n", $h); - $out = array(); - foreach ($a as $v){ - $k = strpos($v, ':'); - if ($k) { - $key = trim(substr($v,0,$k)); - $value = trim(substr($v,$k+1)); - if (!$key) continue; - $out[$key] = $value; - } else - { - if ($v) $out[] = $v; - } - } - return $out; - } - - public function getContent() {return $this->content;} - public function getHeader() {return $this->parsedHeader;} - - -} - - -?> \ No newline at end of file diff --git a/download/paypal/paypal.php b/download/paypal/paypal.php deleted file mode 100755 index 3749018ba..000000000 --- a/download/paypal/paypal.php +++ /dev/null @@ -1,194 +0,0 @@ - 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 MARTIN MALY ''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 MARTIN MALY 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. -*/ - -class PayPal { - - //these constants you have to obtain from PayPal - //Step-by-step manual is here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_NVPAPIBasics - - private $endpoint; - private $host; - private $gate; - - function __construct($real = false) { - $this->endpoint = '/nvp'; - if ($real) { - $this->host = "api-3t.paypal.com"; - $this->gate = 'https://www.paypal.com/cgi-bin/webscr?'; - } else { - //sandbox - $this->host = "api-3t.sandbox.paypal.com"; - $this->gate = 'https://www.sandbox.paypal.com/cgi-bin/webscr?'; - } - } - - /** - * @return HTTPRequest - */ - private function response($data){ - $r = new HTTPRequest($this->host, $this->endpoint, 'POST', true); - $result = $r->connect($data); - if ($result<400) return $r; - return false; - } - - private function buildQuery($data = array()){ - $data['USER'] = API_USERNAME; - $data['PWD'] = API_PASSWORD; - $data['SIGNATURE'] = API_SIGNATURE; - $data['VERSION'] = '52.0'; - $query = http_build_query($data); - return $query; - } - - - /** - * Main payment function - * - * If OK, the customer is redirected to PayPal gateway - * If error, the error info is returned - * - * @param float $amount Amount (2 numbers after decimal point) - * @param string $desc Item description - * @param string $invoice Invoice number (can be omitted) - * @param string $currency 3-letter currency code (USD, GBP, CZK etc.) - * - * @return array error info - */ - public function doExpressCheckout($amount, $desc, $invoice='', $currency='USD'){ - $data = array( - 'PAYMENTACTION' =>'Sale', - 'AMT' =>$amount, - 'RETURNURL' => PP_RETURN, - 'CANCELURL' => PP_CANCEL, - 'DESC'=>$desc, - 'NOSHIPPING'=>"1", - 'ALLOWNOTE'=>"1", - 'CURRENCYCODE'=>$currency, - 'METHOD' =>'SetExpressCheckout'); - - $data['CUSTOM'] = $amount.'|'.$currency.'|'.$invoice; - if ($invoice) $data['INVNUM'] = $invoice; - - $query = $this->buildQuery($data); - - $result = $this->response($query); - - if (!$result) return false; - $response = $result->getContent(); - $return = $this->responseParse($response); - - if ($return['ACK'] == 'Success') { - header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].''); - die(); - } - return($return); - } - - public function getCheckoutDetails($token){ - $data = array( - 'TOKEN' => $token, - 'METHOD' =>'GetExpressCheckoutDetails'); - $query = $this->buildQuery($data); - - $result = $this->response($query); - - if (!$result) return false; - $response = $result->getContent(); - $return = $this->responseParse($response); - return($return); - } - public function doPayment(){ - $token = $_GET['token']; - $payer = $_GET['PayerID']; - $details = $this->getCheckoutDetails($token); - if (!$details) return false; - list($amount,$currency,$invoice) = explode('|',$details['CUSTOM']); - $data = array( - 'PAYMENTACTION' => 'Sale', - 'PAYERID' => $payer, - 'TOKEN' =>$token, - 'AMT' => $amount, - 'CURRENCYCODE'=>$currency, - 'METHOD' =>'DoExpressCheckoutPayment'); - $query = $this->buildQuery($data); - - $result = $this->response($query); - - if (!$result) return false; - $response = $result->getContent(); - $return = $this->responseParse($response); - - /* - * [AMT] => 10.00 - * [CURRENCYCODE] => USD - * [PAYMENTSTATUS] => Completed - * [PENDINGREASON] => None - * [REASONCODE] => None - */ - - return($return); - } - - private function getScheme() { - $scheme = 'http'; - if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { - $scheme .= 's'; - } - return $scheme; - } - - private function responseParse($resp){ - $a=explode("&", $resp); - $out = array(); - foreach ($a as $v){ - $k = strpos($v, '='); - if ($k) { - $key = trim(substr($v,0,$k)); - $value = trim(substr($v,$k+1)); - if (!$key) continue; - $out[$key] = urldecode($value); - } else { - $out[] = $v; - } - } - return $out; - } -} - -?> \ No newline at end of file diff --git a/download/phpmailer/class.phpmailer.php b/download/phpmailer/class.phpmailer.php deleted file mode 100755 index 2be4b8e90..000000000 --- a/download/phpmailer/class.phpmailer.php +++ /dev/null @@ -1,2780 +0,0 @@ -UseSendmailOptions) ) { - $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); - } else { - $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); - } - return $rt; - } - - /** - * Outputs debugging info via user-defined method - * @param string $str - */ - private function edebug($str) { - if ($this->Debugoutput == "error_log") { - error_log($str); - } else { - echo $str; - } - } - - /** - * Constructor - * @param boolean $exceptions Should we throw external exceptions? - */ - public function __construct($exceptions = false) { - $this->exceptions = ($exceptions == true); - } - - /** - * Sets message type to HTML. - * @param bool $ishtml - * @return void - */ - public function IsHTML($ishtml = true) { - if ($ishtml) { - $this->ContentType = 'text/html'; - } else { - $this->ContentType = 'text/plain'; - } - } - - /** - * Sets Mailer to send message using SMTP. - * @return void - */ - public function IsSMTP() { - $this->Mailer = 'smtp'; - } - - /** - * Sets Mailer to send message using PHP mail() function. - * @return void - */ - public function IsMail() { - $this->Mailer = 'mail'; - } - - /** - * Sets Mailer to send message using the $Sendmail program. - * @return void - */ - public function IsSendmail() { - if (!stristr(ini_get('sendmail_path'), 'sendmail')) { - $this->Sendmail = '/var/qmail/bin/sendmail'; - } - $this->Mailer = 'sendmail'; - } - - /** - * Sets Mailer to send message using the qmail MTA. - * @return void - */ - public function IsQmail() { - if (stristr(ini_get('sendmail_path'), 'qmail')) { - $this->Sendmail = '/var/qmail/bin/sendmail'; - } - $this->Mailer = 'sendmail'; - } - - ///////////////////////////////////////////////// - // METHODS, RECIPIENTS - ///////////////////////////////////////////////// - - /** - * Adds a "To" address. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddAddress($address, $name = '') { - return $this->AddAnAddress('to', $address, $name); - } - - /** - * Adds a "Cc" address. - * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddCC($address, $name = '') { - return $this->AddAnAddress('cc', $address, $name); - } - - /** - * Adds a "Bcc" address. - * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddBCC($address, $name = '') { - return $this->AddAnAddress('bcc', $address, $name); - } - - /** - * Adds a "Reply-to" address. - * @param string $address - * @param string $name - * @return boolean - */ - public function AddReplyTo($address, $name = '') { - return $this->AddAnAddress('Reply-To', $address, $name); - } - - /** - * Adds an address to one of the recipient arrays - * Addresses that have been added already return false, but do not throw exceptions - * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' - * @param string $address The email address to send to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function AddAnAddress($kind, $address, $name = '') { - if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { - $this->SetError($this->Lang('Invalid recipient array').': '.$kind); - if ($this->exceptions) { - throw new phpmailerException('Invalid recipient array: ' . $kind); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('Invalid recipient array').': '.$kind); - } - return false; - } - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->ValidateAddress($address)) { - $this->SetError($this->Lang('invalid_address').': '. $address); - if ($this->exceptions) { - throw new phpmailerException($this->Lang('invalid_address').': '.$address); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('invalid_address').': '.$address); - } - return false; - } - if ($kind != 'Reply-To') { - if (!isset($this->all_recipients[strtolower($address)])) { - array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; - return true; - } - } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); - return true; - } - } - return false; -} - - /** - * Set the From and FromName properties - * @param string $address - * @param string $name - * @param int $auto Also set Reply-To and Sender - * @throws phpmailerException - * @return boolean - */ - public function SetFrom($address, $name = '', $auto = 1) { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->ValidateAddress($address)) { - $this->SetError($this->Lang('invalid_address').': '. $address); - if ($this->exceptions) { - throw new phpmailerException($this->Lang('invalid_address').': '.$address); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('invalid_address').': '.$address); - } - return false; - } - $this->From = $address; - $this->FromName = $name; - if ($auto) { - if (empty($this->ReplyTo)) { - $this->AddAnAddress('Reply-To', $address, $name); - } - if (empty($this->Sender)) { - $this->Sender = $address; - } - } - return true; - } - - /** - * Check that a string looks roughly like an email address should - * Static so it can be used without instantiation, public so people can overload - * Conforms to RFC5322: Uses *correct* regex on which FILTER_VALIDATE_EMAIL is - * based; So why not use FILTER_VALIDATE_EMAIL? Because it was broken to - * not allow a@b type valid addresses :( - * @link http://squiloople.com/2009/12/20/email-address-validation/ - * @copyright regex Copyright Michael Rushton 2009-10 | http://squiloople.com/ | Feel free to use and redistribute this code. But please keep this copyright notice. - * @param string $address The email address to check - * @return boolean - * @static - * @access public - */ - public static function ValidateAddress($address) { - if (defined('PCRE_VERSION')) { //Check this instead of extension_loaded so it works when that function is disabled - if (version_compare(PCRE_VERSION, '8.0') >= 0) { - return (boolean)preg_match('/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address); - } else { - //Fall back to an older regex that doesn't need a recent PCRE - return (boolean)preg_match('/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', $address); - } - } else { - //No PCRE! Do something _very_ approximate! - //Check the address is 3 chars or longer and contains an @ that's not the first or last char - return (strlen($address) >= 3 and strpos($address, '@') >= 1 and strpos($address, '@') != strlen($address) - 1); - } - } - - ///////////////////////////////////////////////// - // METHODS, MAIL SENDING - ///////////////////////////////////////////////// - - /** - * Creates message and assigns Mailer. If the message is - * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. - * @throws phpmailerException - * @return bool - */ - public function Send() { - try { - if(!$this->PreSend()) return false; - return $this->PostSend(); - } catch (phpmailerException $e) { - $this->mailHeader = ''; - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - return false; - } - } - - /** - * Prep mail by constructing all message entities - * @throws phpmailerException - * @return bool - */ - public function PreSend() { - try { - $this->mailHeader = ""; - if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { - throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); - } - - // Set whether the message is multipart/alternative - if(!empty($this->AltBody)) { - $this->ContentType = 'multipart/alternative'; - } - - $this->error_count = 0; // reset errors - $this->SetMessageType(); - //Refuse to send an empty message - if (empty($this->Body)) { - throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); - } - - $this->MIMEHeader = $this->CreateHeader(); - $this->MIMEBody = $this->CreateBody(); - - // To capture the complete message when using mail(), create - // an extra header list which CreateHeader() doesn't fold in - if ($this->Mailer == 'mail') { - if (count($this->to) > 0) { - $this->mailHeader .= $this->AddrAppend("To", $this->to); - } else { - $this->mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;"); - } - $this->mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject)))); - } - - // digitally sign with DKIM if enabled - if (!empty($this->DKIM_domain) && !empty($this->DKIM_private) && !empty($this->DKIM_selector) && !empty($this->DKIM_domain) && file_exists($this->DKIM_private)) { - $header_dkim = $this->DKIM_Add($this->MIMEHeader, $this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody); - $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader; - } - - return true; - - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - return false; - } - } - - /** - * Actual Email transport function - * Send the email via the selected mechanism - * @throws phpmailerException - * @return bool - */ - public function PostSend() { - try { - // Choose the mailer and send through it - switch($this->Mailer) { - case 'sendmail': - return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody); - case 'smtp': - return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody); - case 'mail': - return $this->MailSend($this->MIMEHeader, $this->MIMEBody); - default: - return $this->MailSend($this->MIMEHeader, $this->MIMEBody); - } - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - if ($this->SMTPDebug) { - $this->edebug($e->getMessage()."\n"); - } - } - return false; - } - - /** - * Sends mail using the $Sendmail program. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @access protected - * @return bool - */ - protected function SendmailSend($header, $body) { - if ($this->Sender != '') { - $sendmail = sprintf("%s -oi -f%s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } else { - $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); - } - if ($this->SingleTo === true) { - foreach ($this->SingleToArray as $val) { - if(!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, "To: " . $val . "\n"); - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - // implement call back function if it exists - $isSent = ($result == 0) ? 1 : 0; - $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); - if($result != 0) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - } else { - if(!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - // implement call back function if it exists - $isSent = ($result == 0) ? 1 : 0; - $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body); - if($result != 0) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - return true; - } - - /** - * Sends mail using the PHP mail() function. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @access protected - * @return bool - */ - protected function MailSend($header, $body) { - $toArr = array(); - foreach($this->to as $t) { - $toArr[] = $this->AddrFormat($t); - } - $to = implode(', ', $toArr); - - if (empty($this->Sender)) { - $params = "-oi "; - } else { - $params = sprintf("-oi -f%s", $this->Sender); - } - if ($this->Sender != '' and !ini_get('safe_mode')) { - $old_from = ini_get('sendmail_from'); - ini_set('sendmail_from', $this->Sender); - } - $rt = false; - if ($this->SingleTo === true && count($toArr) > 1) { - foreach ($toArr as $val) { - $rt = $this->mail_passthru($val, $this->Subject, $body, $header, $params); - // implement call back function if it exists - $isSent = ($rt == 1) ? 1 : 0; - $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); - } - } else { - $rt = $this->mail_passthru($to, $this->Subject, $body, $header, $params); - // implement call back function if it exists - $isSent = ($rt == 1) ? 1 : 0; - $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); - } - if (isset($old_from)) { - ini_set('sendmail_from', $old_from); - } - if(!$rt) { - throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); - } - return true; - } - - /** - * Sends mail via SMTP using PhpSMTP - * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @uses SMTP - * @access protected - * @return bool - */ - protected function SmtpSend($header, $body) { - require_once $this->PluginDir . 'class.smtp.php'; - $bad_rcpt = array(); - - if(!$this->SmtpConnect()) { - throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL); - } - $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; - if(!$this->smtp->Mail($smtp_from)) { - $this->SetError($this->Lang('from_failed') . $smtp_from . ' : ' .implode(',', $this->smtp->getError())); - throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); - } - - // Attempt to send attach all recipients - foreach($this->to as $to) { - if (!$this->smtp->Recipient($to[0])) { - $bad_rcpt[] = $to[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); - } - } - foreach($this->cc as $cc) { - if (!$this->smtp->Recipient($cc[0])) { - $bad_rcpt[] = $cc[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); - } - } - foreach($this->bcc as $bcc) { - if (!$this->smtp->Recipient($bcc[0])) { - $bad_rcpt[] = $bcc[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); - } - } - - - if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses - $badaddresses = implode(', ', $bad_rcpt); - throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); - } - if(!$this->smtp->Data($header . $body)) { - throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); - } - if($this->SMTPKeepAlive == true) { - $this->smtp->Reset(); - } else { - $this->smtp->Quit(); - $this->smtp->Close(); - } - return true; - } - - /** - * Initiates a connection to an SMTP server. - * Returns false if the operation failed. - * @uses SMTP - * @access public - * @throws phpmailerException - * @return bool - */ - public function SmtpConnect() { - if(is_null($this->smtp)) { - $this->smtp = new SMTP; - } - - $this->smtp->Timeout = $this->Timeout; - $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(';', $this->Host); - $index = 0; - $connection = $this->smtp->Connected(); - - // Retry while there is no connection - try { - while($index < count($hosts) && !$connection) { - $hostinfo = array(); - if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { - $host = $hostinfo[1]; - $port = $hostinfo[2]; - } else { - $host = $hosts[$index]; - $port = $this->Port; - } - - $tls = ($this->SMTPSecure == 'tls'); - $ssl = ($this->SMTPSecure == 'ssl'); - - if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { - - $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); - $this->smtp->Hello($hello); - - if ($tls) { - if (!$this->smtp->StartTLS()) { - throw new phpmailerException($this->Lang('connect_host')); - } - - //We must resend HELO after tls negotiation - $this->smtp->Hello($hello); - } - - $connection = true; - if ($this->SMTPAuth) { - if (!$this->smtp->Authenticate($this->Username, $this->Password, $this->AuthType, $this->Realm, $this->Workstation)) { - throw new phpmailerException($this->Lang('authenticate')); - } - } - } - $index++; - if (!$connection) { - throw new phpmailerException($this->Lang('connect_host')); - } - } - } catch (phpmailerException $e) { - $this->smtp->Reset(); - if ($this->exceptions) { - throw $e; - } - } - return true; - } - - /** - * Closes the active SMTP session if one exists. - * @return void - */ - public function SmtpClose() { - if ($this->smtp !== null) { - if($this->smtp->Connected()) { - $this->smtp->Quit(); - $this->smtp->Close(); - } - } - } - - /** - * Sets the language for all class error messages. - * Returns false if it cannot load the language file. The default language is English. - * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") - * @param string $lang_path Path to the language file directory - * @return bool - * @access public - */ - function SetLanguage($langcode = 'en', $lang_path = 'language/') { - //Define full set of translatable strings - $PHPMAILER_LANG = array( - 'authenticate' => 'SMTP Error: Could not authenticate.', - 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', - 'data_not_accepted' => 'SMTP Error: Data not accepted.', - 'empty_message' => 'Message body empty', - 'encoding' => 'Unknown encoding: ', - 'execute' => 'Could not execute: ', - 'file_access' => 'Could not access file: ', - 'file_open' => 'File Error: Could not open file: ', - 'from_failed' => 'The following From address failed: ', - 'instantiate' => 'Could not instantiate mail function.', - 'invalid_address' => 'Invalid address', - 'mailer_not_supported' => ' mailer is not supported.', - 'provide_address' => 'You must provide at least one recipient email address.', - 'recipients_failed' => 'SMTP Error: The following recipients failed: ', - 'signing' => 'Signing Error: ', - 'smtp_connect_failed' => 'SMTP Connect() failed.', - 'smtp_error' => 'SMTP server error: ', - 'variable_set' => 'Cannot set or reset variable: ' - ); - //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! - $l = true; - if ($langcode != 'en') { //There is no English translation file - $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; - } - $this->language = $PHPMAILER_LANG; - return ($l == true); //Returns false if language not found - } - - /** - * Return the current array of language strings - * @return array - */ - public function GetTranslations() { - return $this->language; - } - - ///////////////////////////////////////////////// - // METHODS, MESSAGE CREATION - ///////////////////////////////////////////////// - - /** - * Creates recipient headers. - * @access public - * @param string $type - * @param array $addr - * @return string - */ - public function AddrAppend($type, $addr) { - $addr_str = $type . ': '; - $addresses = array(); - foreach ($addr as $a) { - $addresses[] = $this->AddrFormat($a); - } - $addr_str .= implode(', ', $addresses); - $addr_str .= $this->LE; - - return $addr_str; - } - - /** - * Formats an address correctly. - * @access public - * @param string $addr - * @return string - */ - public function AddrFormat($addr) { - if (empty($addr[1])) { - return $this->SecureHeader($addr[0]); - } else { - return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; - } - } - - /** - * Wraps message for use with mailers that do not - * automatically perform wrapping and for quoted-printable. - * Original written by philippe. - * @param string $message The message to wrap - * @param integer $length The line length to wrap to - * @param boolean $qp_mode Whether to run in Quoted-Printable mode - * @access public - * @return string - */ - public function WrapText($message, $length, $qp_mode = false) { - $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; - // If utf-8 encoding is used, we will need to make sure we don't - // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == "utf-8"); - $lelen = strlen($this->LE); - $crlflen = strlen(self::CRLF); - - $message = $this->FixEOL($message); - if (substr($message, -$lelen) == $this->LE) { - $message = substr($message, 0, -$lelen); - } - - $line = explode($this->LE, $message); // Magic. We know FixEOL uses $LE - $message = ''; - for ($i = 0 ;$i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); - $buf = ''; - for ($e = 0; $e $length)) { - $space_left = $length - strlen($buf) - $crlflen; - if ($e != 0) { - if ($space_left > 20) { - $len = $space_left; - if ($is_utf8) { - $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { - $len--; - } elseif (substr($word, $len - 2, 1) == "=") { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= ' ' . $part; - $message .= $buf . sprintf("=%s", self::CRLF); - } else { - $message .= $buf . $soft_break; - } - $buf = ''; - } - while (strlen($word) > 0) { - if ($length <= 0) { - break; - } - $len = $length; - if ($is_utf8) { - $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { - $len--; - } elseif (substr($word, $len - 2, 1) == "=") { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) { - $message .= $part . sprintf("=%s", self::CRLF); - } else { - $buf = $part; - } - } - } else { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (' ' . $word); - - if (strlen($buf) > $length and $buf_o != '') { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . self::CRLF; - } - - return $message; - } - - /** - * Finds last character boundary prior to maxLength in a utf-8 - * quoted (printable) encoded string. - * Original written by Colin Brown. - * @access public - * @param string $encodedText utf-8 QP text - * @param int $maxLength find last character boundary prior to this length - * @return int - */ - public function UTF8CharBoundary($encodedText, $maxLength) { - $foundSplitPos = false; - $lookBack = 3; - while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, "="); - if ($encodedCharPos !== false) { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) { // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - $maxLength = ($encodedCharPos == 0) ? $maxLength : - $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec >= 192) { // First byte of a multi byte character - // Reduce maxLength to split at start of character - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } else { - // No encoded character found - $foundSplitPos = true; - } - } - return $maxLength; - } - - - /** - * Set the body wrapping. - * @access public - * @return void - */ - public function SetWordWrap() { - if($this->WordWrap < 1) { - return; - } - - switch($this->message_type) { - case 'alt': - case 'alt_inline': - case 'alt_attach': - case 'alt_inline_attach': - $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->WrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assembles message header. - * @access public - * @return string The assembled header - */ - public function CreateHeader() { - $result = ''; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = 'b1_' . $uniq_id; - $this->boundary[2] = 'b2_' . $uniq_id; - $this->boundary[3] = 'b3_' . $uniq_id; - - if ($this->MessageDate == '') { - $result .= $this->HeaderLine('Date', self::RFCDate()); - } else { - $result .= $this->HeaderLine('Date', $this->MessageDate); - } - - if ($this->ReturnPath) { - $result .= $this->HeaderLine('Return-Path', trim($this->ReturnPath)); - } elseif ($this->Sender == '') { - $result .= $this->HeaderLine('Return-Path', trim($this->From)); - } else { - $result .= $this->HeaderLine('Return-Path', trim($this->Sender)); - } - - // To be created automatically by mail() - if($this->Mailer != 'mail') { - if ($this->SingleTo === true) { - foreach($this->to as $t) { - $this->SingleToArray[] = $this->AddrFormat($t); - } - } else { - if(count($this->to) > 0) { - $result .= $this->AddrAppend('To', $this->to); - } elseif (count($this->cc) == 0) { - $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); - } - } - } - - $from = array(); - $from[0][0] = trim($this->From); - $from[0][1] = $this->FromName; - $result .= $this->AddrAppend('From', $from); - - // sendmail and mail() extract Cc from the header before sending - if(count($this->cc) > 0) { - $result .= $this->AddrAppend('Cc', $this->cc); - } - - // sendmail and mail() extract Bcc from the header before sending - if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { - $result .= $this->AddrAppend('Bcc', $this->bcc); - } - - if(count($this->ReplyTo) > 0) { - $result .= $this->AddrAppend('Reply-To', $this->ReplyTo); - } - - // mail() sets the subject itself - if($this->Mailer != 'mail') { - $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); - } - - if($this->MessageID != '') { - $result .= $this->HeaderLine('Message-ID', $this->MessageID); - } else { - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); - } - $result .= $this->HeaderLine('X-Priority', $this->Priority); - if ($this->XMailer == '') { - $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (http://code.google.com/a/apache-extras.org/p/phpmailer/)'); - } else { - $myXmailer = trim($this->XMailer); - if ($myXmailer) { - $result .= $this->HeaderLine('X-Mailer', $myXmailer); - } - } - - if($this->ConfirmReadingTo != '') { - $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); - } - - // Add custom headers - for($index = 0; $index < count($this->CustomHeader); $index++) { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); - } - if (!$this->sign_key_file) { - $result .= $this->HeaderLine('MIME-Version', '1.0'); - $result .= $this->GetMailMIME(); - } - - return $result; - } - - /** - * Returns the message MIME. - * @access public - * @return string - */ - public function GetMailMIME() { - $result = ''; - switch($this->message_type) { - case 'inline': - $result .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'attach': - case 'inline_attach': - case 'alt_attach': - case 'alt_inline_attach': - $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'alt': - case 'alt_inline': - $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - default: - // Catches case 'plain': and case '': - $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding); - $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet); - break; - } - - if($this->Mailer != 'mail') { - $result .= $this->LE; - } - - return $result; - } - - /** - * Returns the MIME message (headers and body). Only really valid post PreSend(). - * @access public - * @return string - */ - public function GetSentMIMEMessage() { - return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; - } - - - /** - * Assembles the message body. Returns an empty string on failure. - * @access public - * @throws phpmailerException - * @return string The assembled message body - */ - public function CreateBody() { - $body = ''; - - if ($this->sign_key_file) { - $body .= $this->GetMailMIME().$this->LE; - } - - $this->SetWordWrap(); - - switch($this->message_type) { - case 'inline': - $body .= $this->GetBoundary($this->boundary[1], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[1]); - break; - case 'attach': - $body .= $this->GetBoundary($this->boundary[1], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'inline_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'alt': - $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->EndBoundary($this->boundary[1]); - break; - case 'alt_inline': - $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->EndBoundary($this->boundary[1]); - break; - case 'alt_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->EndBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'alt_inline_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->TextLine('--' . $this->boundary[2]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[3]); - $body .= $this->LE; - $body .= $this->EndBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - default: - // catch case 'plain' and case '' - $body .= $this->EncodeString($this->Body, $this->Encoding); - break; - } - - if ($this->IsError()) { - $body = ''; - } elseif ($this->sign_key_file) { - try { - if (!defined('PKCS7_TEXT')) { - throw new phpmailerException($this->Lang('signing').' OpenSSL extension missing.'); - } - $file = tempnam(sys_get_temp_dir(), 'mail'); - file_put_contents($file, $body); //TODO check this worked - $signed = tempnam(sys_get_temp_dir(), 'signed'); - if (@openssl_pkcs7_sign($file, $signed, 'file://'.realpath($this->sign_cert_file), array('file://'.realpath($this->sign_key_file), $this->sign_key_pass), null)) { - @unlink($file); - $body = file_get_contents($signed); - @unlink($signed); - } else { - @unlink($file); - @unlink($signed); - throw new phpmailerException($this->Lang('signing').openssl_error_string()); - } - } catch (phpmailerException $e) { - $body = ''; - if ($this->exceptions) { - throw $e; - } - } - } - return $body; - } - - /** - * Returns the start of a message boundary. - * @access protected - * @param string $boundary - * @param string $charSet - * @param string $contentType - * @param string $encoding - * @return string - */ - protected function GetBoundary($boundary, $charSet, $contentType, $encoding) { - $result = ''; - if($charSet == '') { - $charSet = $this->CharSet; - } - if($contentType == '') { - $contentType = $this->ContentType; - } - if($encoding == '') { - $encoding = $this->Encoding; - } - $result .= $this->TextLine('--' . $boundary); - $result .= sprintf("Content-Type: %s; charset=%s", $contentType, $charSet); - $result .= $this->LE; - $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding); - $result .= $this->LE; - - return $result; - } - - /** - * Returns the end of a message boundary. - * @access protected - * @param string $boundary - * @return string - */ - protected function EndBoundary($boundary) { - return $this->LE . '--' . $boundary . '--' . $this->LE; - } - - /** - * Sets the message type. - * @access protected - * @return void - */ - protected function SetMessageType() { - $this->message_type = array(); - if($this->AlternativeExists()) $this->message_type[] = "alt"; - if($this->InlineImageExists()) $this->message_type[] = "inline"; - if($this->AttachmentExists()) $this->message_type[] = "attach"; - $this->message_type = implode("_", $this->message_type); - if($this->message_type == "") $this->message_type = "plain"; - } - - /** - * Returns a formatted header line. - * @access public - * @param string $name - * @param string $value - * @return string - */ - public function HeaderLine($name, $value) { - return $name . ': ' . $value . $this->LE; - } - - /** - * Returns a formatted mail line. - * @access public - * @param string $value - * @return string - */ - public function TextLine($value) { - return $value . $this->LE; - } - - ///////////////////////////////////////////////// - // CLASS METHODS, ATTACHMENTS - ///////////////////////////////////////////////// - - /** - * Adds an attachment from a path on the filesystem. - * Returns false if the file could not be found - * or accessed. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @throws phpmailerException - * @return bool - */ - public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - try { - if ( !@is_file($path) ) { - throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE); - } - $filename = basename($path); - if ( $name == '' ) { - $name = $filename; - } - - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => 'attachment', - 7 => 0 - ); - - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - if ($this->SMTPDebug) { - $this->edebug($e->getMessage()."\n"); - } - if ( $e->getCode() == self::STOP_CRITICAL ) { - return false; - } - } - return true; - } - - /** - * Return the current array of attachments - * @return array - */ - public function GetAttachments() { - return $this->attachment; - } - - /** - * Attaches all fs, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access protected - * @param string $disposition_type - * @param string $boundary - * @return string - */ - protected function AttachAll($disposition_type, $boundary) { - // Return text of body - $mime = array(); - $cidUniq = array(); - $incl = array(); - - // Add all attachments - foreach ($this->attachment as $attachment) { - // CHECK IF IT IS A VALID DISPOSITION_FILTER - if($attachment[6] == $disposition_type) { - // Check for string attachment - $string = ''; - $path = ''; - $bString = $attachment[5]; - if ($bString) { - $string = $attachment[0]; - } else { - $path = $attachment[0]; - } - - $inclhash = md5(serialize($attachment)); - if (in_array($inclhash, $incl)) { continue; } - $incl[] = $inclhash; - $filename = $attachment[1]; - $name = $attachment[2]; - $encoding = $attachment[3]; - $type = $attachment[4]; - $disposition = $attachment[6]; - $cid = $attachment[7]; - if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; } - $cidUniq[$cid] = true; - - $mime[] = sprintf("--%s%s", $boundary, $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE); - $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); - - if($disposition == 'inline') { - $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - } - - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); - - // Encode as string attachment - if($bString) { - $mime[] = $this->EncodeString($string, $encoding); - if($this->IsError()) { - return ''; - } - $mime[] = $this->LE.$this->LE; - } else { - $mime[] = $this->EncodeFile($path, $encoding); - if($this->IsError()) { - return ''; - } - $mime[] = $this->LE.$this->LE; - } - } - } - - $mime[] = sprintf("--%s--%s", $boundary, $this->LE); - - return implode("", $mime); - } - - /** - * Encodes attachment in requested format. - * Returns an empty string on failure. - * @param string $path The full path to the file - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @throws phpmailerException - * @see EncodeFile() - * @access protected - * @return string - */ - protected function EncodeFile($path, $encoding = 'base64') { - try { - if (!is_readable($path)) { - throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); - } - $magic_quotes = get_magic_quotes_runtime(); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(0); - } else { - ini_set('magic_quotes_runtime', 0); - } - } - $file_buffer = file_get_contents($path); - $file_buffer = $this->EncodeString($file_buffer, $encoding); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } else { - ini_set('magic_quotes_runtime', $magic_quotes); - } - } - return $file_buffer; - } catch (Exception $e) { - $this->SetError($e->getMessage()); - return ''; - } - } - - /** - * Encodes string to requested format. - * Returns an empty string on failure. - * @param string $str The text to encode - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @access public - * @return string - */ - public function EncodeString($str, $encoding = 'base64') { - $encoded = ''; - switch(strtolower($encoding)) { - case 'base64': - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case '7bit': - case '8bit': - $encoded = $this->FixEOL($str); - //Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - break; - case 'binary': - $encoded = $str; - break; - case 'quoted-printable': - $encoded = $this->EncodeQP($str); - break; - default: - $this->SetError($this->Lang('encoding') . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string to best (shortest) of Q, B, quoted or none. - * @access public - * @param string $str - * @param string $position - * @return string - */ - public function EncodeHeader($str, $position = 'text') { - $x = 0; - - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know what value has magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return ($encoded); - } else { - return ("\"$encoded\""); - } - } - $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - case 'comment': - $x = preg_match_all('/[()"]/', $str, $matches); - // Fall-through - case 'text': - default: - $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($x == 0) { - return ($str); - } - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { - $encoding = 'B'; - if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { - // Use a custom function which correctly encodes and wraps long - // multibyte strings without breaking lines within a character - $encoded = $this->Base64EncodeWrapMB($str, "\n"); - } else { - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } - } else { - $encoding = 'Q'; - $encoded = $this->EncodeQ($str, $position); - $encoded = $this->WrapText($encoded, $maxlen, true); - $encoded = str_replace('='.self::CRLF, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Checks if a string contains multibyte characters. - * @access public - * @param string $str multi-byte text to wrap encode - * @return bool - */ - public function HasMultiBytes($str) { - if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); - } else { // Assume no multibytes (we can't handle without mbstring functions anyway) - return false; - } - } - - /** - * Correctly encodes and wraps long multibyte strings for mail headers - * without breaking lines within a character. - * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php - * @access public - * @param string $str multi-byte text to wrap encode - * @param string $lf string to use as linefeed/end-of-line - * @return string - */ - public function Base64EncodeWrapMB($str, $lf=null) { - $start = "=?".$this->CharSet."?B?"; - $end = "?="; - $encoded = ""; - if ($lf === null) { - $lf = $this->LE; - } - - $mb_length = mb_strlen($str, $this->CharSet); - // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); - // Average multi-byte ratio - $ratio = $mb_length / strlen($str); - // Base64 has a 4:3 ratio - $offset = $avgLength = floor($length * $ratio * .75); - - for ($i = 0; $i < $mb_length; $i += $offset) { - $lookBack = 0; - - do { - $offset = $avgLength - $lookBack; - $chunk = mb_substr($str, $i, $offset, $this->CharSet); - $chunk = base64_encode($chunk); - $lookBack++; - } - while (strlen($chunk) > $length); - - $encoded .= $chunk . $lf; - } - - // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($lf)); - return $encoded; - } - - /** - * Encode string to RFC2045 (6.7) quoted-printable format - * @access public - * @param string $string The text to encode - * @param integer $line_max Number of chars allowed on a line before wrapping - * @return string - * @link PHP version adapted from http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 - */ - public function EncodeQP($string, $line_max = 76) { - if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3) - return quoted_printable_encode($string); - } - //Fall back to a pure PHP implementation - $string = str_replace(array('%20', '%0D%0A.', '%0D%0A', '%'), array(' ', "\r\n=2E", "\r\n", '='), rawurlencode($string)); - $string = preg_replace('/[^\r\n]{'.($line_max - 3).'}[^=\r\n]{2}/', "$0=\r\n", $string); - return $string; - } - - /** - * Wrapper to preserve BC for old QP encoding function that was removed - * @see EncodeQP() - * @access public - * @param string $string - * @param integer $line_max - * @param bool $space_conv - * @return string - */ - public function EncodeQPphp($string, $line_max = 76, $space_conv = false) { - return $this->EncodeQP($string, $line_max); - } - - /** - * Encode string to q encoding. - * @link http://tools.ietf.org/html/rfc2047 - * @param string $str the text to encode - * @param string $position Where the text is going to be used, see the RFC for what that means - * @access public - * @return string - */ - public function EncodeQ($str, $position = 'text') { - //There should not be any EOL in the string - $pattern=""; - $encoded = str_replace(array("\r", "\n"), '', $str); - switch (strtolower($position)) { - case 'phrase': - $pattern = '^A-Za-z0-9!*+\/ -'; - break; - - case 'comment': - $pattern = '\(\)"'; - //note that we don't break here! - //for this reason we build the $pattern without including delimiters and [] - - case 'text': - default: - //Replace every high ascii, control =, ? and _ characters - //We put \075 (=) as first value to make sure it's the first one in being converted, preventing double encode - $pattern = '\075\000-\011\013\014\016-\037\077\137\177-\377' . $pattern; - break; - } - - if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { - foreach (array_unique($matches[0]) as $char) { - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); - } - } - - //Replace every spaces to _ (more readable than =20) - return str_replace(' ', '_', $encoded); -} - - - /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return void - */ - public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $filename, - 2 => basename($filename), - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => 'attachment', - 7 => 0 - ); - } - - /** - * Add an embedded attachment from a file. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File MIME type. - * @return bool True on successfully adding an attachment - */ - public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - - if ( !@is_file($path) ) { - $this->SetError($this->Lang('file_access') . $path); - return false; - } - - $filename = basename($path); - if ( $name == '' ) { - $name = $filename; - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => 'inline', - 7 => $cid - ); - return true; - } - - - /** - * Add an embedded stringified attachment. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $string The attachment binary data. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $filename A name for the attachment - * @param string $encoding File encoding (see $Encoding). - * @param string $type MIME type. - * @return bool True on successfully adding an attachment - */ - public function AddStringEmbeddedImage($string, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $name, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => 'inline', - 7 => $cid - ); - return true; - } - - /** - * Returns true if an inline attachment is present. - * @access public - * @return bool - */ - public function InlineImageExists() { - foreach($this->attachment as $attachment) { - if ($attachment[6] == 'inline') { - return true; - } - } - return false; - } - - /** - * Returns true if an attachment (non-inline) is present. - * @return bool - */ - public function AttachmentExists() { - foreach($this->attachment as $attachment) { - if ($attachment[6] == 'attachment') { - return true; - } - } - return false; - } - - /** - * Does this message have an alternative body set? - * @return bool - */ - public function AlternativeExists() { - return !empty($this->AltBody); - } - - ///////////////////////////////////////////////// - // CLASS METHODS, MESSAGE RESET - ///////////////////////////////////////////////// - - /** - * Clears all recipients assigned in the TO array. Returns void. - * @return void - */ - public function ClearAddresses() { - foreach($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); - } - $this->to = array(); - } - - /** - * Clears all recipients assigned in the CC array. Returns void. - * @return void - */ - public function ClearCCs() { - foreach($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); - } - $this->cc = array(); - } - - /** - * Clears all recipients assigned in the BCC array. Returns void. - * @return void - */ - public function ClearBCCs() { - foreach($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); - } - $this->bcc = array(); - } - - /** - * Clears all recipients assigned in the ReplyTo array. Returns void. - * @return void - */ - public function ClearReplyTos() { - $this->ReplyTo = array(); - } - - /** - * Clears all recipients assigned in the TO, CC and BCC - * array. Returns void. - * @return void - */ - public function ClearAllRecipients() { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - $this->all_recipients = array(); - } - - /** - * Clears all previously set filesystem, string, and binary - * attachments. Returns void. - * @return void - */ - public function ClearAttachments() { - $this->attachment = array(); - } - - /** - * Clears all custom headers. Returns void. - * @return void - */ - public function ClearCustomHeaders() { - $this->CustomHeader = array(); - } - - ///////////////////////////////////////////////// - // CLASS METHODS, MISCELLANEOUS - ///////////////////////////////////////////////// - - /** - * Adds the error message to the error container. - * @access protected - * @param string $msg - * @return void - */ - protected function SetError($msg) { - $this->error_count++; - if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { - $lasterror = $this->smtp->getError(); - if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { - $msg .= '

    ' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "

    \n"; - } - } - $this->ErrorInfo = $msg; - } - - /** - * Returns the proper RFC 822 formatted date. - * @access public - * @return string - * @static - */ - public static function RFCDate() { - $tz = date('Z'); - $tzs = ($tz < 0) ? '-' : '+'; - $tz = abs($tz); - $tz = (int)($tz/3600)*100 + ($tz%3600)/60; - $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz); - - return $result; - } - - /** - * Returns the server hostname or 'localhost.localdomain' if unknown. - * @access protected - * @return string - */ - protected function ServerHostname() { - if (!empty($this->Hostname)) { - $result = $this->Hostname; - } elseif (isset($_SERVER['SERVER_NAME'])) { - $result = $_SERVER['SERVER_NAME']; - } else { - $result = 'localhost.localdomain'; - } - - return $result; - } - - /** - * Returns a message in the appropriate language. - * @access protected - * @param string $key - * @return string - */ - protected function Lang($key) { - if(count($this->language) < 1) { - $this->SetLanguage('en'); // set the default language - } - - if(isset($this->language[$key])) { - return $this->language[$key]; - } else { - return 'Language string failed to load: ' . $key; - } - } - - /** - * Returns true if an error occurred. - * @access public - * @return bool - */ - public function IsError() { - return ($this->error_count > 0); - } - - /** - * Changes every end of line from CRLF, CR or LF to $this->LE. - * @access public - * @param string $str String to FixEOL - * @return string - */ - public function FixEOL($str) { - // condense down to \n - $nstr = str_replace(array("\r\n", "\r"), "\n", $str); - // Now convert LE as needed - if ($this->LE !== "\n") { - $nstr = str_replace("\n", $this->LE, $nstr); - } - return $nstr; - } - - /** - * Adds a custom header. $name value can be overloaded to contain - * both header name and value (name:value) - * @access public - * @param string $name custom header name - * @param string $value header value - * @return void - */ - public function AddCustomHeader($name, $value=null) { - if ($value === null) { - // Value passed in as name:value - $this->CustomHeader[] = explode(':', $name, 2); - } else { - $this->CustomHeader[] = array($name, $value); - } - } - - /** - * Evaluates the message and returns modifications for inline images and backgrounds - * Overwrites any existing values in $this->Body and $this->AltBody - * @access public - * @param string $message Text to be HTML modified - * @param string $basedir baseline directory for path - * @return string $message - */ - public function MsgHTML($message, $basedir = '') { - preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); - if(isset($images[2])) { - foreach($images[2] as $i => $url) { - // do not change urls for absolute images (thanks to corvuscorax) - if (!preg_match('#^[A-z]+://#', $url)) { - $filename = basename($url); - $directory = dirname($url); - if ($directory == '.') { - $directory = ''; - } - $cid = 'cid:' . md5($url); - $ext = pathinfo($filename, PATHINFO_EXTENSION); - $mimeType = self::_mime_types($ext); - if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; } - if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; } - if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($url), $filename, 'base64', $mimeType) ) { - $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message); - } - } - } - } - $this->IsHTML(true); - $this->Body = $message; - $this->AltBody = $this->html2text($message); - if (empty($this->AltBody)) { - $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; - } - return $message; - } - - /** - * Convert an HTML string into a plain text version - * @param string $html The HTML text to convert - * @return string - */ - public function html2text($html) { - return html_entity_decode(trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $html))), ENT_QUOTES, $this->CharSet); - } - - /** - * Gets the MIME type of the embedded or inline image - * @param string $ext File extension - * @access public - * @return string MIME type of ext - * @static - */ - public static function _mime_types($ext = '') { - $mimes = array( - 'xl' => 'application/excel', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'bin' => 'application/macbinary', - 'doc' => 'application/msword', - 'word' => 'application/msword', - 'class' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'psd' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'so' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/x-javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'zip' => 'application/zip', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mpga' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'png' => 'image/png', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'eml' => 'message/rfc822', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'log' => 'text/plain', - 'text' => 'text/plain', - 'txt' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mov' => 'video/quicktime', - 'qt' => 'video/quicktime', - 'rv' => 'video/vnd.rn-realvideo', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie' - ); - return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; - } - - /** - * Set (or reset) Class Objects (variables) - * - * Usage Example: - * $page->set('X-Priority', '3'); - * - * @access public - * @param string $name Parameter Name - * @param mixed $value Parameter Value - * NOTE: will not work with arrays, there are no arrays to set/reset - * @throws phpmailerException - * @return bool - * @todo Should this not be using __set() magic function? - */ - public function set($name, $value = '') { - try { - if (isset($this->$name) ) { - $this->$name = $value; - } else { - throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL); - } - } catch (Exception $e) { - $this->SetError($e->getMessage()); - if ($e->getCode() == self::STOP_CRITICAL) { - return false; - } - } - return true; - } - - /** - * Strips newlines to prevent header injection. - * @access public - * @param string $str String - * @return string - */ - public function SecureHeader($str) { - return trim(str_replace(array("\r", "\n"), '', $str)); - } - - /** - * Set the private key file and password to sign the message. - * - * @access public - * @param $cert_filename - * @param string $key_filename Parameter File Name - * @param string $key_pass Password for private key - */ - public function Sign($cert_filename, $key_filename, $key_pass) { - $this->sign_cert_file = $cert_filename; - $this->sign_key_file = $key_filename; - $this->sign_key_pass = $key_pass; - } - - /** - * Set the private key file and password to sign the message. - * - * @access public - * @param string $txt - * @return string - */ - public function DKIM_QP($txt) { - $line = ''; - for ($i = 0; $i < strlen($txt); $i++) { - $ord = ord($txt[$i]); - if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) { - $line .= $txt[$i]; - } else { - $line .= "=".sprintf("%02X", $ord); - } - } - return $line; - } - - /** - * Generate DKIM signature - * - * @access public - * @param string $s Header - * @throws phpmailerException - * @return string - */ - public function DKIM_Sign($s) { - if (!defined('PKCS7_TEXT')) { - if ($this->exceptions) { - throw new phpmailerException($this->Lang("signing").' OpenSSL extension missing.'); - } - return ''; - } - $privKeyStr = file_get_contents($this->DKIM_private); - if ($this->DKIM_passphrase != '') { - $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); - } else { - $privKey = $privKeyStr; - } - if (openssl_sign($s, $signature, $privKey)) { - return base64_encode($signature); - } - return ''; - } - - /** - * Generate DKIM Canonicalization Header - * - * @access public - * @param string $s Header - * @return string - */ - public function DKIM_HeaderC($s) { - $s = preg_replace("/\r\n\s+/", " ", $s); - $lines = explode("\r\n", $s); - foreach ($lines as $key => $line) { - list($heading, $value) = explode(":", $line, 2); - $heading = strtolower($heading); - $value = preg_replace("/\s+/", " ", $value) ; // Compress useless spaces - $lines[$key] = $heading.":".trim($value) ; // Don't forget to remove WSP around the value - } - $s = implode("\r\n", $lines); - return $s; - } - - /** - * Generate DKIM Canonicalization Body - * - * @access public - * @param string $body Message Body - * @return string - */ - public function DKIM_BodyC($body) { - if ($body == '') return "\r\n"; - // stabilize line endings - $body = str_replace("\r\n", "\n", $body); - $body = str_replace("\n", "\r\n", $body); - // END stabilize line endings - while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { - $body = substr($body, 0, strlen($body) - 2); - } - return $body; - } - - /** - * Create the DKIM header, body, as new header - * - * @access public - * @param string $headers_line Header lines - * @param string $subject Subject - * @param string $body Body - * @return string - */ - public function DKIM_Add($headers_line, $subject, $body) { - $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms - $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body - $DKIMquery = 'dns/txt'; // Query method - $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) - $subject_header = "Subject: $subject"; - $headers = explode($this->LE, $headers_line); - $from_header = ""; - $to_header = ""; - foreach($headers as $header) { - if (strpos($header, 'From:') === 0) { - $from_header = $header; - } elseif (strpos($header, 'To:') === 0) { - $to_header = $header; - } - } - $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); - $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable - $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body) ; // Length of body - $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body - $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; - $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". - "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n". - "\th=From:To:Subject;\r\n". - "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n". - "\tz=$from\r\n". - "\t|$to\r\n". - "\t|$subject;\r\n". - "\tbh=" . $DKIMb64 . ";\r\n". - "\tb="; - $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs); - $signed = $this->DKIM_Sign($toSign); - return "X-PHPMAILER-DKIM: code.google.com/a/apache-extras.org/p/phpmailer/\r\n".$dkimhdrs.$signed."\r\n"; - } - - /** - * Perform callback - * @param boolean $isSent - * @param string $to - * @param string $cc - * @param string $bcc - * @param string $subject - * @param string $body - * @param string $from - */ - protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from = null) { - if (!empty($this->action_function) && is_callable($this->action_function)) { - $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); - call_user_func_array($this->action_function, $params); - } - } -} - -/** - * Exception handler for PHPMailer - * @package PHPMailer - */ -class phpmailerException extends Exception { - /** - * Prettify error message output - * @return string - */ - public function errorMessage() { - $errorMsg = '' . $this->getMessage() . "
    \n"; - return $errorMsg; - } -} diff --git a/download/phpmailer/class.pop3.php b/download/phpmailer/class.pop3.php deleted file mode 100755 index d4082a0d7..000000000 --- a/download/phpmailer/class.pop3.php +++ /dev/null @@ -1,417 +0,0 @@ - - * @author Andy Prevost - * @author Jim Jagielski - */ - -class POP3 { - /** - * Default POP3 port - * @var int - */ - public $POP3_PORT = 110; - - /** - * Default Timeout - * @var int - */ - public $POP3_TIMEOUT = 30; - - /** - * POP3 Carriage Return + Line Feed - * @var string - */ - public $CRLF = "\r\n"; - - /** - * Displaying Debug warnings? (0 = now, 1+ = yes) - * @var int - */ - public $do_debug = 2; - - /** - * POP3 Mail Server - * @var string - */ - public $host; - - /** - * POP3 Port - * @var int - */ - public $port; - - /** - * POP3 Timeout Value - * @var int - */ - public $tval; - - /** - * POP3 Username - * @var string - */ - public $username; - - /** - * POP3 Password - * @var string - */ - public $password; - - /** - * Sets the POP3 PHPMailer Version number - * @var string - */ - public $Version = '5.2.4'; - - ///////////////////////////////////////////////// - // PROPERTIES, PRIVATE AND PROTECTED - ///////////////////////////////////////////////// - - /** - * @var resource Resource handle for the POP connection socket - */ - private $pop_conn; - /** - * @var boolean Are we connected? - */ - private $connected; - /** - * @var array Error container - */ - private $error; // Error log array - - /** - * Constructor, sets the initial values - * @access public - * @return POP3 - */ - public function __construct() { - $this->pop_conn = 0; - $this->connected = false; - $this->error = null; - } - - /** - * Combination of public events - connect, login, disconnect - * @access public - * @param string $host - * @param bool|int $port - * @param bool|int $tval - * @param string $username - * @param string $password - * @param int $debug_level - * @return bool - */ - public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { - $this->host = $host; - - // If no port value is passed, retrieve it - if ($port == false) { - $this->port = $this->POP3_PORT; - } else { - $this->port = $port; - } - - // If no port value is passed, retrieve it - if ($tval == false) { - $this->tval = $this->POP3_TIMEOUT; - } else { - $this->tval = $tval; - } - - $this->do_debug = $debug_level; - $this->username = $username; - $this->password = $password; - - // Refresh the error log - $this->error = null; - - // Connect - $result = $this->Connect($this->host, $this->port, $this->tval); - - if ($result) { - $login_result = $this->Login($this->username, $this->password); - - if ($login_result) { - $this->Disconnect(); - - return true; - } - - } - - // We need to disconnect regardless if the login succeeded - $this->Disconnect(); - - return false; - } - - /** - * Connect to the POP3 server - * @access public - * @param string $host - * @param bool|int $port - * @param integer $tval - * @return boolean - */ - public function Connect ($host, $port = false, $tval = 30) { - // Are we already connected? - if ($this->connected) { - return true; - } - - /* - On Windows this will raise a PHP Warning error if the hostname doesn't exist. - Rather than supress it with @fsockopen, let's capture it cleanly instead - */ - - set_error_handler(array(&$this, 'catchWarning')); - - // Connect to the POP3 server - $this->pop_conn = fsockopen($host, // POP3 Host - $port, // Port # - $errno, // Error Number - $errstr, // Error Message - $tval); // Timeout (seconds) - - // Restore the error handler - restore_error_handler(); - - // Does the Error Log now contain anything? - if ($this->error && $this->do_debug >= 1) { - $this->displayErrors(); - } - - // Did we connect? - if ($this->pop_conn == false) { - // It would appear not... - $this->error = array( - 'error' => "Failed to connect to server $host on port $port", - 'errno' => $errno, - 'errstr' => $errstr - ); - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - - return false; - } - - // Increase the stream time-out - - // Check for PHP 4.3.0 or later - if (version_compare(phpversion(), '5.0.0', 'ge')) { - stream_set_timeout($this->pop_conn, $tval, 0); - } else { - // Does not work on Windows - if (substr(PHP_OS, 0, 3) !== 'WIN') { - socket_set_timeout($this->pop_conn, $tval, 0); - } - } - - // Get the POP3 server response - $pop3_response = $this->getResponse(); - - // Check for the +OK - if ($this->checkResponse($pop3_response)) { - // The connection is established and the POP3 server is talking - $this->connected = true; - return true; - } - return false; - } - - /** - * Login to the POP3 server (does not support APOP yet) - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - public function Login ($username = '', $password = '') { - if ($this->connected == false) { - $this->error = 'Not connected to POP3 server'; - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - } - - if (empty($username)) { - $username = $this->username; - } - - if (empty($password)) { - $password = $this->password; - } - - $pop_username = "USER $username" . $this->CRLF; - $pop_password = "PASS $password" . $this->CRLF; - - // Send the Username - $this->sendString($pop_username); - $pop3_response = $this->getResponse(); - - if ($this->checkResponse($pop3_response)) { - // Send the Password - $this->sendString($pop_password); - $pop3_response = $this->getResponse(); - - if ($this->checkResponse($pop3_response)) { - return true; - } - } - return false; - } - - /** - * Disconnect from the POP3 server - * @access public - */ - public function Disconnect () { - $this->sendString('QUIT'); - - fclose($this->pop_conn); - } - - ///////////////////////////////////////////////// - // Private Methods - ///////////////////////////////////////////////// - - /** - * Get the socket response back. - * $size is the maximum number of bytes to retrieve - * @access private - * @param integer $size - * @return string - */ - private function getResponse ($size = 128) { - $pop3_response = fgets($this->pop_conn, $size); - - return $pop3_response; - } - - /** - * Send a string down the open socket connection to the POP3 server - * @access private - * @param string $string - * @return integer - */ - private function sendString ($string) { - $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); - - return $bytes_sent; - } - - /** - * Checks the POP3 server response for +OK or -ERR - * @access private - * @param string $string - * @return boolean - */ - private function checkResponse ($string) { - if (substr($string, 0, 3) !== '+OK') { - $this->error = array( - 'error' => "Server reported an error: $string", - 'errno' => 0, - 'errstr' => '' - ); - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - - return false; - } else { - return true; - } - - } - - /** - * If debug is enabled, display the error message array - * @access private - */ - private function displayErrors () { - echo '
    ';
    -
    -    foreach ($this->error as $single_error) {
    -      print_r($single_error);
    -    }
    -
    -    echo '
    '; - } - - /** - * Takes over from PHP for the socket warning handler - * @access private - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline - */ - private function catchWarning ($errno, $errstr, $errfile, $errline) { - $this->error[] = array( - 'error' => "Connecting to the POP3 server raised a PHP warning: ", - 'errno' => $errno, - 'errstr' => $errstr - ); - } - - // End of class -} diff --git a/download/phpmailer/class.smtp.php b/download/phpmailer/class.smtp.php deleted file mode 100755 index f0e4062ec..000000000 --- a/download/phpmailer/class.smtp.php +++ /dev/null @@ -1,1087 +0,0 @@ -Debugoutput == 'error_log') { - error_log($str); - } else { - echo $str; - } - } - - /** - * Initialize the class so that the data is in a known state. - * @access public - * @return SMTP - */ - public function __construct() { - $this->smtp_conn = 0; - $this->error = null; - $this->helo_rply = null; - - $this->do_debug = 0; - } - - ///////////////////////////////////////////////// - // CONNECTION FUNCTIONS - ///////////////////////////////////////////////// - - /** - * Connect to the server specified on the port specified. - * If the port is not specified use the default SMTP_PORT. - * If tval is specified then a connection will try and be - * established with the server for that number of seconds. - * If tval is not specified the default is 30 seconds to - * try on the connection. - * - * SMTP CODE SUCCESS: 220 - * SMTP CODE FAILURE: 421 - * @access public - * @param string $host - * @param int $port - * @param int $tval - * @return bool - */ - public function Connect($host, $port = 0, $tval = 30) { - // set the error val to null so there is no confusion - $this->error = null; - - // make sure we are __not__ connected - if($this->connected()) { - // already connected, generate error - $this->error = array('error' => 'Already connected to a server'); - return false; - } - - if(empty($port)) { - $port = $this->SMTP_PORT; - } - - // connect to the smtp server - $this->smtp_conn = @fsockopen($host, // the host of the server - $port, // the port to use - $errno, // error number if any - $errstr, // error message if any - $tval); // give up after ? secs - // verify we connected properly - if(empty($this->smtp_conn)) { - $this->error = array('error' => 'Failed to connect to server', - 'errno' => $errno, - 'errstr' => $errstr); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ": $errstr ($errno)" . $this->CRLF . '
    '); - } - return false; - } - - // SMTP server can take longer to respond, give longer timeout for first read - // Windows does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != 'WIN') { - $max = ini_get('max_execution_time'); - if ($max != 0 && $tval > $max) { // don't bother if unlimited - @set_time_limit($tval); - } - stream_set_timeout($this->smtp_conn, $tval, 0); - } - - // get any announcement - $announce = $this->get_lines(); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $announce . $this->CRLF . '
    '); - } - - return true; - } - - /** - * Initiate a TLS communication with the server. - * - * SMTP CODE 220 Ready to start TLS - * SMTP CODE 501 Syntax error (no parameters allowed) - * SMTP CODE 454 TLS not available due to temporary reason - * @access public - * @return bool success - */ - public function StartTLS() { - $this->error = null; # to avoid confusion - - if(!$this->connected()) { - $this->error = array('error' => 'Called StartTLS() without being connected'); - return false; - } - - $this->client_send('STARTTLS' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 220) { - $this->error = - array('error' => 'STARTTLS not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Begin encrypted connection - if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { - return false; - } - - return true; - } - - /** - * Performs SMTP authentication. Must be run after running the - * Hello() method. Returns true if successfully authenticated. - * @access public - * @param string $username - * @param string $password - * @param string $authtype - * @param string $realm - * @param string $workstation - * @return bool - */ - public function Authenticate($username, $password, $authtype='LOGIN', $realm='', $workstation='') { - if (empty($authtype)) { - $authtype = 'LOGIN'; - } - - switch ($authtype) { - case 'PLAIN': - // Start authentication - $this->client_send('AUTH PLAIN' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - // Send encoded username and password - $this->client_send(base64_encode("\0".$username."\0".$password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Authentication not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - case 'LOGIN': - // Start authentication - $this->client_send('AUTH LOGIN' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Send encoded username - $this->client_send(base64_encode($username) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'Username not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Send encoded password - $this->client_send(base64_encode($password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Password not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - case 'NTLM': - /* - * ntlm_sasl_client.php - ** Bundled with Permission - ** - ** How to telnet in windows: http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx - ** PROTOCOL Documentation http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication - */ - require_once 'extras/ntlm_sasl_client.php'; - $temp = new stdClass(); - $ntlm_client = new ntlm_sasl_client_class; - if(! $ntlm_client->Initialize($temp)){//let's test if every function its available - $this->error = array('error' => $temp->error); - if($this->do_debug >= 1) { - $this->edebug('You need to enable some modules in your php.ini file: ' . $this->error['error'] . $this->CRLF); - } - return false; - } - $msg1 = $ntlm_client->TypeMsg1($realm, $workstation);//msg1 - - $this->client_send('AUTH NTLM ' . base64_encode($msg1) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF); - } - return false; - } - - $challenge = substr($rply, 3);//though 0 based, there is a white space after the 3 digit number....//msg2 - $challenge = base64_decode($challenge); - $ntlm_res = $ntlm_client->NTLMResponse(substr($challenge, 24, 8), $password); - $msg3 = $ntlm_client->TypeMsg3($ntlm_res, $username, $realm, $workstation);//msg3 - // Send encoded username - $this->client_send(base64_encode($msg3) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Could not authenticate', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF); - } - return false; - } - break; - case 'CRAM-MD5': - // Start authentication - $this->client_send('AUTH CRAM-MD5' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Get the challenge - $challenge = base64_decode(substr($rply, 4)); - - // Build the response - $response = $username . ' ' . $this->hmac($challenge, $password); - - // Send encoded credentials - $this->client_send(base64_encode($response) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'Credentials not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - } - return true; - } - - /** - * Works like hash_hmac('md5', $data, $key) in case that function is not available - * @access private - * @param string $data - * @param string $key - * @return string - */ - private function hmac($data, $key) { - if (function_exists('hash_hmac')) { - return hash_hmac('md5', $data, $key); - } - - // The following borrowed from http://php.net/manual/en/function.mhash.php#27225 - - // RFC 2104 HMAC implementation for php. - // Creates an md5 HMAC. - // Eliminates the need to install mhash to compute a HMAC - // Hacked by Lance Rushing - - $b = 64; // byte length for md5 - if (strlen($key) > $b) { - $key = pack('H*', md5($key)); - } - $key = str_pad($key, $b, chr(0x00)); - $ipad = str_pad('', $b, chr(0x36)); - $opad = str_pad('', $b, chr(0x5c)); - $k_ipad = $key ^ $ipad ; - $k_opad = $key ^ $opad; - - return md5($k_opad . pack('H*', md5($k_ipad . $data))); - } - - /** - * Returns true if connected to a server otherwise false - * @access public - * @return bool - */ - public function Connected() { - if(!empty($this->smtp_conn)) { - $sock_status = stream_get_meta_data($this->smtp_conn); - if($sock_status['eof']) { - // the socket is valid but we are not connected - if($this->do_debug >= 1) { - $this->edebug('SMTP -> NOTICE:' . $this->CRLF . 'EOF caught while checking if connected'); - } - $this->Close(); - return false; - } - return true; // everything looks good - } - return false; - } - - /** - * Closes the socket and cleans up the state of the class. - * It is not considered good to use this function without - * first trying to use QUIT. - * @access public - * @return void - */ - public function Close() { - $this->error = null; // so there is no confusion - $this->helo_rply = null; - if(!empty($this->smtp_conn)) { - // close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = 0; - } - } - - ///////////////////////////////////////////////// - // SMTP COMMANDS - ///////////////////////////////////////////////// - - /** - * Issues a data command and sends the msg_data to the server - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being seperated by and additional . - * - * Implements rfc 821: DATA - * - * SMTP CODE INTERMEDIATE: 354 - * [data] - * . - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 552, 554, 451, 452 - * SMTP CODE FAILURE: 451, 554 - * SMTP CODE ERROR : 500, 501, 503, 421 - * @access public - * @param string $msg_data - * @return bool - */ - public function Data($msg_data) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Data() without being connected'); - return false; - } - - $this->client_send('DATA' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 354) { - $this->error = - array('error' => 'DATA command not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - /* the server is ready to accept data! - * according to rfc 821 we should not send more than 1000 - * including the CRLF - * characters on a single line so we will break the data up - * into lines by \r and/or \n then if needed we will break - * each of those into smaller lines to fit within the limit. - * in addition we will be looking for lines that start with - * a period '.' and append and additional period '.' to that - * line. NOTE: this does not count towards limit. - */ - - // normalize the line breaks so we know the explode works - $msg_data = str_replace("\r\n", "\n", $msg_data); - $msg_data = str_replace("\r", "\n", $msg_data); - $lines = explode("\n", $msg_data); - - /* we need to find a good way to determine is headers are - * in the msg_data or if it is a straight msg body - * currently I am assuming rfc 822 definitions of msg headers - * and if the first field of the first line (':' sperated) - * does not contain a space then it _should_ be a header - * and we can process all lines before a blank "" line as - * headers. - */ - - $field = substr($lines[0], 0, strpos($lines[0], ':')); - $in_headers = false; - if(!empty($field) && !strstr($field, ' ')) { - $in_headers = true; - } - - $max_line_length = 998; // used below; set here for ease in change - - while(list(, $line) = @each($lines)) { - $lines_out = null; - if($line == '' && $in_headers) { - $in_headers = false; - } - // ok we need to break this line up into several smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line, 0, $max_line_length), ' '); - - // Patch to fix DOS attack - if(!$pos) { - $pos = $max_line_length - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos + 1); - } - - /* if processing headers add a LWSP-char to the front of new line - * rfc 822 on long msg headers - */ - if($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - // send the lines to the server - while(list(, $line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) - { - if(substr($line_out, 0, 1) == '.') { - $line_out = '.' . $line_out; - } - } - $this->client_send($line_out . $this->CRLF); - } - } - - // message data has been sent - $this->client_send($this->CRLF . '.' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'DATA not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the HELO command to the smtp server. - * This makes sure that we and the server are in - * the same known state. - * - * Implements from rfc 821: HELO - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @param string $host - * @return bool - */ - public function Hello($host = '') { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Hello() without being connected'); - return false; - } - - // if hostname for HELO was not specified send default - if(empty($host)) { - // determine appropriate default to send to server - $host = 'localhost'; - } - - // Send extended hello first (RFC 2821) - if(!$this->SendHello('EHLO', $host)) { - if(!$this->SendHello('HELO', $host)) { - return false; - } - } - - return true; - } - - /** - * Sends a HELO/EHLO command. - * @access private - * @param string $hello - * @param string $host - * @return bool - */ - private function SendHello($hello, $host) { - $this->client_send($hello . ' ' . $host . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER: ' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => $hello . ' not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - $this->helo_rply = $rply; - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. - * - * Implements rfc 821: MAIL FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552, 451, 452 - * SMTP CODE SUCCESS: 500, 501, 421 - * @access public - * @param string $from - * @return bool - */ - public function Mail($from) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Mail() without being connected'); - return false; - } - - $useVerp = ($this->do_verp ? ' XVERP' : ''); - $this->client_send('MAIL FROM:<' . $from . '>' . $useVerp . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'MAIL not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the quit command to the server and then closes the socket - * if there is no error or the $close_on_error argument is true. - * - * Implements from rfc 821: QUIT - * - * SMTP CODE SUCCESS: 221 - * SMTP CODE ERROR : 500 - * @access public - * @param bool $close_on_error - * @return bool - */ - public function Quit($close_on_error = true) { - $this->error = null; // so there is no confusion - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Quit() without being connected'); - return false; - } - - // send the quit command to the server - $this->client_send('quit' . $this->CRLF); - - // get any good-bye messages - $byemsg = $this->get_lines(); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $byemsg . $this->CRLF . '
    '); - } - - $rval = true; - $e = null; - - $code = substr($byemsg, 0, 3); - if($code != 221) { - // use e as a tmp var cause Close will overwrite $this->error - $e = array('error' => 'SMTP server rejected quit command', - 'smtp_code' => $code, - 'smtp_rply' => substr($byemsg, 4)); - $rval = false; - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $e['error'] . ': ' . $byemsg . $this->CRLF . '
    '); - } - } - - if(empty($e) || $close_on_error) { - $this->Close(); - } - - return $rval; - } - - /** - * Sends the command RCPT to the SMTP server with the TO: argument of $to. - * Returns true if the recipient was accepted false if it was rejected. - * - * Implements from rfc 821: RCPT TO: - * - * SMTP CODE SUCCESS: 250, 251 - * SMTP CODE FAILURE: 550, 551, 552, 553, 450, 451, 452 - * SMTP CODE ERROR : 500, 501, 503, 421 - * @access public - * @param string $to - * @return bool - */ - public function Recipient($to) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Recipient() without being connected'); - return false; - } - - $this->client_send('RCPT TO:<' . $to . '>' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250 && $code != 251) { - $this->error = - array('error' => 'RCPT not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the RSET command to abort and transaction that is - * currently in progress. Returns true if successful false - * otherwise. - * - * Implements rfc 821: RSET - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @return bool - */ - public function Reset() { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array('error' => 'Called Reset() without being connected'); - return false; - } - - $this->client_send('RSET' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'RSET failed', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * - * Implements rfc 821: SAML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552, 451, 452 - * SMTP CODE SUCCESS: 500, 501, 502, 421 - * @access public - * @param string $from - * @return bool - */ - public function SendAndMail($from) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called SendAndMail() without being connected'); - return false; - } - - $this->client_send('SAML FROM:' . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'SAML not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * This is an optional command for SMTP that this class does not - * support. This method is here to make the RFC821 Definition - * complete for this class and __may__ be implimented in the future - * - * Implements from rfc 821: TURN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 502 - * SMTP CODE ERROR : 500, 503 - * @access public - * @return bool - */ - public function Turn() { - $this->error = array('error' => 'This method, TURN, of the SMTP '. - 'is not implemented'); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> NOTICE: ' . $this->error['error'] . $this->CRLF . '
    '); - } - return false; - } - - /** - * Sends data to the server - * @param string $data - * @access public - * @return Integer number of bytes sent to the server or FALSE on error - */ - public function client_send($data) { - if ($this->do_debug >= 1) { - $this->edebug("CLIENT -> SMTP: $data" . $this->CRLF . '
    '); - } - return fwrite($this->smtp_conn, $data); - } - - /** - * Get the current error - * @access public - * @return array - */ - public function getError() { - return $this->error; - } - - ///////////////////////////////////////////////// - // INTERNAL FUNCTIONS - ///////////////////////////////////////////////// - - /** - * Read in as many lines as possible - * either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access private - * @return string - */ - private function get_lines() { - $data = ''; - $endtime = 0; - /* If for some reason the fp is bad, don't inf loop */ - if (!is_resource($this->smtp_conn)) { - return $data; - } - stream_set_timeout($this->smtp_conn, $this->Timeout); - if ($this->Timelimit > 0) { - $endtime = time() + $this->Timelimit; - } - while(is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { - $str = @fgets($this->smtp_conn, 515); - if($this->do_debug >= 4) { - $this->edebug("SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
    '); - $this->edebug("SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
    '); - } - $data .= $str; - if($this->do_debug >= 4) { - $this->edebug("SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
    '); - } - // if 4th character is a space, we are done reading, break the loop - if(substr($str, 3, 1) == ' ') { break; } - // Timed-out? Log and break - $info = stream_get_meta_data($this->smtp_conn); - if ($info['timed_out']) { - if($this->do_debug >= 4) { - $this->edebug('SMTP -> get_lines(): timed-out (' . $this->Timeout . ' seconds)
    '); - } - break; - } - // Now check if reads took too long - if ($endtime) { - if (time() > $endtime) { - if($this->do_debug >= 4) { - $this->edebug('SMTP -> get_lines(): timelimit reached (' . $this->Timelimit . ' seconds)
    '); - } - break; - } - } - } - return $data; - } - -} diff --git a/download/phpmailer529/.gitignore b/download/phpmailer529/.gitignore deleted file mode 100755 index 989164d65..000000000 --- a/download/phpmailer529/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -docs/phpdoc/ -test/message.txt -test/testbootstrap.php -.idea -build/ diff --git a/download/phpmailer529/.scrutinizer.yml b/download/phpmailer529/.scrutinizer.yml deleted file mode 100755 index be706aeeb..000000000 --- a/download/phpmailer529/.scrutinizer.yml +++ /dev/null @@ -1,143 +0,0 @@ -before_commands: - - "composer install --prefer-source" - -tools: - # Code Coverage - external_code_coverage: - enabled: true - timeout: 300 - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - - php_code_coverage: - enabled: false - test_command: phpunit - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - - # Code Sniffer - php_code_sniffer: - enabled: true - command: phpcs - config: - standard: PSR2 - sniffs: - generic: - files: - one_class_per_file_sniff: false - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - - # Copy/Paste Detector - php_cpd: - enabled: true - command: phpcpd - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - - # PHP CS Fixer (http://http://cs.sensiolabs.org/). - php_cs_fixer: - enabled: true - command: php-cs-fixer - config: - level: psr2 - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - - # Analyzes the size and structure of a PHP project. - php_loc: - enabled: true - command: phploc - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - - # PHP Mess Detector (http://phpmd.org). - php_mess_detector: - enabled: true - command: phpmd - config: - rulesets: - - codesize - - unusedcode - - naming - - design - naming_rules: - short_variable: { minimum: 2 } - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Analyzes the size and structure of a PHP project. - php_pdepend: - enabled: true - command: pdepend - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - # Runs Scrutinizer's PHP Analyzer Tool - # https://scrutinizer-ci.com/docs/tools/php/php-analyzer/config_reference - php_analyzer: - enabled: true - config: - checkstyle: - enabled: true - naming: - enabled: true - property_name: ^[_a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps - method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9_]*$ #Allow underscores & caps - parameter_name: ^[a-z][a-zA-Z0-9_]*$ # Allow underscores - local_variable: ^[a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps - exception_name: ^[a-zA-Z][a-zA-Z0-9]*Exception$ - isser_method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9]*$ #Allow underscores & caps - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Security Advisory Checker - sensiolabs_security_checker: true diff --git a/download/phpmailer529/.travis.yml b/download/phpmailer529/.travis.yml deleted file mode 100755 index c49dd2182..000000000 --- a/download/phpmailer529/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: php -php: - - 5.6 - - 5.5 - - 5.4 - - 5.3 - - hhvm - -matrix: - allow_failures: - - php: hhvm - -before_install: - - sudo apt-get update -qq - - sudo apt-get install -y -qq postfix -before_script: - - sudo service postfix stop - - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & - - mkdir -p build/logs - - cd test - - cp testbootstrap-dist.php testbootstrap.php - - chmod +x fakesendmail.sh - - sudo mkdir -p /var/qmail/bin - - sudo cp fakesendmail.sh /var/qmail/bin/sendmail - - sudo cp fakesendmail.sh /usr/sbin/sendmail - - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -r 'echo PHP_VERSION;'`/etc/conf.d/sendmail.ini" - - pwd - - ls -al -script: - - phpunit --configuration ../travis.phpunit.xml.dist -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml diff --git a/download/phpmailer529/LICENSE b/download/phpmailer529/LICENSE deleted file mode 100755 index 8e0763d1c..000000000 --- a/download/phpmailer529/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/download/phpmailer529/PHPMailerAutoload.php b/download/phpmailer529/PHPMailerAutoload.php deleted file mode 100755 index eaa2e3034..000000000 --- a/download/phpmailer529/PHPMailerAutoload.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer SPL autoloader. - * @param string $classname The name of the class to load - */ -function PHPMailerAutoload($classname) -{ - //Can't use __DIR__ as it's only in PHP 5.3+ - $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; - if (is_readable($filename)) { - require $filename; - } -} - -if (version_compare(PHP_VERSION, '5.1.2', '>=')) { - //SPL autoloading was introduced in PHP 5.1.2 - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register('PHPMailerAutoload', true, true); - } else { - spl_autoload_register('PHPMailerAutoload'); - } -} else { - /** - * Fall back to traditional autoload for old PHP versions - * @param string $classname The name of the class to load - */ - function __autoload($classname) - { - PHPMailerAutoload($classname); - } -} diff --git a/download/phpmailer529/README.md b/download/phpmailer529/README.md deleted file mode 100755 index e952185d3..000000000 --- a/download/phpmailer529/README.md +++ /dev/null @@ -1,165 +0,0 @@ -![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png) - -# PHPMailer - A full-featured email creation and transfer class for PHP - -Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer) -[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) -[![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) - -## Class Features - -- Probably the world's most popular code for sending email from PHP! -- Used by many open-source projects: Wordpress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more -- Integrated SMTP support - send without a local mail server -- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs -- Multipart/alternative emails for mail clients that do not read HTML email -- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings -- SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms over SSL and TLS transports -- Native language support -- DKIM and S/MIME signing support -- Compatible with PHP 5.0 and later -- Much more! - -## Why you might need it - -Many PHP developers utilize email in their code. The only PHP function that supports this is the mail() function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments. - -Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the mail() function directly is just plain wrong! -*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc. - -The PHP mail() function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server. - -## License - -This software is licenced under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html). Please read LICENSE for information on the -software availability and distribution. - -## Installation & loading - -PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer). Alternatively, just copy the contents of the PHPMailer folder into somewhere that's in your PHP `include_path` setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub. - -PHPMailer provides an SPL-compatible autoloader, and that is the preferred way of loading the library - just `require '/path/to/PHPMailerAutoload.php';` and everything should work. The autoloader does not throw errors if it can't find classes so it prepends itself to the SPL list, allowing your own (or your framework's) autoloader to catch errors. SPL autoloading was introduced in PHP 5.1.0, so if you are using a version older than that you will need to require/include each class manually. - -PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3. - -### Minimal installation - -While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [class.phpmailer.php](class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](class.pop3.php). For all of these, we recommend you use [the autoloader](PHPMailerAutoload.php) too as otherwise you will either have to `require` all classes manually or use some other autoloader. You can skip the [language](language/) folder if you're not showing errors to users and can make do with English-only errors. You may need the additional classes in the [extras](extras/) folder if you are using those features, including NTLM authentication and ics generation. - -## A Simple Example - -```php -SMTPDebug = 3; // Enable verbose debug output - -$mail->isSMTP(); // Set mailer to use SMTP -$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers -$mail->SMTPAuth = true; // Enable SMTP authentication -$mail->Username = 'user@example.com'; // SMTP username -$mail->Password = 'secret'; // SMTP password -$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted -$mail->Port = 587; // TCP port to connect to - -$mail->From = 'from@example.com'; -$mail->FromName = 'Mailer'; -$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient -$mail->addAddress('ellen@example.com'); // Name is optional -$mail->addReplyTo('info@example.com', 'Information'); -$mail->addCC('cc@example.com'); -$mail->addBCC('bcc@example.com'); - -$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments -$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -$mail->isHTML(true); // Set email format to HTML - -$mail->Subject = 'Here is the subject'; -$mail->Body = 'This is the HTML message body in bold!'; -$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; - -if(!$mail->send()) { - echo 'Message could not be sent.'; - echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message has been sent'; -} -``` - -You'll find plenty more to play with in the [examples](examples/) folder. - -That's it. You should now be ready to use PHPMailer! - -## Localization -PHPMailer defaults to English, but in the [language](language/) folder you'll find numerous (41 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: - -```php -// To load the French version -$mail->setLanguage('fr', '/optional/path/to/language/directory/'); -``` - -We welcome corrections and new languages - if you're looking for corrections to do, run the [phpmailerLangTest.php](test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations. - -## Documentation - -Examples of how to use PHPMailer for common scenarios can be found in the [examples](examples/) folder. If you're looking for a good starting point, we recommend you start with [the gmail example](examples/gmail.phps). - -There are tips and a troubleshooting guide in the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated. - -Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/). - -You'll find some basic user-level docs in the [docs](docs/) folder, and you can generate complete API-level documentation using the [generatedocs.sh](docs/generatedocs.sh) shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. You may find [the unit tests](test/phpmailerTest.php) a good source of how to do various operations such as encryption. - -If the documentation doesn't cover what you need, search the [many questions on StackOverflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). - -## Tests - -There is a PHPUnit test script in the [test](test/) folder. - -Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer) - -If this isn't passing, is there something you can do to help? - -## Contributing - -Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). - -We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. - -With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone: - -`git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git` - -Please *don't* use the SourceForge or Google Code projects any more. - -## Sponsorship - -Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system. - -Smartmessages email marketing - -Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. - -## Changelog - -See [changelog](changelog.md). - -## History -- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). -- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004. -- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. -- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer). -- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer. -- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub. - -### What's changed since moving from SourceForge? -- Official successor to the SourceForge and Google Code projects. -- Test suite. -- Continuous integration with Travis-CI. -- Composer support. -- Public development. -- Additional languages and language strings. -- CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits and branches from the original SourceForge project. diff --git a/download/phpmailer529/VERSION b/download/phpmailer529/VERSION deleted file mode 100755 index 485d792a3..000000000 --- a/download/phpmailer529/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.2.9 \ No newline at end of file diff --git a/download/phpmailer529/changelog.md b/download/phpmailer529/changelog.md deleted file mode 100755 index 52bc328ad..000000000 --- a/download/phpmailer529/changelog.md +++ /dev/null @@ -1,573 +0,0 @@ -# ChangeLog - -* Use `application/javascript` for .js attachments -* Improve RFC2821 compliance for timelimits, especially for end-of-data -* Add Azerbaijani translations (Thanks to @mirjalal) -* Minor code cleanup for robustness -* Add Indonesian translations (Thanks to @ceceprawiro) -* Avoid `error_log` Debugoutput naming clash -* Add ability to parse server capabilities in response to EHLO (useful for SendGrid etc) -* Amended default values for WordWrap to match RFC -* Remove html2text converter class, provide new mechanism for injecting converters -* Improve pointers to docs and support in README -* Add example file upload script -* Refactor and major cleanup of EasyPeasyICS, now a lot more usable - -## Version 5.2.9 (Sept 25th 2014) -* **Important: The autoloader is no longer autoloaded by the PHPMailer class** -* Update html2text from https://github.com/mtibben/html2text -* Improve Arabic translations (Thanks to @tarekdj) -* Consistent handling of connection variables in SMTP and POP3 -* PHPDoc cleanup -* Update composer to use PHPUnit 4.1 -* Pass consistent params to callbacks -* More consistent handling of error states and debug output -* Use property defaults, remove constructors -* Remove unreachable code -* Use older regex validation pattern for troublesome PCRE library versions -* Improve PCRE detection in older PHP versions -* Handle debug output consistently, and always in UTF-8 -* Allow user-defined debug output method via a callable -* msgHTML now converts data URIs to embedded images -* SMTP::getLastReply() will now always be populated -* Improved example code in README -* Ensure long filenames in Content-Disposition are encoded correctly -* Simplify SMTP debug output mechanism, clarify levels with constants -* Add SMTP connection check example -* Simplify examples, don't use mysql* functions - -## Version 5.2.8 (May 14th 2014) -* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104 -* Add timestamps to default debug output -* Add connection events and new level 3 to debug output options -* Chinese language update (Thanks to @binaryoung) -* Allow custom Mailer types (Thanks to @michield) -* Cope with spaces around SMTP host specs -* Fix processing of multiple hosts in connect string -* Added Galician translation (Thanks to @donatorouco) -* Autoloader now prepends -* Docs updates -* Add Latvian translation (Thanks to @eddsstudio) -* Add Belarusian translation (Thanks to @amaksymiuk) -* Make autoloader work better on older PHP versions -* Avoid double-encoding if mbstring is overloading mail() -* Add Portuguese translation (Thanks to @Jonadabe) -* Make quoted-printable encoder respect line ending setting -* Improve Chinese translation (Thanks to @PeterDaveHello) -* Add Georgian translation (Thanks to @akalongman) -* Add Greek translation (Thanks to @lenasterg) -* Fix serverHostname on PHP < 5.3 -* Improve performance of SMTP class -* Implement automatic 7bit downgrade -* Add Vietnamese translation (Thanks to @vinades) -* Improve example images, switch to PNG -* Add Croatian translation (Thanks to @hrvoj3e) -* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong! -* Fix language file loading if CWD has changed (@stephandesouza) -* Add HTML5 email validation pattern -* Improve Turkish translations (Thanks to @yasinaydin) -* Improve Romanian translations (Thanks to @aflorea) -* Check php.ini for path to sendmail/qmail before using default -* Improve Farsi translation (Thanks to @MHM5000) -* Don't use quoted-printable encoding for multipart types -* Add Serbian translation (Thanks to ajevremovic at gmail.com) -* Remove useless PHP5 check -* Use SVG for build status badges -* Store MessageDate on creation -* Better default behaviour for validateAddress - -## Version 5.2.7 (September 12th 2013) -* Add Ukrainian translation from @Krezalis -* Support for do_verp -* Fix bug in CRAM-MD5 AUTH -* Propagate Debugoutput option to SMTP class (@Reblutus) -* Determine MIME type of attachments automatically -* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it -* Add a new 'html' Debugoutput type -* Clean up SMTP debug output, remove embedded HTML -* Some small changes in header formatting to improve IETF msglint test results -* Update test_script to use some recently changed features, rename to code_generator -* Generated code actually works! -* Update SyntaxHighlighter -* Major overhaul and cleanup of example code -* New PHPMailer graphic -* msgHTML now uses RFC2392-compliant content ids -* Add line break normalization function and use it in msgHTML -* Don't set unnecessary reply-to addresses -* Make fakesendmail.sh a bit cleaner and safer -* Set a content-transfer-encoding on multiparts (fixes msglint error) -* Fix cid generation in msgHTML (Thanks to @digitalthought) -* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo) -* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid) -* Add support for iCal event alternatives (Thanks to @reblutus) -* Update to Polish language file (Thanks to Krzysztof Kowalewski) -* Update to Norwegian language file (Thanks to @datagutten) -* Update to Hungarian language file (Thanks to @dominicus-75) -* Add Persian/Farsi translation from @jaii -* Make SMTPDebug property type match type in SMTP class -* Add unit tests for DKIM -* Major refactor of SMTP class -* Reformat to PSR-2 coding standard -* Introduce autoloader -* Allow overriding of SMTP class -* Overhaul of PHPDocs -* Fix broken Q-encoding -* Czech language update (Thanks to @nemelu) -* Removal of excess blank lines in messages -* Added fake POP server and unit tests for POP-before-SMTP - -## Version 5.2.6 (April 11th 2013) -* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer -* Fix unbumped version numbers -* Update packagist.org with new location -* Clean up Changelog - -## Version 5.2.5 (April 6th 2013) -* First official release after move from Google Code -* Fixes for qmail when sending via mail() -* Merge in changes from Google code 5.2.4 release -* Minor coding standards cleanup in SMTP class -* Improved unit tests, now tests S/MIME signing -* Travis-CI support on GitHub, runs tests with fake SMTP server - -## Version 5.2.4 (February 19, 2013) -* Fix tag and version bug. -* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail(). -* Numerous translation updates - -## Version 5.2.3 (February 8, 2013) -* Fix issue with older PCREs and ValidateAddress() (Bugz: 124) -* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000 -* Replacement of obsolete Quoted-Printable encoder with a much better implementation -* Composer package definition -* New language added: Hebrew - -## Version 5.2.2 (December 3, 2012) -* Some fixes and syncs from https://github.com/Synchro/PHPMailer -* Add Slovak translation, thanks to Michal Tinka - -## Version 5.2.2-rc2 (November 6, 2012) -* Fix SMTP server rotation (Bugz: 118) -* Allow override of autogen'ed 'Date' header (for Drupal's - og_mailinglist module) -* No whitespace after '-f' option (Bugz: 116) -* Work around potential warning (Bugz: 114) - -## Version 5.2.2-rc1 (September 28, 2012) -* Header encoding works with long lines (Bugz: 93) -* Turkish language update (Bugz: 94) -* undefined $pattern in EncodeQ bug squashed (Bugz: 98) -* use of mail() in safe_mode now works (Bugz: 96) -* ValidateAddress() now 'public static' so people can override the - default and use their own validation scheme. -* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL -* Added in AUTH PLAIN SMTP authentication - -## Version 5.2.2-beta2 (August 17, 2012) -* Fixed Postfix VERP support (Bugz: 92) -* Allow action_function callbacks to pass/use - the From address (passed as final param) -* Prevent inf look for get_lines() (Bugz: 77) -* New public var ($UseSendmailOptions). Only pass sendmail() - options iff we really are using sendmail or something sendmail - compatible. (Bugz: 75) -* default setting for LE returned to "\n" due to popular demand. - -## Version 5.2.2-beta1 (July 13, 2012) -* Expose PreSend() and PostSend() as public methods to allow - for more control if serializing message sending. -* GetSentMIMEMessage() only constructs the message copy when - needed. Save memory. -* Only pass params to mail() if the underlying MTA is - "sendmail" (as defined as "having the string sendmail - in its pathname") [#69] -* Attachments now work with Amazon SES and others [Bugz#70] -* Debug output now sent to stdout (via echo) or error_log [Bugz#5] -* New var: Debugoutput (for above) [Bugz#5] -* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71] -* SMTP reads now can have a Timelimit associated with them - (new var: Timelimit=30)[Bugz#71] -* Fix quoting issue associated with charsets -* default setting for LE is now RFC compliant: "\r\n" -* Return-Path can now be user defined (new var: ReturnPath) - (the default is "" which implies no change from previous - behavior, which was to use either From or Sender) [Bugz#46] -* X-Mailer header can now be disabled (by setting to a - whitespace string, eg " ") [Bugz#66] -* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49, - #52, #31, #41, #5. #70, #69 - -## Version 5.2.1 (January 16, 2012) -* Closed several bugs #5 -* Performance improvements -* MsgHTML() now returns the message as required. -* New method: GetSentMIMEMessage() (returns full copy of sent message) - -## Version 5.2 (July 19, 2011) -* protected MIME body and header -* better DKIM DNS Resource Record support -* better aly handling -* htmlfilter class added to extras -* moved to Apache Extras - -## Version 5.1 (October 20, 2009) -* fixed filename issue with AddStringAttachment (thanks to Tony) -* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in - addition to PHP mail() -* added DKIM digital signing functionality, new properties: - - DKIM_domain (sets the domain name) - - DKIM_private (holds DKIM private key) - - DKIM_passphrase (holds your DKIM passphrase) - - DKIM_selector (holds the DKIM "selector") - - DKIM_identity (holds the identifying email address) -* added callback function support - - callback function parameters include: - result, to, cc, bcc, subject and body - - see the test/test_callback.php file for usage. -* added "auto" identity functionality - - can automatically add: - - Return-path (if Sender not set) - - Reply-To (if ReplyTo not set) - - can be disabled: - - $mail->SetFrom('yourname@yourdomain.com','First Last',false); - - or by adding the $mail->Sender and/or $mail->ReplyTo properties - -Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers - -## Version 5.0.2 (May 24, 2009) -* Fix for missing attachments when inline graphics are present -* Fix for missing Cc in header when using SMTP (mail was sent, - but not displayed in header -- Cc receiver only saw email To: - line and no Cc line, but did get the email (To receiver - saw same) - -## Version 5.0.1 (April 05, 2009) -* Temporary fix for missing attachments - -## Version 5.0.0 (April 02, 2009) -With the release of this version, we are initiating a new version numbering -system to differentiate from the PHP4 version of PHPMailer. -Most notable in this release is fully object oriented code. - -### class.smtp.php: -* Refactored class.smtp.php to support new exception handling -* code size reduced from 29.2 Kb to 25.6 Kb -* Removed unnecessary functions from class.smtp.php: - - public function Expand($name) { - - public function Help($keyword="") { - - public function Noop() { - - public function Send($from) { - - public function SendOrMail($from) { - - public function Verify($name) { - -### class.phpmailer.php: -* Refactored class.phpmailer.php with new exception handling -* Changed processing functionality of Sendmail and Qmail so they cannot be - inadvertently used -* removed getFile() function, just became a simple wrapper for - file_get_contents() -* added check for PHP version (will gracefully exit if not at least PHP 5.0) -* enhanced code to check if an attachment source is the same as an embedded or - inline graphic source to eliminate duplicate attachments - -### New /test_script -We have written a test script you can use to test the script as part of your -installation. Once you press submit, the test script will send a multi-mime -email with either the message you type in or an HTML email with an inline -graphic. Two attachments are included in the email (one of the attachments -is also the inline graphic so you can see that only one copy of the graphic -is sent in the email). The test script will also display the functional -script that you can copy/paste to your editor to duplicate the functionality. - -### New examples -All new examples in both basic and advanced modes. Advanced examples show - Exception handling. - -### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0 -All new documentation - -## Version 2.3 (November 06, 2008) -* added Arabic language (many thanks to Bahjat Al Mostafa) -* removed English language from language files and made it a default within - class.phpmailer.php - if no language is found, it will default to use - the english language translation -* fixed public/private declarations -* corrected line 1728, $basedir to $directory -* added $sign_cert_file to avoid improper duplicate use of $sign_key_file -* corrected $this->Hello on line 612 to $this->Helo -* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user - if default is not acceptable -* removed trim() from return results in EncodeQP -* /test and three files it contained are removed from version 2.3 -* fixed phpunit.php for compliance with PHP5 -* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg); -* We have removed the /phpdoc from the downloads. All documentation is now on - the http://phpmailer.codeworxtech.com website. - -## Version 2.2.1 () July 19 2008 -* fixed line 1092 in class.smtp.php (my apologies, error on my part) - -## Version 2.2 () July 15 2008 -* Fixed redirect issue (display of UTF-8 in thank you redirect) -* fixed error in getResponse function declaration (class.pop3.php) -* PHPMailer now PHP6 compliant -* fixed line 1092 in class.smtp.php (endless loop from missing = sign) - -## Version 2.1 (Wed, June 04 2008) -NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED. - -* added S/MIME functionality (ability to digitally sign emails) - BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. - The "Signed Emails" functionality adds the Sign method to pass the private key - filename and the password to read it, and then email will be sent with - content-type multipart/signed and with the digital signature attached. -* fully compatible with E_STRICT error level - - Please note: - In about half the test environments this development version was subjected - to, an error was thrown for the date() functions used (line 1565 and 1569). - This is NOT a PHPMailer error, it is the result of an incorrectly configured - PHP5 installation. The fix is to modify your 'php.ini' file and include the - date.timezone = Etc/UTC (or your own zone) - directive, to your own server timezone - - If you do get this error, and are unable to access your php.ini file: - In your PHP script, add - `date_default_timezone_set('Etc/UTC');` - - do not try to use - `$myVar = date_default_timezone_get();` - as a test, it will throw an error. -* added ability to define path (mainly for embedded images) - function `MsgHTML($message,$basedir='')` ... where: - `$basedir` is the fully qualified path -* fixed `MsgHTML()` function: - - Embedded Images where images are specified by `://` will not be altered or embedded -* fixed the return value of SMTP exit code ( pclose ) -* addressed issue of multibyte characters in subject line and truncating -* added ability to have user specified Message ID - (default is still that PHPMailer create a unique Message ID) -* corrected unidentified message type to 'application/octet-stream' -* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al). -* added check for added attachments -* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny") - -## Version 2.1.0beta2 (Sun, Dec 02 2007) -* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon) -* finished all testing, all known bugs corrected, enhancements tested - -Note: will NOT work with PHP4. - -Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING** - -## Version 2.1.0beta1 -Please note, this is BETA software -** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS - INTENDED STRICTLY FOR TESTING - -## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release -* implements new property to control VERP in class.smtp.php - example (requires instantiating class.smtp.php): - $mail->do_verp = true; -* POP-before-SMTP functionality included, thanks to Richard Davey - (see class.pop3.php & pop3_before_smtp_test.php for examples) -* included example showing how to use PHPMailer with GMAIL -* fixed the missing Cc in SendMail() and Mail() - -## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release -* dramatically simplified using inline graphics ... it's fully automated and requires no user input -* added automatic document type detection for attachments and pictures -* added MsgHTML() function to replace Body tag for HTML emails -* fixed the SendMail security issues (input validation vulnerability) -* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address -* removed the need to use the AltBody method (set from the HTML, or default text used) -* set the PHP Mail() function as the default (still support SendMail, SMTP Mail) -* removed the need to set the IsHTML property (set automatically) -* added Estonian language file by Indrek Päri -* added header injection patch -* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc. -* fixed warning message in SMTP get_lines method -* added TLS/SSL SMTP support. -* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7) -* Works with PHP installed as a module or as CGI-PHP -NOTE: will NOT work with PHP5 in E_STRICT error mode - -## Version 1.73 (Sun, Jun 10 2005) -* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf -* Now has a total of 20 translations -* Fixed alt attachments bug: http://tinyurl.com/98u9k - -## Version 1.72 (Wed, May 25 2004) -* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations. -* Received: Removed this method because spam filter programs like - SpamAssassin reject this header. -* Fixed error count bug. -* SetLanguage default is now "language/". -* Fixed magic_quotes_runtime bug. - -## Version 1.71 (Tue, Jul 28 2003) -* Made several speed enhancements -* Added German and Italian translation files -* Fixed HELO/AUTH bugs on keep-alive connects -* Now provides an error message if language file does not load -* Fixed attachment EOL bug -* Updated some unclear documentation -* Added additional tests and improved others - -## Version 1.70 (Mon, Jun 20 2003) -* Added SMTP keep-alive support -* Added IsError method for error detection -* Added error message translation support (SetLanguage) -* Refactored many methods to increase library performance -* Hello now sends the newer EHLO message before HELO as per RFC 2821 -* Removed the boundary class and replaced it with GetBoundary -* Removed queue support methods -* New $Hostname variable -* New Message-ID header -* Received header reformat -* Helo variable default changed to $Hostname -* Removed extra spaces in Content-Type definition (#667182) -* Return-Path should be set to Sender when set -* Adds Q or B encoding to headers when necessary -* quoted-encoding should now encode NULs \000 -* Fixed encoding of body/AltBody (#553370) -* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC) -* Multiple bug fixes - -## Version 1.65 (Fri, Aug 09 2002) -* Fixed non-visible attachment bug (#585097) for Outlook -* SMTP connections are now closed after each transaction -* Fixed SMTP::Expand return value -* Converted SMTP class documentation to phpDocumentor format - -## Version 1.62 (Wed, Jun 26 2002) -* Fixed multi-attach bug -* Set proper word wrapping -* Reduced memory use with attachments -* Added more debugging -* Changed documentation to phpDocumentor format - -## Version 1.60 (Sat, Mar 30 2002) -* Sendmail pipe and address patch (Christian Holtje) -* Added embedded image and read confirmation support (A. Ognio) -* Added unit tests -* Added SMTP timeout support (*nix only) -* Added possibly temporary PluginDir variable for SMTP class -* Added LE message line ending variable -* Refactored boundary and attachment code -* Eliminated SMTP class warnings -* Added SendToQueue method for future queuing support - -## Version 1.54 (Wed, Dec 19 2001) -* Add some queuing support code -* Fixed a pesky multi/alt bug -* Messages are no longer forced to have "To" addresses - -## Version 1.50 (Thu, Nov 08 2001) -* Fix extra lines when not using SMTP mailer -* Set WordWrap variable to int with a zero default - -## Version 1.47 (Tue, Oct 16 2001) -* Fixed Received header code format -* Fixed AltBody order error -* Fixed alternate port warning - -## Version 1.45 (Tue, Sep 25 2001) -* Added enhanced SMTP debug support -* Added support for multiple ports on SMTP -* Added Received header for tracing -* Fixed AddStringAttachment encoding -* Fixed possible header name quote bug -* Fixed wordwrap() trim bug -* Couple other small bug fixes - -## Version 1.41 (Wed, Aug 22 2001) -* Fixed AltBody bug w/o attachments -* Fixed rfc_date() for certain mail servers - -## Version 1.40 (Sun, Aug 12 2001) -* Added multipart/alternative support (AltBody) -* Documentation update -* Fixed bug in Mercury MTA - -## Version 1.29 (Fri, Aug 03 2001) -* Added AddStringAttachment() method -* Added SMTP authentication support - -## Version 1.28 (Mon, Jul 30 2001) -* Fixed a typo in SMTP class -* Fixed header issue with Imail (win32) SMTP server -* Made fopen() calls for attachments use "rb" to fix win32 error - -## Version 1.25 (Mon, Jul 02 2001) -* Added RFC 822 date fix (Patrice) -* Added improved error handling by adding a $ErrorInfo variable -* Removed MailerDebug variable (obsolete with new error handler) - -## Version 1.20 (Mon, Jun 25 2001) -* Added quoted-printable encoding (Patrice) -* Set Version as public and removed PrintVersion() -* Changed phpdoc to only display public variables and methods - -## Version 1.19 (Thu, Jun 21 2001) -* Fixed MS Mail header bug -* Added fix for Bcc problem with mail(). *Does not work on Win32* - (See PHP bug report: http://www.php.net/bugs.php?id=11616) -* mail() no longer passes a fifth parameter when not needed - -## Version 1.15 (Fri, Jun 15 2001) -Note: these changes contributed by Patrice Fournier -* Changed all remaining \n to \r\n -* Bcc: header no longer written to message except - when sent directly to sendmail -* Added a small message to non-MIME compliant mail reader -* Added Sender variable to change the Sender email - used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode -* Changed boundary setting to a place it will be set only once -* Removed transfer encoding for whole message when using multipart -* Message body now uses Encoding in multipart messages -* Can set encoding and type to attachments 7bit, 8bit - and binary attachment are sent as is, base64 are encoded -* Can set Encoding to base64 to send 8 bits body - through 7 bits servers - -## Version 1.10 (Tue, Jun 12 2001) -* Fixed win32 mail header bug (printed out headers in message body) - -## Version 1.09 (Fri, Jun 08 2001) -* Changed date header to work with Netscape mail programs -* Altered phpdoc documentation - -## Version 1.08 (Tue, Jun 05 2001) -* Added enhanced error-checking -* Added phpdoc documentation to source - -## Version 1.06 (Fri, Jun 01 2001) -* Added optional name for file attachments - -## Version 1.05 (Tue, May 29 2001) -* Code cleanup -* Eliminated sendmail header warning message -* Fixed possible SMTP error - -## Version 1.03 (Thu, May 24 2001) -* Fixed problem where qmail sends out duplicate messages - -## Version 1.02 (Wed, May 23 2001) -* Added multiple recipient and attachment Clear* methods -* Added Sendmail public variable -* Fixed problem with loading SMTP library multiple times - -## Version 0.98 (Tue, May 22 2001) -* Fixed problem with redundant mail hosts sending out multiple messages -* Added additional error handler code -* Added AddCustomHeader() function -* Added support for Microsoft mail client headers (affects priority) -* Fixed small bug with Mailer variable -* Added PrintVersion() function - -## Version 0.92 (Tue, May 15 2001) -* Changed file names to class.phpmailer.php and class.smtp.php to match - current PHP class trend. -* Fixed problem where body not being printed when a message is attached -* Several small bug fixes - -## Version 0.90 (Tue, April 17 2001) -* Initial public release diff --git a/download/phpmailer529/class.phpmailer.php b/download/phpmailer529/class.phpmailer.php deleted file mode 100755 index bc07d6941..000000000 --- a/download/phpmailer529/class.phpmailer.php +++ /dev/null @@ -1,3471 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer - PHP email creation and transport class. - * @package PHPMailer - * @author Marcus Bointon (Synchro/coolbru) - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - */ -class PHPMailer -{ - /** - * The PHPMailer Version number. - * @type string - */ - public $Version = '5.2.9'; - - /** - * Email priority. - * Options: 1 = High, 3 = Normal, 5 = low. - * @type integer - */ - public $Priority = 3; - - /** - * The character set of the message. - * @type string - */ - public $CharSet = 'iso-8859-1'; - - /** - * The MIME Content-type of the message. - * @type string - */ - public $ContentType = 'text/plain'; - - /** - * The message encoding. - * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". - * @type string - */ - public $Encoding = '8bit'; - - /** - * Holds the most recent mailer error message. - * @type string - */ - public $ErrorInfo = ''; - - /** - * The From email address for the message. - * @type string - */ - public $From = 'root@localhost'; - - /** - * The From name of the message. - * @type string - */ - public $FromName = 'Root User'; - - /** - * The Sender email (Return-Path) of the message. - * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. - * @type string - */ - public $Sender = ''; - - /** - * The Return-Path of the message. - * If empty, it will be set to either From or Sender. - * @type string - * @deprecated Email senders should never set a return-path header; - * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything. - * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference - */ - public $ReturnPath = ''; - - /** - * The Subject of the message. - * @type string - */ - public $Subject = ''; - - /** - * An HTML or plain text message body. - * If HTML then call isHTML(true). - * @type string - */ - public $Body = ''; - - /** - * The plain-text message body. - * This body can be read by mail clients that do not have HTML email - * capability such as mutt & Eudora. - * Clients that can read HTML will view the normal Body. - * @type string - */ - public $AltBody = ''; - - /** - * An iCal message part body. - * Only supported in simple alt or alt_inline message types - * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator - * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ - * @link http://kigkonsult.se/iCalcreator/ - * @type string - */ - public $Ical = ''; - - /** - * The complete compiled MIME message body. - * @access protected - * @type string - */ - protected $MIMEBody = ''; - - /** - * The complete compiled MIME message headers. - * @type string - * @access protected - */ - protected $MIMEHeader = ''; - - /** - * Extra headers that createHeader() doesn't fold in. - * @type string - * @access protected - */ - protected $mailHeader = ''; - - /** - * Word-wrap the message body to this number of chars. - * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance. - * @type integer - */ - public $WordWrap = 0; - - /** - * Which method to use to send mail. - * Options: "mail", "sendmail", or "smtp". - * @type string - */ - public $Mailer = 'mail'; - - /** - * The path to the sendmail program. - * @type string - */ - public $Sendmail = '/usr/sbin/sendmail'; - - /** - * Whether mail() uses a fully sendmail-compatible MTA. - * One which supports sendmail's "-oi -f" options. - * @type boolean - */ - public $UseSendmailOptions = true; - - /** - * Path to PHPMailer plugins. - * Useful if the SMTP class is not in the PHP include path. - * @type string - * @deprecated Should not be needed now there is an autoloader. - */ - public $PluginDir = ''; - - /** - * The email address that a reading confirmation should be sent to. - * @type string - */ - public $ConfirmReadingTo = ''; - - /** - * The hostname to use in Message-Id and Received headers - * and as default HELO string. - * If empty, the value returned - * by SERVER_NAME is used or 'localhost.localdomain'. - * @type string - */ - public $Hostname = ''; - - /** - * An ID to be used in the Message-Id header. - * If empty, a unique id will be generated. - * @type string - */ - public $MessageID = ''; - - /** - * The message Date to be used in the Date header. - * If empty, the current date will be added. - * @type string - */ - public $MessageDate = ''; - - /** - * SMTP hosts. - * Either a single hostname or multiple semicolon-delimited hostnames. - * You can also specify a different port - * for each host by using this format: [hostname:port] - * (e.g. "smtp1.example.com:25;smtp2.example.com"). - * You can also specify encryption type, for example: - * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). - * Hosts will be tried in order. - * @type string - */ - public $Host = 'localhost'; - - /** - * The default SMTP server port. - * @type integer - * @TODO Why is this needed when the SMTP class takes care of it? - */ - public $Port = 25; - - /** - * The SMTP HELO of the message. - * Default is $Hostname. - * @type string - * @see PHPMailer::$Hostname - */ - public $Helo = ''; - - /** - * The secure connection prefix. - * Options: "", "ssl" or "tls" - * @type string - */ - public $SMTPSecure = ''; - - /** - * Whether to use SMTP authentication. - * Uses the Username and Password properties. - * @type boolean - * @see PHPMailer::$Username - * @see PHPMailer::$Password - */ - public $SMTPAuth = false; - - /** - * SMTP username. - * @type string - */ - public $Username = ''; - - /** - * SMTP password. - * @type string - */ - public $Password = ''; - - /** - * SMTP auth type. - * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 - * @type string - */ - public $AuthType = ''; - - /** - * SMTP realm. - * Used for NTLM auth - * @type string - */ - public $Realm = ''; - - /** - * SMTP workstation. - * Used for NTLM auth - * @type string - */ - public $Workstation = ''; - - /** - * The SMTP server timeout in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * @type integer - */ - public $Timeout = 300; - - /** - * SMTP class debug output mode. - * Debug output level. - * Options: - * * `0` No output - * * `1` Commands - * * `2` Data and commands - * * `3` As 2 plus connection status - * * `4` Low-level data output - * @type integer - * @see SMTP::$do_debug - */ - public $SMTPDebug = 0; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `
    `, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * - * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * - * @type string|callable - * @see SMTP::$Debugoutput - */ - public $Debugoutput = 'echo'; - - /** - * Whether to keep SMTP connection open after each message. - * If this is set to true then to close the connection - * requires an explicit call to smtpClose(). - * @type boolean - */ - public $SMTPKeepAlive = false; - - /** - * Whether to split multiple to addresses into multiple messages - * or send them all in one message. - * @type boolean - */ - public $SingleTo = false; - - /** - * Storage for addresses when SingleTo is enabled. - * @type array - * @TODO This should really not be public - */ - public $SingleToArray = array(); - - /** - * Whether to generate VERP addresses on send. - * Only applicable when sending via SMTP. - * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Postfix VERP info - * @type boolean - */ - public $do_verp = false; - - /** - * Whether to allow sending messages with an empty body. - * @type boolean - */ - public $AllowEmpty = false; - - /** - * The default line ending. - * @note The default remains "\n". We force CRLF where we know - * it must be used via self::CRLF. - * @type string - */ - public $LE = "\n"; - - /** - * DKIM selector. - * @type string - */ - public $DKIM_selector = ''; - - /** - * DKIM Identity. - * Usually the email address used as the source of the email - * @type string - */ - public $DKIM_identity = ''; - - /** - * DKIM passphrase. - * Used if your key is encrypted. - * @type string - */ - public $DKIM_passphrase = ''; - - /** - * DKIM signing domain name. - * @example 'example.com' - * @type string - */ - public $DKIM_domain = ''; - - /** - * DKIM private key file path. - * @type string - */ - public $DKIM_private = ''; - - /** - * Callback Action function name. - * - * The function that handles the result of the send email action. - * It is called out by send() for each email sent. - * - * Value can be any php callable: http://www.php.net/is_callable - * - * Parameters: - * boolean $result result of the send action - * string $to email address of the recipient - * string $cc cc email addresses - * string $bcc bcc email addresses - * string $subject the subject - * string $body the email body - * string $from email address of sender - * @type string - */ - public $action_function = ''; - - /** - * What to use in the X-Mailer header. - * Options: null for default, whitespace for none, or a string to use - * @type string - */ - public $XMailer = ''; - - /** - * An instance of the SMTP sender class. - * @type SMTP - * @access protected - */ - protected $smtp = null; - - /** - * The array of 'to' addresses. - * @type array - * @access protected - */ - protected $to = array(); - - /** - * The array of 'cc' addresses. - * @type array - * @access protected - */ - protected $cc = array(); - - /** - * The array of 'bcc' addresses. - * @type array - * @access protected - */ - protected $bcc = array(); - - /** - * The array of reply-to names and addresses. - * @type array - * @access protected - */ - protected $ReplyTo = array(); - - /** - * An array of all kinds of addresses. - * Includes all of $to, $cc, $bcc, $replyto - * @type array - * @access protected - */ - protected $all_recipients = array(); - - /** - * The array of attachments. - * @type array - * @access protected - */ - protected $attachment = array(); - - /** - * The array of custom headers. - * @type array - * @access protected - */ - protected $CustomHeader = array(); - - /** - * The most recent Message-ID (including angular brackets). - * @type string - * @access protected - */ - protected $lastMessageID = ''; - - /** - * The message's MIME type. - * @type string - * @access protected - */ - protected $message_type = ''; - - /** - * The array of MIME boundary strings. - * @type array - * @access protected - */ - protected $boundary = array(); - - /** - * The array of available languages. - * @type array - * @access protected - */ - protected $language = array(); - - /** - * The number of errors encountered. - * @type integer - * @access protected - */ - protected $error_count = 0; - - /** - * The S/MIME certificate file path. - * @type string - * @access protected - */ - protected $sign_cert_file = ''; - - /** - * The S/MIME key file path. - * @type string - * @access protected - */ - protected $sign_key_file = ''; - - /** - * The S/MIME password for the key. - * Used only if the key is encrypted. - * @type string - * @access protected - */ - protected $sign_key_pass = ''; - - /** - * Whether to throw exceptions for errors. - * @type boolean - * @access protected - */ - protected $exceptions = false; - - /** - * Error severity: message only, continue processing. - */ - const STOP_MESSAGE = 0; - - /** - * Error severity: message, likely ok to continue processing. - */ - const STOP_CONTINUE = 1; - - /** - * Error severity: message, plus full stop, critical error reached. - */ - const STOP_CRITICAL = 2; - - /** - * SMTP RFC standard line ending. - */ - const CRLF = "\r\n"; - - /** - * Constructor. - * @param boolean $exceptions Should we throw external exceptions? - */ - public function __construct($exceptions = false) - { - $this->exceptions = (boolean)$exceptions; - } - - /** - * Destructor. - */ - public function __destruct() - { - if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely - $this->smtpClose(); - } - } - - /** - * Call mail() in a safe_mode-aware fashion. - * Also, unless sendmail_path points to sendmail (or something that - * claims to be sendmail), don't pass params (not a perfect fix, - * but it will do) - * @param string $to To - * @param string $subject Subject - * @param string $body Message Body - * @param string $header Additional Header(s) - * @param string $params Params - * @access private - * @return boolean - */ - private function mailPassthru($to, $subject, $body, $header, $params) - { - //Check overloading of mail function to avoid double-encoding - if (ini_get('mbstring.func_overload') & 1) { - $subject = $this->secureHeader($subject); - } else { - $subject = $this->encodeHeader($this->secureHeader($subject)); - } - if (ini_get('safe_mode') || !($this->UseSendmailOptions)) { - $result = @mail($to, $subject, $body, $header); - } else { - $result = @mail($to, $subject, $body, $header, $params); - } - return $result; - } - - /** - * Output debugging info via user-defined method. - * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug). - * @see PHPMailer::$Debugoutput - * @see PHPMailer::$SMTPDebug - * @param string $str - */ - protected function edebug($str) - { - if ($this->SMTPDebug <= 0) { - return; - } - //Avoid clash with built-in function names - if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->SMTPDebug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "
    \n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - ) . "\n"; - } - } - - /** - * Sets message type to HTML or plain. - * @param boolean $isHtml True for HTML mode. - * @return void - */ - public function isHTML($isHtml = true) - { - if ($isHtml) { - $this->ContentType = 'text/html'; - } else { - $this->ContentType = 'text/plain'; - } - } - - /** - * Send messages using SMTP. - * @return void - */ - public function isSMTP() - { - $this->Mailer = 'smtp'; - } - - /** - * Send messages using PHP's mail() function. - * @return void - */ - public function isMail() - { - $this->Mailer = 'mail'; - } - - /** - * Send messages using $Sendmail. - * @return void - */ - public function isSendmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'sendmail')) { - $this->Sendmail = '/usr/sbin/sendmail'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'sendmail'; - } - - /** - * Send messages using qmail. - * @return void - */ - public function isQmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'qmail')) { - $this->Sendmail = '/var/qmail/bin/qmail-inject'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'qmail'; - } - - /** - * Add a "To" address. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addAddress($address, $name = '') - { - return $this->addAnAddress('to', $address, $name); - } - - /** - * Add a "CC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addCC($address, $name = '') - { - return $this->addAnAddress('cc', $address, $name); - } - - /** - * Add a "BCC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addBCC($address, $name = '') - { - return $this->addAnAddress('bcc', $address, $name); - } - - /** - * Add a "Reply-to" address. - * @param string $address - * @param string $name - * @return boolean - */ - public function addReplyTo($address, $name = '') - { - return $this->addAnAddress('Reply-To', $address, $name); - } - - /** - * Add an address to one of the recipient arrays. - * Addresses that have been added already return false, but do not throw exceptions - * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' - * @param string $address The email address to send to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function addAnAddress($kind, $address, $name = '') - { - if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { - $this->setError($this->lang('Invalid recipient array') . ': ' . $kind); - $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind); - if ($this->exceptions) { - throw new phpmailerException('Invalid recipient array: ' . $kind); - } - return false; - } - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->validateAddress($address)) { - $this->setError($this->lang('invalid_address') . ': ' . $address); - $this->edebug($this->lang('invalid_address') . ': ' . $address); - if ($this->exceptions) { - throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); - } - return false; - } - if ($kind != 'Reply-To') { - if (!isset($this->all_recipients[strtolower($address)])) { - array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; - return true; - } - } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); - return true; - } - } - return false; - } - - /** - * Set the From and FromName properties. - * @param string $address - * @param string $name - * @param boolean $auto Whether to also set the Sender address, defaults to true - * @throws phpmailerException - * @return boolean - */ - public function setFrom($address, $name = '', $auto = true) - { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->validateAddress($address)) { - $this->setError($this->lang('invalid_address') . ': ' . $address); - $this->edebug($this->lang('invalid_address') . ': ' . $address); - if ($this->exceptions) { - throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); - } - return false; - } - $this->From = $address; - $this->FromName = $name; - if ($auto) { - if (empty($this->Sender)) { - $this->Sender = $address; - } - } - return true; - } - - /** - * Return the Message-ID header of the last email. - * Technically this is the value from the last time the headers were created, - * but it's also the message ID of the last sent message except in - * pathological cases. - * @return string - */ - public function getLastMessageID() - { - return $this->lastMessageID; - } - - /** - * Check that a string looks like an email address. - * @param string $address The email address to check - * @param string $patternselect A selector for the validation pattern to use : - * * `auto` Pick strictest one automatically; - * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; - * * `pcre` Use old PCRE implementation; - * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains; - * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. - * * `noregex` Don't use a regex: super fast, really dumb. - * @return boolean - * @static - * @access public - */ - public static function validateAddress($address, $patternselect = 'auto') - { - if (!$patternselect or $patternselect == 'auto') { - //Check this constant first so it works when extension_loaded() is disabled by safe mode - //Constant was added in PHP 5.2.4 - if (defined('PCRE_VERSION')) { - //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2 - if (version_compare(PCRE_VERSION, '8.0.3') >= 0) { - $patternselect = 'pcre8'; - } else { - $patternselect = 'pcre'; - } - } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) { - //Fall back to older PCRE - $patternselect = 'pcre'; - } else { - //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension - if (version_compare(PHP_VERSION, '5.2.0') >= 0) { - $patternselect = 'php'; - } else { - $patternselect = 'noregex'; - } - } - } - switch ($patternselect) { - case 'pcre8': - /** - * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. - * @link http://squiloople.com/2009/12/20/email-address-validation/ - * @copyright 2009-2010 Michael Rushton - * Feel free to use and redistribute this code. But please keep this copyright notice. - */ - return (boolean)preg_match( - '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . - '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . - '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . - '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . - '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . - '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . - '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . - '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', - $address - ); - case 'pcre': - //An older regex that doesn't need a recent PCRE - return (boolean)preg_match( - '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . - '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . - '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . - '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . - '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . - '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . - '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . - '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . - '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', - $address - ); - case 'html5': - /** - * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. - * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) - */ - return (boolean)preg_match( - '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . - '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', - $address - ); - case 'noregex': - //No PCRE! Do something _very_ approximate! - //Check the address is 3 chars or longer and contains an @ that's not the first or last char - return (strlen($address) >= 3 - and strpos($address, '@') >= 1 - and strpos($address, '@') != strlen($address) - 1); - case 'php': - default: - return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); - } - } - - /** - * Create a message and send it. - * Uses the sending method specified by $Mailer. - * @throws phpmailerException - * @return boolean false on error - See the ErrorInfo property for details of the error. - */ - public function send() - { - try { - if (!$this->preSend()) { - return false; - } - return $this->postSend(); - } catch (phpmailerException $exc) { - $this->mailHeader = ''; - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Prepare a message for sending. - * @throws phpmailerException - * @return boolean - */ - public function preSend() - { - try { - $this->mailHeader = ''; - if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { - throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL); - } - - // Set whether the message is multipart/alternative - if (!empty($this->AltBody)) { - $this->ContentType = 'multipart/alternative'; - } - - $this->error_count = 0; // reset errors - $this->setMessageType(); - // Refuse to send an empty message unless we are specifically allowing it - if (!$this->AllowEmpty and empty($this->Body)) { - throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL); - } - - $this->MIMEHeader = $this->createHeader(); - $this->MIMEBody = $this->createBody(); - - // To capture the complete message when using mail(), create - // an extra header list which createHeader() doesn't fold in - if ($this->Mailer == 'mail') { - if (count($this->to) > 0) { - $this->mailHeader .= $this->addrAppend('To', $this->to); - } else { - $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - $this->mailHeader .= $this->headerLine( - 'Subject', - $this->encodeHeader($this->secureHeader(trim($this->Subject))) - ); - } - - // Sign with DKIM if enabled - if (!empty($this->DKIM_domain) - && !empty($this->DKIM_private) - && !empty($this->DKIM_selector) - && file_exists($this->DKIM_private)) { - $header_dkim = $this->DKIM_Add( - $this->MIMEHeader . $this->mailHeader, - $this->encodeHeader($this->secureHeader($this->Subject)), - $this->MIMEBody - ); - $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF . - str_replace("\r\n", "\n", $header_dkim) . self::CRLF; - } - return true; - - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Actually send a message. - * Send the email via the selected mechanism - * @throws phpmailerException - * @return boolean - */ - public function postSend() - { - try { - // Choose the mailer and send through it - switch ($this->Mailer) { - case 'sendmail': - case 'qmail': - return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); - case 'smtp': - return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); - case 'mail': - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - default: - $sendMethod = $this->Mailer.'Send'; - if (method_exists($this, $sendMethod)) { - return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); - } - - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - } - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - } - return false; - } - - /** - * Send mail using the $Sendmail program. - * @param string $header The message headers - * @param string $body The message body - * @see PHPMailer::$Sendmail - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function sendmailSend($header, $body) - { - if ($this->Sender != '') { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } else { - $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } - } else { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail)); - } else { - $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail)); - } - } - if ($this->SingleTo) { - foreach ($this->SingleToArray as $toAddr) { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, 'To: ' . $toAddr . "\n"); - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback( - ($result == 0), - array($toAddr), - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From - ); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - } else { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - return true; - } - - /** - * Send mail using the PHP mail() function. - * @param string $header The message headers - * @param string $body The message body - * @link http://www.php.net/manual/en/book.mail.php - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function mailSend($header, $body) - { - $toArr = array(); - foreach ($this->to as $toaddr) { - $toArr[] = $this->addrFormat($toaddr); - } - $to = implode(', ', $toArr); - - if (empty($this->Sender)) { - $params = ' '; - } else { - $params = sprintf('-f%s', $this->Sender); - } - if ($this->Sender != '' and !ini_get('safe_mode')) { - $old_from = ini_get('sendmail_from'); - ini_set('sendmail_from', $this->Sender); - } - $result = false; - if ($this->SingleTo && count($toArr) > 1) { - foreach ($toArr as $toAddr) { - $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - } else { - $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); - $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - if (isset($old_from)) { - ini_set('sendmail_from', $old_from); - } - if (!$result) { - throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL); - } - return true; - } - - /** - * Get an instance to use for SMTP operations. - * Override this function to load your own SMTP implementation - * @return SMTP - */ - public function getSMTPInstance() - { - if (!is_object($this->smtp)) { - $this->smtp = new SMTP; - } - return $this->smtp; - } - - /** - * Send mail via SMTP. - * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. - * Uses the PHPMailerSMTP class by default. - * @see PHPMailer::getSMTPInstance() to use a different class. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @uses SMTP - * @access protected - * @return boolean - */ - protected function smtpSend($header, $body) - { - $bad_rcpt = array(); - - if (!$this->smtpConnect()) { - throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); - } - $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; - if (!$this->smtp->mail($smtp_from)) { - $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); - throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); - } - - // Attempt to send to all recipients - foreach ($this->to as $to) { - if (!$this->smtp->recipient($to[0])) { - $bad_rcpt[] = $to[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From); - } - foreach ($this->cc as $cc) { - if (!$this->smtp->recipient($cc[0])) { - $bad_rcpt[] = $cc[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From); - } - foreach ($this->bcc as $bcc) { - if (!$this->smtp->recipient($bcc[0])) { - $bad_rcpt[] = $bcc[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From); - } - - // Only send the DATA command if we have viable recipients - if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) { - throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL); - } - if ($this->SMTPKeepAlive) { - $this->smtp->reset(); - } else { - $this->smtp->quit(); - $this->smtp->close(); - } - if (count($bad_rcpt) > 0) { // Create error message for any bad addresses - throw new phpmailerException( - $this->lang('recipients_failed') . implode(', ', $bad_rcpt), - self::STOP_CONTINUE - ); - } - return true; - } - - /** - * Initiate a connection to an SMTP server. - * Returns false if the operation failed. - * @param array $options An array of options compatible with stream_context_create() - * @uses SMTP - * @access public - * @throws phpmailerException - * @return boolean - */ - public function smtpConnect($options = array()) - { - if (is_null($this->smtp)) { - $this->smtp = $this->getSMTPInstance(); - } - - // Already connected? - if ($this->smtp->connected()) { - return true; - } - - $this->smtp->setTimeout($this->Timeout); - $this->smtp->setDebugLevel($this->SMTPDebug); - $this->smtp->setDebugOutput($this->Debugoutput); - $this->smtp->setVerp($this->do_verp); - $hosts = explode(';', $this->Host); - $lastexception = null; - - foreach ($hosts as $hostentry) { - $hostinfo = array(); - if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { - // Not a valid host entry - continue; - } - // $hostinfo[2]: optional ssl or tls prefix - // $hostinfo[3]: the hostname - // $hostinfo[4]: optional port number - // The host string prefix can temporarily override the current setting for SMTPSecure - // If it's not specified, the default value is used - $prefix = ''; - $tls = ($this->SMTPSecure == 'tls'); - if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) { - $prefix = 'ssl://'; - $tls = false; // Can't have SSL and TLS at once - } elseif ($hostinfo[2] == 'tls') { - $tls = true; - // tls doesn't use a prefix - } - $host = $hostinfo[3]; - $port = $this->Port; - $tport = (integer)$hostinfo[4]; - if ($tport > 0 and $tport < 65536) { - $port = $tport; - } - if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { - try { - if ($this->Helo) { - $hello = $this->Helo; - } else { - $hello = $this->serverHostname(); - } - $this->smtp->hello($hello); - - if ($tls) { - if (!$this->smtp->startTLS()) { - throw new phpmailerException($this->lang('connect_host')); - } - // We must resend HELO after tls negotiation - $this->smtp->hello($hello); - } - if ($this->SMTPAuth) { - if (!$this->smtp->authenticate( - $this->Username, - $this->Password, - $this->AuthType, - $this->Realm, - $this->Workstation - ) - ) { - throw new phpmailerException($this->lang('authenticate')); - } - } - return true; - } catch (phpmailerException $exc) { - $lastexception = $exc; - // We must have connected, but then failed TLS or Auth, so close connection nicely - $this->smtp->quit(); - } - } - } - // If we get here, all connection attempts have failed, so close connection hard - $this->smtp->close(); - // As we've caught all exceptions, just report whatever the last one was - if ($this->exceptions and !is_null($lastexception)) { - throw $lastexception; - } - return false; - } - - /** - * Close the active SMTP session if one exists. - * @return void - */ - public function smtpClose() - { - if ($this->smtp !== null) { - if ($this->smtp->connected()) { - $this->smtp->quit(); - $this->smtp->close(); - } - } - } - - /** - * Set the language for error messages. - * Returns false if it cannot load the language file. - * The default language is English. - * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") - * @param string $lang_path Path to the language file directory, with trailing separator (slash) - * @return boolean - * @access public - */ - public function setLanguage($langcode = 'en', $lang_path = '') - { - // Define full set of translatable strings in English - $PHPMAILER_LANG = array( - 'authenticate' => 'SMTP Error: Could not authenticate.', - 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', - 'data_not_accepted' => 'SMTP Error: data not accepted.', - 'empty_message' => 'Message body empty', - 'encoding' => 'Unknown encoding: ', - 'execute' => 'Could not execute: ', - 'file_access' => 'Could not access file: ', - 'file_open' => 'File Error: Could not open file: ', - 'from_failed' => 'The following From address failed: ', - 'instantiate' => 'Could not instantiate mail function.', - 'invalid_address' => 'Invalid address', - 'mailer_not_supported' => ' mailer is not supported.', - 'provide_address' => 'You must provide at least one recipient email address.', - 'recipients_failed' => 'SMTP Error: The following recipients failed: ', - 'signing' => 'Signing Error: ', - 'smtp_connect_failed' => 'SMTP connect() failed.', - 'smtp_error' => 'SMTP server error: ', - 'variable_set' => 'Cannot set or reset variable: ' - ); - if (empty($lang_path)) { - // Calculate an absolute path so it can work if CWD is not here - $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR; - } - $foundlang = true; - $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; - if ($langcode != 'en') { // There is no English translation file - // Make sure language file path is readable - if (!is_readable($lang_file)) { - $foundlang = false; - } else { - // Overwrite language-specific strings. - // This way we'll never have missing translations. - $foundlang = include $lang_file; - } - } - $this->language = $PHPMAILER_LANG; - return (boolean)$foundlang; // Returns false if language not found - } - - /** - * Get the array of strings for the current language. - * @return array - */ - public function getTranslations() - { - return $this->language; - } - - /** - * Create recipient headers. - * @access public - * @param string $type - * @param array $addr An array of recipient, - * where each recipient is a 2-element indexed array with element 0 containing an address - * and element 1 containing a name, like: - * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User')) - * @return string - */ - public function addrAppend($type, $addr) - { - $addresses = array(); - foreach ($addr as $address) { - $addresses[] = $this->addrFormat($address); - } - return $type . ': ' . implode(', ', $addresses) . $this->LE; - } - - /** - * Format an address for use in a message header. - * @access public - * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name - * like array('joe@example.com', 'Joe User') - * @return string - */ - public function addrFormat($addr) - { - if (empty($addr[1])) { // No name provided - return $this->secureHeader($addr[0]); - } else { - return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader( - $addr[0] - ) . '>'; - } - } - - /** - * Word-wrap message. - * For use with mailers that do not automatically perform wrapping - * and for quoted-printable encoded messages. - * Original written by philippe. - * @param string $message The message to wrap - * @param integer $length The line length to wrap to - * @param boolean $qp_mode Whether to run in Quoted-Printable mode - * @access public - * @return string - */ - public function wrapText($message, $length, $qp_mode = false) - { - $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE; - // If utf-8 encoding is used, we will need to make sure we don't - // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == 'utf-8'); - $lelen = strlen($this->LE); - $crlflen = strlen(self::CRLF); - - $message = $this->fixEOL($message); - if (substr($message, -$lelen) == $this->LE) { - $message = substr($message, 0, -$lelen); - } - - $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE - $message = ''; - for ($i = 0; $i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); - $buf = ''; - for ($e = 0; $e < count($line_part); $e++) { - $word = $line_part[$e]; - if ($qp_mode and (strlen($word) > $length)) { - $space_left = $length - strlen($buf) - $crlflen; - if ($e != 0) { - if ($space_left > 20) { - $len = $space_left; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= ' ' . $part; - $message .= $buf . sprintf('=%s', self::CRLF); - } else { - $message .= $buf . $soft_break; - } - $buf = ''; - } - while (strlen($word) > 0) { - if ($length <= 0) { - break; - } - $len = $length; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) { - $message .= $part . sprintf('=%s', self::CRLF); - } else { - $buf = $part; - } - } - } else { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (' ' . $word); - - if (strlen($buf) > $length and $buf_o != '') { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . self::CRLF; - } - - return $message; - } - - /** - * Find the last character boundary prior to $maxLength in a utf-8 - * quoted (printable) encoded string. - * Original written by Colin Brown. - * @access public - * @param string $encodedText utf-8 QP text - * @param integer $maxLength find last character boundary prior to this length - * @return integer - */ - public function utf8CharBoundary($encodedText, $maxLength) - { - $foundSplitPos = false; - $lookBack = 3; - while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, '='); - if (false !== $encodedCharPos) { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) { // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - $maxLength = ($encodedCharPos == 0) ? $maxLength : - $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec >= 192) { // First byte of a multi byte character - // Reduce maxLength to split at start of character - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } else { - // No encoded character found - $foundSplitPos = true; - } - } - return $maxLength; - } - - /** - * Set the body wrapping. - * @access public - * @return void - */ - public function setWordWrap() - { - if ($this->WordWrap < 1) { - return; - } - - switch ($this->message_type) { - case 'alt': - case 'alt_inline': - case 'alt_attach': - case 'alt_inline_attach': - $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->wrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assemble message headers. - * @access public - * @return string The assembled headers - */ - public function createHeader() - { - $result = ''; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = 'b1_' . $uniq_id; - $this->boundary[2] = 'b2_' . $uniq_id; - $this->boundary[3] = 'b3_' . $uniq_id; - - if ($this->MessageDate == '') { - $this->MessageDate = self::rfcDate(); - } - $result .= $this->headerLine('Date', $this->MessageDate); - - - // To be created automatically by mail() - if ($this->SingleTo) { - if ($this->Mailer != 'mail') { - foreach ($this->to as $toaddr) { - $this->SingleToArray[] = $this->addrFormat($toaddr); - } - } - } else { - if (count($this->to) > 0) { - if ($this->Mailer != 'mail') { - $result .= $this->addrAppend('To', $this->to); - } - } elseif (count($this->cc) == 0) { - $result .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - } - - $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName))); - - // sendmail and mail() extract Cc from the header before sending - if (count($this->cc) > 0) { - $result .= $this->addrAppend('Cc', $this->cc); - } - - // sendmail and mail() extract Bcc from the header before sending - if (( - $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail' - ) - and count($this->bcc) > 0 - ) { - $result .= $this->addrAppend('Bcc', $this->bcc); - } - - if (count($this->ReplyTo) > 0) { - $result .= $this->addrAppend('Reply-To', $this->ReplyTo); - } - - // mail() sets the subject itself - if ($this->Mailer != 'mail') { - $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); - } - - if ($this->MessageID != '') { - $this->lastMessageID = $this->MessageID; - } else { - $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname()); - } - $result .= $this->HeaderLine('Message-ID', $this->lastMessageID); - $result .= $this->headerLine('X-Priority', $this->Priority); - if ($this->XMailer == '') { - $result .= $this->headerLine( - 'X-Mailer', - 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)' - ); - } else { - $myXmailer = trim($this->XMailer); - if ($myXmailer) { - $result .= $this->headerLine('X-Mailer', $myXmailer); - } - } - - if ($this->ConfirmReadingTo != '') { - $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); - } - - // Add custom headers - for ($index = 0; $index < count($this->CustomHeader); $index++) { - $result .= $this->headerLine( - trim($this->CustomHeader[$index][0]), - $this->encodeHeader(trim($this->CustomHeader[$index][1])) - ); - } - if (!$this->sign_key_file) { - $result .= $this->headerLine('MIME-Version', '1.0'); - $result .= $this->getMailMIME(); - } - - return $result; - } - - /** - * Get the message MIME type headers. - * @access public - * @return string - */ - public function getMailMIME() - { - $result = ''; - $ismultipart = true; - switch ($this->message_type) { - case 'inline': - $result .= $this->headerLine('Content-Type', 'multipart/related;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'attach': - case 'inline_attach': - case 'alt_attach': - case 'alt_inline_attach': - $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'alt': - case 'alt_inline': - $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - default: - // Catches case 'plain': and case '': - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); - $ismultipart = false; - break; - } - // RFC1341 part 5 says 7bit is assumed if not specified - if ($this->Encoding != '7bit') { - // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE - if ($ismultipart) { - if ($this->Encoding == '8bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', '8bit'); - } - // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible - } else { - $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding); - } - } - - if ($this->Mailer != 'mail') { - $result .= $this->LE; - } - - return $result; - } - - /** - * Returns the whole MIME message. - * Includes complete headers and body. - * Only valid post preSend(). - * @see PHPMailer::preSend() - * @access public - * @return string - */ - public function getSentMIMEMessage() - { - return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; - } - - - /** - * Assemble the message body. - * Returns an empty string on failure. - * @access public - * @throws phpmailerException - * @return string The assembled message body - */ - public function createBody() - { - $body = ''; - - if ($this->sign_key_file) { - $body .= $this->getMailMIME() . $this->LE; - } - - $this->setWordWrap(); - - $bodyEncoding = $this->Encoding; - $bodyCharSet = $this->CharSet; - if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { - $bodyEncoding = '7bit'; - $bodyCharSet = 'us-ascii'; - } - $altBodyEncoding = $this->Encoding; - $altBodyCharSet = $this->CharSet; - if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { - $altBodyEncoding = '7bit'; - $altBodyCharSet = 'us-ascii'; - } - switch ($this->message_type) { - case 'inline': - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[1]); - break; - case 'attach': - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'inline_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt': - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - if (!empty($this->Ical)) { - $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); - $body .= $this->encodeString($this->Ical, $this->Encoding); - $body .= $this->LE . $this->LE; - } - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_inline': - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt_inline_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[2]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[3]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - default: - // catch case 'plain' and case '' - $body .= $this->encodeString($this->Body, $bodyEncoding); - break; - } - - if ($this->isError()) { - $body = ''; - } elseif ($this->sign_key_file) { - try { - if (!defined('PKCS7_TEXT')) { - throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.'); - } - // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1 - $file = tempnam(sys_get_temp_dir(), 'mail'); - if (false === file_put_contents($file, $body)) { - throw new phpmailerException($this->lang('signing') . ' Could not write temp file'); - } - $signed = tempnam(sys_get_temp_dir(), 'signed'); - if (@openssl_pkcs7_sign( - $file, - $signed, - 'file://' . realpath($this->sign_cert_file), - array('file://' . realpath($this->sign_key_file), $this->sign_key_pass), - null - ) - ) { - @unlink($file); - $body = file_get_contents($signed); - @unlink($signed); - } else { - @unlink($file); - @unlink($signed); - throw new phpmailerException($this->lang('signing') . openssl_error_string()); - } - } catch (phpmailerException $exc) { - $body = ''; - if ($this->exceptions) { - throw $exc; - } - } - } - return $body; - } - - /** - * Return the start of a message boundary. - * @access protected - * @param string $boundary - * @param string $charSet - * @param string $contentType - * @param string $encoding - * @return string - */ - protected function getBoundary($boundary, $charSet, $contentType, $encoding) - { - $result = ''; - if ($charSet == '') { - $charSet = $this->CharSet; - } - if ($contentType == '') { - $contentType = $this->ContentType; - } - if ($encoding == '') { - $encoding = $this->Encoding; - } - $result .= $this->textLine('--' . $boundary); - $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet); - $result .= $this->LE; - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', $encoding); - } - $result .= $this->LE; - - return $result; - } - - /** - * Return the end of a message boundary. - * @access protected - * @param string $boundary - * @return string - */ - protected function endBoundary($boundary) - { - return $this->LE . '--' . $boundary . '--' . $this->LE; - } - - /** - * Set the message type. - * PHPMailer only supports some preset message types, - * not arbitrary MIME structures. - * @access protected - * @return void - */ - protected function setMessageType() - { - $type = array(); - if ($this->alternativeExists()) { - $type[] = 'alt'; - } - if ($this->inlineImageExists()) { - $type[] = 'inline'; - } - if ($this->attachmentExists()) { - $type[] = 'attach'; - } - $this->message_type = implode('_', $type); - if ($this->message_type == '') { - $this->message_type = 'plain'; - } - } - - /** - * Format a header line. - * @access public - * @param string $name - * @param string $value - * @return string - */ - public function headerLine($name, $value) - { - return $name . ': ' . $value . $this->LE; - } - - /** - * Return a formatted mail line. - * @access public - * @param string $value - * @return string - */ - public function textLine($value) - { - return $value . $this->LE; - } - - /** - * Add an attachment from a path on the filesystem. - * Returns false if the file could not be found or read. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @throws phpmailerException - * @return boolean - */ - public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') - { - try { - if (!@is_file($path)) { - throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE); - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - return true; - } - - /** - * Return the array of attachments. - * @return array - */ - public function getAttachments() - { - return $this->attachment; - } - - /** - * Attach all file, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access protected - * @param string $disposition_type - * @param string $boundary - * @return string - */ - protected function attachAll($disposition_type, $boundary) - { - // Return text of body - $mime = array(); - $cidUniq = array(); - $incl = array(); - - // Add all attachments - foreach ($this->attachment as $attachment) { - // Check if it is a valid disposition_filter - if ($attachment[6] == $disposition_type) { - // Check for string attachment - $string = ''; - $path = ''; - $bString = $attachment[5]; - if ($bString) { - $string = $attachment[0]; - } else { - $path = $attachment[0]; - } - - $inclhash = md5(serialize($attachment)); - if (in_array($inclhash, $incl)) { - continue; - } - $incl[] = $inclhash; - $name = $attachment[2]; - $encoding = $attachment[3]; - $type = $attachment[4]; - $disposition = $attachment[6]; - $cid = $attachment[7]; - if ($disposition == 'inline' && isset($cidUniq[$cid])) { - continue; - } - $cidUniq[$cid] = true; - - $mime[] = sprintf('--%s%s', $boundary, $this->LE); - $mime[] = sprintf( - 'Content-Type: %s; name="%s"%s', - $type, - $this->encodeHeader($this->secureHeader($name)), - $this->LE - ); - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE); - } - - if ($disposition == 'inline') { - $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE); - } - - // If a filename contains any of these chars, it should be quoted, - // but not otherwise: RFC2183 & RFC2045 5.1 - // Fixes a warning in IETF's msglint MIME checker - // Allow for bypassing the Content-Disposition header totally - if (!(empty($disposition))) { - $encoded_name = $this->encodeHeader($this->secureHeader($name)); - if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) { - $mime[] = sprintf( - 'Content-Disposition: %s; filename="%s"%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } else { - $mime[] = sprintf( - 'Content-Disposition: %s; filename=%s%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } - } else { - $mime[] = $this->LE; - } - - // Encode as string attachment - if ($bString) { - $mime[] = $this->encodeString($string, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } else { - $mime[] = $this->encodeFile($path, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } - } - } - - $mime[] = sprintf('--%s--%s', $boundary, $this->LE); - - return implode('', $mime); - } - - /** - * Encode a file attachment in requested format. - * Returns an empty string on failure. - * @param string $path The full path to the file - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @throws phpmailerException - * @see EncodeFile(encodeFile - * @access protected - * @return string - */ - protected function encodeFile($path, $encoding = 'base64') - { - try { - if (!is_readable($path)) { - throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE); - } - $magic_quotes = get_magic_quotes_runtime(); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(false); - } else { - //Doesn't exist in PHP 5.4, but we don't need to check because - //get_magic_quotes_runtime always returns false in 5.4+ - //so it will never get here - ini_set('magic_quotes_runtime', 0); - } - } - $file_buffer = file_get_contents($path); - $file_buffer = $this->encodeString($file_buffer, $encoding); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } else { - ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0')); - } - } - return $file_buffer; - } catch (Exception $exc) { - $this->setError($exc->getMessage()); - return ''; - } - } - - /** - * Encode a string in requested format. - * Returns an empty string on failure. - * @param string $str The text to encode - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @access public - * @return string - */ - public function encodeString($str, $encoding = 'base64') - { - $encoded = ''; - switch (strtolower($encoding)) { - case 'base64': - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case '7bit': - case '8bit': - $encoded = $this->fixEOL($str); - // Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) { - $encoded .= $this->LE; - } - break; - case 'binary': - $encoded = $str; - break; - case 'quoted-printable': - $encoded = $this->encodeQP($str); - break; - default: - $this->setError($this->lang('encoding') . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string optimally. - * Picks shortest of Q, B, quoted-printable or none. - * @access public - * @param string $str - * @param string $position - * @return string - */ - public function encodeHeader($str, $position = 'text') - { - $matchcount = 0; - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know the value of magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return ($encoded); - } else { - return ("\"$encoded\""); - } - } - $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - $matchcount = preg_match_all('/[()"]/', $str, $matches); - // Intentional fall-through - case 'text': - default: - $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($matchcount == 0) { // There are no chars that need encoding - return ($str); - } - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if ($matchcount > strlen($str) / 3) { - // More than a third of the content will need encoding, so B encoding will be most efficient - $encoding = 'B'; - if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) { - // Use a custom function which correctly encodes and wraps long - // multibyte strings without breaking lines within a character - $encoded = $this->base64EncodeWrapMB($str, "\n"); - } else { - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } - } else { - $encoding = 'Q'; - $encoded = $this->encodeQ($str, $position); - $encoded = $this->wrapText($encoded, $maxlen, true); - $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Check if a string contains multi-byte characters. - * @access public - * @param string $str multi-byte text to wrap encode - * @return boolean - */ - public function hasMultiBytes($str) - { - if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); - } else { // Assume no multibytes (we can't handle without mbstring functions anyway) - return false; - } - } - - /** - * Does a string contain any 8-bit chars (in any charset)? - * @param string $text - * @return boolean - */ - public function has8bitChars($text) - { - return (boolean)preg_match('/[\x80-\xFF]/', $text); - } - - /** - * Encode and wrap long multibyte strings for mail headers - * without breaking lines within a character. - * Adapted from a function by paravoid - * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 - * @access public - * @param string $str multi-byte text to wrap encode - * @param string $linebreak string to use as linefeed/end-of-line - * @return string - */ - public function base64EncodeWrapMB($str, $linebreak = null) - { - $start = '=?' . $this->CharSet . '?B?'; - $end = '?='; - $encoded = ''; - if ($linebreak === null) { - $linebreak = $this->LE; - } - - $mb_length = mb_strlen($str, $this->CharSet); - // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); - // Average multi-byte ratio - $ratio = $mb_length / strlen($str); - // Base64 has a 4:3 ratio - $avgLength = floor($length * $ratio * .75); - - for ($i = 0; $i < $mb_length; $i += $offset) { - $lookBack = 0; - do { - $offset = $avgLength - $lookBack; - $chunk = mb_substr($str, $i, $offset, $this->CharSet); - $chunk = base64_encode($chunk); - $lookBack++; - } while (strlen($chunk) > $length); - $encoded .= $chunk . $linebreak; - } - - // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($linebreak)); - return $encoded; - } - - /** - * Encode a string in quoted-printable format. - * According to RFC2045 section 6.7. - * @access public - * @param string $string The text to encode - * @param integer $line_max Number of chars allowed on a line before wrapping - * @return string - * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment - */ - public function encodeQP($string, $line_max = 76) - { - if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3) - return $this->fixEOL(quoted_printable_encode($string)); - } - // Fall back to a pure PHP implementation - $string = str_replace( - array('%20', '%0D%0A.', '%0D%0A', '%'), - array(' ', "\r\n=2E", "\r\n", '='), - rawurlencode($string) - ); - $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string); - return $this->fixEOL($string); - } - - /** - * Backward compatibility wrapper for an old QP encoding function that was removed. - * @see PHPMailer::encodeQP() - * @access public - * @param string $string - * @param integer $line_max - * @param boolean $space_conv - * @return string - * @deprecated Use encodeQP instead. - */ - public function encodeQPphp( - $string, - $line_max = 76, - /** @noinspection PhpUnusedParameterInspection */ $space_conv = false - ) { - return $this->encodeQP($string, $line_max); - } - - /** - * Encode a string using Q encoding. - * @link http://tools.ietf.org/html/rfc2047 - * @param string $str the text to encode - * @param string $position Where the text is going to be used, see the RFC for what that means - * @access public - * @return string - */ - public function encodeQ($str, $position = 'text') - { - // There should not be any EOL in the string - $pattern = ''; - $encoded = str_replace(array("\r", "\n"), '', $str); - switch (strtolower($position)) { - case 'phrase': - // RFC 2047 section 5.3 - $pattern = '^A-Za-z0-9!*+\/ -'; - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - // RFC 2047 section 5.2 - $pattern = '\(\)"'; - // intentional fall-through - // for this reason we build the $pattern without including delimiters and [] - case 'text': - default: - // RFC 2047 section 5.1 - // Replace every high ascii, control, =, ? and _ characters - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; - break; - } - $matches = array(); - if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { - // If the string contains an '=', make sure it's the first thing we replace - // so as to avoid double-encoding - $eqkey = array_search('=', $matches[0]); - if (false !== $eqkey) { - unset($matches[0][$eqkey]); - array_unshift($matches[0], '='); - } - foreach (array_unique($matches[0]) as $char) { - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); - } - } - // Replace every spaces to _ (more readable than =20) - return str_replace(' ', '_', $encoded); - } - - - /** - * Add a string or binary attachment (non-filesystem). - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @return void - */ - public function addStringAttachment( - $string, - $filename, - $encoding = 'base64', - $type = '', - $disposition = 'attachment' - ) { - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($filename); - } - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $filename, - 2 => basename($filename), - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - } - - /** - * Add an embedded (inline) attachment from a file. - * This can include images, sounds, and just about any other document type. - * These differ from 'regular' attachments in that they are intended to be - * displayed inline with the message, not just attached for download. - * This is used in HTML messages that embed the images - * the HTML refers to using the $cid value. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') - { - if (!@is_file($path)) { - $this->setError($this->lang('file_access') . $path); - return false; - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Add an embedded stringified attachment. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $string The attachment binary data. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name - * @param string $encoding File encoding (see $Encoding). - * @param string $type MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addStringEmbeddedImage( - $string, - $cid, - $name = '', - $encoding = 'base64', - $type = '', - $disposition = 'inline' - ) { - // If a MIME type is not specified, try to work it out from the name - if ($type == '') { - $type = self::filenameToType($name); - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $name, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Check if an inline attachment is present. - * @access public - * @return boolean - */ - public function inlineImageExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'inline') { - return true; - } - } - return false; - } - - /** - * Check if an attachment (non-inline) is present. - * @return boolean - */ - public function attachmentExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'attachment') { - return true; - } - } - return false; - } - - /** - * Check if this message has an alternative body set. - * @return boolean - */ - public function alternativeExists() - { - return !empty($this->AltBody); - } - - /** - * Clear all To recipients. - * @return void - */ - public function clearAddresses() - { - foreach ($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); - } - $this->to = array(); - } - - /** - * Clear all CC recipients. - * @return void - */ - public function clearCCs() - { - foreach ($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); - } - $this->cc = array(); - } - - /** - * Clear all BCC recipients. - * @return void - */ - public function clearBCCs() - { - foreach ($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); - } - $this->bcc = array(); - } - - /** - * Clear all ReplyTo recipients. - * @return void - */ - public function clearReplyTos() - { - $this->ReplyTo = array(); - } - - /** - * Clear all recipient types. - * @return void - */ - public function clearAllRecipients() - { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - $this->all_recipients = array(); - } - - /** - * Clear all filesystem, string, and binary attachments. - * @return void - */ - public function clearAttachments() - { - $this->attachment = array(); - } - - /** - * Clear all custom headers. - * @return void - */ - public function clearCustomHeaders() - { - $this->CustomHeader = array(); - } - - /** - * Add an error message to the error container. - * @access protected - * @param string $msg - * @return void - */ - protected function setError($msg) - { - $this->error_count++; - if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { - $lasterror = $this->smtp->getError(); - if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { - $msg .= '

    ' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "

    \n"; - } - } - $this->ErrorInfo = $msg; - } - - /** - * Return an RFC 822 formatted date. - * @access public - * @return string - * @static - */ - public static function rfcDate() - { - // Set the time zone to whatever the default is to avoid 500 errors - // Will default to UTC if it's not set properly in php.ini - date_default_timezone_set(@date_default_timezone_get()); - return date('D, j M Y H:i:s O'); - } - - /** - * Get the server hostname. - * Returns 'localhost.localdomain' if unknown. - * @access protected - * @return string - */ - protected function serverHostname() - { - $result = 'localhost.localdomain'; - if (!empty($this->Hostname)) { - $result = $this->Hostname; - } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { - $result = $_SERVER['SERVER_NAME']; - } elseif (function_exists('gethostname') && gethostname() !== false) { - $result = gethostname(); - } elseif (php_uname('n') !== false) { - $result = php_uname('n'); - } - return $result; - } - - /** - * Get an error message in the current language. - * @access protected - * @param string $key - * @return string - */ - protected function lang($key) - { - if (count($this->language) < 1) { - $this->setLanguage('en'); // set the default language - } - - if (isset($this->language[$key])) { - return $this->language[$key]; - } else { - return 'Language string failed to load: ' . $key; - } - } - - /** - * Check if an error occurred. - * @access public - * @return boolean True if an error did occur. - */ - public function isError() - { - return ($this->error_count > 0); - } - - /** - * Ensure consistent line endings in a string. - * Changes every end of line from CRLF, CR or LF to $this->LE. - * @access public - * @param string $str String to fixEOL - * @return string - */ - public function fixEOL($str) - { - // Normalise to \n - $nstr = str_replace(array("\r\n", "\r"), "\n", $str); - // Now convert LE as needed - if ($this->LE !== "\n") { - $nstr = str_replace("\n", $this->LE, $nstr); - } - return $nstr; - } - - /** - * Add a custom header. - * $name value can be overloaded to contain - * both header name and value (name:value) - * @access public - * @param string $name Custom header name - * @param string $value Header value - * @return void - */ - public function addCustomHeader($name, $value = null) - { - if ($value === null) { - // Value passed in as name:value - $this->CustomHeader[] = explode(':', $name, 2); - } else { - $this->CustomHeader[] = array($name, $value); - } - } - - /** - * Create a message from an HTML string. - * Automatically makes modifications for inline images and backgrounds - * and creates a plain-text version by converting the HTML. - * Overwrites any existing values in $this->Body and $this->AltBody - * @access public - * @param string $message HTML message string - * @param string $basedir baseline directory for path - * @param boolean|callable $advanced Whether to use the internal HTML to text converter - * or your own custom converter @see html2text() - * @return string $message - */ - public function msgHTML($message, $basedir = '', $advanced = false) - { - preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images); - if (isset($images[2])) { - foreach ($images[2] as $imgindex => $url) { - // Convert data URIs into embedded images - if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) { - $data = substr($url, strpos($url, ',')); - if ($match[2]) { - $data = base64_decode($data); - } else { - $data = rawurldecode($data); - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) { - $message = str_replace( - $images[0][$imgindex], - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } elseif (!preg_match('#^[A-z]+://#', $url)) { - // Do not change urls for absolute images (thanks to corvuscorax) - $filename = basename($url); - $directory = dirname($url); - if ($directory == '.') { - $directory = ''; - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { - $basedir .= '/'; - } - if (strlen($directory) > 1 && substr($directory, -1) != '/') { - $directory .= '/'; - } - if ($this->addEmbeddedImage( - $basedir . $directory . $filename, - $cid, - $filename, - 'base64', - self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION)) - ) - ) { - $message = preg_replace( - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } - } - } - $this->isHTML(true); - // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better - $this->Body = $this->normalizeBreaks($message); - $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); - if (empty($this->AltBody)) { - $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . - self::CRLF . self::CRLF; - } - return $this->Body; - } - - /** - * Convert an HTML string into plain text. - * This is used by msgHTML(). - * Note - older versions of this function used a bundled advanced converter - * which was been removed for license reasons in #232 - * Example usage: - * - * // Use default conversion - * $plain = $mail->html2text($html); - * // Use your own custom converter - * $plain = $mail->html2text($html, function($html) { - * $converter = new MyHtml2text($html); - * return $converter->get_text(); - * }); - * - * @param string $html The HTML text to convert - * @param boolean|callable $advanced Any boolean value to use the internal converter, - * or provide your own callable for custom conversion. - * @return string - */ - public function html2text($html, $advanced = false) - { - if (is_callable($advanced)) { - return call_user_func($advanced, $html); - } - return html_entity_decode( - trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))), - ENT_QUOTES, - $this->CharSet - ); - } - - /** - * Get the MIME type for a file extension. - * @param string $ext File extension - * @access public - * @return string MIME type of file. - * @static - */ - public static function _mime_types($ext = '') - { - $mimes = array( - 'xl' => 'application/excel', - 'js' => 'application/javascript', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'bin' => 'application/macbinary', - 'doc' => 'application/msword', - 'word' => 'application/msword', - 'class' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'psd' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'so' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'zip' => 'application/zip', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mpga' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'png' => 'image/png', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'eml' => 'message/rfc822', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'log' => 'text/plain', - 'text' => 'text/plain', - 'txt' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'vcf' => 'text/vcard', - 'vcard' => 'text/vcard', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mov' => 'video/quicktime', - 'qt' => 'video/quicktime', - 'rv' => 'video/vnd.rn-realvideo', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie' - ); - return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream'); - } - - /** - * Map a file name to a MIME type. - * Defaults to 'application/octet-stream', i.e.. arbitrary binary data. - * @param string $filename A file name or full path, does not need to exist as a file - * @return string - * @static - */ - public static function filenameToType($filename) - { - // In case the path is a URL, strip any query string before getting extension - $qpos = strpos($filename, '?'); - if (false !== $qpos) { - $filename = substr($filename, 0, $qpos); - } - $pathinfo = self::mb_pathinfo($filename); - return self::_mime_types($pathinfo['extension']); - } - - /** - * Multi-byte-safe pathinfo replacement. - * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. - * Works similarly to the one in PHP >= 5.2.0 - * @link http://www.php.net/manual/en/function.pathinfo.php#107461 - * @param string $path A filename or path, does not need to exist as a file - * @param integer|string $options Either a PATHINFO_* constant, - * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 - * @return string|array - * @static - */ - public static function mb_pathinfo($path, $options = null) - { - $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''); - $pathinfo = array(); - if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) { - if (array_key_exists(1, $pathinfo)) { - $ret['dirname'] = $pathinfo[1]; - } - if (array_key_exists(2, $pathinfo)) { - $ret['basename'] = $pathinfo[2]; - } - if (array_key_exists(5, $pathinfo)) { - $ret['extension'] = $pathinfo[5]; - } - if (array_key_exists(3, $pathinfo)) { - $ret['filename'] = $pathinfo[3]; - } - } - switch ($options) { - case PATHINFO_DIRNAME: - case 'dirname': - return $ret['dirname']; - case PATHINFO_BASENAME: - case 'basename': - return $ret['basename']; - case PATHINFO_EXTENSION: - case 'extension': - return $ret['extension']; - case PATHINFO_FILENAME: - case 'filename': - return $ret['filename']; - default: - return $ret; - } - } - - /** - * Set or reset instance properties. - * - * Usage Example: - * $page->set('X-Priority', '3'); - * - * @access public - * @param string $name - * @param mixed $value - * NOTE: will not work with arrays, there are no arrays to set/reset - * @throws phpmailerException - * @return boolean - * @TODO Should this not be using __set() magic function? - */ - public function set($name, $value = '') - { - try { - if (isset($this->$name)) { - $this->$name = $value; - } else { - throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL); - } - } catch (Exception $exc) { - $this->setError($exc->getMessage()); - if ($exc->getCode() == self::STOP_CRITICAL) { - return false; - } - } - return true; - } - - /** - * Strip newlines to prevent header injection. - * @access public - * @param string $str - * @return string - */ - public function secureHeader($str) - { - return trim(str_replace(array("\r", "\n"), '', $str)); - } - - /** - * Normalize line breaks in a string. - * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. - * Defaults to CRLF (for message bodies) and preserves consecutive breaks. - * @param string $text - * @param string $breaktype What kind of line break to use, defaults to CRLF - * @return string - * @access public - * @static - */ - public static function normalizeBreaks($text, $breaktype = "\r\n") - { - return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text); - } - - - /** - * Set the public and private key files and password for S/MIME signing. - * @access public - * @param string $cert_filename - * @param string $key_filename - * @param string $key_pass Password for private key - */ - public function sign($cert_filename, $key_filename, $key_pass) - { - $this->sign_cert_file = $cert_filename; - $this->sign_key_file = $key_filename; - $this->sign_key_pass = $key_pass; - } - - /** - * Quoted-Printable-encode a DKIM header. - * @access public - * @param string $txt - * @return string - */ - public function DKIM_QP($txt) - { - $line = ''; - for ($i = 0; $i < strlen($txt); $i++) { - $ord = ord($txt[$i]); - if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) { - $line .= $txt[$i]; - } else { - $line .= '=' . sprintf('%02X', $ord); - } - } - return $line; - } - - /** - * Generate a DKIM signature. - * @access public - * @param string $signHeader - * @throws phpmailerException - * @return string - */ - public function DKIM_Sign($signHeader) - { - if (!defined('PKCS7_TEXT')) { - if ($this->exceptions) { - throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.'); - } - return ''; - } - $privKeyStr = file_get_contents($this->DKIM_private); - if ($this->DKIM_passphrase != '') { - $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); - } else { - $privKey = $privKeyStr; - } - if (openssl_sign($signHeader, $signature, $privKey)) { - return base64_encode($signature); - } - return ''; - } - - /** - * Generate a DKIM canonicalization header. - * @access public - * @param string $signHeader Header - * @return string - */ - public function DKIM_HeaderC($signHeader) - { - $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader); - $lines = explode("\r\n", $signHeader); - foreach ($lines as $key => $line) { - list($heading, $value) = explode(':', $line, 2); - $heading = strtolower($heading); - $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces - $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value - } - $signHeader = implode("\r\n", $lines); - return $signHeader; - } - - /** - * Generate a DKIM canonicalization body. - * @access public - * @param string $body Message Body - * @return string - */ - public function DKIM_BodyC($body) - { - if ($body == '') { - return "\r\n"; - } - // stabilize line endings - $body = str_replace("\r\n", "\n", $body); - $body = str_replace("\n", "\r\n", $body); - // END stabilize line endings - while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { - $body = substr($body, 0, strlen($body) - 2); - } - return $body; - } - - /** - * Create the DKIM header and body in a new message header. - * @access public - * @param string $headers_line Header lines - * @param string $subject Subject - * @param string $body Body - * @return string - */ - public function DKIM_Add($headers_line, $subject, $body) - { - $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms - $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body - $DKIMquery = 'dns/txt'; // Query method - $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) - $subject_header = "Subject: $subject"; - $headers = explode($this->LE, $headers_line); - $from_header = ''; - $to_header = ''; - $current = ''; - foreach ($headers as $header) { - if (strpos($header, 'From:') === 0) { - $from_header = $header; - $current = 'from_header'; - } elseif (strpos($header, 'To:') === 0) { - $to_header = $header; - $current = 'to_header'; - } else { - if ($current && strpos($header, ' =?') === 0) { - $current .= $header; - } else { - $current = ''; - } - } - } - $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); - $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $subject = str_replace( - '|', - '=7C', - $this->DKIM_QP($subject_header) - ); // Copied header fields (dkim-quoted-printable) - $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body); // Length of body - $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body - $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';'; - $dkimhdrs = 'DKIM-Signature: v=1; a=' . - $DKIMsignatureType . '; q=' . - $DKIMquery . '; l=' . - $DKIMlen . '; s=' . - $this->DKIM_selector . - ";\r\n" . - "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . - "\th=From:To:Subject;\r\n" . - "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . - "\tz=$from\r\n" . - "\t|$to\r\n" . - "\t|$subject;\r\n" . - "\tbh=" . $DKIMb64 . ";\r\n" . - "\tb="; - $toSign = $this->DKIM_HeaderC( - $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs - ); - $signed = $this->DKIM_Sign($toSign); - return $dkimhdrs . $signed . "\r\n"; - } - - /** - * Allows for public read access to 'to' property. - * @access public - * @return array - */ - public function getToAddresses() - { - return $this->to; - } - - /** - * Allows for public read access to 'cc' property. - * @access public - * @return array - */ - public function getCcAddresses() - { - return $this->cc; - } - - /** - * Allows for public read access to 'bcc' property. - * @access public - * @return array - */ - public function getBccAddresses() - { - return $this->bcc; - } - - /** - * Allows for public read access to 'ReplyTo' property. - * @access public - * @return array - */ - public function getReplyToAddresses() - { - return $this->ReplyTo; - } - - /** - * Allows for public read access to 'all_recipients' property. - * @access public - * @return array - */ - public function getAllRecipientAddresses() - { - return $this->all_recipients; - } - - /** - * Perform a callback. - * @param boolean $isSent - * @param array $to - * @param array $cc - * @param array $bcc - * @param string $subject - * @param string $body - * @param string $from - */ - protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from) - { - if (!empty($this->action_function) && is_callable($this->action_function)) { - $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); - call_user_func_array($this->action_function, $params); - } - } -} - -/** - * PHPMailer exception handler - * @package PHPMailer - */ -class phpmailerException extends Exception -{ - /** - * Prettify error message output - * @return string - */ - public function errorMessage() - { - $errorMsg = '' . $this->getMessage() . "
    \n"; - return $errorMsg; - } -} diff --git a/download/phpmailer529/class.pop3.php b/download/phpmailer529/class.pop3.php deleted file mode 100755 index 984885ff0..000000000 --- a/download/phpmailer529/class.pop3.php +++ /dev/null @@ -1,397 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer POP-Before-SMTP Authentication Class. - * Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication. - * Does not support APOP. - * @package PHPMailer - * @author Richard Davey (original author) - * @author Marcus Bointon (Synchro/coolbru) - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - */ -class POP3 -{ - /** - * The POP3 PHPMailer Version number. - * @type string - * @access public - */ - public $Version = '5.2.9'; - - /** - * Default POP3 port number. - * @type integer - * @access public - */ - public $POP3_PORT = 110; - - /** - * Default timeout in seconds. - * @type integer - * @access public - */ - public $POP3_TIMEOUT = 30; - - /** - * POP3 Carriage Return + Line Feed. - * @type string - * @access public - * @deprecated Use the constant instead - */ - public $CRLF = "\r\n"; - - /** - * Debug display level. - * Options: 0 = no, 1+ = yes - * @type integer - * @access public - */ - public $do_debug = 0; - - /** - * POP3 mail server hostname. - * @type string - * @access public - */ - public $host; - - /** - * POP3 port number. - * @type integer - * @access public - */ - public $port; - - /** - * POP3 Timeout Value in seconds. - * @type integer - * @access public - */ - public $tval; - - /** - * POP3 username - * @type string - * @access public - */ - public $username; - - /** - * POP3 password. - * @type string - * @access public - */ - public $password; - - /** - * Resource handle for the POP3 connection socket. - * @type resource - * @access private - */ - private $pop_conn; - - /** - * Are we connected? - * @type boolean - * @access private - */ - private $connected = false; - - /** - * Error container. - * @type array - * @access private - */ - private $errors = array(); - - /** - * Line break constant - */ - const CRLF = "\r\n"; - - /** - * Simple static wrapper for all-in-one POP before SMTP - * @param $host - * @param boolean $port - * @param boolean $tval - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public static function popBeforeSmtp( - $host, - $port = false, - $tval = false, - $username = '', - $password = '', - $debug_level = 0 - ) { - $pop = new POP3; - return $pop->authorise($host, $port, $tval, $username, $password, $debug_level); - } - - /** - * Authenticate with a POP3 server. - * A connect, login, disconnect sequence - * appropriate for POP-before SMTP authorisation. - * @access public - * @param string $host The hostname to connect to - * @param integer|boolean $port The port number to connect to - * @param integer|boolean $timeout The timeout value - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) - { - $this->host = $host; - // If no port value provided, use default - if (false === $port) { - $this->port = $this->POP3_PORT; - } else { - $this->port = (integer)$port; - } - // If no timeout value provided, use default - if (false === $timeout) { - $this->tval = $this->POP3_TIMEOUT; - } else { - $this->tval = (integer)$timeout; - } - $this->do_debug = $debug_level; - $this->username = $username; - $this->password = $password; - // Reset the error log - $this->errors = array(); - // connect - $result = $this->connect($this->host, $this->port, $this->tval); - if ($result) { - $login_result = $this->login($this->username, $this->password); - if ($login_result) { - $this->disconnect(); - return true; - } - } - // We need to disconnect regardless of whether the login succeeded - $this->disconnect(); - return false; - } - - /** - * Connect to a POP3 server. - * @access public - * @param string $host - * @param integer|boolean $port - * @param integer $tval - * @return boolean - */ - public function connect($host, $port = false, $tval = 30) - { - // Are we already connected? - if ($this->connected) { - return true; - } - - //On Windows this will raise a PHP Warning error if the hostname doesn't exist. - //Rather than suppress it with @fsockopen, capture it cleanly instead - set_error_handler(array($this, 'catchWarning')); - - if (false === $port) { - $port = $this->POP3_PORT; - } - - // connect to the POP3 server - $this->pop_conn = fsockopen( - $host, // POP3 Host - $port, // Port # - $errno, // Error Number - $errstr, // Error Message - $tval - ); // Timeout (seconds) - // Restore the error handler - restore_error_handler(); - - // Did we connect? - if (false === $this->pop_conn) { - // It would appear not... - $this->setError(array( - 'error' => "Failed to connect to server $host on port $port", - 'errno' => $errno, - 'errstr' => $errstr - )); - return false; - } - - // Increase the stream time-out - stream_set_timeout($this->pop_conn, $tval, 0); - - // Get the POP3 server response - $pop3_response = $this->getResponse(); - // Check for the +OK - if ($this->checkResponse($pop3_response)) { - // The connection is established and the POP3 server is talking - $this->connected = true; - return true; - } - return false; - } - - /** - * Log in to the POP3 server. - * Does not support APOP (RFC 2828, 4949). - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - public function login($username = '', $password = '') - { - if (!$this->connected) { - $this->setError('Not connected to POP3 server'); - } - if (empty($username)) { - $username = $this->username; - } - if (empty($password)) { - $password = $this->password; - } - - // Send the Username - $this->sendString("USER $username" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - // Send the Password - $this->sendString("PASS $password" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - return true; - } - } - return false; - } - - /** - * Disconnect from the POP3 server. - * @access public - */ - public function disconnect() - { - $this->sendString('QUIT'); - //The QUIT command may cause the daemon to exit, which will kill our connection - //So ignore errors here - try { - @fclose($this->pop_conn); - } catch (Exception $e) { - //Do nothing - }; - } - - /** - * Get a response from the POP3 server. - * $size is the maximum number of bytes to retrieve - * @param integer $size - * @return string - * @access private - */ - private function getResponse($size = 128) - { - $response = fgets($this->pop_conn, $size); - if ($this->do_debug >= 1) { - echo "Server -> Client: $response"; - } - return $response; - } - - /** - * Send raw data to the POP3 server. - * @param string $string - * @return integer - * @access private - */ - private function sendString($string) - { - if ($this->pop_conn) { - if ($this->do_debug >= 2) { //Show client messages when debug >= 2 - echo "Client -> Server: $string"; - } - return fwrite($this->pop_conn, $string, strlen($string)); - } - return 0; - } - - /** - * Checks the POP3 server response. - * Looks for for +OK or -ERR. - * @param string $string - * @return boolean - * @access private - */ - private function checkResponse($string) - { - if (substr($string, 0, 3) !== '+OK') { - $this->setError(array( - 'error' => "Server reported an error: $string", - 'errno' => 0, - 'errstr' => '' - )); - return false; - } else { - return true; - } - } - - /** - * Add an error to the internal error store. - * Also display debug output if it's enabled. - * @param $error - */ - private function setError($error) - { - $this->errors[] = $error; - if ($this->do_debug >= 1) { - echo '
    ';
    -            foreach ($this->errors as $error) {
    -                print_r($error);
    -            }
    -            echo '
    '; - } - } - - /** - * POP3 connection error handler. - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline - * @access private - */ - private function catchWarning($errno, $errstr, $errfile, $errline) - { - $this->setError(array( - 'error' => "Connecting to the POP3 server raised a PHP warning: ", - 'errno' => $errno, - 'errstr' => $errstr, - 'errfile' => $errfile, - 'errline' => $errline - )); - } -} diff --git a/download/phpmailer529/class.smtp.php b/download/phpmailer529/class.smtp.php deleted file mode 100755 index d6991970f..000000000 --- a/download/phpmailer529/class.smtp.php +++ /dev/null @@ -1,1132 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer RFC821 SMTP email transport class. - * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server. - * @package PHPMailer - * @author Chris Ryan - * @author Marcus Bointon - */ -class SMTP -{ - /** - * The PHPMailer SMTP version number. - * @type string - */ - const VERSION = '5.2.9'; - - /** - * SMTP line break constant. - * @type string - */ - const CRLF = "\r\n"; - - /** - * The SMTP port to use if one is not specified. - * @type integer - */ - const DEFAULT_SMTP_PORT = 25; - - /** - * The maximum line length allowed by RFC 2822 section 2.1.1 - * @type integer - */ - const MAX_LINE_LENGTH = 998; - - /** - * Debug level for no output - */ - const DEBUG_OFF = 0; - - /** - * Debug level to show client -> server messages - */ - const DEBUG_CLIENT = 1; - - /** - * Debug level to show client -> server and server -> client messages - */ - const DEBUG_SERVER = 2; - - /** - * Debug level to show connection status, client -> server and server -> client messages - */ - const DEBUG_CONNECTION = 3; - - /** - * Debug level to show all messages - */ - const DEBUG_LOWLEVEL = 4; - - /** - * The PHPMailer SMTP Version number. - * @type string - * @deprecated Use the `VERSION` constant instead - * @see SMTP::VERSION - */ - public $Version = '5.2.9'; - - /** - * SMTP server port number. - * @type integer - * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead - * @see SMTP::DEFAULT_SMTP_PORT - */ - public $SMTP_PORT = 25; - - /** - * SMTP reply line ending. - * @type string - * @deprecated Use the `CRLF` constant instead - * @see SMTP::CRLF - */ - public $CRLF = "\r\n"; - - /** - * Debug output level. - * Options: - * * self::DEBUG_OFF (`0`) No debug output, default - * * self::DEBUG_CLIENT (`1`) Client commands - * * self::DEBUG_SERVER (`2`) Client commands and server responses - * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status - * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages - * @type integer - */ - public $do_debug = self::DEBUG_OFF; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `
    `, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * - * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * - * @type string|callable - */ - public $Debugoutput = 'echo'; - - /** - * Whether to use VERP. - * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Info on VERP - * @type boolean - */ - public $do_verp = false; - - /** - * The timeout value for connection, in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. - * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 - * @type integer - */ - public $Timeout = 300; - - /** - * How long to wait for commands to complete, in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * @type integer - */ - public $Timelimit = 300; - - /** - * The socket for the server connection. - * @type resource - */ - protected $smtp_conn; - - /** - * Error message, if any, for the last call. - * @type array - */ - protected $error = array(); - - /** - * The reply the server sent to us for HELO. - * If null, no HELO string has yet been received. - * @type string|null - */ - protected $helo_rply = null; - - /** - * The set of SMTP extensions sent in reply to EHLO command. - * Indexes of the array are extension names. - * Value at index 'HELO' or 'EHLO' (according to command that was sent) - * represents the server name. In case of HELO it is the only element of the array. - * Other values can be boolean TRUE or an array containing extension options. - * If null, no HELO/EHLO string has yet been received. - * @type array|null - */ - protected $server_caps = null; - - /** - * The most recent reply received from the server. - * @type string - */ - protected $last_reply = ''; - - /** - * Output debugging info via a user-selected method. - * @see SMTP::$Debugoutput - * @see SMTP::$do_debug - * @param string $str Debug string to output - * @param integer $level The debug level of this message; see DEBUG_* constants - * @return void - */ - protected function edebug($str, $level = 0) - { - if ($level > $this->do_debug) { - return; - } - //Avoid clash with built-in function names - if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->do_debug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "
    \n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - )."\n"; - } - } - - /** - * Connect to an SMTP server. - * @param string $host SMTP server IP or host name - * @param integer $port The port number to connect to - * @param integer $timeout How long to wait for the connection to open - * @param array $options An array of options for stream_context_create() - * @access public - * @return boolean - */ - public function connect($host, $port = null, $timeout = 30, $options = array()) - { - static $streamok; - //This is enabled by default since 5.0.0 but some providers disable it - //Check this once and cache the result - if (is_null($streamok)) { - $streamok = function_exists('stream_socket_client'); - } - // Clear errors to avoid confusion - $this->error = array(); - // Make sure we are __not__ connected - if ($this->connected()) { - // Already connected, generate error - $this->error = array('error' => 'Already connected to a server'); - return false; - } - if (empty($port)) { - $port = self::DEFAULT_SMTP_PORT; - } - // Connect to the SMTP server - $this->edebug( - "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true), - self::DEBUG_CONNECTION - ); - $errno = 0; - $errstr = ''; - if ($streamok) { - $socket_context = stream_context_create($options); - //Suppress errors; connection failures are handled at a higher level - $this->smtp_conn = @stream_socket_client( - $host . ":" . $port, - $errno, - $errstr, - $timeout, - STREAM_CLIENT_CONNECT, - $socket_context - ); - } else { - //Fall back to fsockopen which should work in more places, but is missing some features - $this->edebug( - "Connection: stream_socket_client not available, falling back to fsockopen", - self::DEBUG_CONNECTION - ); - $this->smtp_conn = fsockopen( - $host, - $port, - $errno, - $errstr, - $timeout - ); - } - // Verify we connected properly - if (!is_resource($this->smtp_conn)) { - $this->error = array( - 'error' => 'Failed to connect to server', - 'errno' => $errno, - 'errstr' => $errstr - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] - . ": $errstr ($errno)", - self::DEBUG_CLIENT - ); - return false; - } - $this->edebug('Connection: opened', self::DEBUG_CONNECTION); - // SMTP server can take longer to respond, give longer timeout for first read - // Windows does not have support for this timeout function - if (substr(PHP_OS, 0, 3) != 'WIN') { - $max = ini_get('max_execution_time'); - if ($max != 0 && $timeout > $max) { // Don't bother if unlimited - @set_time_limit($timeout); - } - stream_set_timeout($this->smtp_conn, $timeout, 0); - } - // Get any announcement - $announce = $this->get_lines(); - $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER); - return true; - } - - /** - * Initiate a TLS (encrypted) session. - * @access public - * @return boolean - */ - public function startTLS() - { - if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { - return false; - } - // Begin encrypted connection - if (!stream_socket_enable_crypto( - $this->smtp_conn, - true, - STREAM_CRYPTO_METHOD_TLS_CLIENT - )) { - return false; - } - return true; - } - - /** - * Perform SMTP authentication. - * Must be run after hello(). - * @see hello() - * @param string $username The user name - * @param string $password The password - * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5) - * @param string $realm The auth realm for NTLM - * @param string $workstation The auth workstation for NTLM - * @access public - * @return boolean True if successfully authenticated. - */ - public function authenticate( - $username, - $password, - $authtype = null, - $realm = '', - $workstation = '' - ) { - if (!$this->server_caps) { - $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO'); - return false; - } - - if (array_key_exists('EHLO', $this->server_caps)) { - // SMTP extensions are available. Let's try to find a proper authentication method - - if (!array_key_exists('AUTH', $this->server_caps)) { - $this->error = array( 'error' => 'Authentication is not allowed at this stage' ); - // 'at this stage' means that auth may be allowed after the stage changes - // e.g. after STARTTLS - return false; - } - - self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); - self::edebug( - 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']), - self::DEBUG_LOWLEVEL - ); - - if (empty($authtype)) { - foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) { - if (in_array($method, $this->server_caps['AUTH'])) { - $authtype = $method; - break; - } - } - if (empty($authtype)) { - $this->error = array( 'error' => 'No supported authentication methods found' ); - return false; - } - self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL); - } - - if (!in_array($authtype, $this->server_caps['AUTH'])) { - $this->error = array( 'error' => 'The requested authentication method "' - . $authtype . '" is not supported by the server' ); - return false; - } - } elseif (empty($authtype)) { - $authtype = 'LOGIN'; - } - switch ($authtype) { - case 'PLAIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { - return false; - } - // Send encoded username and password - if (!$this->sendCommand( - 'User & Password', - base64_encode("\0" . $username . "\0" . $password), - 235 - ) - ) { - return false; - } - break; - case 'LOGIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { - return false; - } - if (!$this->sendCommand("Username", base64_encode($username), 334)) { - return false; - } - if (!$this->sendCommand("Password", base64_encode($password), 235)) { - return false; - } - break; - case 'NTLM': - /* - * ntlm_sasl_client.php - * Bundled with Permission - * - * How to telnet in windows: - * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx - * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication - */ - require_once 'extras/ntlm_sasl_client.php'; - $temp = new stdClass(); - $ntlm_client = new ntlm_sasl_client_class; - //Check that functions are available - if (!$ntlm_client->Initialize($temp)) { - $this->error = array('error' => $temp->error); - $this->edebug( - 'You need to enable some modules in your php.ini file: ' - . $this->error['error'], - self::DEBUG_CLIENT - ); - return false; - } - //msg1 - $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 - - if (!$this->sendCommand( - 'AUTH NTLM', - 'AUTH NTLM ' . base64_encode($msg1), - 334 - ) - ) { - return false; - } - //Though 0 based, there is a white space after the 3 digit number - //msg2 - $challenge = substr($this->last_reply, 3); - $challenge = base64_decode($challenge); - $ntlm_res = $ntlm_client->NTLMResponse( - substr($challenge, 24, 8), - $password - ); - //msg3 - $msg3 = $ntlm_client->TypeMsg3( - $ntlm_res, - $username, - $realm, - $workstation - ); - // send encoded username - return $this->sendCommand('Username', base64_encode($msg3), 235); - case 'CRAM-MD5': - // Start authentication - if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { - return false; - } - // Get the challenge - $challenge = base64_decode(substr($this->last_reply, 4)); - - // Build the response - $response = $username . ' ' . $this->hmac($challenge, $password); - - // send encoded credentials - return $this->sendCommand('Username', base64_encode($response), 235); - default: - $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' ); - return false; - } - return true; - } - - /** - * Calculate an MD5 HMAC hash. - * Works like hash_hmac('md5', $data, $key) - * in case that function is not available - * @param string $data The data to hash - * @param string $key The key to hash with - * @access protected - * @return string - */ - protected function hmac($data, $key) - { - if (function_exists('hash_hmac')) { - return hash_hmac('md5', $data, $key); - } - - // The following borrowed from - // http://php.net/manual/en/function.mhash.php#27225 - - // RFC 2104 HMAC implementation for php. - // Creates an md5 HMAC. - // Eliminates the need to install mhash to compute a HMAC - // by Lance Rushing - - $bytelen = 64; // byte length for md5 - if (strlen($key) > $bytelen) { - $key = pack('H*', md5($key)); - } - $key = str_pad($key, $bytelen, chr(0x00)); - $ipad = str_pad('', $bytelen, chr(0x36)); - $opad = str_pad('', $bytelen, chr(0x5c)); - $k_ipad = $key ^ $ipad; - $k_opad = $key ^ $opad; - - return md5($k_opad . pack('H*', md5($k_ipad . $data))); - } - - /** - * Check connection state. - * @access public - * @return boolean True if connected. - */ - public function connected() - { - if (is_resource($this->smtp_conn)) { - $sock_status = stream_get_meta_data($this->smtp_conn); - if ($sock_status['eof']) { - // The socket is valid but we are not connected - $this->edebug( - 'SMTP NOTICE: EOF caught while checking if connected', - self::DEBUG_CLIENT - ); - $this->close(); - return false; - } - return true; // everything looks good - } - return false; - } - - /** - * Close the socket and clean up the state of the class. - * Don't use this function without first trying to use QUIT. - * @see quit() - * @access public - * @return void - */ - public function close() - { - $this->error = array(); - $this->server_caps = null; - $this->helo_rply = null; - if (is_resource($this->smtp_conn)) { - // close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = null; //Makes for cleaner serialization - $this->edebug('Connection: closed', self::DEBUG_CONNECTION); - } - } - - /** - * Send an SMTP DATA command. - * Issues a data command and sends the msg_data to the server, - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being separated by and additional . - * Implements rfc 821: DATA - * @param string $msg_data Message data to send - * @access public - * @return boolean - */ - public function data($msg_data) - { - //This will use the standard timelimit - if (!$this->sendCommand('DATA', 'DATA', 354)) { - return false; - } - - /* The server is ready to accept data! - * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF) - * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into - * smaller lines to fit within the limit. - * We will also look for lines that start with a '.' and prepend an additional '.'. - * NOTE: this does not count towards line-length limit. - */ - - // Normalize line breaks before exploding - $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data)); - - /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field - * of the first line (':' separated) does not contain a space then it _should_ be a header and we will - * process all lines before a blank line as headers. - */ - - $field = substr($lines[0], 0, strpos($lines[0], ':')); - $in_headers = false; - if (!empty($field) && strpos($field, ' ') === false) { - $in_headers = true; - } - - foreach ($lines as $line) { - $lines_out = array(); - if ($in_headers and $line == '') { - $in_headers = false; - } - //We need to break this line up into several smaller lines - //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len) - while (isset($line[self::MAX_LINE_LENGTH])) { - //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on - //so as to avoid breaking in the middle of a word - $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' '); - if (!$pos) { //Deliberately matches both false and 0 - //No nice break found, add a hard break - $pos = self::MAX_LINE_LENGTH - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - //Break at the found point - $lines_out[] = substr($line, 0, $pos); - //Move along by the amount we dealt with - $line = substr($line, $pos + 1); - } - //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 - if ($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - //Send the lines to the server - foreach ($lines_out as $line_out) { - //RFC2821 section 4.5.2 - if (!empty($line_out) and $line_out[0] == '.') { - $line_out = '.' . $line_out; - } - $this->client_send($line_out . self::CRLF); - } - } - - //Message data has been sent, complete the command - //Increase timelimit for end of DATA command - $savetimelimit = $this->Timelimit; - $this->Timelimit = $this->Timelimit * 2; - $result = $this->sendCommand('DATA END', '.', 250); - //Restore timelimit - $this->Timelimit = $savetimelimit; - return $result; - } - - /** - * Send an SMTP HELO or EHLO command. - * Used to identify the sending server to the receiving server. - * This makes sure that client and server are in a known state. - * Implements RFC 821: HELO - * and RFC 2821 EHLO. - * @param string $host The host name or IP to connect to - * @access public - * @return boolean - */ - public function hello($host = '') - { - //Try extended hello first (RFC 2821) - return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host)); - } - - /** - * Send an SMTP HELO or EHLO command. - * Low-level implementation used by hello() - * @see hello() - * @param string $hello The HELO string - * @param string $host The hostname to say we are - * @access protected - * @return boolean - */ - protected function sendHello($hello, $host) - { - $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); - $this->helo_rply = $this->last_reply; - if ($noerror) { - $this->parseHelloFields($hello); - } else { - $this->server_caps = null; - } - return $noerror; - } - - /** - * Parse a reply to HELO/EHLO command to discover server extensions. - * In case of HELO, the only parameter that can be discovered is a server name. - * @access protected - * @param string $type - 'HELO' or 'EHLO' - */ - protected function parseHelloFields($type) - { - $this->server_caps = array(); - $lines = explode("\n", $this->last_reply); - foreach ($lines as $n => $s) { - $s = trim(substr($s, 4)); - if (!$s) { - continue; - } - $fields = explode(' ', $s); - if ($fields) { - if (!$n) { - $name = $type; - $fields = $fields[0]; - } else { - $name = array_shift($fields); - if ($name == 'SIZE') { - $fields = ($fields) ? $fields[0] : 0; - } - } - $this->server_caps[$name] = ($fields ? $fields : true); - } - } - } - - /** - * Send an SMTP MAIL command. - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. - * Implements rfc 821: MAIL FROM: - * @param string $from Source address of this message - * @access public - * @return boolean - */ - public function mail($from) - { - $useVerp = ($this->do_verp ? ' XVERP' : ''); - return $this->sendCommand( - 'MAIL FROM', - 'MAIL FROM:<' . $from . '>' . $useVerp, - 250 - ); - } - - /** - * Send an SMTP QUIT command. - * Closes the socket if there is no error or the $close_on_error argument is true. - * Implements from rfc 821: QUIT - * @param boolean $close_on_error Should the connection close if an error occurs? - * @access public - * @return boolean - */ - public function quit($close_on_error = true) - { - $noerror = $this->sendCommand('QUIT', 'QUIT', 221); - $err = $this->error; //Save any error - if ($noerror or $close_on_error) { - $this->close(); - $this->error = $err; //Restore any error from the quit command - } - return $noerror; - } - - /** - * Send an SMTP RCPT command. - * Sets the TO argument to $toaddr. - * Returns true if the recipient was accepted false if it was rejected. - * Implements from rfc 821: RCPT TO: - * @param string $toaddr The address the message is being sent to - * @access public - * @return boolean - */ - public function recipient($toaddr) - { - return $this->sendCommand( - 'RCPT TO', - 'RCPT TO:<' . $toaddr . '>', - array(250, 251) - ); - } - - /** - * Send an SMTP RSET command. - * Abort any transaction that is currently in progress. - * Implements rfc 821: RSET - * @access public - * @return boolean True on success. - */ - public function reset() - { - return $this->sendCommand('RSET', 'RSET', 250); - } - - /** - * Send a command to an SMTP server and check its return code. - * @param string $command The command name - not sent to the server - * @param string $commandstring The actual command to send - * @param integer|array $expect One or more expected integer success codes - * @access protected - * @return boolean True on success. - */ - protected function sendCommand($command, $commandstring, $expect) - { - if (!$this->connected()) { - $this->error = array( - 'error' => "Called $command without being connected" - ); - return false; - } - $this->client_send($commandstring . self::CRLF); - - $this->last_reply = $this->get_lines(); - // Fetch SMTP code and possible error code explanation - $matches = array(); - if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) { - $code = $matches[1]; - $code_ex = (count($matches) > 2 ? $matches[2] : null); - // Cut off error code from each response line - $detail = preg_replace( - "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m", - '', - $this->last_reply - ); - } else { // Fall back to simple parsing if regex fails - $code = substr($this->last_reply, 0, 3); - $code_ex = null; - $detail = substr($this->last_reply, 4); - } - - $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER); - - if (!in_array($code, (array)$expect)) { - $this->error = array( - 'error' => "$command command failed", - 'smtp_code' => $code, - 'smtp_code_ex' => $code_ex, - 'detail' => $detail - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, - self::DEBUG_CLIENT - ); - return false; - } - - $this->error = array(); - return true; - } - - /** - * Send an SMTP SAML command. - * Starts a mail transaction from the email address specified in $from. - * Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * Implements rfc 821: SAML FROM: - * @param string $from The address the message is from - * @access public - * @return boolean - */ - public function sendAndMail($from) - { - return $this->sendCommand('SAML', "SAML FROM:$from", 250); - } - - /** - * Send an SMTP VRFY command. - * @param string $name The name to verify - * @access public - * @return boolean - */ - public function verify($name) - { - return $this->sendCommand('VRFY', "VRFY $name", array(250, 251)); - } - - /** - * Send an SMTP NOOP command. - * Used to keep keep-alives alive, doesn't actually do anything - * @access public - * @return boolean - */ - public function noop() - { - return $this->sendCommand('NOOP', 'NOOP', 250); - } - - /** - * Send an SMTP TURN command. - * This is an optional command for SMTP that this class does not support. - * This method is here to make the RFC821 Definition complete for this class - * and _may_ be implemented in future - * Implements from rfc 821: TURN - * @access public - * @return boolean - */ - public function turn() - { - $this->error = array( - 'error' => 'The SMTP TURN command is not implemented' - ); - $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT); - return false; - } - - /** - * Send raw data to the server. - * @param string $data The data to send - * @access public - * @return integer|boolean The number of bytes sent to the server or false on error - */ - public function client_send($data) - { - $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); - return fwrite($this->smtp_conn, $data); - } - - /** - * Get the latest error. - * @access public - * @return array - */ - public function getError() - { - return $this->error; - } - - /** - * Get SMTP extensions available on the server - * @access public - * @return array|null - */ - public function getServerExtList() - { - return $this->server_caps; - } - - /** - * A multipurpose method - * The method works in three ways, dependent on argument value and current state - * 1. HELO/EHLO was not sent - returns null and set up $this->error - * 2. HELO was sent - * $name = 'HELO': returns server name - * $name = 'EHLO': returns boolean false - * $name = any string: returns null and set up $this->error - * 3. EHLO was sent - * $name = 'HELO'|'EHLO': returns server name - * $name = any string: if extension $name exists, returns boolean True - * or its options. Otherwise returns boolean False - * In other words, one can use this method to detect 3 conditions: - * - null returned: handshake was not or we don't know about ext (refer to $this->error) - * - false returned: the requested feature exactly not exists - * - positive value returned: the requested feature exists - * @param string $name Name of SMTP extension or 'HELO'|'EHLO' - * @return mixed - */ - public function getServerExt($name) - { - if (!$this->server_caps) { - $this->error = array('No HELO/EHLO was sent'); - return null; - } - - // the tight logic knot ;) - if (!array_key_exists($name, $this->server_caps)) { - if ($name == 'HELO') { - return $this->server_caps['EHLO']; - } - if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) { - return false; - } - $this->error = array('HELO handshake was used. Client knows nothing about server extensions'); - return null; - } - - return $this->server_caps[$name]; - } - - /** - * Get the last reply from the server. - * @access public - * @return string - */ - public function getLastReply() - { - return $this->last_reply; - } - - /** - * Read the SMTP server's response. - * Either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access protected - * @return string - */ - protected function get_lines() - { - // If the connection is bad, give up straight away - if (!is_resource($this->smtp_conn)) { - return ''; - } - $data = ''; - $endtime = 0; - stream_set_timeout($this->smtp_conn, $this->Timeout); - if ($this->Timelimit > 0) { - $endtime = time() + $this->Timelimit; - } - while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { - $str = @fgets($this->smtp_conn, 515); - $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL); - $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); - $data .= $str; - $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); - // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen - if ((isset($str[3]) and $str[3] == ' ')) { - break; - } - // Timed-out? Log and break - $info = stream_get_meta_data($this->smtp_conn); - if ($info['timed_out']) { - $this->edebug( - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - // Now check if reads took too long - if ($endtime and time() > $endtime) { - $this->edebug( - 'SMTP -> get_lines(): timelimit reached ('. - $this->Timelimit . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - } - return $data; - } - - /** - * Enable or disable VERP address generation. - * @param boolean $enabled - */ - public function setVerp($enabled = false) - { - $this->do_verp = $enabled; - } - - /** - * Get VERP address generation mode. - * @return boolean - */ - public function getVerp() - { - return $this->do_verp; - } - - /** - * Set debug output method. - * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it. - */ - public function setDebugOutput($method = 'echo') - { - $this->Debugoutput = $method; - } - - /** - * Get debug output method. - * @return string - */ - public function getDebugOutput() - { - return $this->Debugoutput; - } - - /** - * Set debug output level. - * @param integer $level - */ - public function setDebugLevel($level = 0) - { - $this->do_debug = $level; - } - - /** - * Get debug output level. - * @return integer - */ - public function getDebugLevel() - { - return $this->do_debug; - } - - /** - * Set SMTP timeout. - * @param integer $timeout - */ - public function setTimeout($timeout = 0) - { - $this->Timeout = $timeout; - } - - /** - * Get SMTP timeout. - * @return integer - */ - public function getTimeout() - { - return $this->Timeout; - } -} diff --git a/download/phpmailer529/composer.json b/download/phpmailer529/composer.json deleted file mode 100755 index 53d4eb117..000000000 --- a/download/phpmailer529/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "phpmailer/phpmailer", - "type": "library", - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.1.*" - }, - "autoload": { - "classmap": ["class.phpmailer.php", "class.pop3.php", "class.smtp.php"] - }, - "license": "LGPL-2.1" -} \ No newline at end of file diff --git a/download/phpmailer529/docs/Callback_function_notes.txt b/download/phpmailer529/docs/Callback_function_notes.txt deleted file mode 100755 index 461ea508e..000000000 --- a/download/phpmailer529/docs/Callback_function_notes.txt +++ /dev/null @@ -1,17 +0,0 @@ -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 diff --git a/download/phpmailer529/docs/DomainKeys_notes.txt b/download/phpmailer529/docs/DomainKeys_notes.txt deleted file mode 100755 index 2ad10f159..000000000 --- a/download/phpmailer529/docs/DomainKeys_notes.txt +++ /dev/null @@ -1,55 +0,0 @@ -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 - - order allow,deny - deny from all - - -# secure htkeypublic file - - order allow,deny - deny from all - - -(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 diff --git a/download/phpmailer529/docs/Note_for_SMTP_debugging.txt b/download/phpmailer529/docs/Note_for_SMTP_debugging.txt deleted file mode 100755 index 128b2d9d8..000000000 --- a/download/phpmailer529/docs/Note_for_SMTP_debugging.txt +++ /dev/null @@ -1,17 +0,0 @@ -If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place. -Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example: - -$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 server responses -$mail->SMTPDebug = 2; ... will echo errors, server responses and client messages - -And finally, don't forget to disable debugging before going into production. diff --git a/download/phpmailer529/docs/extending.html b/download/phpmailer529/docs/extending.html deleted file mode 100755 index ec2b85108..000000000 --- a/download/phpmailer529/docs/extending.html +++ /dev/null @@ -1,129 +0,0 @@ - - -Examples using phpmailer - - - - -

    Examples using PHPMailer

    - -

    1. Advanced Example

    -

    - -This demonstrates sending multiple email messages with binary attachments -from a MySQL database using multipart/alternative messages.

    - -

    -require 'PHPMailerAutoload.php';
    -
    -$mail = new PHPMailer();
    -
    -$mail->From     = 'list@example.com';
    -$mail->FromName = 'List manager';
    -$mail->Host     = 'smtp1.example.com;smtp2.example.com';
    -$mail->Mailer   = 'smtp';
    -
    -@mysqli_connect('localhost','root','password');
    -@mysqli_select_db("my_company");
    -$query = "SELECT full_name, email, photo FROM employee";
    -$result = @mysqli_query($query);
    -
    -while ($row = mysqli_fetch_assoc($result))
    -{
    -    // HTML body
    -    $body  = "Hello <font size=\"4\">" . $row['full_name'] . "</font>, <p>";
    -    $body .= "<i>Your</i> personal photograph to this message.<p>";
    -    $body .= "Sincerely, <br>";
    -    $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'] . "<br>";
    -
    -    // Clear all addresses and attachments for next loop
    -    $mail->clearAddresses();
    -    $mail->clearAttachments();
    -}
    -
    -

    - -

    2. Extending PHPMailer

    -

    - -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, and it's very easy to do: - -

    -Here's a class that extends the phpmailer class and sets the defaults -for the particular site:
    -PHP include file: my_phpmailer.php -

    - -

    -require 'PHPMailerAutoload.php';
    -
    -class my_phpmailer extends PHPMailer {
    -    // Set default variables for all new objects
    -    public $From     = 'from@example.com';
    -    public $FromName = 'Mailer';
    -    public $Host     = 'smtp1.example.com;smtp2.example.com';
    -    public $Mailer   = 'smtp';                         // Alternative to isSMTP()
    -    public $WordWrap = 75;
    -
    -    // Replace the default debug output function
    -    protected function edebug($msg) {
    -        print('My Site Error');
    -        print('Description:');
    -        printf('%s', $msg);
    -        exit;
    -    }
    -
    -    //Extend the send function
    -    public function send() {
    -        $this->Subject = '[Yay for me!] '.$this->Subject;
    -        return parent::send()
    -    }
    -
    -    // Create an additional function
    -    public function do_something($something) {
    -        // Place your new code here
    -    }
    -}
    -
    -
    -Now here's a normal PHP page in the site, which will have all the defaults set above:
    - -
    -require 'my_phpmailer.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';
    -
    - - diff --git a/download/phpmailer529/docs/faq.html b/download/phpmailer529/docs/faq.html deleted file mode 100755 index 7033a142e..000000000 --- a/download/phpmailer529/docs/faq.html +++ /dev/null @@ -1,28 +0,0 @@ - - -PHPMailer FAQ - - -

    PHPMailer FAQ

    -
      -
    • Q: I am concerned that using include files will take up too much - processing time on my computer. How can I make it run faster?
      - A: PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable - computer resources. You can bypass this by using an opcode cache which compiles - PHP code and store it in memory to reduce overhead immensely. APC - (Alternative PHP Cache) is a free opcode cache extension in the PECL library.
    • -
    • Q: Which mailer gives me the best performance?
      - A: On a single machine the sendmail (or Qmail) is fastest overall. - Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP. - If you do not have a local mail server (as is typical on Windows), SMTP is your only option.
    • -
    • Q: When I try to attach a file with on my server I get a - "Could not find {file} on filesystem error". Why is this?
      - A: If you are using a Unix machine this is probably because the user - running your web server does not have read access to the directory in question. If you are using Windows, - then the problem is probably that you have used single backslashes to denote directories (\). - A single backslash has a special meaning to PHP so these are not - valid. Instead use double backslashes ("\\") or a single forward - slash ("/").
    • -
    - - diff --git a/download/phpmailer529/docs/generatedocs.sh b/download/phpmailer529/docs/generatedocs.sh deleted file mode 100755 index 9da1ddfe7..000000000 --- a/download/phpmailer529/docs/generatedocs.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Regenerate PHPMailer documentation -# Run from within the docs folder -rm -rf phpdoc/* -phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/,vendor/,language/ --sourcecode --force --title PHPMailer --template="clean" -# You can merge regenerated docs into a separate docs working copy without messing up the git status like so: -# rsync -a --delete --exclude ".git" --exclude "phpdoc-cache-*/" --exclude "README.md" phpdoc/ ../../phpmailer-docs -# After updating docs, push/PR them to the phpmailer gh-pages branch: https://github.com/PHPMailer/PHPMailer/tree/gh-pages diff --git a/download/phpmailer529/docs/pop3_article.txt b/download/phpmailer529/docs/pop3_article.txt deleted file mode 100755 index fb90b9c76..000000000 --- a/download/phpmailer529/docs/pop3_article.txt +++ /dev/null @@ -1,50 +0,0 @@ -This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented. - -With that noted, here is how to implement it: - -I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory. - -When you need it, create your POP3 object - -Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer: - -authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); -$mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP(); -$mail->isHTML(false); $mail->Host = 'relay.example.com'; -$mail->From = 'mailer@example.com'; -$mail->FromName = 'Example Mailer'; -$mail->Subject = 'My subject'; -$mail->Body = 'Hello world'; -$mail->addAddress('rich@corephp.co.uk', 'Richard Davey'); -if (!$mail->send()) { - echo $mail->ErrorInfo; -} -?> - -The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier. -The Parameters - -The authorise parameters are as follows: - -$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); - - 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address) - 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host) - 3. 30 - A connection time-out value (in seconds) - 4. mailer - The POP3 Username required to logon - 5. password - The POP3 Password required to logon - 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser) - -Final Comments + the Download - -1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me. - -2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time. - -3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead. - -4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with. -Download - -My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class) diff --git a/download/phpmailer529/examples/code_generator.phps b/download/phpmailer529/examples/code_generator.phps deleted file mode 100755 index 341a7d674..000000000 --- a/download/phpmailer529/examples/code_generator.phps +++ /dev/null @@ -1,597 +0,0 @@ -CharSet = 'utf-8'; -$mail->Debugoutput = $CFG['smtp_debugoutput']; -$example_code .= "\n\n\$mail = new PHPMailer(true);"; -$example_code .= "\n\$mail->CharSet = 'utf-8';"; - -class phpmailerAppException extends phpmailerException -{ -} - -$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}"; -$example_code .= "\n\ntry {"; - -try { - if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") { - $to = $_POST['To_Email']; - if (!PHPMailer::validateAddress($to)) { - throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!"); - } - - $example_code .= "\n\$to = '{$_POST['To_Email']}';"; - $example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {"; - $example_code .= "\n throw new phpmailerAppException(\"Email address \" . " . - "\$to . \" is invalid -- aborting!\");"; - $example_code .= "\n}"; - - switch ($_POST['test_type']) { - case 'smtp': - $mail->isSMTP(); // telling the class to use SMTP - $mail->SMTPDebug = (integer)$_POST['smtp_debug']; - $mail->Host = $_POST['smtp_server']; // SMTP server - $mail->Port = (integer)$_POST['smtp_port']; // set the SMTP port - if ($_POST['smtp_secure']) { - $mail->SMTPSecure = strtolower($_POST['smtp_secure']); - } - $mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication? - if (array_key_exists('smtp_authenticate', $_POST)) { - $mail->Username = $_POST['authenticate_username']; // SMTP account username - $mail->Password = $_POST['authenticate_password']; // SMTP account password - } - - $example_code .= "\n\$mail->isSMTP();"; - $example_code .= "\n\$mail->SMTPDebug = " . $_POST['smtp_debug'] . ";"; - $example_code .= "\n\$mail->Host = \"" . $_POST['smtp_server'] . "\";"; - $example_code .= "\n\$mail->Port = \"" . $_POST['smtp_port'] . "\";"; - $example_code .= "\n\$mail->SMTPSecure = \"" . strtolower($_POST['smtp_secure']) . "\";"; - $example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists( - 'smtp_authenticate', - $_POST - ) ? 'true' : 'false') . ";"; - if (array_key_exists('smtp_authenticate', $_POST)) { - $example_code .= "\n\$mail->Username = \"" . $_POST['authenticate_username'] . "\";"; - $example_code .= "\n\$mail->Password = \"" . $_POST['authenticate_password'] . "\";"; - } - break; - case 'mail': - $mail->isMail(); // telling the class to use PHP's mail() - $example_code .= "\n\$mail->isMail();"; - break; - case 'sendmail': - $mail->isSendmail(); // telling the class to use Sendmail - $example_code .= "\n\$mail->isSendmail();"; - break; - case 'qmail': - $mail->isQmail(); // telling the class to use Qmail - $example_code .= "\n\$mail->isQmail();"; - break; - default: - throw new phpmailerAppException('Invalid test_type provided'); - } - - try { - if ($_POST['From_Name'] != '') { - $mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']); - $mail->From = $_POST['From_Email']; - $mail->FromName = $_POST['From_Name']; - - $example_code .= "\n\$mail->addReplyTo(\"" . - $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");"; - $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";"; - $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Name'] . "\";"; - } else { - $mail->addReplyTo($_POST['From_Email']); - $mail->From = $_POST['From_Email']; - $mail->FromName = $_POST['From_Email']; - - $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\");"; - $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";"; - $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Email'] . "\";"; - } - - if ($_POST['To_Name'] != '') { - $mail->addAddress($to, $_POST['To_Name']); - $example_code .= "\n\$mail->addAddress(\"$to\", \"" . $_POST['To_Name'] . "\");"; - } else { - $mail->addAddress($to); - $example_code .= "\n\$mail->addAddress(\"$to\");"; - } - - if ($_POST['bcc_Email'] != '') { - $indiBCC = explode(" ", $_POST['bcc_Email']); - foreach ($indiBCC as $key => $value) { - $mail->addBCC($value); - $example_code .= "\n\$mail->addBCC(\"$value\");"; - } - } - - if ($_POST['cc_Email'] != '') { - $indiCC = explode(" ", $_POST['cc_Email']); - foreach ($indiCC as $key => $value) { - $mail->addCC($value); - $example_code .= "\n\$mail->addCC(\"$value\");"; - } - } - } catch (phpmailerException $e) { //Catch all kinds of bad addressing - throw new phpmailerAppException($e->getMessage()); - } - $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')'; - $example_code .= "\n\$mail->Subject = \"" . $_POST['Subject'] . - '(PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";'; - - if ($_POST['Message'] == '') { - $body = file_get_contents('contents.html'); - } else { - $body = $_POST['Message']; - } - - $example_code .= "\n\$body = <<<'EOT'\n" . htmlentities($body) . "\nEOT;"; - - $mail->WordWrap = 78; // set word wrap to the RFC2822 limit - $mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images - - $example_code .= "\n\$mail->WordWrap = 78;"; - $example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images"; - - $mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name - $mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name - $example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," . - "'phpmailer_mini.png'); // optional name"; - $example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name"; - - $example_code .= "\n\ntry {"; - $example_code .= "\n \$mail->send();"; - $example_code .= "\n \$results_messages[] = \"Message has been sent using " . - strtoupper($_POST['test_type']) . "\";"; - $example_code .= "\n}"; - $example_code .= "\ncatch (phpmailerException \$e) {"; - $example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());"; - $example_code .= "\n}"; - - try { - $mail->send(); - $results_messages[] = "Message has been sent using " . strtoupper($_POST["test_type"]); - } catch (phpmailerException $e) { - throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage()); - } - } -} catch (phpmailerAppException $e) { - $results_messages[] = $e->errorMessage(); -} -$example_code .= "\n}"; -$example_code .= "\ncatch (phpmailerAppException \$e) {"; -$example_code .= "\n \$results_messages[] = \$e->errorMessage();"; -$example_code .= "\n}"; -$example_code .= "\n\nif (count(\$results_messages) > 0) {"; -$example_code .= "\n echo \"

    Run results

    \\n\";"; -$example_code .= "\n echo \"
      \\n\";"; -$example_code .= "\nforeach (\$results_messages as \$result) {"; -$example_code .= "\n echo \"
    • \$result
    • \\n\";"; -$example_code .= "\n}"; -$example_code .= "\necho \"
    \\n\";"; -$example_code .= "\n}"; -?> - - - - PHPMailer Test Page - - - - - - - - -"; - echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above."); -} - -if (count($results_messages) > 0) { - echo '

    Run results

    '; - echo '
      '; - foreach ($results_messages as $result) { - echo "
    • $result
    • "; - } - echo '
    '; -} - -if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") { - echo "
    \n"; - echo "
    Script:\n"; - echo "
    \n";
    -    echo $example_code;
    -    echo "\n
    \n"; - echo "\n
    \n"; -} -?> -
    -
    -
    -
    - Mail Details - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    -
    Test will include two attachments.
    -
    -
    -
    -
    - Mail Test Specs - - - - - -
    Test Type -
    - - - required> -
    -
    - - - required> -
    -
    - - - required> -
    -
    - - - required> -
    -
    -
    "> - SMTP Specific Options: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - -
    - -
    - -
    - - value=""> -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    - - \ No newline at end of file diff --git a/download/phpmailer529/examples/contents.html b/download/phpmailer529/examples/contents.html deleted file mode 100755 index 9257f6dd9..000000000 --- a/download/phpmailer529/examples/contents.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - PHPMailer Test - - -
    -

    This is a test of PHPMailer.

    -
    - PHPMailer rocks -
    -

    This example uses HTML.

    -

    The PHPMailer image at the top has been embedded automatically.

    -
    - - diff --git a/download/phpmailer529/examples/exceptions.phps b/download/phpmailer529/examples/exceptions.phps deleted file mode 100755 index 0e941e733..000000000 --- a/download/phpmailer529/examples/exceptions.phps +++ /dev/null @@ -1,35 +0,0 @@ -setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer Exceptions test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo "Message sent!"; -} catch (phpmailerException $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -} diff --git a/download/phpmailer529/examples/gmail.phps b/download/phpmailer529/examples/gmail.phps deleted file mode 100755 index b020f3380..000000000 --- a/download/phpmailer529/examples/gmail.phps +++ /dev/null @@ -1,72 +0,0 @@ -isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; - -//Set the hostname of the mail server -$mail->Host = 'smtp.gmail.com'; - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Username to use for SMTP authentication - use full email address for gmail -$mail->Username = "username@gmail.com"; - -//Password to use for SMTP authentication -$mail->Password = "yourpassword"; - -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); - -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer GMail SMTP test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; - -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/download/phpmailer529/examples/images/phpmailer.png b/download/phpmailer529/examples/images/phpmailer.png deleted file mode 100755 index 9bdd83c8d..000000000 Binary files a/download/phpmailer529/examples/images/phpmailer.png and /dev/null differ diff --git a/download/phpmailer529/examples/images/phpmailer_mini.png b/download/phpmailer529/examples/images/phpmailer_mini.png deleted file mode 100755 index e6915f431..000000000 Binary files a/download/phpmailer529/examples/images/phpmailer_mini.png and /dev/null differ diff --git a/download/phpmailer529/examples/index.html b/download/phpmailer529/examples/index.html deleted file mode 100755 index bbb830d19..000000000 --- a/download/phpmailer529/examples/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - PHPMailer Examples - - -

    PHPMailer code examplesPHPMailer logo

    -

    This folder contains a collection of examples of using PHPMailer.

    -

    About testing email sending

    -

    When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:

    -
      -
    • FakeSMTP, a Java desktop app with the ability to show an SMTP log and save messages to a folder.
    • -
    • FakeEmail, a Python-based fake mail server with a web interface.
    • -
    • smtp-sink, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.
    • -
    • smtp4dev, a dummy SMTP server for Windows.
    • -
    • fakesendmail.sh, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.
    • -
    • msglint, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.
    • -
    -
    -

    Security note

    -

    Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - please don't do that! Similarly, don't leave your passwords in these files as they will be visible to the world!

    -
    -

    code_generator.phps

    -

    This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.

    -

    mail.phps

    -

    This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.

    -

    exceptions.phps

    -

    The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.

    -

    smtp.phps

    -

    A simple example sending using SMTP with authentication.

    -

    smtp_no_auth.phps

    -

    A simple example sending using SMTP without authentication.

    -

    sendmail.phps

    -

    A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.

    -

    gmail.phps

    -

    Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.

    -

    pop_before_smtp.phps

    -

    Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.

    -

    mailing_list.phps

    -

    This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.

    -
    -

    smtp_check.phps

    -

    This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.

    -
    -

    Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in RFC 2606. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!

    - - diff --git a/download/phpmailer529/examples/mail.phps b/download/phpmailer529/examples/mail.phps deleted file mode 100755 index 8e129f47d..000000000 --- a/download/phpmailer529/examples/mail.phps +++ /dev/null @@ -1,31 +0,0 @@ -setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer mail() test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/download/phpmailer529/examples/mailing_list.phps b/download/phpmailer529/examples/mailing_list.phps deleted file mode 100755 index 8644bb596..000000000 --- a/download/phpmailer529/examples/mailing_list.phps +++ /dev/null @@ -1,59 +0,0 @@ -isSMTP(); -$mail->Host = 'smtp.example.com'; -$mail->SMTPAuth = true; -$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead -$mail->Port = 25; -$mail->Username = 'yourname@example.com'; -$mail->Password = 'yourpassword'; -$mail->setFrom('list@example.com', 'List manager'); -$mail->addReplyTo('list@example.com', 'List manager'); - -$mail->Subject = "PHPMailer Simple database mailing list test"; - -//Same body for all messages, so set this before the sending loop -//If you generate a different body for each recipient (e.g. you're using a templating system), -//set it inside the loop -$mail->msgHTML($body); -//msgHTML also sets AltBody, but if you want a custom one, set it afterwards -$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; - -//Connect to the database and select the recipients from your mailing list that have not yet been sent to -//You'll need to alter this to match your database -$mysql = mysqli_connect('localhost', 'username', 'password'); -mysqli_select_db($mysql, 'mydb'); -$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = false'); - -foreach ($result as $row) { //This iterator syntax only works in PHP 5.4+ - $mail->addAddress($row['email'], $row['full_name']); - if (!empty($row['photo'])) { - $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB - } - - if (!$mail->send()) { - echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '
    '; - break; //Abandon sending - } else { - echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')
    '; - //Mark it as sent in the DB - mysqli_query( - $mysql, - "UPDATE mailinglist SET sent = true WHERE email = '" . - mysqli_real_escape_string($mysql, $row['email']) . "'" - ); - } - // Clear all addresses and attachments for next loop - $mail->clearAddresses(); - $mail->clearAttachments(); -} diff --git a/download/phpmailer529/examples/pop_before_smtp.phps b/download/phpmailer529/examples/pop_before_smtp.phps deleted file mode 100755 index 164dfe8dd..000000000 --- a/download/phpmailer529/examples/pop_before_smtp.phps +++ /dev/null @@ -1,54 +0,0 @@ -isSMTP(); - //Enable SMTP debugging - // 0 = off (for production use) - // 1 = client messages - // 2 = client and server messages - $mail->SMTPDebug = 2; - //Ask for HTML-friendly debug output - $mail->Debugoutput = 'html'; - //Set the hostname of the mail server - $mail->Host = "mail.example.com"; - //Set the SMTP port number - likely to be 25, 465 or 587 - $mail->Port = 25; - //Whether to use SMTP authentication - $mail->SMTPAuth = false; - //Set who the message is to be sent from - $mail->setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer POP-before-SMTP test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo "Message sent!"; -} catch (phpmailerException $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -} diff --git a/download/phpmailer529/examples/scripts/XRegExp.js b/download/phpmailer529/examples/scripts/XRegExp.js deleted file mode 100755 index ebdb9c948..000000000 --- a/download/phpmailer529/examples/scripts/XRegExp.js +++ /dev/null @@ -1,664 +0,0 @@ -// XRegExp 1.5.1 -// (c) 2007-2012 Steven Levithan -// MIT License -// -// Provides an augmented, extensible, cross-browser implementation of regular expressions, -// including support for additional syntax, flags, and methods - -var XRegExp; - -if (XRegExp) { - // Avoid running twice, since that would break references to native globals - throw Error("can't load XRegExp twice in the same frame"); -} - -// Run within an anonymous function to protect variables and avoid new globals -(function (undefined) { - - //--------------------------------- - // Constructor - //--------------------------------- - - // Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native - // regular expression in that additional syntax and flags are supported and cross-browser - // syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and - // converts to type XRegExp - XRegExp = function (pattern, flags) { - var output = [], - currScope = XRegExp.OUTSIDE_CLASS, - pos = 0, - context, tokenResult, match, chr, regex; - - if (XRegExp.isRegExp(pattern)) { - if (flags !== undefined) - throw TypeError("can't supply flags when constructing one RegExp from another"); - return clone(pattern); - } - // Tokens become part of the regex construction process, so protect against infinite - // recursion when an XRegExp is constructed within a token handler or trigger - if (isInsideConstructor) - throw Error("can't call the XRegExp constructor within token definition functions"); - - flags = flags || ""; - context = { // `this` object for custom tokens - hasNamedCapture: false, - captureNames: [], - hasFlag: function (flag) {return flags.indexOf(flag) > -1;}, - setFlag: function (flag) {flags += flag;} - }; - - while (pos < pattern.length) { - // Check for custom tokens at the current position - tokenResult = runTokens(pattern, pos, currScope, context); - - if (tokenResult) { - output.push(tokenResult.output); - pos += (tokenResult.match[0].length || 1); - } else { - // Check for native multicharacter metasequences (excluding character classes) at - // the current position - if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) { - output.push(match[0]); - pos += match[0].length; - } else { - chr = pattern.charAt(pos); - if (chr === "[") - currScope = XRegExp.INSIDE_CLASS; - else if (chr === "]") - currScope = XRegExp.OUTSIDE_CLASS; - // Advance position one character - output.push(chr); - pos++; - } - } - } - - regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, "")); - regex._xregexp = { - source: pattern, - captureNames: context.hasNamedCapture ? context.captureNames : null - }; - return regex; - }; - - - //--------------------------------- - // Public properties - //--------------------------------- - - XRegExp.version = "1.5.1"; - - // Token scope bitflags - XRegExp.INSIDE_CLASS = 1; - XRegExp.OUTSIDE_CLASS = 2; - - - //--------------------------------- - // Private variables - //--------------------------------- - - var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g, - flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags - quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/, - isInsideConstructor = false, - tokens = [], - // Copy native globals for reference ("native" is an ES3 reserved keyword) - nativ = { - exec: RegExp.prototype.exec, - test: RegExp.prototype.test, - match: String.prototype.match, - replace: String.prototype.replace, - split: String.prototype.split - }, - compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups - compliantLastIndexIncrement = function () { - var x = /^/g; - nativ.test.call(x, ""); - return !x.lastIndex; - }(), - hasNativeY = RegExp.prototype.sticky !== undefined, - nativeTokens = {}; - - // `nativeTokens` match native multicharacter metasequences only (including deprecated octals, - // excluding character classes) - nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/; - nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/; - - - //--------------------------------- - // Public methods - //--------------------------------- - - // Lets you extend or change XRegExp syntax and create custom flags. This is used internally by - // the XRegExp library and can be used to create XRegExp plugins. This function is intended for - // users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can - // be disabled by `XRegExp.freezeTokens` - XRegExp.addToken = function (regex, handler, scope, trigger) { - tokens.push({ - pattern: clone(regex, "g" + (hasNativeY ? "y" : "")), - handler: handler, - scope: scope || XRegExp.OUTSIDE_CLASS, - trigger: trigger || null - }); - }; - - // Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag - // combination has previously been cached, the cached copy is returned; otherwise the newly - // created regex is cached - XRegExp.cache = function (pattern, flags) { - var key = pattern + "/" + (flags || ""); - return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags)); - }; - - // Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh - // `lastIndex` (set to zero). If you want to copy a regex without forcing the `global` - // property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve - // special properties required for named capture - XRegExp.copyAsGlobal = function (regex) { - return clone(regex, "g"); - }; - - // Accepts a string; returns the string with regex metacharacters escaped. The returned string - // can safely be used at any point within a regex to match the provided literal string. Escaped - // characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace - XRegExp.escape = function (str) { - return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }; - - // Accepts a string to search, regex to search with, position to start the search within the - // string (default: 0), and an optional Boolean indicating whether matches must start at-or- - // after the position or at the specified position only. This function ignores the `lastIndex` - // of the provided regex in its own handling, but updates the property for compatibility - XRegExp.execAt = function (str, regex, pos, anchored) { - var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")), - match; - r2.lastIndex = pos = pos || 0; - match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (anchored && match && match.index !== pos) - match = null; - if (regex.global) - regex.lastIndex = match ? r2.lastIndex : 0; - return match; - }; - - // Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing - // syntax and flag changes. Should be run after XRegExp and any plugins are loaded - XRegExp.freezeTokens = function () { - XRegExp.addToken = function () { - throw Error("can't run addToken after freezeTokens"); - }; - }; - - // Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object. - // Note that this is also `true` for regex literals and regexes created by the `XRegExp` - // constructor. This works correctly for variables created in another frame, when `instanceof` - // and `constructor` checks would fail to work as intended - XRegExp.isRegExp = function (o) { - return Object.prototype.toString.call(o) === "[object RegExp]"; - }; - - // Executes `callback` once per match within `str`. Provides a simpler and cleaner way to - // iterate over regex matches compared to the traditional approaches of subverting - // `String.prototype.replace` or repeatedly calling `exec` within a `while` loop - XRegExp.iterate = function (str, regex, callback, context) { - var r2 = clone(regex, "g"), - i = -1, match; - while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (regex.global) - regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback` - callback.call(context, match, ++i, str, regex); - if (r2.lastIndex === match.index) - r2.lastIndex++; - } - if (regex.global) - regex.lastIndex = 0; - }; - - // Accepts a string and an array of regexes; returns the result of using each successive regex - // to search within the matches of the previous regex. The array of regexes can also contain - // objects with `regex` and `backref` properties, in which case the named or numbered back- - // references specified are passed forward to the next regex or returned. E.g.: - // var xregexpImgFileNames = XRegExp.matchChain(html, [ - // {regex: /]+)>/i, backref: 1}, // tag attributes - // {regex: XRegExp('(?ix) \\s src=" (? [^"]+ )'), backref: "src"}, // src attribute values - // {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths - // /[^\/]+$/ // filenames (strip directory paths) - // ]); - XRegExp.matchChain = function (str, chain) { - return function recurseChain (values, level) { - var item = chain[level].regex ? chain[level] : {regex: chain[level]}, - regex = clone(item.regex, "g"), - matches = [], i; - for (i = 0; i < values.length; i++) { - XRegExp.iterate(values[i], regex, function (match) { - matches.push(item.backref ? (match[item.backref] || "") : match[0]); - }); - } - return ((level === chain.length - 1) || !matches.length) ? - matches : recurseChain(matches, level + 1); - }([str], 0); - }; - - - //--------------------------------- - // New RegExp prototype methods - //--------------------------------- - - // Accepts a context object and arguments array; returns the result of calling `exec` with the - // first value in the arguments array. the context is ignored but is accepted for congruity - // with `Function.prototype.apply` - RegExp.prototype.apply = function (context, args) { - return this.exec(args[0]); - }; - - // Accepts a context object and string; returns the result of calling `exec` with the provided - // string. the context is ignored but is accepted for congruity with `Function.prototype.call` - RegExp.prototype.call = function (context, str) { - return this.exec(str); - }; - - - //--------------------------------- - // Overriden native methods - //--------------------------------- - - // Adds named capture support (with backreferences returned as `result.name`), and fixes two - // cross-browser issues per ES3: - // - Captured values for nonparticipating capturing groups should be returned as `undefined`, - // rather than the empty string. - // - `lastIndex` should not be incremented after zero-length matches. - RegExp.prototype.exec = function (str) { - var match, name, r2, origLastIndex; - if (!this.global) - origLastIndex = this.lastIndex; - match = nativ.exec.apply(this, arguments); - if (match) { - // Fix browsers whose `exec` methods don't consistently return `undefined` for - // nonparticipating capturing groups - if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { - r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", "")); - // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed - // matching due to characters outside the match - nativ.replace.call((str + "").slice(match.index), r2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) - match[i] = undefined; - } - }); - } - // Attach named capture properties - if (this._xregexp && this._xregexp.captureNames) { - for (var i = 1; i < match.length; i++) { - name = this._xregexp.captureNames[i - 1]; - if (name) - match[name] = match[i]; - } - } - // Fix browsers that increment `lastIndex` after zero-length matches - if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - } - if (!this.global) - this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - return match; - }; - - // Fix browser bugs in native method - RegExp.prototype.test = function (str) { - // Use the native `exec` to skip some processing overhead, even though the altered - // `exec` would take care of the `lastIndex` fixes - var match, origLastIndex; - if (!this.global) - origLastIndex = this.lastIndex; - match = nativ.exec.call(this, str); - // Fix browsers that increment `lastIndex` after zero-length matches - if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - if (!this.global) - this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - return !!match; - }; - - // Adds named capture support and fixes browser bugs in native method - String.prototype.match = function (regex) { - if (!XRegExp.isRegExp(regex)) - regex = RegExp(regex); // Native `RegExp` - if (regex.global) { - var result = nativ.match.apply(this, arguments); - regex.lastIndex = 0; // Fix IE bug - return result; - } - return regex.exec(this); // Run the altered `exec` - }; - - // Adds support for `${n}` tokens for named and numbered backreferences in replacement text, - // and provides named backreferences to replacement functions as `arguments[0].name`. Also - // fixes cross-browser differences in replacement text syntax when performing a replacement - // using a nonregex search value, and the value of replacement regexes' `lastIndex` property - // during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary - // third (`flags`) parameter - String.prototype.replace = function (search, replacement) { - var isRegex = XRegExp.isRegExp(search), - captureNames, result, str, origLastIndex; - - // There are too many combinations of search/replacement types/values and browser bugs that - // preclude passing to native `replace`, so don't try - //if (...) - // return nativ.replace.apply(this, arguments); - - if (isRegex) { - if (search._xregexp) - captureNames = search._xregexp.captureNames; // Array or `null` - if (!search.global) - origLastIndex = search.lastIndex; - } else { - search = search + ""; // Type conversion - } - - if (Object.prototype.toString.call(replacement) === "[object Function]") { - result = nativ.replace.call(this + "", search, function () { - if (captureNames) { - // Change the `arguments[0]` string primitive to a String object which can store properties - arguments[0] = new String(arguments[0]); - // Store named backreferences on `arguments[0]` - for (var i = 0; i < captureNames.length; i++) { - if (captureNames[i]) - arguments[0][captureNames[i]] = arguments[i + 1]; - } - } - // Update `lastIndex` before calling `replacement` (fix browsers) - if (isRegex && search.global) - search.lastIndex = arguments[arguments.length - 2] + arguments[0].length; - return replacement.apply(null, arguments); - }); - } else { - str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`) - result = nativ.replace.call(str, search, function () { - var args = arguments; // Keep this function's `arguments` available through closure - return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) { - // Numbered backreference (without delimiters) or special variable - if ($1) { - switch ($1) { - case "$": return "$"; - case "&": return args[0]; - case "`": return args[args.length - 1].slice(0, args[args.length - 2]); - case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length); - // Numbered backreference - default: - // What does "$10" mean? - // - Backreference 10, if 10 or more capturing groups exist - // - Backreference 1 followed by "0", if 1-9 capturing groups exist - // - Otherwise, it's the string "$10" - // Also note: - // - Backreferences cannot be more than two digits (enforced by `replacementToken`) - // - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01" - // - There is no "$0" token ("$&" is the entire match) - var literalNumbers = ""; - $1 = +$1; // Type conversion; drop leading zero - if (!$1) // `$1` was "0" or "00" - return $0; - while ($1 > args.length - 3) { - literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers; - $1 = Math.floor($1 / 10); // Drop the last digit - } - return ($1 ? args[$1] || "" : "$") + literalNumbers; - } - // Named backreference or delimited numbered backreference - } else { - // What does "${n}" mean? - // - Backreference to numbered capture n. Two differences from "$n": - // - n can be more than two digits - // - Backreference 0 is allowed, and is the entire match - // - Backreference to named capture n, if it exists and is not a number overridden by numbered capture - // - Otherwise, it's the string "${n}" - var n = +$2; // Type conversion; drop leading zeros - if (n <= args.length - 3) - return args[n]; - n = captureNames ? indexOf(captureNames, $2) : -1; - return n > -1 ? args[n + 1] : $0; - } - }); - }); - } - - if (isRegex) { - if (search.global) - search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows) - else - search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - } - - return result; - }; - - // A consistent cross-browser, ES3 compliant `split` - String.prototype.split = function (s /* separator */, limit) { - // If separator `s` is not a regex, use the native `split` - if (!XRegExp.isRegExp(s)) - return nativ.split.apply(this, arguments); - - var str = this + "", // Type conversion - output = [], - lastLastIndex = 0, - match, lastLength; - - // Behavior for `limit`: if it's... - // - `undefined`: No limit - // - `NaN` or zero: Return an empty array - // - A positive number: Use `Math.floor(limit)` - // - A negative number: No limit - // - Other: Type-convert, then use the above rules - if (limit === undefined || +limit < 0) { - limit = Infinity; - } else { - limit = Math.floor(+limit); - if (!limit) - return []; - } - - // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero - // and restore it to its original value when we're done using the regex - s = XRegExp.copyAsGlobal(s); - - while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (s.lastIndex > lastLastIndex) { - output.push(str.slice(lastLastIndex, match.index)); - - if (match.length > 1 && match.index < str.length) - Array.prototype.push.apply(output, match.slice(1)); - - lastLength = match[0].length; - lastLastIndex = s.lastIndex; - - if (output.length >= limit) - break; - } - - if (s.lastIndex === match.index) - s.lastIndex++; - } - - if (lastLastIndex === str.length) { - if (!nativ.test.call(s, "") || lastLength) - output.push(""); - } else { - output.push(str.slice(lastLastIndex)); - } - - return output.length > limit ? output.slice(0, limit) : output; - }; - - - //--------------------------------- - // Private helper functions - //--------------------------------- - - // Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp` - // instance with a fresh `lastIndex` (set to zero), preserving properties required for named - // capture. Also allows adding new flags in the process of copying the regex - function clone (regex, additionalFlags) { - if (!XRegExp.isRegExp(regex)) - throw TypeError("type RegExp expected"); - var x = regex._xregexp; - regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || "")); - if (x) { - regex._xregexp = { - source: x.source, - captureNames: x.captureNames ? x.captureNames.slice(0) : null - }; - } - return regex; - } - - function getNativeFlags (regex) { - return (regex.global ? "g" : "") + - (regex.ignoreCase ? "i" : "") + - (regex.multiline ? "m" : "") + - (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 - (regex.sticky ? "y" : ""); - } - - function runTokens (pattern, index, scope, context) { - var i = tokens.length, - result, match, t; - // Protect against constructing XRegExps within token handler and trigger functions - isInsideConstructor = true; - // Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws - try { - while (i--) { // Run in reverse order - t = tokens[i]; - if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) { - t.pattern.lastIndex = index; - match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc. - if (match && match.index === index) { - result = { - output: t.handler.call(context, match, scope), - match: match - }; - break; - } - } - } - } catch (err) { - throw err; - } finally { - isInsideConstructor = false; - } - return result; - } - - function indexOf (array, item, from) { - if (Array.prototype.indexOf) // Use the native array method if available - return array.indexOf(item, from); - for (var i = from || 0; i < array.length; i++) { - if (array[i] === item) - return i; - } - return -1; - } - - - //--------------------------------- - // Built-in tokens - //--------------------------------- - - // Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the - // third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS` - - // Comment pattern: (?# ) - XRegExp.addToken( - /\(\?#[^)]*\)/, - function (match) { - // Keep tokens separated unless the following token is a quantifier - return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)"; - } - ); - - // Capturing group (match the opening parenthesis only). - // Required for support of named capturing groups - XRegExp.addToken( - /\((?!\?)/, - function () { - this.captureNames.push(null); - return "("; - } - ); - - // Named capturing group (match the opening delimiter only): (? - XRegExp.addToken( - /\(\?<([$\w]+)>/, - function (match) { - this.captureNames.push(match[1]); - this.hasNamedCapture = true; - return "("; - } - ); - - // Named backreference: \k - XRegExp.addToken( - /\\k<([\w$]+)>/, - function (match) { - var index = indexOf(this.captureNames, match[1]); - // Keep backreferences separate from subsequent literal numbers. Preserve back- - // references to named groups that are undefined at this point as literal strings - return index > -1 ? - "\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") : - match[0]; - } - ); - - // Empty character class: [] or [^] - XRegExp.addToken( - /\[\^?]/, - function (match) { - // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S]. - // (?!) should work like \b\B, but is unreliable in Firefox - return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]"; - } - ); - - // Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx) - // Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc. - XRegExp.addToken( - /^\(\?([imsx]+)\)/, - function (match) { - this.setFlag(match[1]); - return ""; - } - ); - - // Whitespace and comments, in free-spacing (aka extended) mode only - XRegExp.addToken( - /(?:\s+|#.*)+/, - function (match) { - // Keep tokens separated unless the following token is a quantifier - return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)"; - }, - XRegExp.OUTSIDE_CLASS, - function () {return this.hasFlag("x");} - ); - - // Dot, in dotall (aka singleline) mode only - XRegExp.addToken( - /\./, - function () {return "[\\s\\S]";}, - XRegExp.OUTSIDE_CLASS, - function () {return this.hasFlag("s");} - ); - - - //--------------------------------- - // Backward compatibility - //--------------------------------- - - // Uncomment the following block for compatibility with XRegExp 1.0-1.2: - /* - XRegExp.matchWithinChain = XRegExp.matchChain; - RegExp.prototype.addFlags = function (s) {return clone(this, s);}; - RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;}; - RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);}; - RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;}; - */ - -})(); - diff --git a/download/phpmailer529/examples/scripts/shAutoloader.js b/download/phpmailer529/examples/scripts/shAutoloader.js deleted file mode 100755 index 9f5942ee2..000000000 --- a/download/phpmailer529/examples/scripts/shAutoloader.js +++ /dev/null @@ -1,122 +0,0 @@ -(function() { - -var sh = SyntaxHighlighter; - -/** - * Provides functionality to dynamically load only the brushes that a needed to render the current page. - * - * There are two syntaxes that autoload understands. For example: - * - * SyntaxHighlighter.autoloader( - * [ 'applescript', 'Scripts/shBrushAppleScript.js' ], - * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ] - * ); - * - * or a more easily comprehendable one: - * - * SyntaxHighlighter.autoloader( - * 'applescript Scripts/shBrushAppleScript.js', - * 'actionscript3 as3 Scripts/shBrushAS3.js' - * ); - */ -sh.autoloader = function() -{ - var list = arguments, - elements = sh.findElements(), - brushes = {}, - scripts = {}, - all = SyntaxHighlighter.all, - allCalled = false, - allParams = null, - i - ; - - SyntaxHighlighter.all = function(params) - { - allParams = params; - allCalled = true; - }; - - function addBrush(aliases, url) - { - for (var i = 0; i < aliases.length; i++) - brushes[aliases[i]] = url; - }; - - function getAliases(item) - { - return item.pop - ? item - : item.split(/\s+/) - ; - } - - // create table of aliases and script urls - for (i = 0; i < list.length; i++) - { - var aliases = getAliases(list[i]), - url = aliases.pop() - ; - - addBrush(aliases, url); - } - - // dynamically add diff --git a/java_generate/templates/generic.template.html b/java_generate/templates/generic.template.html index 4d9163a9b..d8858a537 100644 --- a/java_generate/templates/generic.template.html +++ b/java_generate/templates/generic.template.html @@ -1,7 +1,7 @@ - <!-- require:classname --><!-- classname -->::<!-- end --><!-- name --> \ Language (API) \ Processing 2+ + <!-- require:classname --><!-- classname -->::<!-- end --><!-- name --> \ Language (API) \ Processing 3+ @@ -23,13 +23,13 @@ - + diff --git a/java_generate/templates/index.alphabetical.template.html b/java_generate/templates/index.alphabetical.template.html index 0f865fac0..1c52fca5c 100644 --- a/java_generate/templates/index.alphabetical.template.html +++ b/java_generate/templates/index.alphabetical.template.html @@ -1,7 +1,7 @@ - Alphabetical Language Reference (API) \ Processing 2+ + Alphabetical Language Reference (API) \ Processing 3+ @@ -28,6 +28,7 @@
  • p5.js
  • Processing.py
  • Processing for Android
  • +
  • Processing for Pi
    • Processing Foundation
    • @@ -42,6 +43,12 @@

      + diff --git a/java_generate/templates/index.template.html b/java_generate/templates/index.template.html index 2204a2ad0..12b460548 100644 --- a/java_generate/templates/index.template.html +++ b/java_generate/templates/index.template.html @@ -1,7 +1,7 @@ - Language Reference (API) \ Processing 2+ + Language Reference (API) \ Processing 3+ @@ -27,6 +27,7 @@
    • p5.js
    • Processing.py
    • Processing for Android
    • +
    • Processing for Pi
    • Processing Foundation
    • @@ -41,6 +42,12 @@

      + diff --git a/java_generate/templates/library.index.template.html b/java_generate/templates/library.index.template.html index ee0d6a6cd..98c01d64e 100644 --- a/java_generate/templates/library.index.template.html +++ b/java_generate/templates/library.index.template.html @@ -1,7 +1,7 @@ - Video \ Libraries \ Processing 2+ + Video \ Libraries \ Processing 3+ @@ -23,12 +23,13 @@ - + diff --git a/java_generate/templates/nav.web.template.html b/java_generate/templates/nav.web.template.html index 010aeb9d9..43f41939c 100644 --- a/java_generate/templates/nav.web.template.html +++ b/java_generate/templates/nav.web.template.html @@ -1,32 +1,33 @@ \ No newline at end of file diff --git a/javascript/site.js b/javascript/site.js index 7fe7e2493..48c2f805a 100644 --- a/javascript/site.js +++ b/javascript/site.js @@ -1,5 +1,13 @@ $(function(){ + // redirect download to support + $('.download [href*="download.processing.org"]').on('click', function (e) { + e.preventDefault() + window.open($(this).attr('href')) + window.location = '/download/support.html' + window.focus() + }) + // sticky scroll if(!Modernizr.touch){ $(window).scroll(function(){ @@ -97,3 +105,5 @@ function format_relative_time(time_ago) { if ( time_ago.seconds > 1 ) return ' ' + time_ago.seconds + ' seconds ago'; return 'just now'; } + + diff --git a/subscribe/index.php b/subscribe/index.php index 09b856f39..a684a7fc8 100755 --- a/subscribe/index.php +++ b/subscribe/index.php @@ -94,9 +94,9 @@ Shop

      »Forum
      »GitHub
      - »Issues
      - »Wiki
      - »FAQ
      + »Issues
      + »Wiki
      + »FAQ
      »Twitter
      »Facebook
      diff --git a/templates/foundation-template.html b/templates/foundation-template.html deleted file mode 100644 index a77864dac..000000000 --- a/templates/foundation-template.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - <!--*-->title<!--*--> - - - - - - - - - - - - - - - - -
      - - - -
      - header -
      - -

      - -

      -
      -
      - - - - navigation - - -
      - - content_for_layout - -
      - - - - -
      - - - - - - - diff --git a/templates/foundation-template.local.html b/templates/foundation-template.local.html deleted file mode 100644 index 5a5f3167e..000000000 --- a/templates/foundation-template.local.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - <!--*-->title<!--*--> - - - - - - - - - - - - - - - - - - -
      - - - - navigation - - - - -
      - - content_for_layout - -
      - - - - -
      - - diff --git a/templates/foundation-template.nav.php b/templates/foundation-template.nav.php deleted file mode 100644 index 24b967859..000000000 --- a/templates/foundation-template.nav.php +++ /dev/null @@ -1,65 +0,0 @@ - array('/', 0), - - 'Mission' => array('/mission/', 1), - - 'Projects' => array('/projects/', 2), - 'People' => array('/people/', 3), - 'Fellowships' => array('/fellowships/', 4), - 'Reports' => array('/reports/', 5), - 'Patrons' => array('/patrons/', 6), - //'Donate' => array('/donate/', 7), - - //'Download' => array('/download/', 0), - - ); - - -function navigation($section = '') -{ - global $lang; - global $translation; - //$tr = $translation->navigation; // Removed 22 Sep 2011 --CR - - // $abo = array('About', 'Overview', 'People', 'Foundation'); - //$ref = array('Reference', 'Language', 'A-Z', 'Libraries', 'Tools', 'Environment'); - //$learn = array('Learning', 'Tutorials', 'Basics', 'Topics', '3D', 'Library', 'Books'); - //$found = array('Overview', 'Mission', 'Projects', 'People', 'Fellowships', 'Reports', 'Patrons', 'Donate'); - $found = array('Overview', 'Mission', 'Projects', 'People', 'Fellowships', 'Reports', 'Patrons'); - - $html = "\t\t\t".'\n"; -} - -function l($s, $c) -{ - global $pages; - return "$s"; - return "$s"; -} - -?> diff --git a/templates/foundation-template.php b/templates/foundation-template.php deleted file mode 100644 index f71cd33e1..000000000 --- a/templates/foundation-template.php +++ /dev/null @@ -1,290 +0,0 @@ -'); -define('REL_HEADER', ''); -define('HEADER_LINK', ''); - -class Page -{ - var $xhtml; - var $lang; - var $subtemplate = false; - var $section; - - function Page($title = '', $section = '', $bodyid = '', $rel_path = '/') - { - $this->xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.html'); - $this->set('relpath', $rel_path); - if (strcmp($rel_path, '/')) { - $this->xhtml->set('header', REL_HEADER); - } else { - $this->xhtml->set('header', $section == 'Cover' ? HEADER : HEADER_LINK); - $this->xhtml->set('header', $section == 'Overview2' ? HEADER : HEADER_LINK); - } - $this->section = $section; - $this->xhtml->set('bodyid', ($bodyid == '') ? $section : $bodyid); - $title = ($title == '') ? 'Processing Foundation' : $title . ' \ Processing Foundation'; - $this->xhtml->set('title', $title); - $this->xhtml->set('navigation', navigation($section)); - } - - function set($key, $value) - { - $this->xhtml->set($key, $value); - } - - function set_array($array) - { - foreach ($array as $key => $value) { - $this->xhtml->set($key, $value); - } - } - - function subtemplate($file) - { - $piece = new xhtml_piece(TEMPLATEDIR.$file); - $this->xhtml->set('content_for_layout', $piece->out()); - $this->subtemplate = true; - } - - function content($content) - { - if (!$this->subtemplate) { - $this->xhtml->set('content_for_layout', $content); - } else { - $this->xhtml->set('content', $content); - } - } - - function language($lang) - { - global $LANGUAGES; - $this->lang = $lang; - $this->xhtml->set('charset', $LANGUAGES[$lang][1]); - $this->xhtml->set('lang', $lang); - if ($lang != 'en') { - #$this->xhtml->set('navigation', navigation_tr($this->section)); - $this->xhtml->set('navigation', navigation($this->section)); - } - } - - function out() - { - if (!$this->lang) { $this->language('en'); } - return $this->xhtml->out(); - } - - function set_rel_path($path = '') - { - $this->xhtml->set('relpath', $path); - } -} - -class ReferencePage -{ - var $xhtml; - var $lang; - var $filepath; - - function ReferencePage(&$ref, $translation, $lang = 'en') - { - global $LANGUAGES; - - $this->filepath = 'reference/' . ($lang == 'en' ? '' : "$lang/") . $ref->name(); - $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 2+'; - - $xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.translation.html'); - $xhtml->set('header', HEADER_LINK); - $xhtml->set('title', $title); - $xhtml->set('bodyid', 'Langauge-'.$lang); - - $xhtml->set('navigation', ($lang == 'en') ? navigation('Language') : navigation('Language')); - - $piece = new xhtml_piece(TEMPLATEDIR.'foundation-template.reference.item.html'); - $xhtml->set('content_for_layout', $piece->out()); - - $xhtml->set('reference_nav', reference_nav()); - $xhtml->set('language_nav', language_nav($lang)); - - $xhtml->set('content', $ref->display()); - foreach ($translation->attributes as $key => $value) { - $xhtml->set($key, $value); - } - - foreach ($translation->meta as $key => $value) { - $xhtml->set($key, $value); - } - - $xhtml->set('updated', date('F d, Y h:i:sa T', filemtime(CONTENTDIR.'/'.$ref->filepath))); - - $this->xhtml = $xhtml; - $this->language($lang); - } - - function language($lang) - { - global $LANGUAGES; - $this->lang = $lang; - $this->xhtml->set('charset', $LANGUAGES[$lang][1]); - $this->xhtml->set('lang', $lang); - } - - function out() - { - return $this->xhtml->out(); - } - - function write() - { - writeFile($this->filepath, $this->xhtml->out()); - } -} - -class LibReferencePage extends ReferencePage -{ - function LibReferencePage(&$ref, $lib, $translation, $lang = 'en') - { - global $LANGUAGES; - - $this->langdir = 'reference/' . ($lang == 'en' ? '' : "$lang"); - $this->libsdir = $this->langdir . '/libraries'; - $this->libdir = $this->libsdir . "/$lib"; - $this->filepath = $this->libdir . '/' . $ref->name(); - - $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 2+'; - - $xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.translation.html'); - $xhtml->set('header', HEADER_LINK); - $xhtml->set('title', $title); - $xhtml->set('bodyid', 'Library-ref'); - if ($lang == 'en') { - $xhtml->set('navigation', navigation('Libraries')); - } else { - $xhtml->set('navigation', navigation_tr('Libraries')); - } - - $piece = new xhtml_piece(TEMPLATEDIR.'foundation-template.reference.item.html'); - $xhtml->set('content_for_layout', $piece->out()); - - $xhtml->set('reference_nav', library_nav($lib)); - $xhtml->set('language_nav', language_nav($lang)); - - $xhtml->set('content', $ref->display()); - - foreach ($translation->attributes as $key => $value) { - $xhtml->set($key, $value); - } - - foreach ($translation->meta as $key => $value) { - $xhtml->set($key, $value); - } - - //$xhtml->set('updated', date('F d, Y h:i:sa T', filemtime(CONTENTDIR.'/'.$ref->filepath))); - - $this->xhtml = $xhtml; - $this->language($lang); - } -} - -class LocalPage extends Page -{ - var $xhtml; - var $lang = 'en'; - var $subtemplate = false; - - function LocalPage($title = '', $section = '', $bodyid = '', $rel_path = '') - { - $this->xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.local.html'); - $this->xhtml->set('header', ''); - $title = ($title == '') ? 'Processing 2+' : $title . ' \ Processing 2+'; - $this->xhtml->set('title', $title); - $this->xhtml->set('navigation', local_nav($section, $rel_path)); - $this->set('relpath', $rel_path); - $this->language('en'); - $this->xhtml->set('bodyid', ($bodyid == '') ? $section : $bodyid); - } -} - -class LocalReferencePage extends ReferencePage -{ - var $xhtml; - var $lang = 'en'; - var $filepath; - - function LocalReferencePage(&$ref, $translation, $lang = 'en', $rel_path = '') - { - $this->filepath = 'distribution/' . $ref->name(); - $title = $ref->title() .' \ Language (API) \ Processing 2+'; - - $xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.local.html'); - $xhtml->set('header', ''); - $xhtml->set('title', $title); - $xhtml->set('bodyid', 'Langauge'); - $xhtml->set('navigation', local_nav('Language')); - - $piece = new xhtml_piece(TEMPLATEDIR.'foundation-template.reference.item.html'); - $xhtml->set('content_for_layout', $piece->out()); - - $xhtml->set('reference_nav', reference_nav()); - $xhtml->set('language_nav', language_nav($lang)); - - $xhtml->set('content', $ref->display()); - foreach ($translation->attributes as $key => $value) { - $xhtml->set($key, $value); - } - - foreach ($translation->meta as $key => $value) { - $xhtml->set($key, $value); - } - - $xhtml->set('relpath', $rel_path); - $xhtml->set('updated', date('F d, Y h:i:sa T', filemtime(CONTENTDIR.'/'.$ref->filepath))); - - $this->xhtml = $xhtml; - $this->language($lang); - } -} - -class LocalLibReferencePage extends ReferencePage -{ - function LocalLibReferencePage(&$ref, $lib, $translation, $rel_path = '../../') - { - global $LANGUAGES; - $lang = 'en'; - - $this->filepath = "distribution/libraries/$lib/" . $ref->name(); - - $title = $ref->title() . "\\ $lib \\ Language (API) \\ Processing 2+"; - - $xhtml = new xhtml_page(TEMPLATEDIR.'foundation-template.local.html'); - $xhtml->set('header', ''); - $xhtml->set('title', $title); - $xhtml->set('bodyid', 'Library-ref'); - - $xhtml->set('navigation', local_nav('Libraries', $rel_path)); - - $piece = new xhtml_piece(TEMPLATEDIR.'foundation-template.reference.item.html'); - $xhtml->set('content_for_layout', $piece->out()); - - $xhtml->set('reference_nav', library_nav($lib)); - $xhtml->set('language_nav', language_nav($lang)); - - foreach ($translation->attributes as $key => $value) { - $xhtml->set($key, $value); - } - - foreach ($translation->meta as $key => $value) { - $xhtml->set($key, $value); - } - - $xhtml->set('content', $ref->display()); - - $xhtml->set('updated', date('F d, Y h:i:sa T', filemtime(CONTENTDIR.'/'.$ref->filepath))); - $xhtml->set('relpath', $rel_path); - $this->xhtml = $xhtml; - } -} - -?> diff --git a/templates/foundation-template.reference.item.html b/templates/foundation-template.reference.item.html deleted file mode 100644 index c2d527aba..000000000 --- a/templates/foundation-template.reference.item.html +++ /dev/null @@ -1,43 +0,0 @@ -

      disclaimer contact

      - -content - -Updated on updated

      - - - -
      - Creative Commons License -
      - \ No newline at end of file diff --git a/templates/foundation-template.translation.html b/templates/foundation-template.translation.html deleted file mode 100644 index 1bef912c5..000000000 --- a/templates/foundation-template.translation.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - <!--*-->title<!--*--> - - - - - - - - - - - - - - - - - - -
      - - - - navigation - - - - -
      - - content_for_layout - -
      - - - - -
      - - diff --git a/templates/template.cover.html b/templates/template.cover.html index 84ce4be2c..4e776eb87 100755 --- a/templates/template.cover.html +++ b/templates/template.cover.html @@ -7,53 +7,34 @@ Download Processing
      Browse Tutorials
      Visit the Reference
      - -
      -

      - Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping. - -

        -
      • » Free to download and open source
      • -
      • » Interactive programs with 2D, 3D or PDF output
      • -
      • » OpenGL integration for accelerated 2D and 3D
      • -
      • » For GNU/Linux, Mac OS X, and Windows
      • -
      • » Over 100 libraries extend the core software
      • -
      • » Well documented, with many books available
      • -
      -
      -

      +
      +

      + Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping. +

        +
      • » Free to download and open source
      • +
      • » Interactive programs with 2D, 3D, PDF, or SVG output
      • +
      • » OpenGL integration for accelerated 2D and 3D
      • +
      • » For GNU/Linux, Mac OS X, Windows, Android, and ARM
      • +
      • » Over 100 libraries extend the core software
      • +
      • » Well documented, with many books available
      • +
      +

      - -

      - New Books!
      -
      - The 2nd edition of Getting Started with Processing is here and it's updated for Processing 3. It's now in full color and there's a new chapter on working with data. The 2nd edition of the Processing Handbook is here too. Every chapter has been revised, and new chapters introduce more ways to work with data and geometry. New “synthesis” chapters offer discussion and worked examples of such topics as sketching with code, modularity, and algorithms.
      -
      - New Book! -

      - - - - - + Processing Books +

      + +
      - - + -
      -

      Exhibition

      - exhibition +
      + PCD 2020
      +
      + The Processing Community Day (PCD) initiative is evolving. For 2020, we will offer a mentorship program for PCD Worldwide Organizers who are interested in learning from past community organizers and mentors. The goal is to help a diverse group of organizers launch a PCD in their local communities. Check out the PCD @ Worldwide site to learn more about starting or attending an event in 2020!
      +
      - -

      To see more of what people are doing with Processing, check out these sites:

      - -

      » CreativeApplications.Net
      - » For Your Processing
      - » Processing Subreddit
      - » OpenProcessing
      - » Vimeo
      - - » Studio Sketchpad
      +

      + To see more of what people are doing with Processing, check out these sites:
      + » CreativeApplications.Net
      + » OpenProcessing
      + » For Your Processing
      + » Processing Subreddit
      + » Vimeo
      + » Studio Sketchpad

      -

      - To contribute to the development, please visit +

      + To contribute to Processing development, please visit Processing on GitHub to read instructions for downloading the code, building from the source, - reporting and tracking bugs, and + reporting and tracking bugs, and creating libraries and tools.

      -

      -

      Partners
      - » Fathom
      - » UCLA Arts Software Studio
      - » NYU ITP +
      Partners
      + » Fathom
      + » NYU ITP
      + » UCLA Design Media Arts

      -
      -
      Mailing List
      -
      - - -

      - If you are interested in receiving updates about Processing, submit your email through this form. Your email will only be used to send infrequent updates about Processing. It will not be sold or shared. -
      -

      Contact
      foundation@processing.org diff --git a/templates/template.html b/templates/template.html index b90627d71..b3836287a 100755 --- a/templates/template.html +++ b/templates/template.html @@ -27,6 +27,7 @@
    • p5.js
    • Processing.py
    • Processing for Android
    • +
    • Processing for Pi
    • Processing Foundation
    • @@ -42,6 +43,13 @@

      + + diff --git a/templates/template.nav.php b/templates/template.nav.php index 40f2fcbf4..01dd329bd 100755 --- a/templates/template.nav.php +++ b/templates/template.nav.php @@ -8,11 +8,9 @@ 'Learning' => array('/learning/', 1), 'Tutorials' => array('/tutorials/', 2), - 'Examples' => array('/examples/', 2), - # '3D' => array('/learning/3d/', 2), - # 'Library' => array('/learning/library/', 2), - 'Books' => array('/books/', 2), - 'Handbook' => array('/handbook/', 2), + 'Examples' => array('/examples/', 2), + 'Books' => array('/books/', 2), + 'Handbook' => array('/handbook/', 2), 'Reference' => array('/reference/', 1), @@ -23,6 +21,7 @@ 'Environment' => array('/reference/environment/', 2), 'Download' => array('/download/', 1), + 'Donate' => array('/download/support.html', 1), 'Shop' => array('/shop/', 1), @@ -32,7 +31,7 @@ 'People' => array('/people/', 2), 'Foundation' => array('/foundation/', 2), - 'FAQ' => array('http://wiki.processing.org/w/FAQ', 1), + 'FAQ' => array('https://github.com/processing/processing/wiki', 1), ); @@ -56,9 +55,10 @@ function navigation($section = '') $html .= "\t\t\t\t\t" . l('Cover', $section == 'Cover') . "

      \n"; - $html .= "\t\t\t\t\t" . l('Download', $section == 'Download') . "

      \n"; + $html .= "\t\t\t\t\t" . l('Download', $section == 'Download') . "
      \n"; + $html .= "\t\t\t\t\t" . l('Donate', $section == 'Donate') . "

      \n"; - $html .= "\t\t\t\t\t" . l('Exhibition', $section == 'Exhibition') . "

      \n"; + #$html .= "\t\t\t\t\t" . l('Exhibition', $section == 'Exhibition') . "

      \n"; $html .= "\t\t\t\t\t" . l('Reference', $section == 'Reference') . "
      \n"; $html .= "\t\t\t\t\t" . l('Libraries', $section == 'Libraries') . "
      \n"; @@ -67,22 +67,23 @@ function navigation($section = '') $html .= "\t\t\t\t\t" . l('Tutorials', $section == 'Tutorials') . "
      \n"; $html .= "\t\t\t\t\t" . l('Examples', $section == 'Examples') . "
      \n"; - $html .= "\t\t\t\t\t" . l('Books', $section == 'Books') . "
      \n"; - $html .= "\t\t\t\t\t" . l('Handbook', $section == 'Handbook') . "

      \n"; + $html .= "\t\t\t\t\t" . l('Books', $section == 'Books') . "

      \n"; + #$html .= "\t\t\t\t\t" . l('Handbook', $section == 'Handbook') . "

      \n"; $html .= "\t\t\t\t\t" . l('Overview', $section == 'Overview') . "
      \n"; $html .= "\t\t\t\t\t" . l('People', $section == 'People') . "

      \n"; # $html .= "\t\t\t\t\t" . l('Foundation', $section == 'Foundation') . "

      \n"; - $html .= "\t\t\t\t\t" . l('Shop', $section == 'Shop') . "

      \n"; + #$html .= "\t\t\t\t\t" . l('Shop', $section == 'Shop') . "

      \n"; - $html .= "\t\t\t\t\t" . "»Forum
      \n"; + $html .= "\t\t\t\t\t" . "»Forum
      \n"; $html .= "\t\t\t\t\t" . "»GitHub
      \n"; - $html .= "\t\t\t\t\t" . "»Issues
      \n"; - $html .= "\t\t\t\t\t" . "»Wiki
      \n"; - $html .= "\t\t\t\t\t" . "»FAQ
      \n"; + $html .= "\t\t\t\t\t" . "»Issues
      \n"; + $html .= "\t\t\t\t\t" . "»Wiki
      \n"; + $html .= "\t\t\t\t\t" . "»FAQ
      \n"; $html .= "\t\t\t\t\t" . "»Twitter
      \n"; - $html .= "\t\t\t\t\t" . "»Facebook
      \n"; + #$html .= "\t\t\t\t\t" . "»Facebook
      \n"; + $html .= "\t\t\t\t\t" . "»Medium
      \n"; $html .= "\t\t\t\t\n"; diff --git a/templates/template.php b/templates/template.php index d01db7566..f7ecfe4ea 100755 --- a/templates/template.php +++ b/templates/template.php @@ -92,7 +92,7 @@ function ReferencePage(&$ref, $translation, $lang = 'en') global $LANGUAGES; $this->filepath = 'reference/' . ($lang == 'en' ? '' : "$lang/") . $ref->name(); - $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 2+'; + $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 3+'; $xhtml = new xhtml_page(TEMPLATEDIR.'template.translation.html'); $xhtml->set('header', HEADER_LINK); @@ -152,7 +152,7 @@ function LibReferencePage(&$ref, $lib, $translation, $lang = 'en') $this->libdir = $this->libsdir . "/$lib"; $this->filepath = $this->libdir . '/' . $ref->name(); - $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 2+'; + $title = $ref->title() . ($lang == 'en' ? '' : " \ {$LANGUAGES[$lang][0]}") .' \ Language (API) \ Processing 3+'; $xhtml = new xhtml_page(TEMPLATEDIR.'template.translation.html'); $xhtml->set('header', HEADER_LINK); @@ -197,7 +197,7 @@ function LocalPage($title = '', $section = '', $bodyid = '', $rel_path = '') { $this->xhtml = new xhtml_page(TEMPLATEDIR.'template.local.html'); $this->xhtml->set('header', ''); - $title = ($title == '') ? 'Processing 2+' : $title . ' \ Processing 2+'; + $title = ($title == '') ? 'Processing 3+' : $title . ' \ Processing 3+'; $this->xhtml->set('title', $title); $this->xhtml->set('navigation', local_nav($section, $rel_path)); $this->set('relpath', $rel_path); @@ -215,7 +215,7 @@ class LocalReferencePage extends ReferencePage function LocalReferencePage(&$ref, $translation, $lang = 'en', $rel_path = '') { $this->filepath = 'distribution/' . $ref->name(); - $title = $ref->title() .' \ Language (API) \ Processing 2+'; + $title = $ref->title() .' \ Language (API) \ Processing 3+'; $xhtml = new xhtml_page(TEMPLATEDIR.'template.local.html'); $xhtml->set('header', ''); @@ -255,7 +255,7 @@ function LocalLibReferencePage(&$ref, $lib, $translation, $rel_path = '../../') $this->filepath = "distribution/libraries/$lib/" . $ref->name(); - $title = $ref->title() . "\\ $lib \\ Language (API) \\ Processing 2+"; + $title = $ref->title() . "\\ $lib \\ Language (API) \\ Processing 3+"; $xhtml = new xhtml_page(TEMPLATEDIR.'template.local.html'); $xhtml->set('header', ''); diff --git a/todo-web.txt b/todo-web.txt index ef1c459d5..9ce53ba0b 100644 --- a/todo-web.txt +++ b/todo-web.txt @@ -83,7 +83,7 @@ Shop > Twitter > Forum -> Wiki +> Wiki > Issues > GitHub