本文整理汇总了PHP中parent::_buffer方法的典型用法代码示例。如果您正苦于以下问题:PHP parent::_buffer方法的具体用法?PHP parent::_buffer怎么用?PHP parent::_buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parent
的用法示例。
在下文中一共展示了parent::_buffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
/**
* Read n characters.
*
* @param int $length Length.
* @return string
* @throws \Hoa\Xml\Exception
*/
public function read($length)
{
if (0 > $length) {
throw new Xml\Exception('Length must be greater than 0, given %d.', 0, $length);
}
if (null === parent::$_buffer) {
parent::$_buffer = new Stringbuffer\ReadWrite();
parent::$_buffer->initializeWith($this->__toString());
}
return parent::$_buffer->read($length);
}
示例2: write
/**
* Write n characters.
*
* @param string $string String.
* @param int $length Length.
* @return mixed
* @throws \Hoa\Xml\Exception
*/
public function write($string, $length)
{
if (0 > $length) {
throw new Xml\Exception('Length must be greater than 0, given %d.', 0, $length);
}
if (null === parent::$_buffer) {
parent::$_buffer = new Stringbuffer\ReadWrite();
parent::$_buffer->initializeWith($this->__toString());
}
$l = parent::$_buffer->write($string, $length);
if ($l !== $length) {
return false;
}
$this[0] = parent::$_buffer->readAll();
return $l;
}
示例3: init
/**
* Init the object data
*
* @param array $params - the configuration parameters
*
* @return boolean
* @since 1.0
*/
public function init($params)
{
$this->_caching = false;
$this->_template = null;
$this->_letter = null;
$this->_parsed = null;
$this->directory = null;
$this->parsedTags = null;
$this->renderMode = null;
$this->tracking = null;
$this->trackingGa = null;
// reset all previous rendererd data for modules or placeholders
parent::$_buffer = array();
$this->tracking = isset($params['tracking']) ? (bool) $params['tracking'] : true;
$this->trackingGa = isset($params['trackingGa']) ? (bool) $params['trackingGa'] : true;
$this->directory = !empty($params['directory']) ? $params['directory'] : JPATH_COMPONENT_ADMINISTRATOR . DS . 'extensions' . DS . 'templates';
$this->renderMode = !empty($params['renderMode']) ? $params['renderMode'] : 'full';
$this->showNames = !empty($params['showNames']);
// if we already get the template then work with it.
if (!empty($params['template'])) {
$this->_template = $params['template'];
return true;
}
// if request contains the letter ID...
if (!empty($params['newsletter_id'])) {
$this->_letter = $this->loadLetter($params['newsletter_id']);
$this->_template = $this->_loadTemplate($this->_letter->t_style_id);
return;
}
// And finaly try to find the template.
if (!empty($params['t_style_id'])) {
$this->_template = $this->_loadTemplate($params['t_style_id']);
return true;
}
$this->setError('The PLAIN is not allowed because the NEWSLETTER is not loaded');
return false;
}
示例4: truncate
/**
* Truncate to a given length.
*
* @param int $size Size.
* @return bool
*/
public function truncate($size)
{
if (null === parent::$_buffer) {
parent::$_buffer = new Stringbuffer\ReadWrite();
parent::$_buffer->initializeWith($this->__toString());
}
return parent::$_buffer->truncate($size);
}