| 1 | private function stream_body( $handle, $data ) {
|
|---|
| 2 | if ( @function_exists( 'mb_internal_encoding' ) && ((int) @ini_get( 'mbstring.func_overload' )) & 2)
|
|---|
| 3 | {
|
|---|
| 4 | $mbEncoding = mb_internal_encoding();
|
|---|
| 5 | mb_internal_encoding( 'ISO-8859-1' );
|
|---|
| 6 | }
|
|---|
| 7 | if ( $this->max_body_length && ( strlen( $this->body ) + strlen( $data ) ) > $this->max_body_length )
|
|---|
| 8 | $data = substr( $data, 0, ( $this->max_body_length - strlen( $this->body ) ) );
|
|---|
| 9 |
|
|---|
| 10 | if ( $this->stream_handle )
|
|---|
| 11 | fwrite( $this->stream_handle, $data );
|
|---|
| 12 | else
|
|---|
| 13 | $this->body .= $data;
|
|---|
| 14 |
|
|---|
| 15 | $data_len = strlen( $data );
|
|---|
| 16 | if ( isset( $mbEncoding ) )
|
|---|
| 17 | {
|
|---|
| 18 | mb_internal_encoding( $mbEncoding );
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | return $data_len;
|
|---|
| 22 | }
|
|---|