JStream/applyContextToStream: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
| Line 38: | Line 38: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=applyContextToStream | category=applyContextToStream | ||
category=JStream | category=JStream | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 02:07, 25 March 2017
Description
Applies the current context to the stream Use this to change the values of the context after you've opened a stream
Syntax
applyContextToStream()
Defined in
libraries/joomla/filesystem/stream.php
Importing
jimport( 'joomla.filesystem.stream' );
Source Body
function applyContextToStream()
{
$retval = false;
if($this->_fh)
{
// Capture PHP errors
$php_errormsg = 'Unknown error setting context option';
$track_errors = ini_get('track_errors');
ini_set('track_errors', true);
$retval = @stream_context_set_option($this->_fh, $this->_contextOptions);
if(!$retval) {
$this->setError($php_errormsg);
}
// restore error tracking to what it was before
ini_set('track_errors',$track_errors);
}
return $retval;
}
Examples
Code Examples